diff --git a/1.11/To-Dos b/1.11/To-Dos index 379322e2..b98b5446 100644 --- a/1.11/To-Dos +++ b/1.11/To-Dos @@ -2,36 +2,13 @@ To-Dos *** Priority *** -- [ ] Allow redstone, lapis, and shards in the anvil - [ ] Fix renderings in the Anvil - [ ] Fix Renderings in the Forge -- [ ] Create toolHead Item - - [ ] Give toolHead item NBT - - [x] Create pickaxehead Item - - [x] Create pickaxehead SubNBTs -- [ ] Create Forging Recipe for toolHeads -- [ ] Create Anvil recipe for toolHeads - -- [ ] Create Slot for Forge to accept toolheads in slot 4 - +- [ ] Fix StoneTongs rendering for NBT 8 - [ ] Add forgehammer to oreDict - - -Make Iron like normal -make tool heads like normal -put tool heads in forge to get hot -take hot tool head and put in anvil -put upgrade material (redstone, lapis, emerald, diamond) above pick -hammer a few times to get cooled toolhead with new NBT changes - -Repeat the above process to add-on or add-new upgrade - - -Tools are crafted in a workbench type block -The block takes an input toolhead and toolrod -when the block is right-clicked crafting is attempted. - +- [ ] Create Crafting Block for Tools and Weapons +- [ ] Create PickAxe Tool which ingests NBT *** Backlog *** @@ -53,6 +30,17 @@ when the block is right-clicked crafting is attempted. *** Completed *** +- [x] Allow redstone, lapis, and shards in the anvil + +- [x] Create toolHead Item + - [x] Give toolHead item NBT + - [x] Create pickaxehead Item + - [x] Create pickaxehead SubNBTs +- [x] Create Forging Recipe for toolHeads +- [x] Create Anvil recipe for toolHeads + +- [x] Create Slot for Forge to accept toolheads in slot 4 + - [x] Stone Anvil - [x] Stone Anvil Inventory - [x] Stone Anvil Tile diff --git a/1.11/src/main/java/nmd/primal/forgecraft/blocks/Anvil.java b/1.11/src/main/java/nmd/primal/forgecraft/blocks/Anvil.java index 2362cd97..a4541356 100644 --- a/1.11/src/main/java/nmd/primal/forgecraft/blocks/Anvil.java +++ b/1.11/src/main/java/nmd/primal/forgecraft/blocks/Anvil.java @@ -78,9 +78,9 @@ public class Anvil extends CustomContainerFacing { if (tile != null) { ItemStack pItem = player.inventory.getCurrentItem(); - // ***************************************************************************** // - // Crafting Anvil Recipes - // ***************************************************************************** // + /****************************************************************************** + Crafting Anvil Recipes + *****************************************************************************/ if((pItem.getItem().equals(PrimalItems.STONE_GALLAGHER)) || (pItem.getItem() == ModItems.forgehammer)){ String [] tempArray = new String[25]; for(int i=0; i < 25 ; i++){ @@ -102,12 +102,29 @@ public class Anvil extends CustomContainerFacing { if(recipe.getOutput().getItem() instanceof ToolPart){ NBTTagCompound tempNBT = tile.getSlotStack(12).getSubCompound("tags"); ItemStack outputStack = recipe.getOutput(); + outputStack.setTagCompound(new NBTTagCompound()); outputStack.getTagCompound().setTag("tags", tempNBT); outputStack.getSubCompound("tags").setBoolean("hot", false); if(outputStack.getSubCompound("tags").getInteger("modifiers") < 3){ - //Upgrade Redstone + //Upgrade emerald + if(recipe.getUpgrade() == "emerald"){ + outputStack.getSubCompound("tags").setInteger("emerald", + (outputStack.getSubCompound("tags").getInteger("emerald") + 1) ); + outputStack.getSubCompound("tags").setInteger("modifiers", + (outputStack.getSubCompound("tags").getInteger("modifiers") + 1) ); + } + + //Upgrade diamond + if(recipe.getUpgrade() == "diamond"){ + outputStack.getSubCompound("tags").setInteger("diamond", + (outputStack.getSubCompound("tags").getInteger("diamond") + 1) ); + outputStack.getSubCompound("tags").setInteger("modifiers", + (outputStack.getSubCompound("tags").getInteger("modifiers") + 1) ); + } + + //Upgrade redstone if(recipe.getUpgrade() == "redstone"){ outputStack.getSubCompound("tags").setInteger("redstone", (outputStack.getSubCompound("tags").getInteger("redstone") + 1) ); @@ -115,6 +132,16 @@ public class Anvil extends CustomContainerFacing { (outputStack.getSubCompound("tags").getInteger("modifiers") + 1) ); } + //Upgrade lapis + if(recipe.getUpgrade() == "lapis"){ + if(outputStack.getSubCompound("tags").getInteger("emerald") == 0 ) { + outputStack.getSubCompound("tags").setInteger("lapis", + (outputStack.getSubCompound("tags").getInteger("lapis") + 1)); + outputStack.getSubCompound("tags").setInteger("modifiers", + (outputStack.getSubCompound("tags").getInteger("modifiers") + 1)); + } + } + } CommonUtils.spawnItemEntityFromWorld(world, pos, outputStack); @@ -142,9 +169,9 @@ public class Anvil extends CustomContainerFacing { } - // ***************************************************************************** // - // Adding and Removing Inventory With Tongs - // ***************************************************************************** // + /***************************************************************************** + Adding and Removing Inventory With Tongs + *****************************************************************************/ if( (pItem.getItem() != PrimalItems.STONE_GALLAGHER) || (pItem.getItem() != ModItems.forgehammer) ) { @@ -157,7 +184,7 @@ public class Anvil extends CustomContainerFacing { if (hitz >= this.getNormalMin(z) && hitz <= this.getNormalMax(z)) { if (pItem.getItem().equals(ModItems.stonetongs)) { - if ((pItem.getTagCompound().getInteger("type") == 6) || (pItem.getTagCompound().getInteger("type") == 7) || (pItem.getTagCompound().getInteger("type") == 0)) { + if ((pItem.getTagCompound().getInteger("type") == 6) || (pItem.getTagCompound().getInteger("type") == 7) || (pItem.getTagCompound().getInteger("type") == 8)|| (pItem.getTagCompound().getInteger("type") == 0)) { if (!tile.getSlotStack(counter).isEmpty()) { if (pItem.getTagCompound().getInteger("type") == 0) { @@ -190,11 +217,21 @@ public class Anvil extends CustomContainerFacing { } if (pItem.getTagCompound().getInteger("type") == 8) { ItemStack tempStack = new ItemStack (ModItems.pickaxehead, 1); - //tempStack. + tempStack.setTagCompound(new NBTTagCompound()); + NBTTagCompound tempNBT = pItem.getSubCompound("tags"); + tempStack.getTagCompound().setTag("tags", tempNBT); - //tile.setSlotStack((counter), new ItemStack); + tile.setSlotStack((counter), tempStack); pItem.getTagCompound().setInteger("type", 0); - //System.out.println(counter); + + pItem.getSubCompound("tags").setBoolean("hot", false); + + pItem.getSubCompound("tags").setBoolean("emerald", false); + pItem.getSubCompound("tags").setInteger("diamond", 0); + pItem.getSubCompound("tags").setInteger("redstone", 0); + pItem.getSubCompound("tags").setInteger("lapis", 0); + + pItem.getSubCompound("tags").setInteger("modifiers", 0); return true; } } @@ -207,6 +244,35 @@ public class Anvil extends CustomContainerFacing { tile.setSlotStack(counter, ItemStack.EMPTY); return true; } + if (tile.getSlotStack(counter).getItem().equals(PrimalItems.DIAMOND_KNAPP)) { + CommonUtils.spawnItemEntityFromWorld(world, pos, tile.getSlotStack(counter)); + tile.setSlotStack(counter, ItemStack.EMPTY); + return true; + } + if (tile.getSlotStack(counter).getItem().equals(Items.EMERALD)) { + CommonUtils.spawnItemEntityFromWorld(world, pos, tile.getSlotStack(counter)); + tile.setSlotStack(counter, ItemStack.EMPTY); + return true; + } + if (tile.getSlotStack(counter).getItem().equals(PrimalItems.EMERALD_KNAPP)) { + CommonUtils.spawnItemEntityFromWorld(world, pos, tile.getSlotStack(counter)); + tile.setSlotStack(counter, ItemStack.EMPTY); + return true; + } + if (tile.getSlotStack(counter).getItem().equals(Items.REDSTONE)) { + CommonUtils.spawnItemEntityFromWorld(world, pos, tile.getSlotStack(counter)); + tile.setSlotStack(counter, ItemStack.EMPTY); + return true; + } + + + if (tile.getSlotStack(counter).getItem().equals(ModItems.pickaxehead)) { + if(tile.getSlotStack(counter).getSubCompound("tags").getBoolean("hot") == false){ + CommonUtils.spawnItemEntityFromWorld(world, pos, tile.getSlotStack(counter)); + tile.setSlotStack(counter, ItemStack.EMPTY); + return true; + } + } } if (pItem.getItem().equals(Items.DIAMOND)) { @@ -217,6 +283,48 @@ public class Anvil extends CustomContainerFacing { } } + if (pItem.getItem().equals(Items.EMERALD)) { + if (tile.getSlotStack(counter).isEmpty()) { + tile.setSlotStack(counter, new ItemStack(pItem.getItem(), 1, pItem.getItemDamage())); + pItem.shrink(1); + return true; + } + } + + if (pItem.getItem().equals(PrimalItems.EMERALD_KNAPP)) { + if (tile.getSlotStack(counter).isEmpty()) { + tile.setSlotStack(counter, new ItemStack(pItem.getItem(), 1, pItem.getItemDamage())); + pItem.shrink(1); + return true; + } + } + + if (pItem.getItem().equals(PrimalItems.DIAMOND_KNAPP)) { + if (tile.getSlotStack(counter).isEmpty()) { + tile.setSlotStack(counter, new ItemStack(pItem.getItem(), 1, pItem.getItemDamage())); + pItem.shrink(1); + return true; + } + } + + if (pItem.getItem().equals(Items.REDSTONE)) { + if (tile.getSlotStack(counter).isEmpty()) { + tile.setSlotStack(counter, new ItemStack(pItem.getItem(), 1, pItem.getItemDamage())); + pItem.shrink(1); + return true; + } + } + + if (pItem.equals(new ItemStack(Items.DYE, 1, 4))) { + if (tile.getSlotStack(counter).isEmpty()) { + tile.setSlotStack(counter, new ItemStack(pItem.getItem(), 1, pItem.getItemDamage())); + pItem.shrink(1); + return true; + } + } + + + //4 } } counter++; @@ -231,7 +339,7 @@ public class Anvil extends CustomContainerFacing { if (hitz >= this.getReverseMin(z) && hitz <= this.getReverseMax(z)) { if (pItem.getItem().equals(ModItems.stonetongs)) { - if ((pItem.getTagCompound().getInteger("type") == 6) || (pItem.getTagCompound().getInteger("type") == 7) || (pItem.getTagCompound().getInteger("type") == 0)) { + if ((pItem.getTagCompound().getInteger("type") == 6) || (pItem.getTagCompound().getInteger("type") == 7) || (pItem.getTagCompound().getInteger("type") == 8)|| (pItem.getTagCompound().getInteger("type") == 0)) { if (!tile.getSlotStack(counter).isEmpty()) { if (pItem.getTagCompound().getInteger("type") == 0) { @@ -295,7 +403,7 @@ public class Anvil extends CustomContainerFacing { if (hitz >= this.getReverseMin(z) && hitz <= this.getReverseMax(z)) { if (pItem.getItem().equals(ModItems.stonetongs)) { - if ((pItem.getTagCompound().getInteger("type") == 6) || (pItem.getTagCompound().getInteger("type") == 7) || (pItem.getTagCompound().getInteger("type") == 0)) { + if ((pItem.getTagCompound().getInteger("type") == 6) || (pItem.getTagCompound().getInteger("type") == 7) || (pItem.getTagCompound().getInteger("type") == 8) || (pItem.getTagCompound().getInteger("type") == 0)) { if (!tile.getSlotStack(counter).isEmpty()) { if (pItem.getTagCompound().getInteger("type") == 0) { @@ -359,7 +467,7 @@ public class Anvil extends CustomContainerFacing { if (hitz >= this.getNormalMin(z) && hitz <= this.getNormalMax(z)) { if (pItem.getItem().equals(ModItems.stonetongs)) { - if ((pItem.getTagCompound().getInteger("type") == 6) || (pItem.getTagCompound().getInteger("type") == 7) || (pItem.getTagCompound().getInteger("type") == 0)) { + if ((pItem.getTagCompound().getInteger("type") == 6) || (pItem.getTagCompound().getInteger("type") == 7) || (pItem.getTagCompound().getInteger("type") == 8) || (pItem.getTagCompound().getInteger("type") == 0)) { if (!tile.getSlotStack(counter).isEmpty()) { if (pItem.getTagCompound().getInteger("type") == 0) { diff --git a/1.11/src/main/java/nmd/primal/forgecraft/blocks/Forge.java b/1.11/src/main/java/nmd/primal/forgecraft/blocks/Forge.java index 6b7e7f76..0003970c 100644 --- a/1.11/src/main/java/nmd/primal/forgecraft/blocks/Forge.java +++ b/1.11/src/main/java/nmd/primal/forgecraft/blocks/Forge.java @@ -15,6 +15,7 @@ import net.minecraft.init.Items; import net.minecraft.init.SoundEvents; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.*; import net.minecraft.util.math.AxisAlignedBB; @@ -83,15 +84,10 @@ public class Forge extends CustomContainerFacing implements ITileEntityProvider/ if (tile != null) { ItemStack pItem = player.inventory.getCurrentItem(); ItemStack fuelItem = tile.getSlotStack(0); - /* - System.out.println(tile.getSlotStack(0)); - System.out.println(tile.getSlotStack(1)); - System.out.println(tile.getSlotStack(2)); - System.out.println(tile.getSlotStack(3)); - System.out.println(tile.getSlotStack(4)); - System.out.println(tile.getSlotStack(5)); - System.out.println(tile.getSlotStack(6)); - */ + //System.out.println(pItem.getItem().getRegistryName().toString()); + + + /*********************** FUEL SLOT CODE @@ -206,38 +202,25 @@ public class Forge extends CustomContainerFacing implements ITileEntityProvider/ } } - - if (pItem.getItem().equals(ModItems.stonetongs)) { - if (pItem.getTagCompound().getInteger("type") == 0) { - for (int i = 2; i < tile.getSlotListSize(); i++) { - if (tile.getSlotStack(i).getItem().equals(ModItems.ironchunkhot)) { - tile.setSlotStack(i, ItemStack.EMPTY); - pItem.getTagCompound().setInteger("type", 7); - return true; - } - if (tile.getSlotStack(i).getItem().equals(ModItems.ironingotballhot)) { - tile.setSlotStack(i, ItemStack.EMPTY); - pItem.getTagCompound().setInteger("type", 6); - return true; - } - /* - To-Do - Insert StoneTongs Code for ToolPart Hot - */ - } - } - } - if(pItem.getItem() instanceof ToolPart){ if(tile.getSlotStack(4).isEmpty()){ + System.out.println("Adding player Item to slot"); tile.setSlotStack(4, pItem); - pItem.shrink(1); + System.out.println(tile.getSlotStack(4)); + player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY); return true; } } } } + System.out.println(tile.getSlotStack(0)); + System.out.println(tile.getSlotStack(1)); + System.out.println(tile.getSlotStack(2)); + System.out.println(tile.getSlotStack(3)); + System.out.println(tile.getSlotStack(4)); + System.out.println(tile.getSlotStack(5)); + System.out.println(tile.getSlotStack(6)); } return false; } diff --git a/1.11/src/main/java/nmd/primal/forgecraft/init/ModCrafting.java b/1.11/src/main/java/nmd/primal/forgecraft/init/ModCrafting.java index 3936e0cf..014f15d6 100644 --- a/1.11/src/main/java/nmd/primal/forgecraft/init/ModCrafting.java +++ b/1.11/src/main/java/nmd/primal/forgecraft/init/ModCrafting.java @@ -184,6 +184,13 @@ public class ModCrafting { String diamond = Items.DIAMOND.getRegistryName().toString(); String emerald = Items.EMERALD.getRegistryName().toString(); + String emeraldShard = PrimalItems.EMERALD_KNAPP.getRegistryName().toString(); + String diamondShard = PrimalItems.DIAMOND_KNAPP.getRegistryName().toString(); + String redstone = Items.REDSTONE.getRegistryName().toString(); + String lapis = Items.DYE.getRegistryName().toString(); + + String pickaxehead = ModItems.pickaxehead.getRegistryName().toString(); + /* Empty = 0 hotChunk = 1 @@ -237,17 +244,54 @@ public class ModCrafting { new ItemStack(ModItems.pickaxehead, 1), "null" ); + + //Makes a emerald Upgrade to Pickaxe Head + AnvilCrafting.addRecipe( + new String[] { + empty,empty,empty,empty,empty, + empty,empty,emeraldShard,empty,empty, + empty,empty,pickaxehead,empty,empty, + empty,empty,empty,empty,empty, + empty,empty,empty,empty,empty }, + new ItemStack(ModItems.pickaxehead, 1), + "emerald" + ); + + //Makes a diamond Upgrade to Pickaxe Head + AnvilCrafting.addRecipe( + new String[] { + empty,empty,empty,empty,empty, + empty,empty,diamondShard,empty,empty, + empty,empty,pickaxehead,empty,empty, + empty,empty,empty,empty,empty, + empty,empty,empty,empty,empty }, + new ItemStack(ModItems.pickaxehead, 1), + "diamond" + ); + //Makes a Redstone Upgrade to Pickaxe Head AnvilCrafting.addRecipe( new String[] { empty,empty,empty,empty,empty, - empty,empty,empty,empty,empty, - empty,empty,empty,empty,empty, + empty,empty,redstone,empty,empty, + empty,empty,pickaxehead,empty,empty, empty,empty,empty,empty,empty, empty,empty,empty,empty,empty }, new ItemStack(ModItems.pickaxehead, 1), "redstone" ); + //Makes a lapis Upgrade to Pickaxe Head + AnvilCrafting.addRecipe( + new String[] { + empty,empty,empty,empty,empty, + empty,empty,lapis,empty,empty, + empty,empty,pickaxehead,empty,empty, + empty,empty,empty,empty,empty, + empty,empty,empty,empty,empty }, + new ItemStack(ModItems.pickaxehead, 1), + "lapis" + ); + } } diff --git a/1.11/src/main/java/nmd/primal/forgecraft/items/ItemStoneTongs.java b/1.11/src/main/java/nmd/primal/forgecraft/items/ItemStoneTongs.java index ae4f9b60..20397b20 100644 --- a/1.11/src/main/java/nmd/primal/forgecraft/items/ItemStoneTongs.java +++ b/1.11/src/main/java/nmd/primal/forgecraft/items/ItemStoneTongs.java @@ -1,5 +1,6 @@ package nmd.primal.forgecraft.items; +import com.mojang.realmsclient.gui.ChatFormatting; import net.minecraft.block.material.Material; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; @@ -10,13 +11,19 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.*; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; import nmd.primal.forgecraft.ModInfo; import nmd.primal.forgecraft.blocks.Crucible; import nmd.primal.forgecraft.blocks.CrucibleHot; import nmd.primal.forgecraft.blocks.IngotBall; import nmd.primal.forgecraft.init.ModBlocks; +import nmd.primal.forgecraft.init.ModItems; import nmd.primal.forgecraft.tiles.TileBaseCrucible; import nmd.primal.forgecraft.tiles.TileBloomery; +import nmd.primal.forgecraft.tiles.TileForge; + +import java.util.List; /** * Created by mminaie on 1/23/17. @@ -36,25 +43,26 @@ public class ItemStoneTongs extends Item { public void onUpdate(ItemStack item, World world, Entity player, int itemSlot, boolean isSelected) { if (!item.hasTagCompound()) { item.setTagCompound(new NBTTagCompound()); + NBTTagCompound tags = new NBTTagCompound(); //this.setDamage(item, 1000); item.getTagCompound().setInteger("type", 0); item.getTagCompound().setInteger("cooldown", 0); - //item.getTagCompound().setTag("toolpart", ); + item.getTagCompound().setTag("tags", tags); - //item.getTagCompound().setBoolean("hot", false); + item.getSubCompound("tags").setBoolean("hot", false); - //item.getTagCompound().setBoolean("emerald", false); - //item.getTagCompound().setInteger("diamond", 0); - //item.getTagCompound().setInteger("redstone", 0); - //item.getTagCompound().setInteger("lapis", 0); + item.getSubCompound("tags").setBoolean("emerald", false); + item.getSubCompound("tags").setInteger("diamond", 0); + item.getSubCompound("tags").setInteger("redstone", 0); + item.getSubCompound("tags").setInteger("lapis", 0); + item.getSubCompound("tags").setInteger("modifiers", 0); - //item.getTagCompound().setInteger("modifiers", 0); - - //item.getTagCompound().setBoolean("active", false); } } + + public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { @@ -75,6 +83,8 @@ public class ItemStoneTongs extends Item { if(!world.isRemote) { ItemStack itemstack = player.getHeldItem(hand); + System.out.println(itemstack.getTagCompound().getInteger("type")); + System.out.println(itemstack.getSubCompound("tags")); /***** Picks Up Hot Ingots from the Ground @@ -233,6 +243,38 @@ public class ItemStoneTongs extends Item { } +/***** + Pulls the Tool Parts from the Forge + *****/ + if(itemstack.getTagCompound().getInteger("type") == 0){ + if (world.getBlockState(pos).getBlock() == ModBlocks.firebox) { + TileForge tile = (TileForge) world.getTileEntity(pos); + for (int i = 2; i < tile.getSlotListSize(); i++) { + if (tile.getSlotStack(i).getItem().equals(ModItems.ironchunkhot)) { + tile.setSlotStack(i, ItemStack.EMPTY); + itemstack.getTagCompound().setInteger("type", 7); + return EnumActionResult.SUCCESS; + } + if (tile.getSlotStack(i).getItem().equals(ModItems.ironingotballhot)) { + tile.setSlotStack(i, ItemStack.EMPTY); + itemstack.getTagCompound().setInteger("type", 6); + return EnumActionResult.SUCCESS; + } + if (tile.getSlotStack(i).getItem().equals(ModItems.pickaxehead)) { + itemstack.getTagCompound().setInteger("type", 8); + + NBTTagCompound tempNBT = tile.getSlotStack(i).getSubCompound("tags"); + itemstack.getTagCompound().setTag("tags", tempNBT); + itemstack.getSubCompound("tags").setBoolean("hot", true); + tile.setSlotStack(i, ItemStack.EMPTY); + return EnumActionResult.SUCCESS; + } + } + } + } + + + else return EnumActionResult.FAIL; //System.out.println(itemstack.getTagCompound().getInteger("type")); } @@ -241,4 +283,12 @@ public class ItemStoneTongs extends Item { } + @Override + @SideOnly(Side.CLIENT) + public void addInformation(ItemStack item, EntityPlayer player, List tooltip, boolean advanced) + { + tooltip.add(ChatFormatting.BLUE + "NBT: " + item.getSubCompound("tags")); + //tooltip.add(ChatFormatting.RED + "Consumes sticks"); + } + } diff --git a/1.11/src/main/java/nmd/primal/forgecraft/items/toolparts/PickaxePart.java b/1.11/src/main/java/nmd/primal/forgecraft/items/toolparts/PickaxePart.java index 6ffdfdad..6935a450 100644 --- a/1.11/src/main/java/nmd/primal/forgecraft/items/toolparts/PickaxePart.java +++ b/1.11/src/main/java/nmd/primal/forgecraft/items/toolparts/PickaxePart.java @@ -1,5 +1,6 @@ package nmd.primal.forgecraft.items.toolparts; +import com.mojang.realmsclient.gui.ChatFormatting; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; @@ -12,6 +13,7 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import javax.annotation.Nullable; +import java.util.List; /** * Created by mminaie on 3/11/17. @@ -33,157 +35,157 @@ public class PickaxePart extends ToolPart { public float apply(ItemStack item, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) { if (item.hasTagCompound()) { - if (item.getTagCompound().getBoolean("hot") == true) { + if (item.getSubCompound("tags").getBoolean("hot") == true) { return 1.0F; } - if (item.getTagCompound().getBoolean("hot") == false) { - if (item.getTagCompound().getInteger("modifiers") == 0) { + if (item.getSubCompound("tags").getBoolean("hot") == false) { + if (item.getSubCompound("tags").getInteger("modifiers") == 0) { return 0.0F; } } - if (item.getTagCompound().getBoolean("hot") == false) { - if (item.getTagCompound().getInteger("modifiers") != 0) { - if ((item.getTagCompound().getBoolean("emerald") == true) && - (item.getTagCompound().getInteger("diamond") == 0) && - (item.getTagCompound().getInteger("redstone") == 0) && - (item.getTagCompound().getInteger("lapis") == 0)) { + if (item.getSubCompound("tags").getBoolean("hot") == false) { + if (item.getSubCompound("tags").getInteger("modifiers") != 0) { + if ((item.getSubCompound("tags").getBoolean("emerald") == true) && + (item.getSubCompound("tags").getInteger("diamond") == 0) && + (item.getSubCompound("tags").getInteger("redstone") == 0) && + (item.getSubCompound("tags").getInteger("lapis") == 0)) { return 0.1F; } - if ((item.getTagCompound().getBoolean("emerald") == true) && - (item.getTagCompound().getInteger("diamond") == 1) && - (item.getTagCompound().getInteger("redstone") == 0) && - (item.getTagCompound().getInteger("lapis") == 0)) { + if ((item.getSubCompound("tags").getBoolean("emerald") == true) && + (item.getSubCompound("tags").getInteger("diamond") == 1) && + (item.getSubCompound("tags").getInteger("redstone") == 0) && + (item.getSubCompound("tags").getInteger("lapis") == 0)) { return 0.11F; } - if ((item.getTagCompound().getBoolean("emerald") == true) && - (item.getTagCompound().getInteger("diamond") == 2) && - (item.getTagCompound().getInteger("redstone") == 0) && - (item.getTagCompound().getInteger("lapis") == 0)) { + if ((item.getSubCompound("tags").getBoolean("emerald") == true) && + (item.getSubCompound("tags").getInteger("diamond") == 2) && + (item.getSubCompound("tags").getInteger("redstone") == 0) && + (item.getSubCompound("tags").getInteger("lapis") == 0)) { return 0.12F; } - if ((item.getTagCompound().getBoolean("emerald") == true) && - (item.getTagCompound().getInteger("diamond") == 1) && - (item.getTagCompound().getInteger("redstone") == 1) && - (item.getTagCompound().getInteger("lapis") == 0)) { + if ((item.getSubCompound("tags").getBoolean("emerald") == true) && + (item.getSubCompound("tags").getInteger("diamond") == 1) && + (item.getSubCompound("tags").getInteger("redstone") == 1) && + (item.getSubCompound("tags").getInteger("lapis") == 0)) { return 0.111F; } - if ((item.getTagCompound().getBoolean("emerald") == true) && - (item.getTagCompound().getInteger("diamond") == 0) && - (item.getTagCompound().getInteger("redstone") == 2) && - (item.getTagCompound().getInteger("lapis") == 0)) { + if ((item.getSubCompound("tags").getBoolean("emerald") == true) && + (item.getSubCompound("tags").getInteger("diamond") == 0) && + (item.getSubCompound("tags").getInteger("redstone") == 2) && + (item.getSubCompound("tags").getInteger("lapis") == 0)) { return 0.102F; } // ============ - if ((item.getTagCompound().getBoolean("emerald") == false) && - (item.getTagCompound().getInteger("diamond") == 1) && - (item.getTagCompound().getInteger("redstone") == 0) && - (item.getTagCompound().getInteger("lapis") == 0)) { + if ((item.getSubCompound("tags").getBoolean("emerald") == false) && + (item.getSubCompound("tags").getInteger("diamond") == 1) && + (item.getSubCompound("tags").getInteger("redstone") == 0) && + (item.getSubCompound("tags").getInteger("lapis") == 0)) { return 0.01F; } - if ((item.getTagCompound().getBoolean("emerald") == false) && - (item.getTagCompound().getInteger("diamond") == 2) && - (item.getTagCompound().getInteger("redstone") == 0) && - (item.getTagCompound().getInteger("lapis") == 0)) { + if ((item.getSubCompound("tags").getBoolean("emerald") == false) && + (item.getSubCompound("tags").getInteger("diamond") == 2) && + (item.getSubCompound("tags").getInteger("redstone") == 0) && + (item.getSubCompound("tags").getInteger("lapis") == 0)) { return 0.02F; } - if ((item.getTagCompound().getBoolean("emerald") == false) && - (item.getTagCompound().getInteger("diamond") == 3) && - (item.getTagCompound().getInteger("redstone") == 0) && - (item.getTagCompound().getInteger("lapis") == 0)) { + if ((item.getSubCompound("tags").getBoolean("emerald") == false) && + (item.getSubCompound("tags").getInteger("diamond") == 3) && + (item.getSubCompound("tags").getInteger("redstone") == 0) && + (item.getSubCompound("tags").getInteger("lapis") == 0)) { return 0.03F; } - if ((item.getTagCompound().getBoolean("emerald") == false) && - (item.getTagCompound().getInteger("diamond") == 0) && - (item.getTagCompound().getInteger("redstone") == 1) && - (item.getTagCompound().getInteger("lapis") == 0)) { + if ((item.getSubCompound("tags").getBoolean("emerald") == false) && + (item.getSubCompound("tags").getInteger("diamond") == 0) && + (item.getSubCompound("tags").getInteger("redstone") == 1) && + (item.getSubCompound("tags").getInteger("lapis") == 0)) { return 0.001F; } - if ((item.getTagCompound().getBoolean("emerald") == false) && - (item.getTagCompound().getInteger("diamond") == 0) && - (item.getTagCompound().getInteger("redstone") == 2) && - (item.getTagCompound().getInteger("lapis") == 0)) { + if ((item.getSubCompound("tags").getBoolean("emerald") == false) && + (item.getSubCompound("tags").getInteger("diamond") == 0) && + (item.getSubCompound("tags").getInteger("redstone") == 2) && + (item.getSubCompound("tags").getInteger("lapis") == 0)) { return 0.002F; } - if ((item.getTagCompound().getBoolean("emerald") == false) && - (item.getTagCompound().getInteger("diamond") == 0) && - (item.getTagCompound().getInteger("redstone") == 3) && - (item.getTagCompound().getInteger("lapis") == 0)) { + if ((item.getSubCompound("tags").getBoolean("emerald") == false) && + (item.getSubCompound("tags").getInteger("diamond") == 0) && + (item.getSubCompound("tags").getInteger("redstone") == 3) && + (item.getSubCompound("tags").getInteger("lapis") == 0)) { return 0.003F; } - if ((item.getTagCompound().getBoolean("emerald") == false) && - (item.getTagCompound().getInteger("diamond") == 0) && - (item.getTagCompound().getInteger("redstone") == 0) && - (item.getTagCompound().getInteger("lapis") == 1)) { + if ((item.getSubCompound("tags").getBoolean("emerald") == false) && + (item.getSubCompound("tags").getInteger("diamond") == 0) && + (item.getSubCompound("tags").getInteger("redstone") == 0) && + (item.getSubCompound("tags").getInteger("lapis") == 1)) { return 0.0001F; } - if ((item.getTagCompound().getBoolean("emerald") == false) && - (item.getTagCompound().getInteger("diamond") == 0) && - (item.getTagCompound().getInteger("redstone") == 0) && - (item.getTagCompound().getInteger("lapis") == 2)) { + if ((item.getSubCompound("tags").getBoolean("emerald") == false) && + (item.getSubCompound("tags").getInteger("diamond") == 0) && + (item.getSubCompound("tags").getInteger("redstone") == 0) && + (item.getSubCompound("tags").getInteger("lapis") == 2)) { return 0.0002F; } - if ((item.getTagCompound().getBoolean("emerald") == false) && - (item.getTagCompound().getInteger("diamond") == 0) && - (item.getTagCompound().getInteger("redstone") == 0) && - (item.getTagCompound().getInteger("lapis") == 3)) { + if ((item.getSubCompound("tags").getBoolean("emerald") == false) && + (item.getSubCompound("tags").getInteger("diamond") == 0) && + (item.getSubCompound("tags").getInteger("redstone") == 0) && + (item.getSubCompound("tags").getInteger("lapis") == 3)) { return 0.0003F; } - if ((item.getTagCompound().getBoolean("emerald") == false) && - (item.getTagCompound().getInteger("diamond") == 1) && - (item.getTagCompound().getInteger("redstone") == 1) && - (item.getTagCompound().getInteger("lapis") == 1)) { + if ((item.getSubCompound("tags").getBoolean("emerald") == false) && + (item.getSubCompound("tags").getInteger("diamond") == 1) && + (item.getSubCompound("tags").getInteger("redstone") == 1) && + (item.getSubCompound("tags").getInteger("lapis") == 1)) { return 0.0111F; } - if ((item.getTagCompound().getBoolean("emerald") == false) && - (item.getTagCompound().getInteger("diamond") == 2) && - (item.getTagCompound().getInteger("redstone") == 1) && - (item.getTagCompound().getInteger("lapis") == 0)) { + if ((item.getSubCompound("tags").getBoolean("emerald") == false) && + (item.getSubCompound("tags").getInteger("diamond") == 2) && + (item.getSubCompound("tags").getInteger("redstone") == 1) && + (item.getSubCompound("tags").getInteger("lapis") == 0)) { return 0.021F; } - if ((item.getTagCompound().getBoolean("emerald") == false) && - (item.getTagCompound().getInteger("diamond") == 1) && - (item.getTagCompound().getInteger("redstone") == 2) && - (item.getTagCompound().getInteger("lapis") == 0)) { + if ((item.getSubCompound("tags").getBoolean("emerald") == false) && + (item.getSubCompound("tags").getInteger("diamond") == 1) && + (item.getSubCompound("tags").getInteger("redstone") == 2) && + (item.getSubCompound("tags").getInteger("lapis") == 0)) { return 0.012F; } - if ((item.getTagCompound().getBoolean("emerald") == false) && - (item.getTagCompound().getInteger("diamond") == 0) && - (item.getTagCompound().getInteger("redstone") == 1) && - (item.getTagCompound().getInteger("lapis") == 2)) { + if ((item.getSubCompound("tags").getBoolean("emerald") == false) && + (item.getSubCompound("tags").getInteger("diamond") == 0) && + (item.getSubCompound("tags").getInteger("redstone") == 1) && + (item.getSubCompound("tags").getInteger("lapis") == 2)) { return 0.012F; } - if ((item.getTagCompound().getBoolean("emerald") == false) && - (item.getTagCompound().getInteger("diamond") == 0) && - (item.getTagCompound().getInteger("redstone") == 1) && - (item.getTagCompound().getInteger("lapis") == 2)) { + if ((item.getSubCompound("tags").getBoolean("emerald") == false) && + (item.getSubCompound("tags").getInteger("diamond") == 0) && + (item.getSubCompound("tags").getInteger("redstone") == 1) && + (item.getSubCompound("tags").getInteger("lapis") == 2)) { return 0.0012F; } - if ((item.getTagCompound().getBoolean("emerald") == false) && - (item.getTagCompound().getInteger("diamond") == 1) && - (item.getTagCompound().getInteger("redstone") == 0) && - (item.getTagCompound().getInteger("lapis") == 2)) { + if ((item.getSubCompound("tags").getBoolean("emerald") == false) && + (item.getSubCompound("tags").getInteger("diamond") == 1) && + (item.getSubCompound("tags").getInteger("redstone") == 0) && + (item.getSubCompound("tags").getInteger("lapis") == 2)) { return 0.0102F; } } @@ -235,5 +237,12 @@ public class PickaxePart extends ToolPart { } } + @Override + @SideOnly(Side.CLIENT) + public void addInformation(ItemStack item, EntityPlayer player, List tooltip, boolean advanced) + { + tooltip.add(ChatFormatting.BLUE + "NBT: " + item.getSubCompound("tags")); + //tooltip.add(ChatFormatting.RED + "Consumes sticks"); + } } diff --git a/1.11/src/main/java/nmd/primal/forgecraft/tiles/TileForge.java b/1.11/src/main/java/nmd/primal/forgecraft/tiles/TileForge.java index 24777759..ef4757b5 100644 --- a/1.11/src/main/java/nmd/primal/forgecraft/tiles/TileForge.java +++ b/1.11/src/main/java/nmd/primal/forgecraft/tiles/TileForge.java @@ -113,11 +113,7 @@ public class TileForge extends TileBaseSlot implements ITickable { } if (cookCounter2 >= recipe.getIdealTime()) { if(this.getSlotStack(i).hasTagCompound()){ - NBTTagCompound tempNBT = this.getSlotStack(i).getSubCompound("tags"); - ItemStack outputStack = recipe.getOutput(); - outputStack.getTagCompound().setTag("tags", tempNBT); - outputStack.getSubCompound("tags").setBoolean("hot", true); - this.setSlotStack(i, outputStack); + this.getSlotStack(i).getSubCompound("tags").setBoolean("hot", true); } else this.setSlotStack(i, recipe.getOutput()); cookCounter2 = 0; } @@ -131,11 +127,7 @@ public class TileForge extends TileBaseSlot implements ITickable { } if (cookCounter3 >= recipe.getIdealTime()) { if(this.getSlotStack(i).hasTagCompound()){ - NBTTagCompound tempNBT = this.getSlotStack(i).getSubCompound("tags"); - ItemStack outputStack = recipe.getOutput(); - outputStack.getTagCompound().setTag("tags", tempNBT); - outputStack.getSubCompound("tags").setBoolean("hot", true); - this.setSlotStack(i, outputStack); + this.getSlotStack(i).getSubCompound("tags").setBoolean("hot", true); } else this.setSlotStack(i, recipe.getOutput()); cookCounter3 = 0; } @@ -149,11 +141,8 @@ public class TileForge extends TileBaseSlot implements ITickable { } if (cookCounter4 >= recipe.getIdealTime()) { if(this.getSlotStack(i).hasTagCompound()){ - NBTTagCompound tempNBT = this.getSlotStack(i).getSubCompound("tags"); - ItemStack outputStack = recipe.getOutput(); - outputStack.getTagCompound().setTag("tags", tempNBT); - outputStack.getSubCompound("tags").setBoolean("hot", true); - this.setSlotStack(i, outputStack); + this.getSlotStack(i).getSubCompound("tags").setBoolean("hot", true); + System.out.println("its hot now"); } else this.setSlotStack(i, recipe.getOutput()); cookCounter4 = 0; } @@ -167,11 +156,7 @@ public class TileForge extends TileBaseSlot implements ITickable { } if (cookCounter5 >= recipe.getIdealTime()) { if(this.getSlotStack(i).hasTagCompound()){ - NBTTagCompound tempNBT = this.getSlotStack(i).getSubCompound("tags"); - ItemStack outputStack = recipe.getOutput(); - outputStack.getTagCompound().setTag("tags", tempNBT); - outputStack.getSubCompound("tags").setBoolean("hot", true); - this.setSlotStack(i, outputStack); + this.getSlotStack(i).getSubCompound("tags").setBoolean("hot", true); } else this.setSlotStack(i, recipe.getOutput()); cookCounter5 = 0; } @@ -185,11 +170,7 @@ public class TileForge extends TileBaseSlot implements ITickable { } if (cookCounter6 >= recipe.getIdealTime()) { if(this.getSlotStack(i).hasTagCompound()){ - NBTTagCompound tempNBT = this.getSlotStack(i).getSubCompound("tags"); - ItemStack outputStack = recipe.getOutput(); - outputStack.getTagCompound().setTag("tags", tempNBT); - outputStack.getSubCompound("tags").setBoolean("hot", true); - this.setSlotStack(i, outputStack); + this.getSlotStack(i).getSubCompound("tags").setBoolean("hot", true); } else this.setSlotStack(i, recipe.getOutput()); cookCounter6 = 0; } diff --git a/1.11/src/main/resources/assets/forgecraft/models/item/ironpickaxehead.json b/1.11/src/main/resources/assets/forgecraft/models/item/ironpickaxehead.json index 608a0304..a6604456 100644 --- a/1.11/src/main/resources/assets/forgecraft/models/item/ironpickaxehead.json +++ b/1.11/src/main/resources/assets/forgecraft/models/item/ironpickaxehead.json @@ -6,12 +6,8 @@ "texture1": "forgecraft:blocks/iron_ingot" }, "overrides": [ - { - "predicate": { - "type": 0.0 - }, - "model": "forgecraft:item/ironpickaxehead_0" - } + {"predicate": {"type": 0.0},"model": "forgecraft:item/ironpickaxehead_0"}, + {"predicate": {"type": 1.0},"model": "forgecraft:item/ironpickaxehead_1"} ] } diff --git a/1.11/src/main/resources/assets/forgecraft/models/item/ironpickaxehead_1.json b/1.11/src/main/resources/assets/forgecraft/models/item/ironpickaxehead_1.json new file mode 100644 index 00000000..210322ec --- /dev/null +++ b/1.11/src/main/resources/assets/forgecraft/models/item/ironpickaxehead_1.json @@ -0,0 +1,8 @@ +{ + "parent": "forgecraft:item/pickaxehead", + "textures": { + "particle": "forgecraft:blocks/iron_ingot_hot", + "texture": "blocks/planks_oak", + "texture1": "forgecraft:blocks/iron_ingot_hot" + } +}