From b593173489a429b377dd10627306da254c6954b3 Mon Sep 17 00:00:00 2001 From: Mohammad-Ali Minaie Date: Sat, 7 Apr 2018 23:24:13 -0400 Subject: [PATCH] removed a lot of blocks removed block ingots and made them all items --- .../forgecraft/blocks/Anvil/AnvilStone.java | 96 ++++-- .../forgecraft/blocks/Crucibles/Crucible.java | 15 +- .../nmd/primal/forgecraft/blocks/Forge.java | 9 +- .../primal/forgecraft/blocks/IngotBall.java | 30 +- .../forgecraft/compat/ModDictionary.java | 13 +- .../nmd/primal/forgecraft/init/ModBlocks.java | 287 ++++++------------ .../primal/forgecraft/init/ModCrafting.java | 72 +++-- .../nmd/primal/forgecraft/init/ModItems.java | 109 +++---- .../forgecraft/items/BaseMultiItem.java | 66 +++- .../forgecraft/items/ItemStoneTongs.java | 25 +- .../primal/forgecraft/items/SlottedTongs.java | 232 ++++++++++++-- .../items/parts/BronzeToolPart.java | 10 +- .../forgecraft/items/parts/ToolPart.java | 18 +- .../renders/blocks/TileAnvilRender.java | 7 +- .../primal/forgecraft/tiles/TileAnvil.java | 11 +- .../primal/forgecraft/tiles/TileForge.java | 22 ++ .../primal/forgecraft/util/AnvilHandler.java | 44 +-- .../forgecraft/models/item/ingots/test.txt | 0 .../item/ingots/wroughtiron/ingot_0.json | 7 + .../item/ingots/wroughtiron/ingot_1.json | 7 + .../forgecraft/models/item/ironingotball.json | 11 + .../forgecraft/models/item/ironingothot.json | 4 +- .../forgecraft/models/item/slottedtongs.json | 39 +++ .../item/slottedtongs/slottedtongs_0.json | 3 + .../item/slottedtongs/slottedtongs_1.json | 9 + .../item/slottedtongs/slottedtongs_10.json | 9 + .../item/slottedtongs/slottedtongs_11.json | 9 + .../item/slottedtongs/slottedtongs_12.json | 9 + .../item/slottedtongs/slottedtongs_13.json | 9 + .../item/slottedtongs/slottedtongs_14.json | 9 + .../item/slottedtongs/slottedtongs_15.json | 9 + .../item/slottedtongs/slottedtongs_16.json | 9 + .../item/slottedtongs/slottedtongs_17.json | 9 + .../item/slottedtongs/slottedtongs_18.json | 9 + .../item/slottedtongs/slottedtongs_19.json | 9 + .../item/slottedtongs/slottedtongs_2.json | 9 + .../item/slottedtongs/slottedtongs_20.json | 9 + .../item/slottedtongs/slottedtongs_21.json | 9 + .../item/slottedtongs/slottedtongs_22.json | 9 + .../item/slottedtongs/slottedtongs_23.json | 9 + .../item/slottedtongs/slottedtongs_24.json | 9 + .../item/slottedtongs/slottedtongs_25.json | 9 + .../item/slottedtongs/slottedtongs_26.json | 9 + .../item/slottedtongs/slottedtongs_3.json | 9 + .../item/slottedtongs/slottedtongs_4.json | 9 + .../item/slottedtongs/slottedtongs_5.json | 9 + .../item/slottedtongs/slottedtongs_6.json | 13 + .../item/slottedtongs/slottedtongs_7.json | 12 + .../item/slottedtongs/slottedtongs_8.json | 9 + .../item/slottedtongs/slottedtongs_9.json | 9 + 50 files changed, 984 insertions(+), 394 deletions(-) create mode 100644 kfc/src/main/resources/assets/forgecraft/models/item/ingots/test.txt create mode 100644 kfc/src/main/resources/assets/forgecraft/models/item/ingots/wroughtiron/ingot_0.json create mode 100644 kfc/src/main/resources/assets/forgecraft/models/item/ingots/wroughtiron/ingot_1.json create mode 100644 kfc/src/main/resources/assets/forgecraft/models/item/ironingotball.json create mode 100644 kfc/src/main/resources/assets/forgecraft/models/item/slottedtongs.json create mode 100644 kfc/src/main/resources/assets/forgecraft/models/item/slottedtongs/slottedtongs_0.json create mode 100644 kfc/src/main/resources/assets/forgecraft/models/item/slottedtongs/slottedtongs_1.json create mode 100644 kfc/src/main/resources/assets/forgecraft/models/item/slottedtongs/slottedtongs_10.json create mode 100644 kfc/src/main/resources/assets/forgecraft/models/item/slottedtongs/slottedtongs_11.json create mode 100644 kfc/src/main/resources/assets/forgecraft/models/item/slottedtongs/slottedtongs_12.json create mode 100644 kfc/src/main/resources/assets/forgecraft/models/item/slottedtongs/slottedtongs_13.json create mode 100644 kfc/src/main/resources/assets/forgecraft/models/item/slottedtongs/slottedtongs_14.json create mode 100644 kfc/src/main/resources/assets/forgecraft/models/item/slottedtongs/slottedtongs_15.json create mode 100644 kfc/src/main/resources/assets/forgecraft/models/item/slottedtongs/slottedtongs_16.json create mode 100644 kfc/src/main/resources/assets/forgecraft/models/item/slottedtongs/slottedtongs_17.json create mode 100644 kfc/src/main/resources/assets/forgecraft/models/item/slottedtongs/slottedtongs_18.json create mode 100644 kfc/src/main/resources/assets/forgecraft/models/item/slottedtongs/slottedtongs_19.json create mode 100644 kfc/src/main/resources/assets/forgecraft/models/item/slottedtongs/slottedtongs_2.json create mode 100644 kfc/src/main/resources/assets/forgecraft/models/item/slottedtongs/slottedtongs_20.json create mode 100644 kfc/src/main/resources/assets/forgecraft/models/item/slottedtongs/slottedtongs_21.json create mode 100644 kfc/src/main/resources/assets/forgecraft/models/item/slottedtongs/slottedtongs_22.json create mode 100644 kfc/src/main/resources/assets/forgecraft/models/item/slottedtongs/slottedtongs_23.json create mode 100644 kfc/src/main/resources/assets/forgecraft/models/item/slottedtongs/slottedtongs_24.json create mode 100644 kfc/src/main/resources/assets/forgecraft/models/item/slottedtongs/slottedtongs_25.json create mode 100644 kfc/src/main/resources/assets/forgecraft/models/item/slottedtongs/slottedtongs_26.json create mode 100644 kfc/src/main/resources/assets/forgecraft/models/item/slottedtongs/slottedtongs_3.json create mode 100644 kfc/src/main/resources/assets/forgecraft/models/item/slottedtongs/slottedtongs_4.json create mode 100644 kfc/src/main/resources/assets/forgecraft/models/item/slottedtongs/slottedtongs_5.json create mode 100644 kfc/src/main/resources/assets/forgecraft/models/item/slottedtongs/slottedtongs_6.json create mode 100644 kfc/src/main/resources/assets/forgecraft/models/item/slottedtongs/slottedtongs_7.json create mode 100644 kfc/src/main/resources/assets/forgecraft/models/item/slottedtongs/slottedtongs_8.json create mode 100644 kfc/src/main/resources/assets/forgecraft/models/item/slottedtongs/slottedtongs_9.json diff --git a/kfc/src/main/java/nmd/primal/forgecraft/blocks/Anvil/AnvilStone.java b/kfc/src/main/java/nmd/primal/forgecraft/blocks/Anvil/AnvilStone.java index cf099022..89fac109 100644 --- a/kfc/src/main/java/nmd/primal/forgecraft/blocks/Anvil/AnvilStone.java +++ b/kfc/src/main/java/nmd/primal/forgecraft/blocks/Anvil/AnvilStone.java @@ -1,5 +1,6 @@ package nmd.primal.forgecraft.blocks.Anvil; +import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; @@ -8,7 +9,9 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import nmd.primal.core.api.PrimalAPI; import nmd.primal.core.common.items.tools.Gallagher; +import nmd.primal.forgecraft.init.ModBlocks; import nmd.primal.forgecraft.init.ModItems; import nmd.primal.forgecraft.tiles.TileAnvil; @@ -30,45 +33,74 @@ public class AnvilStone extends AnvilBase { if (!world.isRemote) { ItemStack pItem = player.inventory.getCurrentItem(); TileAnvil tile = (TileAnvil) world.getTileEntity(pos); + + ItemStack tempironball = new ItemStack(ModItems.ironingotball, 1); + tempironball.getTagCompound().setBoolean("hot", true); + ItemStack tempironcleanball = new ItemStack(ModItems.ironcleaningotball, 1); + tempironcleanball.getTagCompound().setBoolean("hot", true); + ItemStack tempsteelball = new ItemStack(ModItems.steelingotball, 1); + tempsteelball.getTagCompound().setBoolean("hot", true); + ItemStack tempwootzball = new ItemStack(ModItems.wootzingotball, 1); + tempwootzball.getTagCompound().setBoolean("hot", true); + + ItemStack tempironchunk = new ItemStack(ModItems.ironchunk, 1); + tempironchunk.getTagCompound().setBoolean("hot", true); + ItemStack tempironcleanchunk = new ItemStack(ModItems.ironcleanchunk, 1); + tempironcleanchunk.getTagCompound().setBoolean("hot", true); + ItemStack tempsteelchunk = new ItemStack(ModItems.steelchunk, 1); + tempsteelchunk.getTagCompound().setBoolean("hot", true); + ItemStack tempwootzchunk = new ItemStack(ModItems.wootzchunk, 1); + tempwootzchunk.getTagCompound().setBoolean("hot", true); + + + if (tile != null) { if ((pItem.getItem() instanceof Gallagher) || (pItem.getItem() == ModItems.forgehammer)) { - if(tile.getSlotStack(12).getItem().equals(ModItems.ironingotballhot) ){ - tile.setSlotStack(6, new ItemStack(ModItems.ironchunkhot, 1)); - tile.setSlotStack(7, new ItemStack(ModItems.ironchunkhot, 1)); - tile.setSlotStack(8, new ItemStack(ModItems.ironchunkhot, 1)); - tile.setSlotStack(11, new ItemStack(ModItems.ironchunkhot, 1)); - tile.setSlotStack(12, new ItemStack(ModItems.ironchunkhot, 1)); - tile.setSlotStack(13, new ItemStack(ModItems.ironchunkhot, 1)); - tile.setSlotStack(16, new ItemStack(ModItems.ironchunkhot, 1)); - tile.setSlotStack(17, new ItemStack(ModItems.ironchunkhot, 1)); - tile.setSlotStack(18, new ItemStack(ModItems.ironchunkhot, 1)); + if(tile.getSlotStack(12).getItem().equals(tempironball) ){ + tile.setSlotStack(6, tempironchunk); + tile.setSlotStack(7, tempironchunk); + tile.setSlotStack(8, tempironchunk); + tile.setSlotStack(11, tempironchunk); + tile.setSlotStack(12, tempironchunk); + tile.setSlotStack(13, tempironchunk); + tile.setSlotStack(16, tempironchunk); + tile.setSlotStack(17, tempironchunk); + tile.setSlotStack(18, tempironchunk); world.playEvent(1031, pos, 0); } - if(tile.getSlotStack(12).getItem().equals(ModItems.ironcleaningotballhot) ){ - tile.setSlotStack(6, new ItemStack(ModItems.ironcleanchunkhot, 1)); - tile.setSlotStack(7, new ItemStack(ModItems.ironcleanchunkhot, 1)); - tile.setSlotStack(8, new ItemStack(ModItems.ironcleanchunkhot, 1)); - tile.setSlotStack(11, new ItemStack(ModItems.ironcleanchunkhot, 1)); - tile.setSlotStack(12, new ItemStack(ModItems.ironcleanchunkhot, 1)); - tile.setSlotStack(13, new ItemStack(ModItems.ironcleanchunkhot, 1)); - tile.setSlotStack(16, new ItemStack(ModItems.ironcleanchunkhot, 1)); - tile.setSlotStack(17, new ItemStack(ModItems.ironcleanchunkhot, 1)); - tile.setSlotStack(18, new ItemStack(ModItems.ironcleanchunkhot, 1)); + if(tile.getSlotStack(12).getItem().equals(tempironcleanball) ){ + tile.setSlotStack(6, tempironcleanchunk); + tile.setSlotStack(7, tempironcleanchunk); + tile.setSlotStack(8, tempironcleanchunk); + tile.setSlotStack(11, tempironcleanchunk); + tile.setSlotStack(12, tempironcleanchunk); + tile.setSlotStack(13, tempironcleanchunk); + tile.setSlotStack(16, tempironcleanchunk); + tile.setSlotStack(17, tempironcleanchunk); + tile.setSlotStack(18, tempironcleanchunk); world.playEvent(1031, pos, 0); } - if(tile.getSlotStack(12).getItem().equals(ModItems.steelingotballhot) ){ - tile.setSlotStack(6, new ItemStack(ModItems.steelchunkhot, 1)); - tile.setSlotStack(7, new ItemStack(ModItems.steelchunkhot, 1)); - tile.setSlotStack(8, new ItemStack(ModItems.steelchunkhot, 1)); - tile.setSlotStack(11, new ItemStack(ModItems.steelchunkhot, 1)); - tile.setSlotStack(12, new ItemStack(ModItems.steelchunkhot, 1)); - tile.setSlotStack(13, new ItemStack(ModItems.steelchunkhot, 1)); - tile.setSlotStack(16, new ItemStack(ModItems.steelchunkhot, 1)); - tile.setSlotStack(17, new ItemStack(ModItems.steelchunkhot, 1)); - tile.setSlotStack(18, new ItemStack(ModItems.steelchunkhot, 1)); + if(tile.getSlotStack(12).getItem().equals(tempsteelball) ){ + tile.setSlotStack(6, tempsteelchunk); + tile.setSlotStack(7, tempsteelchunk); + tile.setSlotStack(8, tempsteelchunk); + tile.setSlotStack(11, tempsteelchunk); + tile.setSlotStack(12, tempsteelchunk); + tile.setSlotStack(13, tempsteelchunk); + tile.setSlotStack(16, tempsteelchunk); + tile.setSlotStack(17, tempsteelchunk); + tile.setSlotStack(18, tempsteelchunk); } - if(tile.getSlotStack(12).getItem().equals(ModItems.wootzingotballhot) ){ - //TODO Wootz chunks + if(tile.getSlotStack(12).getItem().equals(tempwootzball) ){ + tile.setSlotStack(6, tempwootzchunk); + tile.setSlotStack(7, tempwootzchunk); + tile.setSlotStack(8, tempwootzchunk); + tile.setSlotStack(11, tempwootzchunk); + tile.setSlotStack(12, tempwootzchunk); + tile.setSlotStack(13, tempwootzchunk); + tile.setSlotStack(16, tempwootzchunk); + tile.setSlotStack(17, tempwootzchunk); + tile.setSlotStack(18, tempwootzchunk); } } if ((pItem.getItem() instanceof Gallagher) || (pItem.getItem() == ModItems.forgehammer)) { diff --git a/kfc/src/main/java/nmd/primal/forgecraft/blocks/Crucibles/Crucible.java b/kfc/src/main/java/nmd/primal/forgecraft/blocks/Crucibles/Crucible.java index b99776f7..338d7666 100644 --- a/kfc/src/main/java/nmd/primal/forgecraft/blocks/Crucibles/Crucible.java +++ b/kfc/src/main/java/nmd/primal/forgecraft/blocks/Crucibles/Crucible.java @@ -129,19 +129,24 @@ public class Crucible extends Block { private Item getItemFromName(String name){ if(name.equals("tile.coolironcrucible")){ - return Item.getItemFromBlock(ModBlocks.ironball); + //return Item.getItemFromBlock(ModBlocks.ironball); + return null; } else if (name.equals("tile.rawironcrucible")){ return Item.getItemFromBlock(Blocks.IRON_ORE); } else if (name.equals("tile.coolcleanironcrucible")){ - return Item.getItemFromBlock(ModBlocks.ironcleanball); + //return Item.getItemFromBlock(ModBlocks.ironcleanball); + return null; } else if (name.equals("tile.rawcleanironcrucible")){ return PrimalAPI.Items.IRON_DUST; } else if (name.equals("tile.coolsteelcrucible")){ - return Item.getItemFromBlock(ModBlocks.steelball); + //return Item.getItemFromBlock(ModBlocks.steelball); + return null; } else if (name.equals("tile.rawsteelcrucible")){ - return Item.getItemFromBlock(ModBlocks.ironcleanball); + //return Item.getItemFromBlock(ModBlocks.ironcleanball); + return null; } else if (name.equals("tile.coolwootzcrucible")){ - return Item.getItemFromBlock(ModBlocks.wootzball); + //return Item.getItemFromBlock(ModBlocks.wootzball); + return null; } else if (name.equals("tile.rawcleanironcrucible")){ return PrimalAPI.Items.IRON_DUST; }else if (name.equals("tile.emptycruciblecracked")){ diff --git a/kfc/src/main/java/nmd/primal/forgecraft/blocks/Forge.java b/kfc/src/main/java/nmd/primal/forgecraft/blocks/Forge.java index 70875476..23b4d171 100644 --- a/kfc/src/main/java/nmd/primal/forgecraft/blocks/Forge.java +++ b/kfc/src/main/java/nmd/primal/forgecraft/blocks/Forge.java @@ -28,6 +28,8 @@ import nmd.primal.core.api.PrimalAPI; import nmd.primal.core.common.helper.PlayerHelper; import nmd.primal.core.common.recipes.FireSource; import nmd.primal.forgecraft.ModInfo; +import nmd.primal.forgecraft.items.BaseMultiItem; +import nmd.primal.forgecraft.items.SlottedTongs; import nmd.primal.forgecraft.items.parts.ToolPart; import nmd.primal.forgecraft.tiles.TileForge; @@ -95,6 +97,7 @@ public class Forge extends CustomContainerFacing implements ITileEntityProvider{ ItemStack fuelItem = tile.getSlotStack(0); //System.out.println(pItem.getItem().getRegistryName().toString()); + /*********************** FUEL SLOT CODE ***********************/ @@ -178,11 +181,12 @@ public class Forge extends CustomContainerFacing implements ITileEntityProvider{ }*/ - if (Block.getBlockFromItem(pItem.getItem()) instanceof IngotBall) { + if (pItem.getItem() instanceof BaseMultiItem) { //System.out.println("Activating"); for (int i = 2; i <= tile.getSlotListSize(); i++) { if (tile.getSlotStack(i).isEmpty()) { - tile.setSlotStack(i, new ItemStack(pItem.getItem(), 1)); + ItemStack tempItem = pItem.copy(); + tile.setSlotStack(i,tempItem); pItem.shrink(1); return true; } @@ -208,7 +212,6 @@ public class Forge extends CustomContainerFacing implements ITileEntityProvider{ return true; } } - } } //System.out.println(tile.getSlotStack(0)); diff --git a/kfc/src/main/java/nmd/primal/forgecraft/blocks/IngotBall.java b/kfc/src/main/java/nmd/primal/forgecraft/blocks/IngotBall.java index 969113ca..0ba107c2 100644 --- a/kfc/src/main/java/nmd/primal/forgecraft/blocks/IngotBall.java +++ b/kfc/src/main/java/nmd/primal/forgecraft/blocks/IngotBall.java @@ -1,5 +1,6 @@ package nmd.primal.forgecraft.blocks; +import net.minecraft.block.Block; import net.minecraft.block.BlockDynamicLiquid; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; @@ -9,13 +10,25 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.SoundEvents; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; import net.minecraft.util.SoundCategory; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import nmd.primal.core.api.PrimalAPI; +import nmd.primal.core.api.interfaces.IPickup; +import nmd.primal.core.common.helper.PlayerHelper; +import nmd.primal.core.common.items.tools.Gallagher; +import nmd.primal.forgecraft.ModInfo; +import nmd.primal.forgecraft.blocks.Anvil.AnvilBase; +import nmd.primal.forgecraft.blocks.Anvil.AnvilStone; +import nmd.primal.forgecraft.init.ModBlocks; +import nmd.primal.forgecraft.init.ModItems; +import nmd.primal.forgecraft.tiles.TileAnvil; import java.util.Random; import java.util.concurrent.ThreadLocalRandom; @@ -28,30 +41,35 @@ public class IngotBall extends BlockCustomBase { protected static AxisAlignedBB boundBoxLarge = new AxisAlignedBB(6/16D, 0.0D, 6/16D, 10/16D, 4/16D, 10/16D); protected static AxisAlignedBB boundBoxSmall = new AxisAlignedBB(7/16D, 0.0D, 7/16D, 9/16D, 2/16D, 9/16D); //public static final PropertyBool ACTIVE = PropertyBool.create("active"); - private String type; + private String AABBsize; - public IngotBall(Material material, String registryName, Float hardness, String type){ + public IngotBall(Material material, String registryName, Float hardness, String size){ super(material, registryName, hardness); - this.type = type; this.setTickRandomly(true); + this.AABBsize = size; + setCreativeTab(ModInfo.TAB_FORGECRAFT); + setDefaultState(this.blockState.getBaseState().withProperty(PrimalAPI.States.ACTIVE, Boolean.valueOf(false))); } @Override public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { - if(this.type.equals("chunk")){ + + if(this.AABBsize.equals("small")){ return boundBoxSmall; }else return boundBoxLarge; } + @Override public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { - //System.out.println(stack.getItemDamage()); - worldIn.setBlockState(pos, state.withProperty(PrimalAPI.States.ACTIVE, Boolean.valueOf(false)), 2); + System.out.println("Print Something"); + System.out.println(stack.getTagCompound()); + //worldIn.setBlockState(pos, state.withProperty(PrimalAPI.States.ACTIVE, Boolean.valueOf(false)), 2); //System.out.println(state.getValue(ACTIVE)); } diff --git a/kfc/src/main/java/nmd/primal/forgecraft/compat/ModDictionary.java b/kfc/src/main/java/nmd/primal/forgecraft/compat/ModDictionary.java index e9452451..2f68320f 100644 --- a/kfc/src/main/java/nmd/primal/forgecraft/compat/ModDictionary.java +++ b/kfc/src/main/java/nmd/primal/forgecraft/compat/ModDictionary.java @@ -2,6 +2,7 @@ package nmd.primal.forgecraft.compat; import net.minecraftforge.oredict.OreDictionary; import nmd.primal.forgecraft.init.ModBlocks; +import nmd.primal.forgecraft.init.ModItems; /** * Created by mminaie on 2/7/17. @@ -19,12 +20,12 @@ public class ModDictionary {/*************************************************** { //if (ModConfig.COMPATIBILITY_DICTIONARY_MAGMACREAM_AS_SLIME) //OreDictionary.registerOre("clayball", Items.CLAY_BALL); - OreDictionary.registerOre("ingotIron", ModBlocks.ironball); - OreDictionary.registerOre("nuggetIron", ModBlocks.ironchunk); - OreDictionary.registerOre("ingotIron", ModBlocks.ironcleanball); - OreDictionary.registerOre("nuggetIron", ModBlocks.ironcleanchunk); - OreDictionary.registerOre("ingotSteel", ModBlocks.steelball); - OreDictionary.registerOre("nuggetSteel", ModBlocks.steelchunk); + OreDictionary.registerOre("ingotIron", ModItems.ironingotball); + OreDictionary.registerOre("nuggetIron", ModItems.ironchunk); + OreDictionary.registerOre("ingotIron", ModItems.ironcleaningotball); + OreDictionary.registerOre("nuggetIron", ModItems.ironcleanchunk); + OreDictionary.registerOre("ingotSteel", ModItems.steelingotball); + OreDictionary.registerOre("nuggetSteel", ModItems.steelchunk); diff --git a/kfc/src/main/java/nmd/primal/forgecraft/init/ModBlocks.java b/kfc/src/main/java/nmd/primal/forgecraft/init/ModBlocks.java index f8558a52..5515fbee 100644 --- a/kfc/src/main/java/nmd/primal/forgecraft/init/ModBlocks.java +++ b/kfc/src/main/java/nmd/primal/forgecraft/init/ModBlocks.java @@ -7,6 +7,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; +import net.minecraft.inventory.ItemStackHelper; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; @@ -18,6 +19,8 @@ import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.fml.common.registry.ForgeRegistries; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import nmd.primal.core.api.PrimalAPI; +import nmd.primal.core.common.helper.PlayerHelper; import nmd.primal.core.common.items.tools.Gallagher; import nmd.primal.forgecraft.blocks.Anvil.AnvilBase; import nmd.primal.forgecraft.blocks.Anvil.AnvilIron; @@ -75,42 +78,14 @@ public class ModBlocks { public static Block hotbronzecrucible_emerald; public static Block hotcookedbronzecrucible_emerald; - public static Block rawironcrucible; - public static Block hotironcrucible; - public static Block hotcookedironcrucible; - public static Block coolironcrucible; - public static Block failedironcrucible; - public static Block failedironcruciblehot; - - public static Block rawcleanironcrucible; - public static Block hotcleanironcrucible; - public static Block hotcookedcleanironcrucible; - public static Block coolcleanironcrucible; - public static Block failedcleanironcrucible; - public static Block failedcleanironcruciblehot; - - public static Block rawsteelcrucible; - public static Block hotsteelcrucible; - public static Block hotcookedsteelcrucible; - public static Block coolsteelcrucible; - public static Block failedsteelcrucible; - public static Block failedsteelcruciblehot; - - public static Block rawwootzcrucible; - public static Block hotwootzcrucible; - public static Block hotcookedwootzcrucible; - public static Block coolwootzcrucible; - public static Block failedwootzcrucible; - public static Block failedwootzcruciblehot; - - public static Block ironball; - public static Block ironchunk; - public static Block ironcleanball; - public static Block ironcleanchunk; - public static Block steelball; - public static Block steelchunk; - public static Block wootzball; - public static Block wootzchunk; + //public static Block ironball; + //public static Block ironchunk; + //public static Block ironcleanball; + //public static Block ironcleanchunk; + //public static Block steelball; + //public static Block steelchunk; + //public static Block wootzball; + //public static Block wootzchunk; public static Block stoneanvil; public static Block ironanvil; @@ -161,40 +136,14 @@ public class ModBlocks { hotbronzecrucible_emerald = new CrucibleHot(Material.ROCK, "hotbronzecrucible_emerald"); hotcookedbronzecrucible_emerald = new CrucibleHot(Material.ROCK, "hotcookedbronzecrucible_emerald"); - rawironcrucible = new Crucible(Material.ROCK, "rawironcrucible"); - hotironcrucible = new CrucibleHot(Material.ROCK, "hotironcrucible"); - hotcookedironcrucible = new CrucibleHot(Material.ROCK, "hotcookedironcrucible"); - coolironcrucible = new Crucible(Material.ROCK, "coolironcrucible"); - failedironcrucible = new Crucible(Material.ROCK, "failedironcrucible"); - failedironcruciblehot = new CrucibleHot(Material.ROCK, "failedironcruciblehot"); - - rawcleanironcrucible = new Crucible(Material.ROCK, "rawcleanironcrucible"); - hotcleanironcrucible = new CrucibleHot(Material.ROCK, "hotcleanironcrucible"); - hotcookedcleanironcrucible = new CrucibleHot(Material.ROCK, "hotcookedcleanironcrucible"); - coolcleanironcrucible = new Crucible(Material.ROCK, "coolcleanironcrucible"); - failedcleanironcrucible = new Crucible(Material.ROCK, "failedcleanironcrucible"); - failedcleanironcruciblehot = new Crucible(Material.ROCK, "failedcleanironcruciblehot"); - - rawsteelcrucible = new Crucible(Material.ROCK, "rawsteelcrucible"); - hotsteelcrucible = new CrucibleHot(Material.ROCK, "hotsteelcrucible"); - hotcookedsteelcrucible = new CrucibleHot(Material.ROCK, "hotcookedsteelcrucible"); - coolsteelcrucible = new Crucible(Material.ROCK, "coolsteelcrucible"); - failedsteelcrucible = new Crucible(Material.ROCK, "failedsteelcrucible"); - failedsteelcruciblehot = new Crucible(Material.ROCK, "failedsteelcruciblehot"); - - rawwootzcrucible = new Crucible(Material.ROCK, "rawwootzcrucible"); - hotwootzcrucible = new CrucibleHot(Material.ROCK, "hotwootzcrucible"); - hotcookedwootzcrucible = new CrucibleHot(Material.ROCK, "hotcookedwootzcrucible"); - coolwootzcrucible = new Crucible(Material.ROCK, "coolwootzcrucible"); - failedwootzcrucible = new Crucible(Material.ROCK, "failedwootzcrucible"); - failedwootzcruciblehot = new Crucible(Material.ROCK, "failedwootzcruciblehot"); - - ironball = new IngotBall(Material.IRON, "ironball", 5.0F, "ingot") { + /* + ironball = new IngotBall(Material.IRON, "ironball", 5.0F, "big") { @Override public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitx, float hity, float hitz) { if(!world.isRemote){ Item pItem = player.getHeldItem(hand).getItem(); + ItemStack pstack = player.getHeldItemMainhand(); BlockPos belowPos = pos.down(); //System.out.println("Activating"); if (pItem instanceof Gallagher && world.getBlockState(belowPos).getBlock().equals(Blocks.STONE)) { @@ -205,14 +154,12 @@ public class ModBlocks { //CommonUtils.spawnItemEntityFromWorld(world, pos, new ItemStack(ModBlocks.stoneanvil, 1)); return true; } - /*if (pItem instanceof ForgeHammer && world.getBlockState(belowPos).getBlock().equals(Blocks.IRON_BLOCK)) { - player.swingArm(hand); - world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2); - world.setBlockState(belowPos, ModBlocks.ironanvil.getDefaultState().withProperty(AnvilStone.FACING, player.getHorizontalFacing()), 2); - world.playEvent(1031, pos, 0); - //CommonUtils.spawnItemEntityFromWorld(world, pos, new ItemStack(ModBlocks.stoneanvil, 1)); + if (pstack.isEmpty()) { + System.out.println(state); + PlayerHelper.playerTakeItem(world, pos, EnumFacing.DOWN, player, player.getActiveHand(), this.getItem(world, pos, state)); + world.setBlockState(pos, Blocks.AIR.getDefaultState(), 3); return true; - }*/ + } if (pItem instanceof Gallagher || pItem.equals(ModItems.forgehammer)) { if(world.getBlockState(belowPos).getBlock() instanceof AnvilBase) { @@ -230,26 +177,29 @@ public class ModBlocks { ) { player.swingArm(hand); world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2); - tile.setSlotStack(6, new ItemStack(ModItems.ironchunkhot, 1)); - tile.setSlotStack(7, new ItemStack(ModItems.ironchunkhot, 1)); - tile.setSlotStack(8, new ItemStack(ModItems.ironchunkhot, 1)); - tile.setSlotStack(11, new ItemStack(ModItems.ironchunkhot, 1)); - tile.setSlotStack(12, new ItemStack(ModItems.ironchunkhot, 1)); - tile.setSlotStack(13, new ItemStack(ModItems.ironchunkhot, 1)); - tile.setSlotStack(16, new ItemStack(ModItems.ironchunkhot, 1)); - tile.setSlotStack(17, new ItemStack(ModItems.ironchunkhot, 1)); - tile.setSlotStack(18, new ItemStack(ModItems.ironchunkhot, 1)); + + Block tempBlock = ModBlocks.ironchunk; + tempBlock.getDefaultState().withProperty(PrimalAPI.States.ACTIVE, true); + + tile.setSlotStack(6, new ItemStack(tempBlock, 1)); + tile.setSlotStack(7, new ItemStack(tempBlock, 1)); + tile.setSlotStack(8, new ItemStack(tempBlock, 1)); + tile.setSlotStack(11, new ItemStack(tempBlock, 1)); + tile.setSlotStack(12, new ItemStack(tempBlock, 1)); + tile.setSlotStack(13, new ItemStack(tempBlock, 1)); + tile.setSlotStack(16, new ItemStack(tempBlock, 1)); + tile.setSlotStack(17, new ItemStack(tempBlock, 1)); + tile.setSlotStack(18, new ItemStack(tempBlock, 1)); world.playEvent(1031, pos, 0); return true; } } } - } return false; } }; - ironcleanball = new IngotBall(Material.IRON, "ironcleanball", 5.0f, "ingot") { + ironcleanball = new IngotBall(Material.IRON, "ironcleanball", 5.0f,"big") { @Override public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitx, float hity, float hitz) { @@ -283,15 +233,18 @@ public class ModBlocks { ) { player.swingArm(hand); world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2); - tile.setSlotStack(6, new ItemStack(ModItems.ironcleanchunkhot, 1)); - tile.setSlotStack(7, new ItemStack(ModItems.ironcleanchunkhot, 1)); - tile.setSlotStack(8, new ItemStack(ModItems.ironcleanchunkhot, 1)); - tile.setSlotStack(11, new ItemStack(ModItems.ironcleanchunkhot, 1)); - tile.setSlotStack(12, new ItemStack(ModItems.ironcleanchunkhot, 1)); - tile.setSlotStack(13, new ItemStack(ModItems.ironcleanchunkhot, 1)); - tile.setSlotStack(16, new ItemStack(ModItems.ironcleanchunkhot, 1)); - tile.setSlotStack(17, new ItemStack(ModItems.ironcleanchunkhot, 1)); - tile.setSlotStack(18, new ItemStack(ModItems.ironcleanchunkhot, 1)); + + Block tempBlock = ModBlocks.ironcleanchunk; + tempBlock.getDefaultState().withProperty(PrimalAPI.States.ACTIVE, true); + tile.setSlotStack(6, new ItemStack(tempBlock, 1)); + tile.setSlotStack(7, new ItemStack(tempBlock, 1)); + tile.setSlotStack(8, new ItemStack(tempBlock, 1)); + tile.setSlotStack(11, new ItemStack(tempBlock, 1)); + tile.setSlotStack(12, new ItemStack(tempBlock, 1)); + tile.setSlotStack(13, new ItemStack(tempBlock, 1)); + tile.setSlotStack(16, new ItemStack(tempBlock, 1)); + tile.setSlotStack(17, new ItemStack(tempBlock, 1)); + tile.setSlotStack(18, new ItemStack(tempBlock, 1)); world.playEvent(1031, pos, 0); return true; } @@ -301,8 +254,8 @@ public class ModBlocks { } return false; } - }; // clean_iron_ingot ironcleanball.json ironcleanballhot.json - done - steelball = new IngotBall(Material.IRON, "steelball", 6.0f, "ingot"){ + }; + steelball = new IngotBall(Material.IRON, "steelball", 6.0f,"big"){ @Override public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitx, float hity, float hitz) { @@ -334,16 +287,20 @@ public class ModBlocks { tile.getSlotStack(18).isEmpty() ) { player.swingArm(hand); + + Block tempBlock = ModBlocks.steelchunk; + tempBlock.getDefaultState().withProperty(PrimalAPI.States.ACTIVE, true); + world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2); - tile.setSlotStack(6, new ItemStack(ModItems.steelchunkhot, 1)); - tile.setSlotStack(7, new ItemStack(ModItems.steelchunkhot, 1)); - tile.setSlotStack(8, new ItemStack(ModItems.steelchunkhot, 1)); - tile.setSlotStack(11, new ItemStack(ModItems.steelchunkhot, 1)); - tile.setSlotStack(12, new ItemStack(ModItems.steelchunkhot, 1)); - tile.setSlotStack(13, new ItemStack(ModItems.steelchunkhot, 1)); - tile.setSlotStack(16, new ItemStack(ModItems.steelchunkhot, 1)); - tile.setSlotStack(17, new ItemStack(ModItems.steelchunkhot, 1)); - tile.setSlotStack(18, new ItemStack(ModItems.steelchunkhot, 1)); + tile.setSlotStack(6, new ItemStack(tempBlock, 1)); + tile.setSlotStack(7, new ItemStack(tempBlock, 1)); + tile.setSlotStack(8, new ItemStack(tempBlock, 1)); + tile.setSlotStack(11, new ItemStack(tempBlock, 1)); + tile.setSlotStack(12, new ItemStack(tempBlock, 1)); + tile.setSlotStack(13, new ItemStack(tempBlock, 1)); + tile.setSlotStack(16, new ItemStack(tempBlock, 1)); + tile.setSlotStack(17, new ItemStack(tempBlock, 1)); + tile.setSlotStack(18, new ItemStack(tempBlock, 1)); world.playEvent(1031, pos, 0); return true; } @@ -353,8 +310,8 @@ public class ModBlocks { } return false; } - }; // steel_ingot steelball.json steelballhot.json - wootzball = new IngotBall(Material.IRON, "wootzball", 6.0f, "ingot") { + }; + wootzball = new IngotBall(Material.IRON, "wootzball", 6.0f,"big") { @Override public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitx, float hity, float hitz) { @@ -387,15 +344,19 @@ public class ModBlocks { ) { player.swingArm(hand); world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2); - tile.setSlotStack(6, new ItemStack(ModItems.wootzchunkhot, 1)); - tile.setSlotStack(7, new ItemStack(ModItems.wootzchunkhot, 1)); - tile.setSlotStack(8, new ItemStack(ModItems.wootzchunkhot, 1)); - tile.setSlotStack(11, new ItemStack(ModItems.wootzchunkhot, 1)); - tile.setSlotStack(12, new ItemStack(ModItems.wootzchunkhot, 1)); - tile.setSlotStack(13, new ItemStack(ModItems.wootzchunkhot, 1)); - tile.setSlotStack(16, new ItemStack(ModItems.wootzchunkhot, 1)); - tile.setSlotStack(17, new ItemStack(ModItems.wootzchunkhot, 1)); - tile.setSlotStack(18, new ItemStack(ModItems.wootzchunkhot, 1)); + + Block tempBlock = ModBlocks.wootzchunk; + tempBlock.getDefaultState().withProperty(PrimalAPI.States.ACTIVE, true); + + tile.setSlotStack(6, new ItemStack(tempBlock, 1)); + tile.setSlotStack(7, new ItemStack(tempBlock, 1)); + tile.setSlotStack(8, new ItemStack(tempBlock, 1)); + tile.setSlotStack(11, new ItemStack(tempBlock, 1)); + tile.setSlotStack(12, new ItemStack(tempBlock, 1)); + tile.setSlotStack(13, new ItemStack(tempBlock, 1)); + tile.setSlotStack(16, new ItemStack(tempBlock, 1)); + tile.setSlotStack(17, new ItemStack(tempBlock, 1)); + tile.setSlotStack(18, new ItemStack(tempBlock, 1)); world.playEvent(1031, pos, 0); return true; } @@ -405,12 +366,13 @@ public class ModBlocks { } return false; } - }; //wootz_ingot wootzball.json wootzballhot.json + }; - ironchunk = new IngotBall(Material.IRON, "ironchunk", 5.0F, "chunk"); - ironcleanchunk = new IngotBall(Material.IRON, "ironcleanchunk", 5.0F, "chunk"); //Lyle to make assets clean_iron_ingot, blockstate\ironcleanchunk.json, item\ironcleanchunk.json, item\ironcleanchunkhot.json - done - steelchunk = new IngotBall(Material.IRON, "steelchunk", 6.0f, "chunk"); //steel_ingot steelchunk.json steelchunkhot.json - done - wootzchunk = new IngotBall(Material.IRON, "wootzchunk", 6.0f, "chunk"); //wootz_ingot wootzchunk.json wootzchunkhot.json - done + ironchunk = new IngotBall(Material.IRON, "ironchunk", 5.0F, "small"); + ironcleanchunk = new IngotBall(Material.IRON, "ironcleanchunk", 5.0F, "small"); + steelchunk = new IngotBall(Material.IRON, "steelchunk", 6.0f,"small"); + wootzchunk = new IngotBall(Material.IRON, "wootzchunk", 6.0f,"small"); +*/ stoneanvil = new AnvilStone(Material.ANVIL, "stoneanvil", 5.0f, true); ironanvil = new AnvilIron(Material.ANVIL, "ironanvil", 6.0f, true); @@ -463,45 +425,17 @@ public class ModBlocks { registerBlockWithItem(hotbronzecrucible_lapis); registerBlockWithItem(hotcookedbronzecrucible_lapis); - registerBlockWithItem(rawironcrucible); - registerBlockWithItem(hotironcrucible); - registerBlockWithItem(hotcookedironcrucible); - registerBlockWithItem(coolironcrucible); - registerBlockWithItem(failedironcrucible); - registerBlockWithItem(failedironcruciblehot); + //registerBlockWithItem(ironball); + //registerBlockWithItem(ironchunk); - registerBlockWithItem(rawcleanironcrucible); - registerBlockWithItem(hotcleanironcrucible); - registerBlockWithItem(hotcookedcleanironcrucible); - registerBlockWithItem(coolcleanironcrucible); - registerBlockWithItem(failedcleanironcrucible); - registerBlockWithItem(failedcleanironcruciblehot); + //registerBlockWithItem(ironcleanball); + //registerBlockWithItem(ironcleanchunk); - registerBlockWithItem(rawsteelcrucible); - registerBlockWithItem(hotsteelcrucible); - registerBlockWithItem(hotcookedsteelcrucible); - registerBlockWithItem(coolsteelcrucible); - registerBlockWithItem(failedsteelcrucible); - registerBlockWithItem(failedsteelcruciblehot); + //registerBlockWithItem(steelball); + //registerBlockWithItem(steelchunk); - registerBlockWithItem(rawwootzcrucible); - registerBlockWithItem(hotwootzcrucible); - registerBlockWithItem(hotcookedwootzcrucible); - registerBlockWithItem(coolwootzcrucible); - registerBlockWithItem(failedwootzcrucible); - registerBlockWithItem(failedwootzcruciblehot); - - registerBlockWithItem(ironball); - registerBlockWithItem(ironchunk); - - registerBlockWithItem(ironcleanball); - registerBlockWithItem(ironcleanchunk); - - registerBlockWithItem(steelball); - registerBlockWithItem(steelchunk); - - registerBlockWithItem(wootzball); - registerBlockWithItem(wootzchunk); + //registerBlockWithItem(wootzball); + //registerBlockWithItem(wootzchunk); //registerBlockWithItemSubType(ironball, ironballitemcool, "ironcool"); //registerBlockWithItemSubType(ironball, ironballitemhot, "ironhot"); @@ -555,45 +489,18 @@ public class ModBlocks { registerRender(hotbronzecrucible_lapis); registerRender(hotcookedbronzecrucible_lapis); - registerRender(rawironcrucible); - registerRender(hotironcrucible); - registerRender(hotcookedironcrucible); - registerRender(coolironcrucible); - registerRender(failedironcrucible); - registerRender(failedironcruciblehot); + //registerRender(ironball); + //registerRender(ironchunk); - registerRender(rawcleanironcrucible); - registerRender(hotcleanironcrucible); - registerRender(hotcookedcleanironcrucible); - registerRender(coolcleanironcrucible); - registerRender(failedcleanironcrucible); - registerRender(failedcleanironcruciblehot); + //registerRender(ironcleanball); + //registerRender(ironcleanchunk); - registerRender(rawsteelcrucible); - registerRender(hotsteelcrucible); - registerRender(hotcookedsteelcrucible); - registerRender(coolsteelcrucible); - registerRender(failedsteelcrucible); - registerRender(failedsteelcruciblehot); + //registerRender(steelball); + //registerRender(steelchunk); - registerRender(rawwootzcrucible); - registerRender(hotwootzcrucible); - registerRender(hotcookedwootzcrucible); - registerRender(coolwootzcrucible); - registerRender(failedwootzcrucible); - registerRender(failedwootzcruciblehot); + //registerRender(wootzball); + //registerRender(wootzchunk); - registerRender(ironball); - registerRender(ironchunk); - - registerRender(ironcleanball); - registerRender(ironcleanchunk); - - registerRender(steelball); - registerRender(steelchunk); - - registerRender(wootzball); - registerRender(wootzchunk); //registerRenderCustom(ironballitemcool, 0, new ModelResourceLocation(ironballitemcool.getUnlocalizedName())); //registerRenderCustom(ironballitemhot, 1, new ModelResourceLocation(ironballitemhot.getUnlocalizedName())); diff --git a/kfc/src/main/java/nmd/primal/forgecraft/init/ModCrafting.java b/kfc/src/main/java/nmd/primal/forgecraft/init/ModCrafting.java index 8143f7f6..b091a4b9 100644 --- a/kfc/src/main/java/nmd/primal/forgecraft/init/ModCrafting.java +++ b/kfc/src/main/java/nmd/primal/forgecraft/init/ModCrafting.java @@ -1,5 +1,6 @@ package nmd.primal.forgecraft.init; +import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; @@ -30,7 +31,7 @@ public class ModCrafting{ Ingredient.EMPTY, Ingredient.EMPTY, new ItemStack(Blocks.IRON_ORE, 1), - new ItemStack(ModBlocks.ironball, 1), + new ItemStack(ModItems.ironingotball, 1), 100, 100, 1000); @@ -114,7 +115,7 @@ public class ModCrafting{ "X X", "YSY", 'X', Blocks.STONE, 'S', Items.STRING, 'Y', Items.STICK); /***RAW CRUCIBLES***/ - +/* RecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.rawironcrucible), "X","Y", ('X'), "oreIron", @@ -131,6 +132,9 @@ public class ModCrafting{ ('X'), new ItemStack(ModBlocks.ironcleanball, 1), ('C'), new ItemStack(PrimalAPI.Items.CHARCOAL_HIGH), ('Y'), ModBlocks.emptycrucible); + + + */ RecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.rawbronzecrucible), "XCX"," X "," Y ", ('X'), "dustCopper", @@ -184,6 +188,7 @@ public class ModCrafting{ ('T'), new ItemStack(ModItems.brokenbronzetool, 1), ('Y'), new ItemStack(ModBlocks.emptycrucible, 1) ); +/* RecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.rawironcrucible, 1), "T", "Y", ('T'), new ItemStack(ModItems.brokenwroughtirontool, 1), @@ -204,7 +209,7 @@ public class ModCrafting{ ('T'), new ItemStack(ModItems.brokenwootztool, 1), ('Y'), new ItemStack(ModBlocks.emptycrucible, 1) ); - +*/ /*************************************************************** * TOOL CRAFTING RECIPES @@ -397,6 +402,7 @@ public class ModCrafting{ 0.0f, 0.0f); + /* //Makes the Hot Iron Crucible BloomeryCrafting.addRecipe( new ItemStack(ModBlocks.rawironcrucible, 1), @@ -474,6 +480,7 @@ public class ModCrafting{ 0.2f, 0.25f ); + */ //Makes the Hot Bronze Crucible BloomeryCrafting.addRecipe( new ItemStack(ModBlocks.rawbronzecrucible, 1), @@ -671,18 +678,19 @@ public class ModCrafting{ //Makes a Hot Iron Ingot ForgeCrafting.addRecipe( - Item.getItemFromBlock(ModBlocks.ironball), - new ItemStack(ModItems.ironingotballhot, 1), - 800, - 200, + ModItems.ironingotball, + //800, 200 + new ItemStack(ModItems.ironingotball, 1), + 100, + 100, 500, 1.0f, 1.0f ); //Makes a Hot Clean Iron Ingot ForgeCrafting.addRecipe( - Item.getItemFromBlock(ModBlocks.ironcleanball), - new ItemStack(ModItems.ironcleaningotballhot, 1), + ModItems.ironcleaningotball, + new ItemStack(ModItems.ironcleaningotball, 1), 900, 250, 500, @@ -691,8 +699,18 @@ public class ModCrafting{ ); //Makes a Hot Steel Ingot ForgeCrafting.addRecipe( - Item.getItemFromBlock(ModBlocks.steelball), - new ItemStack(ModItems.steelingotballhot, 1), + ModItems.steelingotball, + new ItemStack(ModItems.steelingotball, 1), + 1000, + 300, + 500, + 1.0f, + 1.0f + ); + //Makes a Hot Wootz Ingot + ForgeCrafting.addRecipe( + ModItems.wootzingotball, + new ItemStack(ModItems.wootzingotball, 1), 1000, 300, 500, @@ -703,7 +721,7 @@ public class ModCrafting{ // Converts a Vanilla Ingot into ForgeCraft Ingot Ball ForgeCrafting.addRecipe( Items.IRON_INGOT, - new ItemStack(ModItems.ironingotballhot, 1), + new ItemStack(ModItems.ironingotball, 1), 800, 200, 500, @@ -713,8 +731,8 @@ public class ModCrafting{ //Makes a Hot Iron Chunk ForgeCrafting.addRecipe( - Item.getItemFromBlock(ModBlocks.ironchunk), - new ItemStack(ModItems.ironchunkhot,1), + ModItems.ironchunk, + new ItemStack(ModItems.ironchunk,1), 800, 160, 400, @@ -723,8 +741,8 @@ public class ModCrafting{ ); //Makes a Hot Clean Iron Chunk ForgeCrafting.addRecipe( - Item.getItemFromBlock(ModBlocks.ironcleanchunk), - new ItemStack(ModItems.ironcleanchunkhot,1), + ModItems.ironcleanchunk, + new ItemStack(ModItems.ironcleanchunk,1), 900, 250, 500, @@ -733,8 +751,19 @@ public class ModCrafting{ ); //Makes a Hot Steel Chunk ForgeCrafting.addRecipe( - Item.getItemFromBlock(ModBlocks.steelchunk), - new ItemStack(ModItems.steelchunkhot,1), + ModItems.steelchunk, + new ItemStack(ModItems.steelchunk,1), + 1000, + 300, + 500, + 1.0f, + 1.0f + ); + + //Makes a Hot Wootz Chunk + ForgeCrafting.addRecipe( + ModItems.wootzchunk, + new ItemStack(ModItems.wootzchunk,1), 1000, 300, 500, @@ -878,9 +907,10 @@ public class ModCrafting{ ******************************************************************************/ //String empty = ItemStack.EMPTY.getItem().getRegistryName().toString(); - String hotChunk = ModItems.ironchunkhot.getRegistryName().toString(); - String hotCleanChunk = ModItems.ironcleanchunkhot.getRegistryName().toString(); - String hotSteelChunk = ModItems.steelchunkhot.getRegistryName().toString(); + String hotChunk = ModItems.ironchunk.getRegistryName().toString(); + String hotCleanChunk = ModItems.ironcleanchunk.getRegistryName().toString(); + String hotSteelChunk = ModItems.steelchunk.getRegistryName().toString(); + String hotWootzChunk = ModItems.wootzchunk.getRegistryName().toString(); String diamond = Items.DIAMOND.getRegistryName().toString(); String emerald = Items.EMERALD.getRegistryName().toString(); diff --git a/kfc/src/main/java/nmd/primal/forgecraft/init/ModItems.java b/kfc/src/main/java/nmd/primal/forgecraft/init/ModItems.java index c8edcef6..b406a3fe 100644 --- a/kfc/src/main/java/nmd/primal/forgecraft/init/ModItems.java +++ b/kfc/src/main/java/nmd/primal/forgecraft/init/ModItems.java @@ -43,15 +43,15 @@ public class ModItems { public static Item stonetongs; public static Item castingmud; - public static Item ironingotballhot; - public static Item ironchunkhot; - public static Item ironcleaningotballhot; - public static Item ironcleanchunkhot; - public static Item steelingotballhot; - public static Item steelchunkhot; - public static Item wootzingotballhot; - public static Item wootzchunkhot; + public static Item ironingotball; + public static Item ironchunk; + public static Item ironcleaningotball; + public static Item ironcleanchunk; + public static Item steelingotball; + public static Item steelchunk; + public static Item wootzingotball; + public static Item wootzchunk; public static Item cast_axe; public static Item cast_gladius; @@ -174,30 +174,30 @@ public class ModItems { /********** TOOL PARTS **********/ - bronzepickaxehead = new BronzeToolPart("bronzepickaxehead", PrimalAPI.ToolMaterials.TOOL_BRONZE, 41); - bronzeaxehead = new BronzeToolPart("bronzeaxehead", PrimalAPI.ToolMaterials.TOOL_BRONZE, 42); - bronzeshovelhead = new BronzeToolPart("bronzeshovelhead", PrimalAPI.ToolMaterials.TOOL_BRONZE, 43); - bronzehoehead = new BronzeToolPart("bronzehoehead", PrimalAPI.ToolMaterials.TOOL_BRONZE, 44); + bronzepickaxehead = new BronzeToolPart("bronzepickaxehead", PrimalAPI.ToolMaterials.TOOL_BRONZE, "pickaxe"); + bronzeaxehead = new BronzeToolPart("bronzeaxehead", PrimalAPI.ToolMaterials.TOOL_BRONZE, "axe"); + bronzeshovelhead = new BronzeToolPart("bronzeshovelhead", PrimalAPI.ToolMaterials.TOOL_BRONZE, "shovel"); + bronzehoehead = new BronzeToolPart("bronzehoehead", PrimalAPI.ToolMaterials.TOOL_BRONZE, "hoe"); - pickaxehead = new ToolPart("ironpickaxehead", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON, 8); - ironaxehead = new ToolPart("ironaxehead", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON, 9); - ironshovelhead = new ToolPart("ironshovelhead", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON, 10); - ironhoehead = new ToolPart("ironhoehead", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON, 11); + pickaxehead = new ToolPart("ironpickaxehead", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON, "pickaxe"); + ironaxehead = new ToolPart("ironaxehead", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON, "axe"); + ironshovelhead = new ToolPart("ironshovelhead", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON, "shovel"); + ironhoehead = new ToolPart("ironhoehead", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON, "hoe"); - cleanironpickaxehead = new ToolPart("cleanironpickaxehead", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON, 17); - cleanironaxehead = new ToolPart("cleanironaxehead", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON, 18); - cleanironshovelhead = new ToolPart("cleanironshovelhead", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON, 19); - cleanironhoehead = new ToolPart("cleanironhoehead", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON, 20); + cleanironpickaxehead = new ToolPart("cleanironpickaxehead", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON, "pickaxe"); + cleanironaxehead = new ToolPart("cleanironaxehead", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON, "axe"); + cleanironshovelhead = new ToolPart("cleanironshovelhead", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON, "shovel"); + cleanironhoehead = new ToolPart("cleanironhoehead", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON, "hoe"); - steelpickaxehead = new ToolPart("steelpickaxehead", PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL, 26); - steelaxehead = new ToolPart("steelaxehead", PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL, 27); - steelshovelhead = new ToolPart("steelshovelhead", PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL, 28); - steelhoehead = new ToolPart("steelhoehead", PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL, 29); + steelpickaxehead = new ToolPart("steelpickaxehead", PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL, "pickaxe"); + steelaxehead = new ToolPart("steelaxehead", PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL, "axe"); + steelshovelhead = new ToolPart("steelshovelhead", PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL, "shovel"); + steelhoehead = new ToolPart("steelhoehead", PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL, "hoe"); - wootzpickaxehead = new ToolPart("wootzpickaxehead", PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL, 35); - wootzaxehead = new ToolPart("wootzaxehead", PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL, 36); - wootzshovelhead = new ToolPart("wootzshovelhead", PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL, 37); - wootzhoehead = new ToolPart("wootzhoehead", PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL, 38); + wootzpickaxehead = new ToolPart("wootzpickaxehead", PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL, "pickaxe"); + wootzaxehead = new ToolPart("wootzaxehead", PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL, "axe"); + wootzshovelhead = new ToolPart("wootzshovelhead", PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL, "shovel"); + wootzhoehead = new ToolPart("wootzhoehead", PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL, "hoe"); /********** TOOLS @@ -247,14 +247,16 @@ public class ModItems { /********** INGOTS AND CHUNKS **********/ - ironingotballhot = new BaseMultiItem("ironingothot", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON, 6); - ironchunkhot = new BaseMultiItem("ironchunkhot", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON, 7); - ironcleaningotballhot= new BaseMultiItem("ironcleaningotballhot", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON, 15); - ironcleanchunkhot= new BaseMultiItem("ironcleanchunkhot", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON, 16); - steelingotballhot= new BaseMultiItem("steelingotballhot", PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL, 24); - steelchunkhot= new BaseMultiItem("steelchunkhot", PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL, 25); - wootzingotballhot= new BaseMultiItem("wootzingotballhot", PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL, 33); - wootzchunkhot= new BaseMultiItem("wootzchunkhot", PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL, 34); + + ironingotball = new BaseMultiItem("ironingotball", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON); + ironchunk = new BaseMultiItem("ironchunk", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON); + ironcleaningotball= new BaseMultiItem("ironcleaningotball", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON); + ironcleanchunk= new BaseMultiItem("ironcleanchunk", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON); + steelingotball= new BaseMultiItem("steelingotball", PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL); + steelchunk= new BaseMultiItem("steelchunk", PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL); + wootzingotball= new BaseMultiItem("wootzingotball", PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL); + wootzchunk= new BaseMultiItem("wootzchunk", PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL); + //forgingmanual = new ItemForgingManual(); //test = new ItemTest("ironsword"); @@ -282,14 +284,16 @@ public class ModItems { ForgeRegistries.ITEMS.register(softcrucible); ForgeRegistries.ITEMS.register(stonetongs); ForgeRegistries.ITEMS.register(forgehammer); - ForgeRegistries.ITEMS.register(ironingotballhot); - ForgeRegistries.ITEMS.register(ironchunkhot); - ForgeRegistries.ITEMS.register(ironcleaningotballhot); - ForgeRegistries.ITEMS.register(ironcleanchunkhot); - ForgeRegistries.ITEMS.register(steelingotballhot); - ForgeRegistries.ITEMS.register(steelchunkhot); - ForgeRegistries.ITEMS.register(wootzingotballhot); - ForgeRegistries.ITEMS.register(wootzchunkhot); + + ForgeRegistries.ITEMS.register(ironingotball); + ForgeRegistries.ITEMS.register(ironchunk); + ForgeRegistries.ITEMS.register(ironcleaningotball); + ForgeRegistries.ITEMS.register(ironcleanchunk); + ForgeRegistries.ITEMS.register(steelingotball); + ForgeRegistries.ITEMS.register(steelchunk); + ForgeRegistries.ITEMS.register(wootzingotball); + ForgeRegistries.ITEMS.register(wootzchunk); + //ForgeRegistries.ITEMS.register(test); /********** @@ -397,17 +401,20 @@ public class ModItems { @SideOnly(Side.CLIENT) public static void registerRenders() { registerRender(itemnbtcrucible); - //registerRender(itemcrucible); + registerRender(slottedtongs); registerRender(castingmud); registerRender(bellowshandle); registerRender(softcrucible); registerRender(forgehammer); - registerRender(ironingotballhot); - registerRender(ironchunkhot); - registerRender(ironcleaningotballhot); - registerRender(ironcleanchunkhot); - registerRender(steelingotballhot); - registerRender(steelchunkhot); + + + registerRender(ironingotball); + registerRender(ironchunk); + registerRender(ironcleaningotball); + registerRender(ironcleanchunk); + registerRender(steelingotball); + registerRender(steelchunk); + //registerRender(test); /********** diff --git a/kfc/src/main/java/nmd/primal/forgecraft/items/BaseMultiItem.java b/kfc/src/main/java/nmd/primal/forgecraft/items/BaseMultiItem.java index f1d190d6..e5b97d64 100644 --- a/kfc/src/main/java/nmd/primal/forgecraft/items/BaseMultiItem.java +++ b/kfc/src/main/java/nmd/primal/forgecraft/items/BaseMultiItem.java @@ -1,6 +1,23 @@ package nmd.primal.forgecraft.items; +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.IItemPropertyGetter; import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ResourceLocation; +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.items.blocks.ItemNBTCrucible; +import nmd.primal.forgecraft.items.parts.ToolPart; + +import javax.annotation.Nullable; /** * Created by mminaie on 2/19/17. @@ -8,12 +25,34 @@ import net.minecraft.item.Item; public class BaseMultiItem extends BaseItem { private Item.ToolMaterial mat; - private int ID; - public BaseMultiItem( String registryName, Item.ToolMaterial material, Integer ID) { - super(registryName); + public BaseMultiItem( String name, Item.ToolMaterial material) { + super(name); mat = material; - this.ID = ID; + this.setMaxStackSize(1); + this.setNoRepair(); + + this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() { + + @SideOnly(Side.CLIENT) + public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) { + BaseMultiItem item = (BaseMultiItem) stack.getItem(); + //TODO get the item name + if (stack.getItem() instanceof BaseMultiItem) { + if(stack.getTagCompound() != null) { + if (!stack.getTagCompound().getBoolean("hot")) { + return 0.0f; + } + if (stack.getTagCompound().getBoolean("hot")) { + return 0.1f; + } + } + } + return 0.0f; + } + }); + + } @@ -21,7 +60,22 @@ public class BaseMultiItem extends BaseItem { return mat; } - public int getID() { - return ID; + @Override + public void onCreated(ItemStack item, World worldIn, EntityPlayer playerIn) { + + if (!item.hasTagCompound()) { + item.setTagCompound(new NBTTagCompound()); + item.getTagCompound().setBoolean("hot", false); + } + } + + @Override + public void onUpdate(ItemStack item, World world, Entity player, int itemSlot, boolean isSelected) { + //System.out.println(item.getTagCompound()); + if (!item.hasTagCompound()) { + item.setTagCompound(new NBTTagCompound()); + item.getTagCompound().setBoolean("hot", false); + } + } } diff --git a/kfc/src/main/java/nmd/primal/forgecraft/items/ItemStoneTongs.java b/kfc/src/main/java/nmd/primal/forgecraft/items/ItemStoneTongs.java index 1dc11528..97590c1e 100644 --- a/kfc/src/main/java/nmd/primal/forgecraft/items/ItemStoneTongs.java +++ b/kfc/src/main/java/nmd/primal/forgecraft/items/ItemStoneTongs.java @@ -157,6 +157,7 @@ public class ItemStoneTongs extends Item { /***** Picks Up Hot Ingots from the Ground *****/ + /* if (world.getBlockState(pos).getBlock() instanceof BloomeryBase == false) { if (world.getBlockState(pos).getBlock() instanceof IngotBall) { if(world.getBlockState(pos).getValue(PrimalAPI.States.ACTIVE) == true) { @@ -190,10 +191,10 @@ public class ItemStoneTongs extends Item { world.setBlockToAir(pos); return EnumActionResult.SUCCESS; } - /* TODO Wootz */ + // TODO Wootz } } - } + }*/ /***** @@ -220,6 +221,7 @@ public class ItemStoneTongs extends Item { /*************************** * Iron * ***************************/ + /* if (world.getBlockState(pos).getBlock() == ModBlocks.hotironcrucible) { itemstack.getTagCompound().setInteger("type", 3); itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown); @@ -238,9 +240,11 @@ public class ItemStoneTongs extends Item { world.setBlockToAir(pos); return EnumActionResult.SUCCESS; } + */ /*************************** * Clean Iron * ***************************/ + /* if (world.getBlockState(pos).getBlock() == ModBlocks.hotcleanironcrucible) { itemstack.getTagCompound().setInteger("type", 12); itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown); @@ -259,9 +263,11 @@ public class ItemStoneTongs extends Item { world.setBlockToAir(pos); return EnumActionResult.SUCCESS; } + */ /*************************** * Steel * ***************************/ + /* if (world.getBlockState(pos).getBlock() == ModBlocks.hotsteelcrucible) { itemstack.getTagCompound().setInteger("type", 21); itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown); @@ -280,6 +286,7 @@ public class ItemStoneTongs extends Item { world.setBlockToAir(pos); return EnumActionResult.SUCCESS; } + */ /* TODO Wootz */ @@ -386,7 +393,7 @@ public class ItemStoneTongs extends Item { itemstack.getTagCompound().setInteger("cooldown", 0); itemstack.getTagCompound().setInteger("type", 0); return EnumActionResult.SUCCESS; - case 3: + /*case 3: world.setBlockState(tempPos, ModBlocks.hotironcrucible.getDefaultState(), 2); TileBaseCrucible tileCrucible3 = (TileBaseCrucible) world.getTileEntity(tempPos); tileCrucible3.countdown = itemstack.getTagCompound().getInteger("cooldown"); @@ -415,6 +422,7 @@ public class ItemStoneTongs extends Item { world.setBlockState(tempPos, ModBlocks.ironchunk.getDefaultState().withProperty(PrimalAPI.States.ACTIVE, true), 2); itemstack.getTagCompound().setInteger("type", 0); return EnumActionResult.SUCCESS; + */ case 8: return EnumActionResult.FAIL; case 9: @@ -423,7 +431,7 @@ public class ItemStoneTongs extends Item { return EnumActionResult.FAIL; case 11: return EnumActionResult.FAIL; - case 12: + /*case 12: world.setBlockState(tempPos, ModBlocks.hotcleanironcrucible.getDefaultState(), 2); TileBaseCrucible tileCrucible12 = (TileBaseCrucible) world.getTileEntity(tempPos); tileCrucible12.countdown = itemstack.getTagCompound().getInteger("cooldown"); @@ -452,6 +460,7 @@ public class ItemStoneTongs extends Item { world.setBlockState(tempPos, ModBlocks.ironcleanchunk.getDefaultState().withProperty(PrimalAPI.States.ACTIVE, true), 2); itemstack.getTagCompound().setInteger("type", 0); return EnumActionResult.SUCCESS; + */ case 17: return EnumActionResult.FAIL; case 18: @@ -460,6 +469,7 @@ public class ItemStoneTongs extends Item { return EnumActionResult.FAIL; case 20: return EnumActionResult.FAIL; + /* case 21: world.setBlockState(tempPos, ModBlocks.hotsteelcrucible.getDefaultState(), 2); TileBaseCrucible tileCrucible21 = (TileBaseCrucible) world.getTileEntity(tempPos); @@ -489,6 +499,7 @@ public class ItemStoneTongs extends Item { world.setBlockState(tempPos, ModBlocks.steelchunk.getDefaultState().withProperty(PrimalAPI.States.ACTIVE, true), 2); itemstack.getTagCompound().setInteger("type", 0); return EnumActionResult.SUCCESS; + */ case 29: world.setBlockState(tempPos, ModBlocks.hotbronzecrucible.getDefaultState(), 2); TileBaseCrucible tileCrucible39 = (TileBaseCrucible) world.getTileEntity(tempPos); @@ -591,6 +602,7 @@ public class ItemStoneTongs extends Item { itemstack.getTagCompound().setInteger("type", 2); tile.setSlotStack(1, ItemStack.EMPTY); return EnumActionResult.SUCCESS; + /* } else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotironcrucible))) { itemstack.getTagCompound().setInteger("cooldown", 0); itemstack.getTagCompound().setInteger("type", 3); @@ -636,6 +648,7 @@ public class ItemStoneTongs extends Item { itemstack.getTagCompound().setInteger("type", 23); tile.setSlotStack(1, ItemStack.EMPTY); return EnumActionResult.SUCCESS; + */ } else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotbronzecrucible))) { itemstack.getTagCompound().setInteger("cooldown", 0); itemstack.getTagCompound().setInteger("type", 39); @@ -706,7 +719,7 @@ public class ItemStoneTongs extends Item { /***** Pulls the Tool Parts from the Forge *****/ - if(itemstack.getTagCompound().getInteger("type") == 0){ + /*if(itemstack.getTagCompound().getInteger("type") == 0){ if (world.getBlockState(pos).getBlock() instanceof Forge) { TileForge tile = (TileForge) world.getTileEntity(pos); for (int i = 2; i < tile.getSlotListSize(); i++) { @@ -876,7 +889,7 @@ public class ItemStoneTongs extends Item { } } } - } + }*/ diff --git a/kfc/src/main/java/nmd/primal/forgecraft/items/SlottedTongs.java b/kfc/src/main/java/nmd/primal/forgecraft/items/SlottedTongs.java index 11aa885f..cb06b6fe 100644 --- a/kfc/src/main/java/nmd/primal/forgecraft/items/SlottedTongs.java +++ b/kfc/src/main/java/nmd/primal/forgecraft/items/SlottedTongs.java @@ -2,26 +2,37 @@ package nmd.primal.forgecraft.items; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.inventory.ItemStackHelper; +import net.minecraft.item.IItemPropertyGetter; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumActionResult; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; -import net.minecraft.util.NonNullList; +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.core.api.PrimalAPI; import nmd.primal.core.api.interfaces.IPickup; import nmd.primal.core.common.helper.NBTHelper; +import nmd.primal.core.common.helper.PlayerHelper; import nmd.primal.forgecraft.ModInfo; +import nmd.primal.forgecraft.blocks.Crucibles.NBTCrucible; +import nmd.primal.forgecraft.blocks.Forge; +import nmd.primal.forgecraft.init.ModItems; +import nmd.primal.forgecraft.items.blocks.ItemNBTCrucible; +import nmd.primal.forgecraft.items.parts.ToolPart; +import nmd.primal.forgecraft.tiles.TileForge; import nmd.primal.forgecraft.tiles.TileNBTCrucible; +import javax.annotation.Nullable; + /** * Created by mminaie on 12/30/17. */ @@ -32,6 +43,132 @@ public class SlottedTongs extends Item implements IPickup { this.setRegistryName(unlocalizedName); this.setMaxStackSize(1); this.setCreativeTab(ModInfo.TAB_FORGECRAFT); + + this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() { + + @SideOnly(Side.CLIENT) + public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) + { + SlottedTongs item = (SlottedTongs) stack.getItem(); + ItemStack slotStack = item.getSlotList().get(0); + //TODO get the item name + if (stack.getItem() instanceof SlottedTongs) { + if (slotStack.getItem() instanceof ItemNBTCrucible){ + if(item.getSlotList().get(0).getSubCompound("BlockEntityTag").getBoolean("hot")){ + return 0.01f; + } + if(!item.getSlotList().get(0).getSubCompound("BlockEntityTag").getBoolean("hot")){ + return 0.02f; + } + } + if(slotStack.getItem() instanceof ToolPart){ + ToolPart toolPart = (ToolPart) item.getSlotList().get(0).getItem(); + if(toolPart.getID() == "pickaxe"){ + if (item.getSlotList().get(0).getSubCompound("tags") != null) { + if (slotStack.getSubCompound("tags").getBoolean("hot")) { + return 0.03f; + } + if (!item.getSlotList().get(0).getSubCompound("tags").getBoolean("hot")) { + if(toolPart.getMaterial() == PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON){ + return 0.04f; + } + if(toolPart.getMaterial() == PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON){ + return 0.05f; + } + if(toolPart.getMaterial() == PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL){ + return 0.06f; + } + if(toolPart.getMaterial() == PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL){ + return 0.07f; + } + if(toolPart.getMaterial() == PrimalAPI.ToolMaterials.TOOL_BRONZE){ + return 0.08f; + } + } + } + } + if(toolPart.getID() == "axe"){ + if (item.getSlotList().get(0).getSubCompound("tags") != null) { + if (slotStack.getSubCompound("tags").getBoolean("hot")) { + return 0.09f; + } + if (!item.getSlotList().get(0).getSubCompound("tags").getBoolean("hot")) { + if(toolPart.getMaterial() == PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON){ + return 0.10f; + } + if(toolPart.getMaterial() == PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON){ + return 0.11f; + } + if(toolPart.getMaterial() == PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL){ + return 0.12f; + } + if(toolPart.getMaterial() == PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL){ + return 0.13f; + } + if(toolPart.getMaterial() == PrimalAPI.ToolMaterials.TOOL_BRONZE){ + return 0.14f; + } + } + } + } + if(toolPart.getID() == "shovel"){ + if (item.getSlotList().get(0).getSubCompound("tags") != null) { + if (slotStack.getSubCompound("tags").getBoolean("hot")) { + return 0.15f; + } + if (!item.getSlotList().get(0).getSubCompound("tags").getBoolean("hot")) { + if(toolPart.getMaterial() == PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON){ + return 0.16f; + } + if(toolPart.getMaterial() == PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON){ + return 0.17f; + } + if(toolPart.getMaterial() == PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL){ + return 0.18f; + } + if(toolPart.getMaterial() == PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL){ + return 0.19f; + } + if(toolPart.getMaterial() == PrimalAPI.ToolMaterials.TOOL_BRONZE){ + return 0.20f; + } + } + } + } + if(toolPart.getID() == "hoe"){ + if (item.getSlotList().get(0).getSubCompound("tags") != null) { + if (slotStack.getSubCompound("tags").getBoolean("hot")) { + return 0.21f; + } + if (!item.getSlotList().get(0).getSubCompound("tags").getBoolean("hot")) { + if(toolPart.getMaterial() == PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON){ + return 0.22f; + } + if(toolPart.getMaterial() == PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON){ + return 0.23f; + } + if(toolPart.getMaterial() == PrimalAPI.ToolMaterials.TOOL_BASIC_STEEL){ + return 0.24f; + } + if(toolPart.getMaterial() == PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL){ + return 0.25f; + } + if(toolPart.getMaterial() == PrimalAPI.ToolMaterials.TOOL_BRONZE){ + return 0.26f; + } + } + } + } + } + } + return 0.0F; + } + }); + + } + + public NonNullList getSlotList() { + return slotList; } public NonNullList slotList = NonNullList.withSize(1, ItemStack.EMPTY); @@ -42,25 +179,86 @@ public class SlottedTongs extends Item implements IPickup { if(!world.isRemote){ IBlockState state = world.getBlockState(pos); Block block = world.getBlockState(pos).getBlock(); - if(slotList.get(0).isEmpty() || slotList.get(0).getItem().equals(Items.AIR) || slotList.get(0).getItem().equals(Blocks.AIR)){ - ItemStack tempStack = takeBlock(world, pos, state, face, player, block).copy(); - slotList.set(0, tempStack); - world.setBlockState(pos, this.getReplacementBlock(world, pos, state)); - return EnumActionResult.SUCCESS; + ItemStack itemstack = player.getHeldItem(hand); + if(slotList.get(0).isEmpty()){ + if (block instanceof NBTCrucible) { + ItemStack tempStack = takeBlock(world, pos, state, face, player, block).copy(); + slotList.set(0, tempStack); + world.setBlockState(pos, this.getReplacementBlock(world, pos, state)); + return EnumActionResult.SUCCESS; + } } if(!slotList.get(0).isEmpty() ){ - System.out.println("Current Item:" + slotList.get(0)); - NBTTagCompound tag = this.slotList.get(0).getSubCompound("BlockEntityTag").copy(); - if(tag != null){ - ItemBlock temp = (ItemBlock) slotList.get(0).getItem(); - int i = this.getMetadata(slotList.get(0).getMetadata()); - IBlockState iblockstate1 = temp.getBlock().getStateForPlacement(world, pos, face, hitX, hitY, hitZ, i, player, hand); - temp.placeBlockAt(slotList.get(0), player, world, pos.up(1), face, hitX, hitY, hitZ, iblockstate1); + if(slotList.get(0).getItem() instanceof ItemNBTCrucible) { + NBTTagCompound tag = this.slotList.get(0).getSubCompound("BlockEntityTag").copy(); + if (tag != null) { + ItemBlock temp = (ItemBlock) slotList.get(0).getItem(); + int i = this.getMetadata(slotList.get(0).getMetadata()); + IBlockState iblockstate1 = temp.getBlock().getStateForPlacement(world, pos, face, hitX, hitY, hitZ, i, player, hand); + temp.placeBlockAt(slotList.get(0), player, world, pos.up(1), face, hitX, hitY, hitZ, iblockstate1); + slotList.set(0, ItemStack.EMPTY); + return EnumActionResult.SUCCESS; + } + } + } + + + /***** + TAKES the Tool Parts from the Forge + *****/ + if(slotList.get(0).isEmpty()) { + if (world.getBlockState(pos).getBlock() instanceof Forge) { + TileForge tile = (TileForge) world.getTileEntity(pos); + for (int i = 4; i < tile.getSlotListSize(); i++) { + ItemStack tempStack = tile.getSlotStack(i).copy(); + slotList.set(0, tempStack); + tile.setSlotStack(i, ItemStack.EMPTY); + return EnumActionResult.SUCCESS; + } + } + } + + /***** + PUTS the Ingots into the Forge + *****/ + if(!slotList.get(0).isEmpty()) { + if (world.getBlockState(pos).getBlock() instanceof Forge) { + TileForge tile = (TileForge) world.getTileEntity(pos); + if( !(slotList.get(0).getItem() instanceof ToolPart)) { + for (int i = 4; i < tile.getSlotListSize(); i++) { + ItemStack tempStack = slotList.get(0).copy(); + tile.setSlotStack(i, tempStack); + slotList.set(0, ItemStack.EMPTY); + return EnumActionResult.SUCCESS; + } + } + } + } + /***** + PUTS the Ingots into the Forge + *****/ + + if(!slotList.get(0).isEmpty()) { + if (world.getBlockState(pos).getBlock() instanceof Forge) { + TileForge tile = (TileForge) world.getTileEntity(pos); + if(slotList.get(0).getItem() instanceof ToolPart) { + ItemStack tempStack = slotList.get(0).copy(); + tile.setSlotStack(4, tempStack); + slotList.set(0, ItemStack.EMPTY); + return EnumActionResult.SUCCESS; + } + } + } + + if(!slotList.get(0).isEmpty() ){ + if(slotList.get(0).getItem() instanceof ToolPart) { + ItemStack tempStack = slotList.get(0).copy(); + PlayerHelper.spawnItemOnGround(world, pos, tempStack); slotList.set(0, ItemStack.EMPTY); return EnumActionResult.SUCCESS; } - return EnumActionResult.FAIL; } + return EnumActionResult.FAIL; } return EnumActionResult.SUCCESS; diff --git a/kfc/src/main/java/nmd/primal/forgecraft/items/parts/BronzeToolPart.java b/kfc/src/main/java/nmd/primal/forgecraft/items/parts/BronzeToolPart.java index ab811075..abecdb4c 100644 --- a/kfc/src/main/java/nmd/primal/forgecraft/items/parts/BronzeToolPart.java +++ b/kfc/src/main/java/nmd/primal/forgecraft/items/parts/BronzeToolPart.java @@ -23,9 +23,9 @@ import java.util.List; */ public class BronzeToolPart extends Item implements ToolNBT{ - private int ID; + private String toolType; - public BronzeToolPart(String name, ToolMaterial material, Integer ID) { + public BronzeToolPart(String name, ToolMaterial material, String type) { this.setMaxDamage(material.getMaxUses()); this.setUnlocalizedName(name); this.setRegistryName(name); @@ -33,7 +33,7 @@ public class BronzeToolPart extends Item implements ToolNBT{ this.setMaxStackSize(1); this.setNoRepair(); - this.ID = ID; + this.toolType = type; this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() { @@ -83,8 +83,8 @@ public class BronzeToolPart extends Item implements ToolNBT{ return false; } - public int getID() { - return ID; + public String getID() { + return toolType; } @Override diff --git a/kfc/src/main/java/nmd/primal/forgecraft/items/parts/ToolPart.java b/kfc/src/main/java/nmd/primal/forgecraft/items/parts/ToolPart.java index fbc72b47..55980139 100644 --- a/kfc/src/main/java/nmd/primal/forgecraft/items/parts/ToolPart.java +++ b/kfc/src/main/java/nmd/primal/forgecraft/items/parts/ToolPart.java @@ -1,6 +1,7 @@ package nmd.primal.forgecraft.items.parts; import com.mojang.realmsclient.gui.ChatFormatting; +import net.minecraft.block.material.Material; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -13,27 +14,31 @@ import net.minecraft.util.ResourceLocation; 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.util.ToolNBT; import javax.annotation.Nullable; import java.util.List; +import java.util.StringJoiner; /** * Created by mminaie on 3/9/17. */ public class ToolPart extends Item implements ToolNBT{ - private int ID; + private String toolType; + private ToolMaterial toolMaterial; - public ToolPart(String name, Item.ToolMaterial material, Integer ID) { + public ToolPart(String name, Item.ToolMaterial material, String type) { this.setMaxDamage(material.getMaxUses()); this.setUnlocalizedName(name); this.setRegistryName(name); - //this.setCreativeTab(ModInfo.TAB_FORGECRAFT); + this.setCreativeTab(ModInfo.TAB_FORGECRAFT); this.setMaxStackSize(1); this.setNoRepair(); - this.ID = ID; + this.toolType = type; + this.toolMaterial = material; this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() { @@ -228,9 +233,10 @@ public class ToolPart extends Item implements ToolNBT{ return false; } - public int getID() { - return ID; + public String getID() { + return toolType; } + public ToolMaterial getMaterial() {return toolMaterial;} @Override public void onCreated(ItemStack item, World worldIn, EntityPlayer playerIn) { diff --git a/kfc/src/main/java/nmd/primal/forgecraft/renders/blocks/TileAnvilRender.java b/kfc/src/main/java/nmd/primal/forgecraft/renders/blocks/TileAnvilRender.java index e47d412f..d0df1e0f 100644 --- a/kfc/src/main/java/nmd/primal/forgecraft/renders/blocks/TileAnvilRender.java +++ b/kfc/src/main/java/nmd/primal/forgecraft/renders/blocks/TileAnvilRender.java @@ -17,6 +17,7 @@ import nmd.primal.core.api.PrimalAPI; import nmd.primal.forgecraft.blocks.Anvil.AnvilBase; import nmd.primal.forgecraft.blocks.Anvil.AnvilStone; import nmd.primal.forgecraft.blocks.IngotBall; +import nmd.primal.forgecraft.init.ModBlocks; import nmd.primal.forgecraft.init.ModItems; import nmd.primal.forgecraft.items.BaseMultiItem; import nmd.primal.forgecraft.tiles.TileAnvil; @@ -507,7 +508,8 @@ public class TileAnvilRender extends TileEntitySpecialRenderer renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED); GL11.glPopMatrix(); } - if(item == ModItems.ironingotballhot ){ + //ModItems.ironingotballhot + if(item == ModItems.ironingotball){ GL11.glPushMatrix(); double scale = 1.0D; GL11.glScaled(scale, scale, scale); @@ -515,7 +517,8 @@ public class TileAnvilRender extends TileEntitySpecialRenderer renderItem.renderItem(tile.getSlotStack(counter), ItemCameraTransforms.TransformType.FIXED); GL11.glPopMatrix(); } - if(item == ModItems.ironchunkhot){ + //ModItems.ironchunkhot + if(item == ModItems.ironchunk){ GL11.glPushMatrix(); double scale = 1.0D; GL11.glScaled(scale, scale, scale); diff --git a/kfc/src/main/java/nmd/primal/forgecraft/tiles/TileAnvil.java b/kfc/src/main/java/nmd/primal/forgecraft/tiles/TileAnvil.java index b5be8142..c4056673 100644 --- a/kfc/src/main/java/nmd/primal/forgecraft/tiles/TileAnvil.java +++ b/kfc/src/main/java/nmd/primal/forgecraft/tiles/TileAnvil.java @@ -1,10 +1,12 @@ package nmd.primal.forgecraft.tiles; +import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.item.ItemStack; import net.minecraft.util.ITickable; import net.minecraft.util.NonNullList; import net.minecraft.world.World; +import nmd.primal.core.api.PrimalAPI; import nmd.primal.forgecraft.init.ModBlocks; import nmd.primal.forgecraft.init.ModItems; import nmd.primal.forgecraft.items.parts.ToolPart; @@ -49,9 +51,13 @@ public class TileAnvil extends TileBaseSlot implements ITickable { if (!world.isRemote) { IBlockState state = world.getBlockState(this.pos); - if ( ThreadLocalRandom.current().nextInt(0,10000) == 0 ) { + + /*** + Cooling Code + */ + /*if ( ThreadLocalRandom.current().nextInt(0,10000) == 0 ) { for(int i=0; i