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

Binary file not shown.

Binary file not shown.

View File

@@ -405,9 +405,8 @@ public void splitLogEvent(PlayerInteractEvent event){
ItemStack itemStack = new ItemStack(Items.diamond);
if(player.isSneaking()){
if((player.inventory.getCurrentItem() != null)) {
if((player.inventory.getCurrentItem().isItemEqual(itemStack))){
if((player.inventory.getCurrentItem().getItem().equals(Items.diamond))){
if((event.action == event.action.RIGHT_CLICK_BLOCK ) ) { //&& (test == ModBlocks.testForge) && (isEmpty == Blocks.air)
if(event.world.getBlock(event.x, event.y + 1, event.z).equals(Blocks.air)){
event.world.setBlock(event.x, event.y + 1, event.z, ModBlocks.myDiamond, 0, 2);
player.inventory.consumeInventoryItem(Items.diamond);

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){
@@ -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"));
}
}
}
}

View File

@@ -9,9 +9,9 @@ import net.minecraft.world.World;
import com.kitsu.medievalcraft.block.ModBlocks;
import com.kitsu.medievalcraft.tileents.machine.TileEntityAnvilForge;
import com.kitsu.medievalcraft.util.IronFormNames;
import com.kitsu.medievalcraft.util.AnvilUtil;
public class TileIngotBase extends TileEntity implements IronFormNames{
public class TileIngotBase extends TileEntity implements AnvilUtil{
private String specName;
public int hits = 0;

View File

@@ -8,9 +8,9 @@ import net.minecraft.item.ItemStack;
import com.kitsu.medievalcraft.block.ModBlocks;
import com.kitsu.medievalcraft.item.ModItems;
public interface IronFormNames {
public interface AnvilUtil {
static final Hashtable<Item, ItemStack> forms = new Hashtable <Item, ItemStack>(){{
static final Hashtable<Item, ItemStack> formsIron = new Hashtable <Item, ItemStack>(){{
put(ModItems.ironAxeForm, new ItemStack(ModItems.ironaxeHead, 1));
put(ModItems.ironBattleAxeForm, new ItemStack(ModItems.ironbattleaxeHead, 1));
@@ -29,6 +29,25 @@ public interface IronFormNames {
}};
static final Hashtable<Item, ItemStack> makeForms = new Hashtable <Item, ItemStack>(){{
put(ModItems.ironaxeHead, new ItemStack(ModItems.ironAxeForm, 1));
put(ModItems.ironbattleaxeHead, new ItemStack(ModItems.ironBattleAxeForm, 1));
put(ModItems.irondaggerBlade, new ItemStack(ModItems.ironDaggerForm, 1));
put(ModItems.woodentoolHandle, new ItemStack(ModItems.ironHandleForm, 1));
put(ModItems.ironhoeHead, new ItemStack(ModItems.ironHoeForm, 1));
put(ModItems.ironlongswordBlade, new ItemStack(ModItems.ironLongswordForm, 1));
put(ModItems.ironmaceHead, new ItemStack(ModItems.ironMaceHeadForm, 1));
put(ModItems.ironpickaxeHead, new ItemStack(ModItems.ironPickaxeForm, 1));
put(ModItems.ironRing, new ItemStack(ModItems.ironRingForm, 1));
put(ModItems.ironsawBlade, new ItemStack(ModItems.ironSawBladeForm, 1));
put(ModItems.ironsharpTip, new ItemStack(ModItems.ironSharpTipForm, 1));
put(ModItems.ironshortswordBlade, new ItemStack(ModItems.ironShortSwordForm, 1));
put(ModItems.ironspadeHead, new ItemStack(ModItems.ironSpadForm, 1));
put(ModItems.ironspearTip, new ItemStack(ModItems.ironSpearTipForm, 1));
}};
static final Hashtable<Item, ItemStack> formsClay = new Hashtable <Item, ItemStack>(){{
put(ModItems.cookedaxeHeadClayForm, new ItemStack(ModItems.ironaxeHead, 1));
@@ -48,4 +67,6 @@ public interface IronFormNames {
}};
}

View File

@@ -8,19 +8,19 @@ import net.minecraft.item.Item;
import com.kitsu.medievalcraft.block.ModBlocks;
import com.kitsu.medievalcraft.item.ModItems;
public class InlayTables {
public interface InlayTables {
public static final Hashtable<Integer, Block> upgrade = new Hashtable <Integer, Block>(){{
public static Hashtable<Integer, Block> upgrade = new Hashtable <Integer, Block>(){{
put(0, ModBlocks.myDiamond);
put(1, ModBlocks.myEmerald);
//put(2, ModBlocks.hotLapisIngot);
//put(3, ModBlocks.hotRedstoneIngot);
put(2, ModBlocks.lapisIngot);
put(3, ModBlocks.redstoneIngot);
//put(3, ModItems.battleAxe);
}};
public static final Hashtable<Integer, Item> zeroUpgrade = new Hashtable <Integer, Item>(){{
public static Hashtable<Integer, Item> zeroUpgrade = new Hashtable <Integer, Item>(){{
put(0, ModItems.ironpickaxeHead);
put(1, ModItems.ironspadeHead);
@@ -40,7 +40,7 @@ public class InlayTables {
}};
public static final Hashtable<Integer, Item> oneUpgrade = new Hashtable <Integer, Item>(){{
public static Hashtable<Integer, Item> oneUpgrade = new Hashtable <Integer, Item>(){{
put(0, ModItems.unbreakingOneHead);
put(1, ModItems.unbreakingOneSpade);
@@ -59,7 +59,7 @@ public class InlayTables {
}};
public static final Hashtable<Integer, Item> twoUpgrade = new Hashtable <Integer, Item>(){{
public static Hashtable<Integer, Item> twoUpgrade = new Hashtable <Integer, Item>(){{
put(0, ModItems.unbreakingTwoHead);
put(1, ModItems.unbreakingTwoSpade);
@@ -78,7 +78,7 @@ public class InlayTables {
}};
public static final Hashtable<Integer, Item> multiUpgrade = new Hashtable <Integer, Item>(){{
public static Hashtable<Integer, Item> multiUpgrade = new Hashtable <Integer, Item>(){{
put(0, ModItems.unbreakingOneEfficOneHead);
put(1, ModItems.unbreakingOneEfficOneSpade);
@@ -97,7 +97,7 @@ public class InlayTables {
}};
public static final Hashtable<Integer, Item> silkTouch = new Hashtable <Integer, Item>(){{
public static Hashtable<Integer, Item> silkTouch = new Hashtable <Integer, Item>(){{
put(0, ModItems.silkTouchIronHead);
put(1, ModItems.silkTouchIronSpade);
@@ -107,7 +107,7 @@ public class InlayTables {
}};
public static final Hashtable<Integer, String> enchantType = new Hashtable <Integer, String>(){{
public static Hashtable<Integer, String> enchantType = new Hashtable <Integer, String>(){{
put(0, "unbreaking");
put(1, "fortune");