inlay hammer

This commit is contained in:
KitsuShadow
2015-07-04 23:13:55 -04:00
parent 65b13d581b
commit 9f0b506d42
17 changed files with 509 additions and 571 deletions

View File

@@ -30,13 +30,13 @@ import com.kitsu.medievalcraft.tileents.ingots.TileIngotBase;
import com.kitsu.medievalcraft.tileents.ingots.TileIronPlate;
import com.kitsu.medievalcraft.tileents.ingots.TileMyIronIngot;
import com.kitsu.medievalcraft.tileents.machine.TileEntityAnvilForge;
import com.kitsu.medievalcraft.util.AnvilUtil;
import com.kitsu.medievalcraft.util.CustomTab;
import com.kitsu.medievalcraft.util.IronFormNames;
import cpw.mods.fml.common.registry.GameRegistry;
public class ForgeHammer extends Item implements IronFormNames{
public class ForgeHammer extends Item implements AnvilUtil{
private String name = "forgeHammer";
private Item item;
@@ -84,213 +84,127 @@ public class ForgeHammer extends Item implements IronFormNames{
if(block == ModBlocks.ironPlate){
tilePlate = (TileIronPlate) world.getTileEntity(x, y, z);
}
if((block instanceof IngotBase)&&(blockSub == ModBlocks.forgeAnvil) && (p.isSwingInProgress == false)&&(block!=ModBlocks.ironPlate)){
if((blockSub == ModBlocks.forgeAnvil)&&(p.isSwingInProgress == false)){
TileEntityAnvilForge tileEnt = (TileEntityAnvilForge) world.getTileEntity(x, y-1, z);
TileIngotBase tile = (TileIngotBase) world.getTileEntity(x, y, z);
if((tileEnt.getStackInSlot(0).getItem() instanceof IronForms)&&(tile.hot==true)){
p.worldObj.playSoundAtEntity(p, Main.MODID + ":anvilhammer", 1.0F, 1.0F);
Main.sNet.sendToAll(new MsgPacket(true));
Main.sNet.sendToAll(new MsgPacketLocX(x));
Main.sNet.sendToAll(new MsgPacketLocY(y));
Main.sNet.sendToAll(new MsgPacketLocZ(z));
tile.hits++;
if(tile.hits >= 3 + rand.nextInt(3)){
world.spawnEntityInWorld(new EntityItem(world, x+0.5D, y+0.6D, z+0.5D, forms.get(tileEnt.getStackInSlot(0).getItem())));
if((block instanceof IngotBase)&&(block==ModBlocks.refinedIron)){
TileIngotBase tile = (TileIngotBase) world.getTileEntity(x, y, z);
if(tileEnt.getStackInSlot(0)==null){
p.worldObj.playSoundAtEntity(p, Main.MODID + ":anvilhammer", 1.0F, 1.0F);
Main.sNet.sendToAll(new MsgPacket(true));
Main.sNet.sendToAll(new MsgPacketLocX(x));
Main.sNet.sendToAll(new MsgPacketLocY(y));
Main.sNet.sendToAll(new MsgPacketLocZ(z));
tile.hits++;
stack.damageItem(1, p);
world.setBlock(x, y, z, Blocks.air, 0, 2);
if(tileEnt.getStackInSlot(0).getMaxStackSize() == 1){
if(tileEnt.getStackInSlot(0).getItemDamage() == tileEnt.getStackInSlot(0).getMaxDamage()-1){
if(tile.hits >= 4 + rand.nextInt(3)){
world.setBlock(x, y, z, ModBlocks.ironPlate, 0, 2);
}
}
if((tileEnt.getStackInSlot(0).getItem().equals(Items.flower_pot))||tileEnt.getStackInSlot(0).getItem().equals(Items.bucket)){
p.worldObj.playSoundAtEntity(p, Main.MODID + ":anvilhammer", 1.0F, 1.0F);
Main.sNet.sendToAll(new MsgPacket(true));
Main.sNet.sendToAll(new MsgPacketLocX(x));
Main.sNet.sendToAll(new MsgPacketLocY(y));
Main.sNet.sendToAll(new MsgPacketLocZ(z));
tile.hits++;
stack.damageItem(1, p);
if(tile.hits >= 4 + rand.nextInt(3)){
world.setBlock(x, y, z, Blocks.air, 0, 2);
if(tileEnt.getStackInSlot(0).getItem().equals(Items.flower_pot)){
tileEnt.decrStackSize(0, 1);
}
else {tileEnt.getStackInSlot(0).setItemDamage(tileEnt.getStackInSlot(0).getItemDamage()+1);
}
world.spawnEntityInWorld(new EntityItem(world, x+0.5D, y+0.6D, z+0.5D, new ItemStack(Items.bucket, 1)));
}
}
}
if((tileEnt.getStackInSlot(0).getItem() instanceof ClayForms)&&(tile.hot==true)&&(block!=ModBlocks.ironPlate)){
p.worldObj.playSoundAtEntity(p, Main.MODID + ":anvilhammer", 1.0F, 1.0F);
Main.sNet.sendToAll(new MsgPacket(true));
Main.sNet.sendToAll(new MsgPacketLocX(x));
Main.sNet.sendToAll(new MsgPacketLocY(y));
Main.sNet.sendToAll(new MsgPacketLocZ(z));
tile.hits++;
if(tile.hits >= 3 + rand.nextInt(3)){
world.spawnEntityInWorld(new EntityItem(world, x+0.5D, y+0.6D, z+0.5D, formsClay.get(tileEnt.getStackInSlot(0).getItem())));
stack.damageItem(1, p);
world.setBlock(x, y, z, Blocks.air, 0, 2);
tileEnt.decrStackSize(0, 1);
tile.markForUpdate();
}
}
}
/*if((block == blockToRun(block)) && (blockSub == ModBlocks.forgeAnvil) && (p.isSwingInProgress == false)){
TileEntityAnvilForge tileEnt = (TileEntityAnvilForge) world.getTileEntity(x, y-1, z);
if((tileEnt.getStackInSlot(0) == null) && (blockKey == 0)){
if (rand.nextInt(2) == 0 ) {
tileRefIngot.hits++;
}
p.worldObj.playSoundAtEntity(p, Main.MODID + ":anvilhammer", 1.0F, 1.0F);
Main.sNet.sendToAll(new MsgPacket(true));
Main.sNet.sendToAll(new MsgPacketlTicks(x));
Main.sNet.sendToAll(new MsgPacketLocY(y));
Main.sNet.sendToAll(new MsgPacketLocZ(z));
if(tileRefIngot.hits >= 4){
tileRefIngot.hits = 0;
p.worldObj.playSoundAtEntity(p, Main.MODID + ":anvilhammer", 1.0F, 1.0F);
Main.sNet.sendToAll(new MsgPacket(true));
Main.sNet.sendToAll(new MsgPacketlTicks(x));
Main.sNet.sendToAll(new MsgPacketLocY(y));
Main.sNet.sendToAll(new MsgPacketLocZ(z));
world.setBlock(x, y, z, ModBlocks.ironPlate, 0, 2);
stack.damageItem(1, p);
}
}
if((tileEnt.getStackInSlot(0) != null)){
if((tileEnt.getStackInSlot(0).getItem() == Items.flower_pot) && (blockKey == 0)){
if (rand.nextInt(2) == 0 ) {
tileRefIngot.hits++;
}
p.worldObj.playSoundAtEntity(p, Main.MODID + ":anvilhammer", 1.0F, 1.0F);
Main.sNet.sendToAll(new MsgPacket(true));
Main.sNet.sendToAll(new MsgPacketlTicks(x));
Main.sNet.sendToAll(new MsgPacketLocY(y));
Main.sNet.sendToAll(new MsgPacketLocZ(z));
if(tileRefIngot.hits >= 4){key
tileRefIngot.hits = 0;
//IRON FORMS
if(tileEnt.getStackInSlot(0)!=null){
if((tileEnt.getStackInSlot(0).getItem() instanceof IronForms)&&(tile.hot==true)){
p.worldObj.playSoundAtEntity(p, Main.MODID + ":anvilhammer", 1.0F, 1.0F);
Main.sNet.sendToAll(new MsgPacket(true));
Main.sNet.sendToAll(new MsgPacketlTicks(x));
Main.sNet.sendToAll(new MsgPacketLocX(x));
Main.sNet.sendToAll(new MsgPacketLocY(y));
Main.sNet.sendToAll(new MsgPacketLocZ(z));
world.setBlock(x, y, z, Blocks.air, 0, 2);
tileEnt.decrStackSize(0, 1);
ItemStack bucket = new ItemStack(Items.bucket);
world.spawnEntityInWorld(new EntityItem(world, x+0.5D, y+0.6D, z+0.5D, bucket));
tile.hits++;
stack.damageItem(1, p);
}
}
}
if(tileEnt.getStackInSlot(0) != null){
Item checkItem = tileEnt.getStackInSlot(0).getItem();
String displayName = tileEnt.getStackInSlot(0).getDisplayName();
if(displayName.equals(getTool(tileEnt.getStackInSlot(0)))){
if(tileEnt.getStackInSlot(0).isItemDamaged() == true){
p.worldObj.playSoundAtEntity(p, Main.MODID + ":anvilhammer", 1.0F, 1.0F);
Main.sNet.sendToAll(new MsgPacket(true));
Main.sNet.sendToAll(new MsgPacketlTicks(x));
Main.sNet.sendToAll(new MsgPacketLocY(y));
Main.sNet.sendToAll(new MsgPacketLocZ(z));
stack.damageItem(1, p);
if (rand.nextInt(2) == 0 ) {
tileRefIngot.hits++;
}
}
if(tileRefIngot.hits >= 4){
tileRefIngot.hits=0;
checkItem.setDamage(tileEnt.getStackInSlot(0), 0);
world.setBlock(x, y, z, Blocks.air, 0, 2);
}
}
if((blockKey == 3) && tileEnt.getStackInSlot(0).getItem().equals(ModItems.woodentoolHandle)){
p.worldObj.playSoundAtEntity(p, Main.MODID + ":anvilhammer", 1.0F, 1.0F);
Main.sNet.sendToAll(new MsgPacket(true));
Main.sNet.sendToAll(new MsgPacketlTicks(x));
Main.sNet.sendToAll(new MsgPacketLocY(y));
Main.sNet.sendToAll(new MsgPacketLocZ(z));
if (rand.nextInt(2) == 0 ) {
tilePlate.hits++;
}
if(tilePlate.hits >= 4){
tilePlate.hits=0;
tileEnt.decrStackSize(0, 1);
world.setBlock(x, y, z, Blocks.air, 0, 2);
ItemStack ironForm = new ItemStack(ModItems.ironHandleForm);
world.spawnEntityInWorld(new EntityItem(world, x+0.5D, y+0.6D, z+0.5D, ironForm));
}
}
if((checkItem == getItem(checkItem)) || (checkItem == getItem3(checkItem)) || (checkItem == getItem2(checkItem).getItem())){
if (rand.nextInt(2) == 0 ) {
if(blockKey == 0){
tileRefIngot.hits++;
}
if(blockKey == 3){
tilePlate.hits++;
}
}
p.worldObj.playSoundAtEntity(p, Main.MODID + ":anvilhammer", 1.0F, 1.0F);
Main.sNet.sendToAll(new MsgPacket(true));
Main.sNet.sendToAll(new MsgPacketlTicks(x));
Main.sNet.sendToAll(new MsgPacketLocY(y));
Main.sNet.sendToAll(new MsgPacketLocZ(z));
if((blockKey == 0) && (checkItem == getItem(checkItem))){
if(tileRefIngot.hits >= 4){
tileRefIngot.hits=0;
giveItem(key, world, x, y, z, p);
stack.damageItem(1, p);
if(tile.hits >= 4 + rand.nextInt(3)){
world.spawnEntityInWorld(new EntityItem(world, x+0.5D, y+0.6D, z+0.5D, formsIron.get(tileEnt.getStackInSlot(0).getItem())));
world.setBlock(x, y, z, Blocks.air, 0, 2);
if(tileEnt.getStackInSlot(0).getMaxStackSize() == 1){
if(tileEnt.getStackInSlot(0).getItemDamage() == tileEnt.getStackInSlot(0).getMaxDamage()-1){
tileEnt.decrStackSize(0, 1);
} else {tileEnt.getStackInSlot(0).setItemDamage(tileEnt.getStackInSlot(0).getItemDamage()+1);}
}
if((tileEnt.getStackInSlot(0).getItem() == getItem3(checkItem))){
tileEnt.decrStackSize(0, 1);
}
}
}
if((blockKey == 0) && (checkItem == getItem3(checkItem))){
if(tileRefIngot.hits >= 4){
tileRefIngot.hits=0;
giveItem(key, world, x, y, z, p);
stack.damageItem(1, p);
if(tileEnt.getStackInSlot(0).getMaxStackSize() == 1){
if(tileEnt.getStackInSlot(0).getItemDamage() == tileEnt.getStackInSlot(0).getMaxDamage()-1){
tileEnt.decrStackSize(0, 1);
} else {tileEnt.getStackInSlot(0).setItemDamage(tileEnt.getStackInSlot(0).getItemDamage()+1);}
}
if((tileEnt.getStackInSlot(0).getItem() == getItem3(checkItem))){
tileEnt.decrStackSize(0, 1);
}
}
}
if(blockKey == 3){
p.worldObj.playSoundAtEntity(p, Main.MODID + ":anvilhammer", 1.0F, 1.0F);
Main.sNet.sendToAll(new MsgPacket(true));
Main.sNet.sendToAll(new MsgPacketlTicks(x));
Main.sNet.sendToAll(new MsgPacketLocY(y));
Main.sNet.sendToAll(new MsgPacketLocZ(z));
if((checkItem == getItem2(checkItem).getItem())){
if(tilePlate.hits >= 3){
tilePlate.hits=0;
giveItem(key, world, x, y, z, p);
stack.damageItem(1, p);
if(tileEnt.getStackInSlot(0).getItem() == getItem2(checkItem).getItem()){
tileEnt.decrStackSize(0, 1);
}
else {tileEnt.getStackInSlot(0).setItemDamage(tileEnt.getStackInSlot(0).getItemDamage()+1);
}
}
}
}
//CLAY FORMS
if((tileEnt.getStackInSlot(0).getItem() instanceof ClayForms)&&(tile.hot==true)){
p.worldObj.playSoundAtEntity(p, Main.MODID + ":anvilhammer", 1.0F, 1.0F);
Main.sNet.sendToAll(new MsgPacket(true));
Main.sNet.sendToAll(new MsgPacketLocX(x));
Main.sNet.sendToAll(new MsgPacketLocY(y));
Main.sNet.sendToAll(new MsgPacketLocZ(z));
tile.hits++;
stack.damageItem(1, p);
if(tile.hits >= 4 + rand.nextInt(3)){
world.spawnEntityInWorld(new EntityItem(world, x+0.5D, y+0.6D, z+0.5D, formsClay.get(tileEnt.getStackInSlot(0).getItem())));
world.setBlock(x, y, z, Blocks.air, 0, 2);
tileEnt.decrStackSize(0, 1);
tile.markForUpdate();
}
}
}
}
if((block instanceof IngotBase)){
TileIngotBase tile = (TileIngotBase) world.getTileEntity(x, y, z);
//REPAIR TOOLS
Item checkItem = tileEnt.getStackInSlot(0).getItem();
String displayName = tileEnt.getStackInSlot(0).getDisplayName();
if(tileEnt.getStackInSlot(0) != null){
if(displayName.equals(getTool(tileEnt.getStackInSlot(0)))&&(tile.hot == true)&&(block==ModBlocks.refinedIron)){
if(tileEnt.getStackInSlot(0).isItemDamaged() == true){
p.worldObj.playSoundAtEntity(p, Main.MODID + ":anvilhammer", 1.0F, 1.0F);
Main.sNet.sendToAll(new MsgPacket(true));
Main.sNet.sendToAll(new MsgPacketLocX(x));
Main.sNet.sendToAll(new MsgPacketLocY(y));
Main.sNet.sendToAll(new MsgPacketLocZ(z));
stack.damageItem(1, p);
tile.hits++;
if(tile.hits >= 4 + rand.nextInt(3)){
checkItem.setDamage(tileEnt.getStackInSlot(0), 0);
world.setBlock(x, y, z, Blocks.air, 0, 2);
}
}
}
}
//MAKE FORMS
if(tileEnt.getStackInSlot(0)!= null){
if((makeForms.containsKey(tileEnt.getStackInSlot(0).getItem())==true)){
if((tile.hot == true)&&(block==ModBlocks.ironPlate)){
p.worldObj.playSoundAtEntity(p, Main.MODID + ":anvilhammer", 1.0F, 1.0F);
Main.sNet.sendToAll(new MsgPacket(true));
Main.sNet.sendToAll(new MsgPacketLocX(x));
Main.sNet.sendToAll(new MsgPacketLocY(y));
Main.sNet.sendToAll(new MsgPacketLocZ(z));
stack.damageItem(1, p);
tile.hits++;
if(tile.hits >= 4 + rand.nextInt(3)){
world.spawnEntityInWorld(new EntityItem(world, x+0.5D, y+0.6D, z+0.5D, makeForms.get(tileEnt.getStackInSlot(0).getItem())));
world.setBlock(x, y, z, Blocks.air, 0, 2);
tileEnt.decrStackSize(0, 1);
tile.markForUpdate();
}
}
}
}
}
}
*/
}
/*
* ItemStack gladius0 = new ItemStack(ModItems.gladius);

View File

@@ -15,13 +15,15 @@ import com.kitsu.medievalcraft.block.ModBlocks;
import com.kitsu.medievalcraft.item.ModItems;
import com.kitsu.medievalcraft.tileents.ingots.TileEntityMyDiamond;
import com.kitsu.medievalcraft.tileents.ingots.TileEntityMyEmerald;
import com.kitsu.medievalcraft.tileents.ingots.TileLapisIngot;
import com.kitsu.medievalcraft.tileents.ingots.TileRedstoneIngot;
import com.kitsu.medievalcraft.tileents.machine.TileEntityAnvilForge;
import com.kitsu.medievalcraft.util.CustomTab;
import com.kitsu.medievalcraft.util.InlayTables;
import cpw.mods.fml.common.registry.GameRegistry;
public class InlayHammer extends Item {
public class InlayHammer extends Item implements InlayTables{
private String name = "inlayHammer";
//private Item item;
@@ -30,8 +32,8 @@ public class InlayHammer extends Item {
public static boolean forgeHammerLeftClick;
TileEntityMyDiamond tileDiamond;
TileEntityMyEmerald tileEmerald;
//TileEntityHotRedstoneIngot tileRedstone;
//TileEntityHotLapisIngot tileLapis;
TileRedstoneIngot tileRedstone;
TileLapisIngot tileLapis;
//TileEntityHotIronPlate tilePlate;
Random rand;
@@ -71,14 +73,16 @@ public class InlayHammer extends Item {
if(block == ModBlocks.myEmerald){
tileEmerald = (TileEntityMyEmerald) world.getTileEntity(x, y, z);
}
if(block == ModBlocks.hotRedstoneIngot){
tileRedstone = (TileEntityHotRedstoneIngot) world.getTileEntity(x, y, z);
if(block == ModBlocks.redstoneIngot){
tileRedstone = (TileRedstoneIngot) world.getTileEntity(x, y, z);
}
if(block == ModBlocks.hotLapisIngot){
tileLapis = (TileEntityHotLapisIngot) world.getTileEntity(x, y, z);
if(block == ModBlocks.lapisIngot){
tileLapis = (TileLapisIngot) world.getTileEntity(x, y, z);
}
if((block == blockToRun(block)) && (blockSub == ModBlocks.forgeAnvil) && (player.isSwingInProgress == false)){
if((block == blockToRun(block))
&& (blockSub == ModBlocks.forgeAnvil)
&& (player.isSwingInProgress == false)){
TileEntityAnvilForge tileAnvil = (TileEntityAnvilForge) world.getTileEntity(x, y-1, z);
//DIAMOND BLOCK
if(keyUpgrade == 0){
@@ -86,7 +90,7 @@ public class InlayHammer extends Item {
if(tileAnvil.getStackInSlot(0) != null){
player.worldObj.playSoundAtEntity(player, Main.MODID + ":anvilhammer", 1.0F, 2.25F);
if(tileAnvil.getStackInSlot(0).getItem().equals(ModItems.woodentoolHandle)){
if (rand.nextInt(2) == 0 ) {
tileDiamond.hits++;
@@ -101,11 +105,6 @@ public class InlayHammer extends Item {
}
if(tileAnvil.getStackInSlot(0).isItemEqual(new ItemStack(oneUpgradeCheck(tileAnvil.getStackInSlot(0).getItem())))){
//System.out.println("Lvl 1 second upgrade");
//System.out.println(keyCheckOne);
//System.out.println(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE"));
//ItemStack tempStack = tileAnvil.getStackInSlot(0);
//keyCHeckone is oneUpgrade check
if(keyCheckOne == 0){
if (rand.nextInt(2) == 0 ) {
tileDiamond.hits++;
@@ -306,404 +305,409 @@ public class InlayHammer extends Item {
if(keyUpgrade == 2){
if(tileAnvil.getStackInSlot(0) != null){
player.worldObj.playSoundAtEntity(player, Main.MODID + ":anvilhammer", 1.0F, 2.25F);
if(tileAnvil.getStackInSlot(0).getItem().equals(ModItems.woodentoolHandle)){
if (rand.nextInt(2) == 0 ) {
tileLapis.hits++;
}
if(tileLapis.hits >= 8){
tileLapis.hits=0;
ItemStack resetStack = new ItemStack(ModItems.fortuneWoodRod);
tileAnvil.setInventorySlotContents(0, resetStack);
world.setBlock(x, y, z, Blocks.air, 0, 2);
stack.damageItem(1, player);
}
}
if(tileAnvil.getStackInSlot(0).getItem().equals(ModItems.ironweaponHandle)){
if (rand.nextInt(2) == 0 ) {
tileLapis.hits++;
}
if(tileLapis.hits >= 8){
tileLapis.hits=0;
ItemStack resetStack = new ItemStack(ModItems.fortuneIronRod);
tileAnvil.setInventorySlotContents(0, resetStack);
world.setBlock(x, y, z, Blocks.air, 0, 2);
stack.damageItem(1, player);
}
}
if(tileAnvil.getStackInSlot(0).isItemEqual(new ItemStack(oneUpgradeCheck(tileAnvil.getStackInSlot(0).getItem())))){
//System.out.println("Lvl 1 second upgrade");
//System.out.println(keyCheckOne);
//System.out.println(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE"));
//ItemStack tempStack = tileAnvil.getStackInSlot(0);
//keyCHeckone is oneUpgrade check
if(keyCheckOne == 0){
if(tileLapis.hot==true){
player.worldObj.playSoundAtEntity(player, Main.MODID + ":anvilhammer", 1.0F, 2.25F);
if(tileAnvil.getStackInSlot(0).getItem().equals(ModItems.woodentoolHandle)){
if (rand.nextInt(2) == 0 ) {
tileLapis.hits++;
}
if(tileLapis.hits >= 8){
tileLapis.hits=0;
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("unbreaking")){
Item reset = InlayTables.multiUpgrade.get(keyCheckOne+6);
ItemStack resetStack = new ItemStack(reset);
resetStack.stackTagCompound = new NBTTagCompound();
tileAnvil.setInventorySlotContents(0, resetStack);
world.setBlock(x, y, z, Blocks.air, 0, 2);
stack.damageItem(1, player);
}
ItemStack resetStack = new ItemStack(ModItems.fortuneWoodRod);
tileAnvil.setInventorySlotContents(0, resetStack);
world.setBlock(x, y, z, Blocks.air, 0, 2);
stack.damageItem(1, player);
}
}
if(keyCheckOne == 1){
if(tileAnvil.getStackInSlot(0).getItem().equals(ModItems.ironweaponHandle)){
if (rand.nextInt(2) == 0 ) {
tileLapis.hits++;
}
if(tileLapis.hits >= 8){
tileLapis.hits=0;
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("unbreaking")){
Item reset = InlayTables.multiUpgrade.get(keyCheckOne+6);
ItemStack resetStack = new ItemStack(reset);
resetStack.stackTagCompound = new NBTTagCompound();
tileAnvil.setInventorySlotContents(0, resetStack);
world.setBlock(x, y, z, Blocks.air, 0, 2);
stack.damageItem(1, player);
ItemStack resetStack = new ItemStack(ModItems.fortuneIronRod);
tileAnvil.setInventorySlotContents(0, resetStack);
world.setBlock(x, y, z, Blocks.air, 0, 2);
stack.damageItem(1, player);
}
}
if(tileAnvil.getStackInSlot(0).isItemEqual(new ItemStack(oneUpgradeCheck(tileAnvil.getStackInSlot(0).getItem())))){
//System.out.println("Lvl 1 second upgrade");
//System.out.println(keyCheckOne);
//System.out.println(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE"));
//ItemStack tempStack = tileAnvil.getStackInSlot(0);
//keyCHeckone is oneUpgrade check
if(keyCheckOne == 0){
if (rand.nextInt(2) == 0 ) {
tileLapis.hits++;
}
if(tileLapis.hits >= 8){
tileLapis.hits=0;
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("unbreaking")){
Item reset = InlayTables.multiUpgrade.get(keyCheckOne+6);
ItemStack resetStack = new ItemStack(reset);
resetStack.stackTagCompound = new NBTTagCompound();
tileAnvil.setInventorySlotContents(0, resetStack);
world.setBlock(x, y, z, Blocks.air, 0, 2);
stack.damageItem(1, player);
}
}
}
if(keyCheckOne == 1){
if (rand.nextInt(2) == 0 ) {
tileLapis.hits++;
}
if(tileLapis.hits >= 8){
tileLapis.hits=0;
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("unbreaking")){
Item reset = InlayTables.multiUpgrade.get(keyCheckOne+6);
ItemStack resetStack = new ItemStack(reset);
resetStack.stackTagCompound = new NBTTagCompound();
tileAnvil.setInventorySlotContents(0, resetStack);
world.setBlock(x, y, z, Blocks.air, 0, 2);
stack.damageItem(1, player);
}
}
}
if(keyCheckOne == 2){
if (rand.nextInt(2) == 0 ) {
tileLapis.hits++;
}
if(tileLapis.hits >= 8){
tileLapis.hits=0;
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("unbreaking")){
Item reset = InlayTables.multiUpgrade.get(keyCheckOne+6);
ItemStack resetStack = new ItemStack(reset);
resetStack.stackTagCompound = new NBTTagCompound();
tileAnvil.setInventorySlotContents(0, resetStack);
world.setBlock(x, y, z, Blocks.air, 0, 2);
stack.damageItem(1, player);
}
}
}
if(keyCheckOne == 3){
if (rand.nextInt(2) == 0 ) {
tileLapis.hits++;
}
if(tileLapis.hits >= 8){
tileLapis.hits=0;
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("effic")){
Item reset = InlayTables.multiUpgrade.get(keyCheckOne);
ItemStack resetStack = new ItemStack(reset);
resetStack.stackTagCompound = new NBTTagCompound();
tileAnvil.setInventorySlotContents(0, resetStack);
world.setBlock(x, y, z, Blocks.air, 0, 2);
stack.damageItem(1, player);
}
}
}
if(keyCheckOne == 4){
if (rand.nextInt(2) == 0 ) {
tileLapis.hits++;
}
if(tileLapis.hits >= 8){
tileLapis.hits=0;
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("effic")){
Item reset = InlayTables.multiUpgrade.get(keyCheckOne);
ItemStack resetStack = new ItemStack(reset);
resetStack.stackTagCompound = new NBTTagCompound();
tileAnvil.setInventorySlotContents(0, resetStack);
world.setBlock(x, y, z, Blocks.air, 0, 2);
stack.damageItem(1, player);
}
}
}
if(keyCheckOne == 5){
if (rand.nextInt(2) == 0 ) {
tileLapis.hits++;
}
if(tileLapis.hits >= 8){
tileLapis.hits=0;
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("effic")){
Item reset = InlayTables.multiUpgrade.get(keyCheckOne);
ItemStack resetStack = new ItemStack(reset);
resetStack.stackTagCompound = new NBTTagCompound();
tileAnvil.setInventorySlotContents(0, resetStack);
world.setBlock(x, y, z, Blocks.air, 0, 2);
stack.damageItem(1, player);
}
}
}
if(keyCheckOne == 6){
if (rand.nextInt(2) == 0 ) {
tileLapis.hits++;
}
if(tileLapis.hits >= 8){
tileLapis.hits=0;
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("fortune")){
Item reset = InlayTables.twoUpgrade.get(keyCheckOne);
ItemStack resetStack = new ItemStack(reset);
resetStack.stackTagCompound = new NBTTagCompound();
tileAnvil.setInventorySlotContents(0, resetStack);
world.setBlock(x, y, z, Blocks.air, 0, 2);
stack.damageItem(1, player);
}
}
}
if(keyCheckOne == 7){
if (rand.nextInt(2) == 0 ) {
tileLapis.hits++;
}
if(tileLapis.hits >= 8){
tileLapis.hits=0;
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("fortune")){
Item reset = InlayTables.twoUpgrade.get(keyCheckOne);
ItemStack resetStack = new ItemStack(reset);
resetStack.stackTagCompound = new NBTTagCompound();
tileAnvil.setInventorySlotContents(0, resetStack);
world.setBlock(x, y, z, Blocks.air, 0, 2);
stack.damageItem(1, player);
}
}
}
if(keyCheckOne == 8){
if (rand.nextInt(2) == 0 ) {
tileLapis.hits++;
}
if(tileLapis.hits >= 8){
tileLapis.hits=0;
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("fortune")){
Item reset = InlayTables.twoUpgrade.get(keyCheckOne);
ItemStack resetStack = new ItemStack(reset);
resetStack.stackTagCompound = new NBTTagCompound();
tileAnvil.setInventorySlotContents(0, resetStack);
world.setBlock(x, y, z, Blocks.air, 0, 2);
stack.damageItem(1, player);
}
}
}
}
if(keyCheckOne == 2){
if(tileAnvil.getStackInSlot(0).isItemEqual(new ItemStack(zeroUpgradeCheck(tileAnvil.getStackInSlot(0).getItem())))){
if (rand.nextInt(2) == 0 ) {
tileLapis.hits++;
}
if(tileLapis.hits >= 8){
tileLapis.hits=0;
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("unbreaking")){
Item reset = InlayTables.multiUpgrade.get(keyCheckOne+6);
ItemStack resetStack = new ItemStack(reset);
resetStack.stackTagCompound = new NBTTagCompound();
tileAnvil.setInventorySlotContents(0, resetStack);
world.setBlock(x, y, z, Blocks.air, 0, 2);
stack.damageItem(1, player);
}
Item reset = InlayTables.oneUpgrade.get(keyCheck+6);
ItemStack resetStack = new ItemStack(reset);
resetStack.stackTagCompound = new NBTTagCompound();
resetStack.stackTagCompound.setInteger("UPGRADES", 1);
resetStack.stackTagCompound.setString("ENCHANTTYPE", "fortune");
tileAnvil.setInventorySlotContents(0, resetStack);
world.setBlock(x, y, z, Blocks.air, 0, 2);
stack.damageItem(1, player);
//System.out.println(resetStack.stackTagCompound.getString("ENCHANTTYPE"));
}
}
if(keyCheckOne == 3){
if (rand.nextInt(2) == 0 ) {
tileLapis.hits++;
}
if(tileLapis.hits >= 8){
tileLapis.hits=0;
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("effic")){
Item reset = InlayTables.multiUpgrade.get(keyCheckOne);
ItemStack resetStack = new ItemStack(reset);
resetStack.stackTagCompound = new NBTTagCompound();
tileAnvil.setInventorySlotContents(0, resetStack);
world.setBlock(x, y, z, Blocks.air, 0, 2);
stack.damageItem(1, player);
}
}
}
if(keyCheckOne == 4){
if (rand.nextInt(2) == 0 ) {
tileLapis.hits++;
}
if(tileLapis.hits >= 8){
tileLapis.hits=0;
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("effic")){
Item reset = InlayTables.multiUpgrade.get(keyCheckOne);
ItemStack resetStack = new ItemStack(reset);
resetStack.stackTagCompound = new NBTTagCompound();
tileAnvil.setInventorySlotContents(0, resetStack);
world.setBlock(x, y, z, Blocks.air, 0, 2);
stack.damageItem(1, player);
}
}
}
if(keyCheckOne == 5){
if (rand.nextInt(2) == 0 ) {
tileLapis.hits++;
}
if(tileLapis.hits >= 8){
tileLapis.hits=0;
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("effic")){
Item reset = InlayTables.multiUpgrade.get(keyCheckOne);
ItemStack resetStack = new ItemStack(reset);
resetStack.stackTagCompound = new NBTTagCompound();
tileAnvil.setInventorySlotContents(0, resetStack);
world.setBlock(x, y, z, Blocks.air, 0, 2);
stack.damageItem(1, player);
}
}
}
if(keyCheckOne == 6){
if (rand.nextInt(2) == 0 ) {
tileLapis.hits++;
}
if(tileLapis.hits >= 8){
tileLapis.hits=0;
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("fortune")){
Item reset = InlayTables.twoUpgrade.get(keyCheckOne);
ItemStack resetStack = new ItemStack(reset);
resetStack.stackTagCompound = new NBTTagCompound();
tileAnvil.setInventorySlotContents(0, resetStack);
world.setBlock(x, y, z, Blocks.air, 0, 2);
stack.damageItem(1, player);
}
}
}
if(keyCheckOne == 7){
if (rand.nextInt(2) == 0 ) {
tileLapis.hits++;
}
if(tileLapis.hits >= 8){
tileLapis.hits=0;
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("fortune")){
Item reset = InlayTables.twoUpgrade.get(keyCheckOne);
ItemStack resetStack = new ItemStack(reset);
resetStack.stackTagCompound = new NBTTagCompound();
tileAnvil.setInventorySlotContents(0, resetStack);
world.setBlock(x, y, z, Blocks.air, 0, 2);
stack.damageItem(1, player);
}
}
}
if(keyCheckOne == 8){
if (rand.nextInt(2) == 0 ) {
tileLapis.hits++;
}
if(tileLapis.hits >= 8){
tileLapis.hits=0;
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("fortune")){
Item reset = InlayTables.twoUpgrade.get(keyCheckOne);
ItemStack resetStack = new ItemStack(reset);
resetStack.stackTagCompound = new NBTTagCompound();
tileAnvil.setInventorySlotContents(0, resetStack);
world.setBlock(x, y, z, Blocks.air, 0, 2);
stack.damageItem(1, player);
}
}
}
}
if(tileAnvil.getStackInSlot(0).isItemEqual(new ItemStack(zeroUpgradeCheck(tileAnvil.getStackInSlot(0).getItem())))){
if (rand.nextInt(2) == 0 ) {
tileLapis.hits++;
}
if(tileLapis.hits >= 8){
tileLapis.hits=0;
Item reset = InlayTables.oneUpgrade.get(keyCheck+6);
ItemStack resetStack = new ItemStack(reset);
resetStack.stackTagCompound = new NBTTagCompound();
resetStack.stackTagCompound.setInteger("UPGRADES", 1);
resetStack.stackTagCompound.setString("ENCHANTTYPE", "fortune");
tileAnvil.setInventorySlotContents(0, resetStack);
world.setBlock(x, y, z, Blocks.air, 0, 2);
stack.damageItem(1, player);
//System.out.println(resetStack.stackTagCompound.getString("ENCHANTTYPE"));
}
}
}
}
if(keyUpgrade == 3){
if(tileAnvil.getStackInSlot(0) != null){
player.worldObj.playSoundAtEntity(player, Main.MODID + ":anvilhammer", 1.0F, 2.25F);
if(tileAnvil.getStackInSlot(0).getItem().equals(ModItems.ironweaponHandle)){
if (rand.nextInt(2) == 0 ) {
tileRedstone.hits++;
}
if(tileRedstone.hits >= 8){
tileRedstone.hits=0;
ItemStack resetStack = new ItemStack(ModItems.efficIronRod);
tileAnvil.setInventorySlotContents(0, resetStack);
world.setBlock(x, y, z, Blocks.air, 0, 2);
stack.damageItem(1, player);
}
}
if(tileRedstone.hot==true){
player.worldObj.playSoundAtEntity(player, Main.MODID + ":anvilhammer", 1.0F, 2.25F);
if(tileAnvil.getStackInSlot(0).isItemEqual(new ItemStack(oneUpgradeCheck(tileAnvil.getStackInSlot(0).getItem())))){
//System.out.println("Lvl 1 second upgrade");
//System.out.println(keyCheckOne);
//System.out.println(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE"));
//ItemStack tempStack = tileAnvil.getStackInSlot(0);
//keyCHeckone is oneUpgrade check
if(keyCheckOne == 0){
if(tileAnvil.getStackInSlot(0).getItem().equals(ModItems.ironweaponHandle)){
if (rand.nextInt(2) == 0 ) {
tileRedstone.hits++;
}
if(tileRedstone.hits >= 8){
tileRedstone.hits=0;
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("unbreaking")){
Item reset = InlayTables.multiUpgrade.get(keyCheckOne);
ItemStack resetStack = new ItemStack(reset);
resetStack.stackTagCompound = new NBTTagCompound();
tileAnvil.setInventorySlotContents(0, resetStack);
world.setBlock(x, y, z, Blocks.air, 0, 2);
stack.damageItem(1, player);
}
ItemStack resetStack = new ItemStack(ModItems.efficIronRod);
tileAnvil.setInventorySlotContents(0, resetStack);
world.setBlock(x, y, z, Blocks.air, 0, 2);
stack.damageItem(1, player);
}
}
if(keyCheckOne == 1){
if(tileAnvil.getStackInSlot(0).isItemEqual(new ItemStack(oneUpgradeCheck(tileAnvil.getStackInSlot(0).getItem())))){
//System.out.println("Lvl 1 second upgrade");
//System.out.println(keyCheckOne);
//System.out.println(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE"));
//ItemStack tempStack = tileAnvil.getStackInSlot(0);
//keyCHeckone is oneUpgrade check
if(keyCheckOne == 0){
if (rand.nextInt(2) == 0 ) {
tileRedstone.hits++;
}
if(tileRedstone.hits >= 8){
tileRedstone.hits=0;
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("unbreaking")){
Item reset = InlayTables.multiUpgrade.get(keyCheckOne);
ItemStack resetStack = new ItemStack(reset);
resetStack.stackTagCompound = new NBTTagCompound();
tileAnvil.setInventorySlotContents(0, resetStack);
world.setBlock(x, y, z, Blocks.air, 0, 2);
stack.damageItem(1, player);
}
}
}
if(keyCheckOne == 1){
if (rand.nextInt(2) == 0 ) {
tileRedstone.hits++;
}
if(tileRedstone.hits >= 8){
tileRedstone.hits=0;
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("unbreaking")){
Item reset = InlayTables.multiUpgrade.get(keyCheckOne);
ItemStack resetStack = new ItemStack(reset);
resetStack.stackTagCompound = new NBTTagCompound();
tileAnvil.setInventorySlotContents(0, resetStack);
world.setBlock(x, y, z, Blocks.air, 0, 2);
stack.damageItem(1, player);
}
}
}
if(keyCheckOne == 2){
if (rand.nextInt(2) == 0 ) {
tileRedstone.hits++;
}
if(tileRedstone.hits >= 8){
tileRedstone.hits=0;
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("unbreaking")){
Item reset = InlayTables.multiUpgrade.get(keyCheckOne);
ItemStack resetStack = new ItemStack(reset);
resetStack.stackTagCompound = new NBTTagCompound();
tileAnvil.setInventorySlotContents(0, resetStack);
world.setBlock(x, y, z, Blocks.air, 0, 2);
stack.damageItem(1, player);
}
}
}
if(keyCheckOne == 3){
if (rand.nextInt(2) == 0 ) {
tileRedstone.hits++;
}
if(tileRedstone.hits >= 8){
tileRedstone.hits=0;
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("effic")){
Item reset = InlayTables.twoUpgrade.get(keyCheckOne);
ItemStack resetStack = new ItemStack(reset);
resetStack.stackTagCompound = new NBTTagCompound();
tileAnvil.setInventorySlotContents(0, resetStack);
world.setBlock(x, y, z, Blocks.air, 0, 2);
stack.damageItem(1, player);
}
}
}
if(keyCheckOne == 4){
if (rand.nextInt(2) == 0 ) {
tileRedstone.hits++;
}
if(tileRedstone.hits >= 8){
tileRedstone.hits=0;
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("effic")){
Item reset = InlayTables.twoUpgrade.get(keyCheckOne);
ItemStack resetStack = new ItemStack(reset);
resetStack.stackTagCompound = new NBTTagCompound();
tileAnvil.setInventorySlotContents(0, resetStack);
world.setBlock(x, y, z, Blocks.air, 0, 2);
stack.damageItem(1, player);
}
}
}
if(keyCheckOne == 5){
if (rand.nextInt(2) == 0 ) {
tileRedstone.hits++;
}
if(tileRedstone.hits >= 8){
tileRedstone.hits=0;
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("effic")){
Item reset = InlayTables.twoUpgrade.get(keyCheckOne);
ItemStack resetStack = new ItemStack(reset);
resetStack.stackTagCompound = new NBTTagCompound();
tileAnvil.setInventorySlotContents(0, resetStack);
world.setBlock(x, y, z, Blocks.air, 0, 2);
stack.damageItem(1, player);
}
}
}
if(keyCheckOne == 6){
if (rand.nextInt(2) == 0 ) {
tileRedstone.hits++;
}
if(tileRedstone.hits >= 8){
tileRedstone.hits=0;
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("fortune")){
Item reset = InlayTables.multiUpgrade.get(keyCheckOne-3);
ItemStack resetStack = new ItemStack(reset);
resetStack.stackTagCompound = new NBTTagCompound();
tileAnvil.setInventorySlotContents(0, resetStack);
world.setBlock(x, y, z, Blocks.air, 0, 2);
stack.damageItem(1, player);
}
}
}
if(keyCheckOne == 7){
if (rand.nextInt(2) == 0 ) {
tileRedstone.hits++;
}
if(tileRedstone.hits >= 8){
tileRedstone.hits=0;
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("fortune")){
Item reset = InlayTables.multiUpgrade.get(keyCheckOne-3);
ItemStack resetStack = new ItemStack(reset);
resetStack.stackTagCompound = new NBTTagCompound();
tileAnvil.setInventorySlotContents(0, resetStack);
world.setBlock(x, y, z, Blocks.air, 0, 2);
stack.damageItem(1, player);
}
}
}
if(keyCheckOne == 8){
if (rand.nextInt(2) == 0 ) {
tileRedstone.hits++;
}
if(tileRedstone.hits >= 8){
tileRedstone.hits=0;
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("fortune")){
Item reset = InlayTables.multiUpgrade.get(keyCheckOne-3);
ItemStack resetStack = new ItemStack(reset);
resetStack.stackTagCompound = new NBTTagCompound();
tileAnvil.setInventorySlotContents(0, resetStack);
world.setBlock(x, y, z, Blocks.air, 0, 2);
stack.damageItem(1, player);
}
}
}
}
if(tileAnvil.getStackInSlot(0).isItemEqual(new ItemStack(zeroUpgradeCheck(tileAnvil.getStackInSlot(0).getItem())))){
if (rand.nextInt(2) == 0 ) {
tileRedstone.hits++;
}
if(tileRedstone.hits >= 8){
tileRedstone.hits=0;
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("unbreaking")){
Item reset = InlayTables.multiUpgrade.get(keyCheckOne);
ItemStack resetStack = new ItemStack(reset);
resetStack.stackTagCompound = new NBTTagCompound();
tileAnvil.setInventorySlotContents(0, resetStack);
world.setBlock(x, y, z, Blocks.air, 0, 2);
stack.damageItem(1, player);
}
Item reset = InlayTables.oneUpgrade.get(keyCheck+3);
ItemStack resetStack = new ItemStack(reset);
resetStack.stackTagCompound = new NBTTagCompound();
resetStack.stackTagCompound.setInteger("UPGRADES", 1);
resetStack.stackTagCompound.setString("ENCHANTTYPE", "effic");
tileAnvil.setInventorySlotContents(0, resetStack);
world.setBlock(x, y, z, Blocks.air, 0, 2);
stack.damageItem(1, player);
//System.out.println(resetStack.stackTagCompound.getString("ENCHANTTYPE"));
}
}
if(keyCheckOne == 2){
if (rand.nextInt(2) == 0 ) {
tileRedstone.hits++;
}
if(tileRedstone.hits >= 8){
tileRedstone.hits=0;
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("unbreaking")){
Item reset = InlayTables.multiUpgrade.get(keyCheckOne);
ItemStack resetStack = new ItemStack(reset);
resetStack.stackTagCompound = new NBTTagCompound();
tileAnvil.setInventorySlotContents(0, resetStack);
world.setBlock(x, y, z, Blocks.air, 0, 2);
stack.damageItem(1, player);
}
}
}
if(keyCheckOne == 3){
if (rand.nextInt(2) == 0 ) {
tileRedstone.hits++;
}
if(tileRedstone.hits >= 8){
tileRedstone.hits=0;
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("effic")){
Item reset = InlayTables.twoUpgrade.get(keyCheckOne);
ItemStack resetStack = new ItemStack(reset);
resetStack.stackTagCompound = new NBTTagCompound();
tileAnvil.setInventorySlotContents(0, resetStack);
world.setBlock(x, y, z, Blocks.air, 0, 2);
stack.damageItem(1, player);
}
}
}
if(keyCheckOne == 4){
if (rand.nextInt(2) == 0 ) {
tileRedstone.hits++;
}
if(tileRedstone.hits >= 8){
tileRedstone.hits=0;
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("effic")){
Item reset = InlayTables.twoUpgrade.get(keyCheckOne);
ItemStack resetStack = new ItemStack(reset);
resetStack.stackTagCompound = new NBTTagCompound();
tileAnvil.setInventorySlotContents(0, resetStack);
world.setBlock(x, y, z, Blocks.air, 0, 2);
stack.damageItem(1, player);
}
}
}
if(keyCheckOne == 5){
if (rand.nextInt(2) == 0 ) {
tileRedstone.hits++;
}
if(tileRedstone.hits >= 8){
tileRedstone.hits=0;
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("effic")){
Item reset = InlayTables.twoUpgrade.get(keyCheckOne);
ItemStack resetStack = new ItemStack(reset);
resetStack.stackTagCompound = new NBTTagCompound();
tileAnvil.setInventorySlotContents(0, resetStack);
world.setBlock(x, y, z, Blocks.air, 0, 2);
stack.damageItem(1, player);
}
}
}
if(keyCheckOne == 6){
if (rand.nextInt(2) == 0 ) {
tileRedstone.hits++;
}
if(tileRedstone.hits >= 8){
tileRedstone.hits=0;
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("fortune")){
Item reset = InlayTables.multiUpgrade.get(keyCheckOne-3);
ItemStack resetStack = new ItemStack(reset);
resetStack.stackTagCompound = new NBTTagCompound();
tileAnvil.setInventorySlotContents(0, resetStack);
world.setBlock(x, y, z, Blocks.air, 0, 2);
stack.damageItem(1, player);
}
}
}
if(keyCheckOne == 7){
if (rand.nextInt(2) == 0 ) {
tileRedstone.hits++;
}
if(tileRedstone.hits >= 8){
tileRedstone.hits=0;
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("fortune")){
Item reset = InlayTables.multiUpgrade.get(keyCheckOne-3);
ItemStack resetStack = new ItemStack(reset);
resetStack.stackTagCompound = new NBTTagCompound();
tileAnvil.setInventorySlotContents(0, resetStack);
world.setBlock(x, y, z, Blocks.air, 0, 2);
stack.damageItem(1, player);
}
}
}
if(keyCheckOne == 8){
if (rand.nextInt(2) == 0 ) {
tileRedstone.hits++;
}
if(tileRedstone.hits >= 8){
tileRedstone.hits=0;
if(tileAnvil.getStackInSlot(0).stackTagCompound.getString("ENCHANTTYPE").equals("fortune")){
Item reset = InlayTables.multiUpgrade.get(keyCheckOne-3);
ItemStack resetStack = new ItemStack(reset);
resetStack.stackTagCompound = new NBTTagCompound();
tileAnvil.setInventorySlotContents(0, resetStack);
world.setBlock(x, y, z, Blocks.air, 0, 2);
stack.damageItem(1, player);
}
}
}
}
if(tileAnvil.getStackInSlot(0).isItemEqual(new ItemStack(zeroUpgradeCheck(tileAnvil.getStackInSlot(0).getItem())))){
if (rand.nextInt(2) == 0 ) {
tileRedstone.hits++;
}
if(tileRedstone.hits >= 8){
tileRedstone.hits=0;
Item reset = InlayTables.oneUpgrade.get(keyCheck+3);
ItemStack resetStack = new ItemStack(reset);
resetStack.stackTagCompound = new NBTTagCompound();
resetStack.stackTagCompound.setInteger("UPGRADES", 1);
resetStack.stackTagCompound.setString("ENCHANTTYPE", "effic");
tileAnvil.setInventorySlotContents(0, resetStack);
world.setBlock(x, y, z, Blocks.air, 0, 2);
stack.damageItem(1, player);
//System.out.println(resetStack.stackTagCompound.getString("ENCHANTTYPE"));
}
}
}
}