From fd347fe3e39f9ae1c6364348695cda42fe85f2d5 Mon Sep 17 00:00:00 2001 From: Mohammad-Ali Minaie Date: Tue, 11 Sep 2018 11:43:09 -0400 Subject: [PATCH] SlottedTongs now can cool and drop its hot ingot in a barrel or water or rain_water also starting JEI fml --- kfc/nbtCrucible-To-Dos.md | 1 + .../nmd/primal/forgecraft/compat/JEI.java | 15 - .../primal/forgecraft/compat/JEI/ModJEI.java | 284 ++++++ .../forgecraft/items/BaseMultiItem.java | 5 + .../forgecraft/items/ItemStoneTongs.java | 920 ------------------ .../primal/forgecraft/items/SlottedTongs.java | 224 +++-- 6 files changed, 409 insertions(+), 1040 deletions(-) delete mode 100644 kfc/src/main/java/nmd/primal/forgecraft/compat/JEI.java create mode 100644 kfc/src/main/java/nmd/primal/forgecraft/compat/JEI/ModJEI.java delete mode 100644 kfc/src/main/java/nmd/primal/forgecraft/items/ItemStoneTongs.java diff --git a/kfc/nbtCrucible-To-Dos.md b/kfc/nbtCrucible-To-Dos.md index 35127849..315ae4e7 100644 --- a/kfc/nbtCrucible-To-Dos.md +++ b/kfc/nbtCrucible-To-Dos.md @@ -17,6 +17,7 @@ you'll need to update the annotation @GameRegistry.ObjectHolder(ModInfo.MOD_ID) - [ ] Craft Tweaker Support - [ ] JEI Support - [ ] People seem to not like being able to put anything in the Crucible +- [ ] Apply Forge turn off logic to Bloomery - [x] Steel Plate Recipe #37 - [x] Damascus Recipes - [x] Damascus Weapons diff --git a/kfc/src/main/java/nmd/primal/forgecraft/compat/JEI.java b/kfc/src/main/java/nmd/primal/forgecraft/compat/JEI.java deleted file mode 100644 index 1dde971d..00000000 --- a/kfc/src/main/java/nmd/primal/forgecraft/compat/JEI.java +++ /dev/null @@ -1,15 +0,0 @@ -package nmd.primal.forgecraft.compat; - -import mezz.jei.api.BlankModPlugin; -import mezz.jei.api.IModRegistry; - -/** - * Created by mminaie on 6/1/17. - */ -public class JEI extends BlankModPlugin -{ - @Override - public void register(IModRegistry registry) { - - } -} diff --git a/kfc/src/main/java/nmd/primal/forgecraft/compat/JEI/ModJEI.java b/kfc/src/main/java/nmd/primal/forgecraft/compat/JEI/ModJEI.java new file mode 100644 index 00000000..9f780ec9 --- /dev/null +++ b/kfc/src/main/java/nmd/primal/forgecraft/compat/JEI/ModJEI.java @@ -0,0 +1,284 @@ +package nmd.primal.forgecraft.compat.JEI; + +import mezz.jei.api.*; +import mezz.jei.api.gui.ICraftingGridHelper; +import mezz.jei.api.recipe.IRecipeCategoryRegistration; +import mezz.jei.api.recipe.VanillaRecipeCategoryUid; +import net.minecraft.init.Blocks; +import net.minecraft.item.*; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.fml.common.registry.ForgeRegistries; +import net.minecraftforge.oredict.OreDictionary; +import net.minecraftforge.oredict.OreIngredient; +import nmd.primal.core.api.PrimalAPI; +import nmd.primal.core.api.interfaces.types.ITypeMud; +import nmd.primal.core.api.interfaces.types.ITypeWood; +import nmd.primal.core.common.compat.jei.CraftingTableTransfer; +import nmd.primal.core.common.compat.jei.cauldron.CauldronRecipeCategory; +import nmd.primal.core.common.compat.jei.cauldron.CauldronRecipeChecker; +import nmd.primal.core.common.compat.jei.cauldron.CauldronRecipeHandler; +import nmd.primal.core.common.compat.jei.drying.DryingRecipeCategory; +import nmd.primal.core.common.compat.jei.drying.DryingRecipeChecker; +import nmd.primal.core.common.compat.jei.drying.DryingRecipeHandler; +import nmd.primal.core.common.compat.jei.flake.FlakeRecipeCategory; +import nmd.primal.core.common.compat.jei.flake.FlakeRecipeChecker; +import nmd.primal.core.common.compat.jei.flake.FlakeRecipeHandler; +import nmd.primal.core.common.compat.jei.hibachi.HibachiRecipeCategory; +import nmd.primal.core.common.compat.jei.hibachi.HibachiRecipeChecker; +import nmd.primal.core.common.compat.jei.hibachi.HibachiRecipeHandler; +import nmd.primal.core.common.compat.jei.smelter.SmelterRecipeCategory; +import nmd.primal.core.common.compat.jei.smelter.SmelterRecipeChecker; +import nmd.primal.core.common.compat.jei.smelter.SmelterRecipeHandler; +import nmd.primal.core.common.compat.jei.tools.axe.AxeRecipeCategory; +import nmd.primal.core.common.compat.jei.tools.axe.AxeRecipeChecker; +import nmd.primal.core.common.compat.jei.tools.axe.AxeRecipeHandler; +import nmd.primal.core.common.compat.jei.tools.blade.BladeRecipeCategory; +import nmd.primal.core.common.compat.jei.tools.blade.BladeRecipeChecker; +import nmd.primal.core.common.compat.jei.tools.blade.BladeRecipeHandler; +import nmd.primal.core.common.compat.jei.tools.gallahger.GallagherRecipeCategory; +import nmd.primal.core.common.compat.jei.tools.gallahger.GallagherRecipeChecker; +import nmd.primal.core.common.compat.jei.tools.gallahger.GallagherRecipeHandler; +import nmd.primal.core.common.compat.jei.tools.hoe.HoeRecipeCategory; +import nmd.primal.core.common.compat.jei.tools.hoe.HoeRecipeChecker; +import nmd.primal.core.common.compat.jei.tools.hoe.HoeRecipeHandler; +import nmd.primal.core.common.compat.jei.tools.shovel.ShovelRecipeCategory; +import nmd.primal.core.common.compat.jei.tools.shovel.ShovelRecipeChecker; +import nmd.primal.core.common.compat.jei.tools.shovel.ShovelRecipeHandler; +import nmd.primal.core.common.helper.RecipeHelper; +import nmd.primal.core.common.items.tools.Gallagher; +import nmd.primal.core.common.items.tools.WorkBlade; +import nmd.primal.core.common.recipes.inworld.*; +import nmd.primal.core.common.recipes.tile.CauldronRecipe; +import nmd.primal.core.common.recipes.tile.DryingRecipe; +import nmd.primal.core.common.recipes.tile.HibachiRecipe; +import nmd.primal.core.common.recipes.tile.SmelterRecipe; + +import javax.annotation.Nonnull; +import java.util.ArrayList; +import java.util.List; + +/** + * Created by mminaie on 9/11/18. + */ +@JEIPlugin +public class ModJEI implements IModPlugin { + public static IJeiHelpers jeiHelper; + public static ICraftingGridHelper craftingGridHelper; + public static IRecipeRegistry recipeRegistry; + public static IGuiHelper guiHelper; + private static final int craftOutputSlot = 0; + private static final int craftInputSlot1 = 1; + private static List gallaghers = new ArrayList<>(); + private static List blades = new ArrayList<>(); + private static List axes = new ArrayList<>(); + private static List shovels = new ArrayList<>(); + private static List hoes = new ArrayList<>(); + + @Override + public void registerCategories(IRecipeCategoryRegistration registry) { + final IJeiHelpers jeiHelpers = registry.getJeiHelpers(); + final IGuiHelper guiHelper = jeiHelpers.getGuiHelper(); + + // + // In-World + // + registry.addRecipeCategories(new FlakeRecipeCategory(guiHelper)); + registry.addRecipeCategories(new GallagherRecipeCategory(guiHelper)); + registry.addRecipeCategories(new BladeRecipeCategory(guiHelper)); + registry.addRecipeCategories(new AxeRecipeCategory(guiHelper)); + registry.addRecipeCategories(new ShovelRecipeCategory(guiHelper)); + registry.addRecipeCategories(new HoeRecipeCategory(guiHelper)); + + // + // Tiles + // + registry.addRecipeCategories(new DryingRecipeCategory(guiHelper)); + registry.addRecipeCategories(new HibachiRecipeCategory(guiHelper)); + registry.addRecipeCategories(new SmelterRecipeCategory(guiHelper)); + registry.addRecipeCategories(new CauldronRecipeCategory(guiHelper)); + } + + @Override + public void register(@Nonnull IModRegistry registry) { + jeiHelper = registry.getJeiHelpers(); + guiHelper = jeiHelper.getGuiHelper(); + craftingGridHelper = guiHelper.createCraftingGridHelper(craftInputSlot1, craftOutputSlot); + + this.buildToolLists(); + + // + // Crafting Tables + // + //registry.handleRecipes(TableRecipe.class, new TableRecipeHandler(), VanillaRecipeCategoryUid.CRAFTING); + registry.getRecipeTransferRegistry().addRecipeTransferHandler(new CraftingTableTransfer()); + registry.addRecipeCatalyst(new ItemStack(PrimalAPI.Blocks.WORKTABLE_SHELF, 1, OreDictionary.WILDCARD_VALUE), VanillaRecipeCategoryUid.CRAFTING); + registry.addRecipeCatalyst(new ItemStack(PrimalAPI.Blocks.WORKTABLE_SLAB, 1, OreDictionary.WILDCARD_VALUE), VanillaRecipeCategoryUid.CRAFTING); + + // ***************************************************************************** // + // Tile Recipes + // ***************************************************************************** // + // + // Drying Racks + // + registry.handleRecipes(DryingRecipe.class, new DryingRecipeHandler(), DryingRecipeCategory.CATEGORY); + registry.addRecipes(DryingRecipeChecker.getRecipes(), DryingRecipeCategory.CATEGORY); + // TODO: report to JEI? wildcard does not work for the tab icon + //registry.addRecipeCatalyst(new ItemStack(PrimalAPI.Blocks.DRYING_RACK, 1, OreDictionary.WILDCARD_VALUE), DryingRecipeCategory.CATEGORY); + for (ITypeWood.EnumType type : ITypeWood.EnumType.values()) + registry.addRecipeCatalyst(new ItemStack(PrimalAPI.Blocks.DRYING_RACK, 1, type.getMetadata()), DryingRecipeCategory.CATEGORY); + + // + // Hibachi + // + registry.handleRecipes(HibachiRecipe.class, new HibachiRecipeHandler(), HibachiRecipeCategory.CATEGORY); + registry.addRecipes(HibachiRecipeChecker.getRecipes(), HibachiRecipeCategory.CATEGORY); + for (ITypeMud.EnumType type : ITypeMud.EnumType.values()) + registry.addRecipeCatalyst(new ItemStack(PrimalAPI.Blocks.HIBACHI, 1, type.getMetadata()), HibachiRecipeCategory.CATEGORY); + + // + // Smelter + // + registry.handleRecipes(SmelterRecipe.class, new SmelterRecipeHandler(), SmelterRecipeCategory.CATEGORY); + registry.addRecipes(SmelterRecipeChecker.getRecipes(), SmelterRecipeCategory.CATEGORY); + for (ITypeMud.EnumType type : ITypeMud.EnumType.values()) { + ItemStack stack = new ItemStack(PrimalAPI.Blocks.SMELTER, 1, type.getMetadata()); + NBTTagCompound nbt = new NBTTagCompound(); + stack.setTagInfo("BlockEntityTag", nbt); + nbt.setBoolean("covered", true); + registry.addRecipeCatalyst(stack, SmelterRecipeCategory.CATEGORY); + } + + // + // Cauldron + // + registry.handleRecipes(CauldronRecipe.class, new CauldronRecipeHandler(), CauldronRecipeCategory.CATEGORY); + registry.addRecipes(CauldronRecipeChecker.getRecipes(), CauldronRecipeCategory.CATEGORY); + registry.addRecipeCatalyst(new ItemStack(PrimalAPI.Blocks.CAULDRON), CauldronRecipeCategory.CATEGORY); + + // ***************************************************************************** // + // In-World Tools + // ***************************************************************************** // + // + // Flaking + // + registry.handleRecipes(FlakeRecipe.class, new FlakeRecipeHandler(), FlakeRecipeCategory.CATEGORY); + registry.addRecipes(FlakeRecipeChecker.getRecipes(), FlakeRecipeCategory.CATEGORY); + registry.addRecipeCatalyst(new ItemStack(Blocks.STONE), FlakeRecipeCategory.CATEGORY); + + // + // Gallagher + // + registry.handleRecipes(GallagherRecipe.class, new GallagherRecipeHandler(), GallagherRecipeCategory.CATEGORY); + registry.addRecipes(GallagherRecipeChecker.getRecipes(), GallagherRecipeCategory.CATEGORY); + for (ItemStack stack : gallaghers) + registry.addRecipeCatalyst(stack, GallagherRecipeCategory.CATEGORY); + + // + // Blade + // + registry.handleRecipes(BladeRecipe.class, new BladeRecipeHandler(), BladeRecipeCategory.CATEGORY); + registry.addRecipes(BladeRecipeChecker.getRecipes(), BladeRecipeCategory.CATEGORY); + for (ItemStack stack : blades) + registry.addRecipeCatalyst(stack, BladeRecipeCategory.CATEGORY); + + // + // Axe + // + registry.handleRecipes(AxeRecipe.class, new AxeRecipeHandler(), AxeRecipeCategory.CATEGORY); + registry.addRecipes(AxeRecipeChecker.getRecipes(), AxeRecipeCategory.CATEGORY); + for (ItemStack stack : axes) + registry.addRecipeCatalyst(stack, AxeRecipeCategory.CATEGORY); + + // + // Shovel + // + registry.handleRecipes(ShovelRecipe.class, new ShovelRecipeHandler(), ShovelRecipeCategory.CATEGORY); + registry.addRecipes(ShovelRecipeChecker.getRecipes(), ShovelRecipeCategory.CATEGORY); + for (ItemStack stack : shovels) + registry.addRecipeCatalyst(stack, ShovelRecipeCategory.CATEGORY); + + // + // Hoe + // + registry.handleRecipes(HoeRecipe.class, new HoeRecipeHandler(), HoeRecipeCategory.CATEGORY); + registry.addRecipes(HoeRecipeChecker.getRecipes(), HoeRecipeCategory.CATEGORY); + for (ItemStack stack : hoes) + registry.addRecipeCatalyst(stack, HoeRecipeCategory.CATEGORY); + + // ***************************************************************************** // + // Info + // ***************************************************************************** // + registry.addIngredientInfo(new ItemStack(PrimalAPI.Blocks.FISH_TRAP, 1, OreDictionary.WILDCARD_VALUE), ItemStack.class, "jei.info.primal.fish_trap"); + registry.addIngredientInfo(new ItemStack(PrimalAPI.Blocks.DRYING_RACK, 1, OreDictionary.WILDCARD_VALUE), ItemStack.class, "jei.info.primal.drying_rack"); + registry.addIngredientInfo(new ItemStack(PrimalAPI.Blocks.HIBACHI, 1, OreDictionary.WILDCARD_VALUE), ItemStack.class, "jei.info.primal.hibachi"); + registry.addIngredientInfo(new ItemStack(PrimalAPI.Blocks.SMELTER, 1, OreDictionary.WILDCARD_VALUE), ItemStack.class, "jei.info.primal.smelter"); + registry.addIngredientInfo(new ItemStack(PrimalAPI.Blocks.CAULDRON), ItemStack.class, "jei.info.primal.cauldron"); + + registry.addIngredientInfo(new ItemStack(PrimalAPI.Blocks.STORAGE_CRATE, 1, OreDictionary.WILDCARD_VALUE), ItemStack.class, "jei.info.primal.crate"); + registry.addIngredientInfo(new ItemStack(PrimalAPI.Blocks.BARREL, 1, OreDictionary.WILDCARD_VALUE), ItemStack.class, "jei.info.primal.barrel"); + + registry.addIngredientInfo(new ItemStack(PrimalAPI.Items.PLANT_FIBER), ItemStack.class, "jei.info.primal.plant_fiber", "jei.info.primal.fiber"); + registry.addIngredientInfo(new ItemStack(PrimalAPI.Items.CINERIS_FIBER), ItemStack.class, "jei.info.primal.cineris_fiber", "jei.info.primal.fiber"); + registry.addIngredientInfo(new ItemStack(PrimalAPI.Items.VOID_FIBER), ItemStack.class, "jei.info.primal.ineris_fiber", "jei.info.primal.fiber"); + + registry.addIngredientInfo(RecipeHelper.buildList(new OreIngredient("ladle").getMatchingStacks()), ItemStack.class, "jei.info.primal.ladle"); + registry.addIngredientInfo(RecipeHelper.buildList(new OreIngredient("rock").getMatchingStacks()), ItemStack.class, "jei.info.primal.rocks"); + registry.addIngredientInfo(RecipeHelper.buildList(new OreIngredient("flake").getMatchingStacks()), ItemStack.class, "jei.info.primal.flakes"); + registry.addIngredientInfo(RecipeHelper.buildList(new OreIngredient("pelt").getMatchingStacks()), ItemStack.class, "jei.info.primal.pelts"); + registry.addIngredientInfo(RecipeHelper.buildList(new OreIngredient("hide").getMatchingStacks()), ItemStack.class, "jei.info.primal.hides"); + registry.addIngredientInfo(RecipeHelper.buildList(new OreIngredient("ash").getMatchingStacks()), ItemStack.class, "jei.info.primal.ash"); + registry.addIngredientInfo(RecipeHelper.buildList(new OreIngredient("logStripped").getMatchingStacks()), ItemStack.class, "jei.info.primal.log_stripped"); + registry.addIngredientInfo(RecipeHelper.buildList(new OreIngredient("logSplit").getMatchingStacks()), ItemStack.class, "jei.info.primal.log_split"); + registry.addIngredientInfo(RecipeHelper.buildList(new OreIngredient("logStack").getMatchingStacks()), ItemStack.class, "jei.info.primal.log_stack"); + + registry.addIngredientInfo(new ItemStack(PrimalAPI.Blocks.THATCH_WET), ItemStack.class, "jei.info.primal.wet_block"); + registry.addIngredientInfo(new ItemStack(PrimalAPI.Blocks.MUD_WET), ItemStack.class, "jei.info.primal.wet_block"); + //registry.addIngredientInfo(new ItemStack(PrimalAPI.Items.DARK_LENS_GOGGLES),ItemStack.class,"jei.info.primal.goggles"); + registry.addIngredientInfo(new ItemStack(PrimalAPI.Blocks.IGNIS_FATUUS), ItemStack.class, "jei.info.primal.ignis"); + registry.addIngredientInfo(new ItemStack(PrimalAPI.Items.ACONITE_ROOT), ItemStack.class, "jei.info.primal.aconite"); + registry.addIngredientInfo(new ItemStack(PrimalAPI.Items.CINERIS_SEED), ItemStack.class, "jei.info.primal.cineris"); + registry.addIngredientInfo(new ItemStack(PrimalAPI.Items.VOID_SEED), ItemStack.class, "jei.info.primal.cineris"); + registry.addIngredientInfo(new ItemStack(PrimalAPI.Blocks.SOUL_GLASS), ItemStack.class, "jei.info.primal.soulglass"); + registry.addIngredientInfo(new ItemStack(PrimalAPI.Blocks.PITFALL), ItemStack.class, "jei.info.primal.pitfall"); + registry.addIngredientInfo(new ItemStack(PrimalAPI.Blocks.ANCIENT_ICE), ItemStack.class, "jei.info.primal.ancient_ice"); + registry.addIngredientInfo(new ItemStack(PrimalAPI.Blocks.OVIS_ATRE_WOOL), ItemStack.class, "jei.info.primal.ovis_atre_wool"); + //registry.addIngredientInfo(new ItemStack(PrimalAPI.Blocks.SATETSU),ItemStack.class,"jei.info.primal.satetsu"); + //registry.addIngredientInfo(new ItemStack(PrimalAPI.Blocks.NETHER_GROWTH),ItemStack.class,"jei.info.primal.nethergrowth"); + + registry.addIngredientInfo(new ItemStack(PrimalAPI.Items.DIRT_STICK), ItemStack.class, "jei.info.primal.debug_dirt_stick"); + + this.cleanLists(); + } + + private void buildToolLists() { + for (Item item : ForgeRegistries.ITEMS.getValuesCollection()) { + if (item != null) { + //ItemStack stack = new ItemStack(item); + //if (CommonUtils.isToolEffective(stack, Blocks.PLANKS.getDefaultState())) + if (item instanceof ItemAxe) + axes.add(new ItemStack(item)); + + //if (CommonUtils.isToolEffective(stack, Blocks.DIRT.getDefaultState())) + else if (item instanceof ItemSpade) + shovels.add(new ItemStack(item)); + + else if (item instanceof ItemHoe) + hoes.add(new ItemStack(item)); + + else if (item instanceof WorkBlade) + blades.add(new ItemStack(item)); + + else if (item instanceof Gallagher) + gallaghers.add(new ItemStack(item)); + } + } + } + + private void cleanLists() { + axes.clear(); + shovels.clear(); + hoes.clear(); + blades.clear(); + gallaghers.clear(); + } +} 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 84ff659a..fd28aef1 100644 --- a/kfc/src/main/java/nmd/primal/forgecraft/items/BaseMultiItem.java +++ b/kfc/src/main/java/nmd/primal/forgecraft/items/BaseMultiItem.java @@ -6,14 +6,17 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.SoundEvents; import net.minecraft.item.IItemPropertyGetter; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.SoundCategory; 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.forgecraft.init.ModItems; import javax.annotation.Nullable; @@ -189,10 +192,12 @@ public class BaseMultiItem extends BaseItem { if(entityItem.getItem().hasTagCompound()) { if(entityItem.getItem().getTagCompound().getBoolean("hot")){ entityItem.getItem().getTagCompound().setBoolean("hot", false); + entityItem.getEntityWorld().playSound(null, entityItem.getPosition(), SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.AMBIENT, 1.0F, PrimalAPI.getRandom().nextFloat() * 0.4F + 0.8F); return true; } } } + return 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 deleted file mode 100644 index dfd3a3e7..00000000 --- a/kfc/src/main/java/nmd/primal/forgecraft/items/ItemStoneTongs.java +++ /dev/null @@ -1,920 +0,0 @@ -package nmd.primal.forgecraft.items; - -import net.minecraft.block.material.Material; -import net.minecraft.client.util.ITooltipFlag; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumActionResult; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; -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.BloomeryBase; -import nmd.primal.forgecraft.blocks.Crucibles.Crucible; -import nmd.primal.forgecraft.blocks.Crucibles.CrucibleHot; -import nmd.primal.forgecraft.init.ModBlocks; -import nmd.primal.forgecraft.tiles.TileBaseCrucible; -import nmd.primal.forgecraft.tiles.TileBloomery; - -import javax.annotation.Nullable; -import java.util.List; - -/** - * Created by mminaie on 1/23/17. - */ -/** -public class ItemStoneTongs extends Item { - - public ItemStoneTongs(String unlocalizedName) { - setUnlocalizedName(unlocalizedName); - this.setRegistryName(unlocalizedName); - //this.setMaxDamage(0); - //this.setHasSubtypes(true); //This just says the item has metadata - this.setMaxStackSize(1); - this.setCreativeTab(ModInfo.TAB_FORGECRAFT); - } - - @Override - 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("tags", tags); - - item.getSubCompound("tags").setBoolean("hot", false); - - 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); - - } - } - - - @Override - public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) - { - - /* - 0 | Default StoneTongs - 1 | Empty Crucible Hot - 2 | Empty Crucible Cracked Hot - - ================================ - - 3 | Hot Iron Crucible - 4 | Hot Cooked Iron Crucible - 5 | Hot Failed Iron Crucible - 6 | Hot Iron Ingot - 7 | Hot Iron Chunk - -------------------------------- - 8 | Hot Iron Pickaxe Head - 9 | Hot Iron Axe Head - 10 | Hot Iron Shovel Head - 11 | Hot Iron Hoe Head - - ================================ - - 12 | Hot Clean Iron Crucible - 13 | Hot Cooked Clean Iron Crucible - 14 | Hot Failed Clean Iron Crucible - 15 | Hot Clean Iron Ball - 16 | Hot Clean Iron Chunk - -------------------------------- - 17 | Hot Clean Iron Pickaxe Head - 18 | Hot Clean Iron Axe Head - 19 | Hot Clean Iron Shovel Head - 20 | Hot Clean Iron Hoe Head - - ================================ - - 21 | Hot Steel Crucible - 22 | Hot Cooked Steel Crucible - 23 | Hot Failed Steel Crucible - 24 | Hot Steel Ingot - 25 | Hot Steel Chunk - -------------------------------- - 26 | Hot Steel Pickaxe Head - 27 | Hot Steel Axe Head - 28 | Hot Steel Shovel Head - 29 | Hot Steel Hoe Head - - ================================ - - 30 | Hot Wootz Crucible - 31 | Hot Cooked Wootz Crucible - 32 | Hot Failed Wootz Crucible - 33 | Hot Wootz Ingot - 34 | Hot Wootz Chunk - -------------------------------- - 35 | Hot Wootz Pickaxe Head - 36 | Hot Wootz Axe Head - 37 | Hot Wootz Shovel Head - 38 | Hot Wootz Hoe Head - - ================================ - - 39 | Hot Bronze Crucible - 40 | Hot Cooked Bronze Crucible - 41 | Bronze Pickaxe Head - 42 | Bronze Axe Head - 43 | Bronze Shovel Head - 44 | Bronze Hoe Head - 45 | Hot Bronze Crucible Emerald - 46 | Hot Cooked Bronze Crucible Emerald - 47 | Hot Bronze Crucible Diamond - 48 | Hot Cooked Bronze Crucible Diamond - 49 | Hot Bronze Crucible Redstone - 50 | Hot Cooked Bronze Crucible Redstone - 51 | Hot Bronze Crucible Lapis - 52 | Hot Cooked Bronze Crucible Lapis - - - */ -/* - 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 - *****/ - /* - if (world.getBlockState(pos).getBlock() instanceof BloomeryBase == false) { - if (world.getBlockState(pos).getBlock() instanceof IngotBall) { - if(world.getBlockState(pos).getValue(PrimalAPI.States.ACTIVE) == true) { - if (world.getBlockState(pos).getBlock() == ModBlocks.ironball) { - itemstack.getTagCompound().setInteger("type", 6); - world.setBlockToAir(pos); - return EnumActionResult.SUCCESS; - } - if (world.getBlockState(pos).getBlock() == ModBlocks.ironchunk) { - itemstack.getTagCompound().setInteger("type", 7); - world.setBlockToAir(pos); - return EnumActionResult.SUCCESS; - } - if (world.getBlockState(pos).getBlock() == ModBlocks.ironcleanball) { - itemstack.getTagCompound().setInteger("type", 15); - world.setBlockToAir(pos); - return EnumActionResult.SUCCESS; - } - if (world.getBlockState(pos).getBlock() == ModBlocks.ironcleanchunk) { - itemstack.getTagCompound().setInteger("type", 16); - world.setBlockToAir(pos); - return EnumActionResult.SUCCESS; - } - if (world.getBlockState(pos).getBlock() == ModBlocks.steelball) { - itemstack.getTagCompound().setInteger("type", 24); - world.setBlockToAir(pos); - return EnumActionResult.SUCCESS; - } - if (world.getBlockState(pos).getBlock() == ModBlocks.steelchunk) { - itemstack.getTagCompound().setInteger("type", 25); - world.setBlockToAir(pos); - return EnumActionResult.SUCCESS; - } - // TODO Wootz - } - } - }*/ - - -/***** - Picks Up Hot Crucibles from the Ground - *****/ -/* - if (world.getBlockState(pos).getBlock() instanceof BloomeryBase == false) { - if(world.getBlockState(pos).getBlock() instanceof CrucibleHot) { - TileBaseCrucible tileCrucible = (TileBaseCrucible) world.getTileEntity(pos); - /*************************** - * Crucibles * - ***************************/ -/* - if (world.getBlockState(pos).getBlock() == ModBlocks.emptycruciblehot) { - itemstack.getTagCompound().setInteger("type", 1); - itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown); - world.setBlockToAir(pos); - return EnumActionResult.SUCCESS; - } - if (world.getBlockState(pos).getBlock() == ModBlocks.emptycruciblecrackedhot) { - itemstack.getTagCompound().setInteger("type", 2); - itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown); - world.setBlockToAir(pos); - return EnumActionResult.SUCCESS; - } - /*************************** - * Iron * - ***************************/ - /* - if (world.getBlockState(pos).getBlock() == ModBlocks.hotironcrucible) { - itemstack.getTagCompound().setInteger("type", 3); - itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown); - world.setBlockToAir(pos); - return EnumActionResult.SUCCESS; - } - if (world.getBlockState(pos).getBlock() == ModBlocks.hotcookedironcrucible) { - itemstack.getTagCompound().setInteger("type", 4); - itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown); - world.setBlockToAir(pos); - return EnumActionResult.SUCCESS; - } - if (world.getBlockState(pos).getBlock() == ModBlocks.failedironcruciblehot) { - itemstack.getTagCompound().setInteger("type", 5); - itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown); - 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); - world.setBlockToAir(pos); - return EnumActionResult.SUCCESS; - } - if (world.getBlockState(pos).getBlock() == ModBlocks.hotcookedcleanironcrucible) { - itemstack.getTagCompound().setInteger("type", 13); - itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown); - world.setBlockToAir(pos); - return EnumActionResult.SUCCESS; - } - if (world.getBlockState(pos).getBlock() == ModBlocks.failedcleanironcruciblehot) { - itemstack.getTagCompound().setInteger("type", 14); - itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown); - 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); - world.setBlockToAir(pos); - return EnumActionResult.SUCCESS; - } - if (world.getBlockState(pos).getBlock() == ModBlocks.hotcookedsteelcrucible) { - itemstack.getTagCompound().setInteger("type", 22); - itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown); - world.setBlockToAir(pos); - return EnumActionResult.SUCCESS; - } - if (world.getBlockState(pos).getBlock() == ModBlocks.failedsteelcruciblehot) { - itemstack.getTagCompound().setInteger("type", 23); - itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown); - world.setBlockToAir(pos); - return EnumActionResult.SUCCESS; - } - */ - /* TODO Wootz */ - - - /*************************** - * Bronze * - * - 45 | Hot Bronze Crucible Emerald - 46 | Hot Cooked Bronze Crucible Emerald - 47 | Hot Bronze Crucible Diamond - 48 | Hot Cooked Bronze Crucible Diamond - 49 | Hot Bronze Crucible Redstone - 50 | Hot Cooked Bronze Crucible Redstone - 51 | Hot Bronze Crucible Lapis - 52 | Hot Cooked Bronze Crucible Lapis - ***************************/ - /* - if (world.getBlockState(pos).getBlock() == ModBlocks.hotbronzecrucible) { - itemstack.getTagCompound().setInteger("type", 39); - itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown); - world.setBlockToAir(pos); - return EnumActionResult.SUCCESS; - } - if (world.getBlockState(pos).getBlock() == ModBlocks.hotcookedbronzecrucible) { - itemstack.getTagCompound().setInteger("type", 40); - itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown); - world.setBlockToAir(pos); - return EnumActionResult.SUCCESS; - } - if (world.getBlockState(pos).getBlock() == ModBlocks.hotbronzecrucible_emerald) { - itemstack.getTagCompound().setInteger("type", 45); - itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown); - world.setBlockToAir(pos); - return EnumActionResult.SUCCESS; - } - if (world.getBlockState(pos).getBlock() == ModBlocks.hotcookedbronzecrucible_emerald) { - itemstack.getTagCompound().setInteger("type", 46); - itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown); - world.setBlockToAir(pos); - return EnumActionResult.SUCCESS; - } - if (world.getBlockState(pos).getBlock() == ModBlocks.hotbronzecrucible_diamond) { - itemstack.getTagCompound().setInteger("type", 47); - itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown); - world.setBlockToAir(pos); - return EnumActionResult.SUCCESS; - } - if (world.getBlockState(pos).getBlock() == ModBlocks.hotcookedbronzecrucible_diamond) { - itemstack.getTagCompound().setInteger("type", 48); - itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown); - world.setBlockToAir(pos); - return EnumActionResult.SUCCESS; - } - if (world.getBlockState(pos).getBlock() == ModBlocks.hotbronzecrucible_redstone) { - itemstack.getTagCompound().setInteger("type", 49); - itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown); - world.setBlockToAir(pos); - return EnumActionResult.SUCCESS; - } - if (world.getBlockState(pos).getBlock() == ModBlocks.hotcookedbronzecrucible_redstone) { - itemstack.getTagCompound().setInteger("type", 50); - itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown); - world.setBlockToAir(pos); - return EnumActionResult.SUCCESS; - } - if (world.getBlockState(pos).getBlock() == ModBlocks.hotbronzecrucible_lapis) { - itemstack.getTagCompound().setInteger("type", 51); - itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown); - world.setBlockToAir(pos); - return EnumActionResult.SUCCESS; - } - if (world.getBlockState(pos).getBlock() == ModBlocks.hotcookedbronzecrucible_lapis) { - itemstack.getTagCompound().setInteger("type", 52); - itemstack.getTagCompound().setInteger("cooldown", tileCrucible.countdown); - world.setBlockToAir(pos); - return EnumActionResult.SUCCESS; - } - - } -/***** - Places the content from the Tongs to the World - *****/ - /* - if ((world.getBlockState(pos).getBlock() instanceof Crucible) || (world.getBlockState(pos).getBlock() instanceof CrucibleHot)) { - return EnumActionResult.FAIL; - } else if (world.getBlockState(pos).getMaterial() == Material.ROCK || - world.getBlockState(pos).getMaterial() == Material.SAND || - world.getBlockState(pos).getMaterial() == Material.IRON || - world.getBlockState(pos).getMaterial() == Material.ANVIL ) - { - BlockPos tempPos = new BlockPos(pos.getX(), pos.getY() + 1, pos.getZ()); - if (world.getBlockState(tempPos).getBlock() == Blocks.AIR) { - switch (itemstack.getTagCompound().getInteger("type")) { - case 0: - break; - case 1: - world.setBlockState(tempPos, ModBlocks.emptycruciblehot.getDefaultState(), 2); - TileBaseCrucible tileCrucible1 = (TileBaseCrucible) world.getTileEntity(tempPos); - tileCrucible1.countdown = itemstack.getTagCompound().getInteger("cooldown"); - itemstack.getTagCompound().setInteger("cooldown", 0); - itemstack.getTagCompound().setInteger("type", 0); - return EnumActionResult.SUCCESS; - case 2: - world.setBlockState(tempPos, ModBlocks.emptycruciblecrackedhot.getDefaultState(), 2); - TileBaseCrucible tileCrucible2 = (TileBaseCrucible) world.getTileEntity(tempPos); - tileCrucible2.countdown = itemstack.getTagCompound().getInteger("cooldown"); - itemstack.getTagCompound().setInteger("cooldown", 0); - itemstack.getTagCompound().setInteger("type", 0); - return EnumActionResult.SUCCESS; - /*case 3: - world.setBlockState(tempPos, ModBlocks.hotironcrucible.getDefaultState(), 2); - TileBaseCrucible tileCrucible3 = (TileBaseCrucible) world.getTileEntity(tempPos); - tileCrucible3.countdown = itemstack.getTagCompound().getInteger("cooldown"); - itemstack.getTagCompound().setInteger("cooldown", 0); - itemstack.getTagCompound().setInteger("type", 0); - return EnumActionResult.SUCCESS; - case 4: - world.setBlockState(tempPos, ModBlocks.hotcookedironcrucible.getDefaultState(), 2); - TileBaseCrucible tileCrucible4 = (TileBaseCrucible) world.getTileEntity(tempPos); - tileCrucible4.countdown = itemstack.getTagCompound().getInteger("cooldown"); - itemstack.getTagCompound().setInteger("cooldown", 0); - itemstack.getTagCompound().setInteger("type", 0); - return EnumActionResult.SUCCESS; - case 5: - world.setBlockState(tempPos, ModBlocks.failedironcruciblehot.getDefaultState(), 2); - TileBaseCrucible tileCrucible5 = (TileBaseCrucible) world.getTileEntity(tempPos); - tileCrucible5.countdown = itemstack.getTagCompound().getInteger("cooldown"); - itemstack.getTagCompound().setInteger("cooldown", 0); - itemstack.getTagCompound().setInteger("type", 0); - return EnumActionResult.SUCCESS; - case 6: - world.setBlockState(tempPos, ModBlocks.ironball.getDefaultState().withProperty(PrimalAPI.States.ACTIVE, true), 2); - itemstack.getTagCompound().setInteger("type", 0); - return EnumActionResult.SUCCESS; - case 7: - 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: - return EnumActionResult.FAIL; - case 10: - return EnumActionResult.FAIL; - case 11: - return EnumActionResult.FAIL; - /*case 12: - world.setBlockState(tempPos, ModBlocks.hotcleanironcrucible.getDefaultState(), 2); - TileBaseCrucible tileCrucible12 = (TileBaseCrucible) world.getTileEntity(tempPos); - tileCrucible12.countdown = itemstack.getTagCompound().getInteger("cooldown"); - itemstack.getTagCompound().setInteger("cooldown", 0); - itemstack.getTagCompound().setInteger("type", 0); - return EnumActionResult.SUCCESS; - case 13: - world.setBlockState(tempPos, ModBlocks.hotcookedcleanironcrucible.getDefaultState(), 2); - TileBaseCrucible tileCrucible13 = (TileBaseCrucible) world.getTileEntity(tempPos); - tileCrucible13.countdown = itemstack.getTagCompound().getInteger("cooldown"); - itemstack.getTagCompound().setInteger("cooldown", 0); - itemstack.getTagCompound().setInteger("type", 0); - return EnumActionResult.SUCCESS; - case 14: - world.setBlockState(tempPos, ModBlocks.failedcleanironcruciblehot.getDefaultState(), 2); - TileBaseCrucible tileCrucible14 = (TileBaseCrucible) world.getTileEntity(tempPos); - tileCrucible14.countdown = itemstack.getTagCompound().getInteger("cooldown"); - itemstack.getTagCompound().setInteger("cooldown", 0); - itemstack.getTagCompound().setInteger("type", 0); - return EnumActionResult.SUCCESS; - case 15: - world.setBlockState(tempPos, ModBlocks.ironcleanball.getDefaultState().withProperty(PrimalAPI.States.ACTIVE, true), 2); - itemstack.getTagCompound().setInteger("type", 0); - return EnumActionResult.SUCCESS; - case 16: - 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: - return EnumActionResult.FAIL; - case 19: - return EnumActionResult.FAIL; - case 20: - return EnumActionResult.FAIL; - /* - case 21: - world.setBlockState(tempPos, ModBlocks.hotsteelcrucible.getDefaultState(), 2); - TileBaseCrucible tileCrucible21 = (TileBaseCrucible) world.getTileEntity(tempPos); - tileCrucible21.countdown = itemstack.getTagCompound().getInteger("cooldown"); - itemstack.getTagCompound().setInteger("cooldown", 0); - itemstack.getTagCompound().setInteger("type", 0); - return EnumActionResult.SUCCESS; - case 22: - world.setBlockState(tempPos, ModBlocks.hotcookedsteelcrucible.getDefaultState(), 2); - TileBaseCrucible tileCrucible22 = (TileBaseCrucible) world.getTileEntity(tempPos); - tileCrucible22.countdown = itemstack.getTagCompound().getInteger("cooldown"); - itemstack.getTagCompound().setInteger("cooldown", 0); - itemstack.getTagCompound().setInteger("type", 0); - return EnumActionResult.SUCCESS; - case 23: - world.setBlockState(tempPos, ModBlocks.failedsteelcruciblehot.getDefaultState(), 2); - TileBaseCrucible tileCrucible23 = (TileBaseCrucible) world.getTileEntity(tempPos); - tileCrucible23.countdown = itemstack.getTagCompound().getInteger("cooldown"); - itemstack.getTagCompound().setInteger("cooldown", 0); - itemstack.getTagCompound().setInteger("type", 0); - return EnumActionResult.SUCCESS; - case 24: - world.setBlockState(tempPos, ModBlocks.steelball.getDefaultState().withProperty(PrimalAPI.States.ACTIVE, true), 2); - itemstack.getTagCompound().setInteger("type", 0); - return EnumActionResult.SUCCESS; - case 25: - 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); - tileCrucible39.countdown = itemstack.getTagCompound().getInteger("cooldown"); - itemstack.getTagCompound().setInteger("cooldown", 0); - itemstack.getTagCompound().setInteger("type", 0); - return EnumActionResult.SUCCESS; - case 40: - world.setBlockState(tempPos, ModBlocks.hotcookedbronzecrucible.getDefaultState(), 2); - TileBaseCrucible tileCrucible40 = (TileBaseCrucible) world.getTileEntity(tempPos); - tileCrucible40.countdown = itemstack.getTagCompound().getInteger("cooldown"); - itemstack.getTagCompound().setInteger("cooldown", 0); - itemstack.getTagCompound().setInteger("type", 0); - return EnumActionResult.SUCCESS; - /*************************** - * Bronze * - * - 45 | Hot Bronze Crucible Emerald - 46 | Hot Cooked Bronze Crucible Emerald - 47 | Hot Bronze Crucible Diamond - 48 | Hot Cooked Bronze Crucible Diamond - 49 | Hot Bronze Crucible Redstone - 50 | Hot Cooked Bronze Crucible Redstone - 51 | Hot Bronze Crucible Lapis - 52 | Hot Cooked Bronze Crucible Lapis - ***************************/ - /* - case 45: - world.setBlockState(tempPos, ModBlocks.hotbronzecrucible_emerald.getDefaultState(), 2); - TileBaseCrucible tileCrucible45 = (TileBaseCrucible) world.getTileEntity(tempPos); - tileCrucible45.countdown = itemstack.getTagCompound().getInteger("cooldown"); - itemstack.getTagCompound().setInteger("cooldown", 0); - itemstack.getTagCompound().setInteger("type", 0); - return EnumActionResult.SUCCESS; - case 46: - world.setBlockState(tempPos, ModBlocks.hotcookedbronzecrucible_emerald.getDefaultState(), 2); - TileBaseCrucible tileCrucible46 = (TileBaseCrucible) world.getTileEntity(tempPos); - tileCrucible46.countdown = itemstack.getTagCompound().getInteger("cooldown"); - itemstack.getTagCompound().setInteger("cooldown", 0); - itemstack.getTagCompound().setInteger("type", 0); - return EnumActionResult.SUCCESS; - case 47: - world.setBlockState(tempPos, ModBlocks.hotbronzecrucible_diamond.getDefaultState(), 2); - TileBaseCrucible tileCrucible47 = (TileBaseCrucible) world.getTileEntity(tempPos); - tileCrucible47.countdown = itemstack.getTagCompound().getInteger("cooldown"); - itemstack.getTagCompound().setInteger("cooldown", 0); - itemstack.getTagCompound().setInteger("type", 0); - return EnumActionResult.SUCCESS; - case 48: - world.setBlockState(tempPos, ModBlocks.hotcookedbronzecrucible_diamond.getDefaultState(), 2); - TileBaseCrucible tileCrucible48 = (TileBaseCrucible) world.getTileEntity(tempPos); - tileCrucible48.countdown = itemstack.getTagCompound().getInteger("cooldown"); - itemstack.getTagCompound().setInteger("cooldown", 0); - itemstack.getTagCompound().setInteger("type", 0); - return EnumActionResult.SUCCESS; - case 49: - world.setBlockState(tempPos, ModBlocks.hotbronzecrucible_redstone.getDefaultState(), 2); - TileBaseCrucible tileCrucible49 = (TileBaseCrucible) world.getTileEntity(tempPos); - tileCrucible49.countdown = itemstack.getTagCompound().getInteger("cooldown"); - itemstack.getTagCompound().setInteger("cooldown", 0); - itemstack.getTagCompound().setInteger("type", 0); - return EnumActionResult.SUCCESS; - case 50: - world.setBlockState(tempPos, ModBlocks.hotcookedbronzecrucible_redstone.getDefaultState(), 2); - TileBaseCrucible tileCrucible50 = (TileBaseCrucible) world.getTileEntity(tempPos); - tileCrucible50.countdown = itemstack.getTagCompound().getInteger("cooldown"); - itemstack.getTagCompound().setInteger("cooldown", 0); - itemstack.getTagCompound().setInteger("type", 0); - return EnumActionResult.SUCCESS; - case 51: - world.setBlockState(tempPos, ModBlocks.hotbronzecrucible_lapis.getDefaultState(), 2); - TileBaseCrucible tileCrucible51 = (TileBaseCrucible) world.getTileEntity(tempPos); - tileCrucible51.countdown = itemstack.getTagCompound().getInteger("cooldown"); - itemstack.getTagCompound().setInteger("cooldown", 0); - itemstack.getTagCompound().setInteger("type", 0); - return EnumActionResult.SUCCESS; - case 52: - world.setBlockState(tempPos, ModBlocks.hotcookedbronzecrucible_lapis.getDefaultState(), 2); - TileBaseCrucible tileCrucible52 = (TileBaseCrucible) world.getTileEntity(tempPos); - tileCrucible52.countdown = itemstack.getTagCompound().getInteger("cooldown"); - itemstack.getTagCompound().setInteger("cooldown", 0); - itemstack.getTagCompound().setInteger("type", 0); - return EnumActionResult.SUCCESS; - } - } - } - } -/***** - Pulls the crucible from the Bloomery - *****/ - /* - if (world.getBlockState(pos).getBlock() instanceof BloomeryBase) { - if (itemstack.getTagCompound().getInteger("type") == 0) { - TileBloomery tile = (TileBloomery) world.getTileEntity(pos); - if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.emptycruciblehot))) { - itemstack.getTagCompound().setInteger("type", 1); - itemstack.getTagCompound().setInteger("cooldown", 0); - tile.setSlotStack(1, ItemStack.EMPTY); - return EnumActionResult.SUCCESS; - } else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.emptycruciblecrackedhot))) { - itemstack.getTagCompound().setInteger("cooldown", 0); - 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); - tile.setSlotStack(1, ItemStack.EMPTY); - return EnumActionResult.SUCCESS; - } else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotcookedironcrucible))) { - itemstack.getTagCompound().setInteger("cooldown", 0); - itemstack.getTagCompound().setInteger("type", 4); - tile.setSlotStack(1, ItemStack.EMPTY); - return EnumActionResult.SUCCESS; - } else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.failedironcruciblehot))) { - itemstack.getTagCompound().setInteger("cooldown", 0); - itemstack.getTagCompound().setInteger("type", 5); - tile.setSlotStack(1, ItemStack.EMPTY); - return EnumActionResult.SUCCESS; - } else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotcleanironcrucible))) { - itemstack.getTagCompound().setInteger("cooldown", 0); - itemstack.getTagCompound().setInteger("type", 12); - tile.setSlotStack(1, ItemStack.EMPTY); - return EnumActionResult.SUCCESS; - } else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotcookedcleanironcrucible))) { - itemstack.getTagCompound().setInteger("cooldown", 0); - itemstack.getTagCompound().setInteger("type", 13); - tile.setSlotStack(1, ItemStack.EMPTY); - return EnumActionResult.SUCCESS; - } else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.failedcleanironcrucible))) { - itemstack.getTagCompound().setInteger("cooldown", 0); - itemstack.getTagCompound().setInteger("type", 14); - tile.setSlotStack(1, ItemStack.EMPTY); - return EnumActionResult.SUCCESS; - } else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotsteelcrucible))) { - itemstack.getTagCompound().setInteger("cooldown", 0); - itemstack.getTagCompound().setInteger("type", 21); - tile.setSlotStack(1, ItemStack.EMPTY); - return EnumActionResult.SUCCESS; - } else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotcookedsteelcrucible))) { - itemstack.getTagCompound().setInteger("cooldown", 0); - itemstack.getTagCompound().setInteger("type", 22); - tile.setSlotStack(1, ItemStack.EMPTY); - return EnumActionResult.SUCCESS; - } else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.failedsteelcrucible))) { - itemstack.getTagCompound().setInteger("cooldown", 0); - 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); - tile.setSlotStack(1, ItemStack.EMPTY); - return EnumActionResult.SUCCESS; - } else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotcookedbronzecrucible))) { - itemstack.getTagCompound().setInteger("cooldown", 0); - itemstack.getTagCompound().setInteger("type", 40); - tile.setSlotStack(1, ItemStack.EMPTY); - return EnumActionResult.SUCCESS; - /*************************** - * Bronze * - * - 45 | Hot Bronze Crucible Emerald - 46 | Hot Cooked Bronze Crucible Emerald - 47 | Hot Bronze Crucible Diamond - 48 | Hot Cooked Bronze Crucible Diamond - 49 | Hot Bronze Crucible Redstone - 50 | Hot Cooked Bronze Crucible Redstone - 51 | Hot Bronze Crucible Lapis - 52 | Hot Cooked Bronze Crucible Lapis - ***************************/ - /* - } else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotbronzecrucible_emerald))) { - itemstack.getTagCompound().setInteger("cooldown", 0); - itemstack.getTagCompound().setInteger("type", 45); - tile.setSlotStack(1, ItemStack.EMPTY); - return EnumActionResult.SUCCESS; - } else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotcookedbronzecrucible_emerald))) { - itemstack.getTagCompound().setInteger("cooldown", 0); - itemstack.getTagCompound().setInteger("type", 46); - tile.setSlotStack(1, ItemStack.EMPTY); - return EnumActionResult.SUCCESS; - } else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotbronzecrucible_diamond))) { - itemstack.getTagCompound().setInteger("cooldown", 0); - itemstack.getTagCompound().setInteger("type", 47); - tile.setSlotStack(1, ItemStack.EMPTY); - return EnumActionResult.SUCCESS; - } else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotcookedbronzecrucible_diamond))) { - itemstack.getTagCompound().setInteger("cooldown", 0); - itemstack.getTagCompound().setInteger("type", 48); - tile.setSlotStack(1, ItemStack.EMPTY); - return EnumActionResult.SUCCESS; - } else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotbronzecrucible_redstone))) { - itemstack.getTagCompound().setInteger("cooldown", 0); - itemstack.getTagCompound().setInteger("type", 49); - tile.setSlotStack(1, ItemStack.EMPTY); - return EnumActionResult.SUCCESS; - } else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotcookedbronzecrucible_redstone))) { - itemstack.getTagCompound().setInteger("cooldown", 0); - itemstack.getTagCompound().setInteger("type", 50); - tile.setSlotStack(1, ItemStack.EMPTY); - return EnumActionResult.SUCCESS; - } else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotbronzecrucible_lapis))) { - itemstack.getTagCompound().setInteger("cooldown", 0); - itemstack.getTagCompound().setInteger("type", 51); - tile.setSlotStack(1, ItemStack.EMPTY); - return EnumActionResult.SUCCESS; - } else if (tile.getSlotStack(1).getItem().equals(Item.getItemFromBlock(ModBlocks.hotcookedbronzecrucible_lapis))) { - itemstack.getTagCompound().setInteger("cooldown", 0); - itemstack.getTagCompound().setInteger("type", 52); - tile.setSlotStack(1, ItemStack.EMPTY); - return EnumActionResult.SUCCESS; - } - - } - } - -/***** - Pulls the Tool Parts from the Forge - *****/ - /*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++) { - 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)) { - if(tile.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == true) { - itemstack.getTagCompound().setInteger("type", 8); - NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy(); - itemstack.getTagCompound().setTag("tags", tags); - itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage()); - //itemstack.getSubCompound("tags").setBoolean("hot", true); - tile.setSlotStack(i, ItemStack.EMPTY); - return EnumActionResult.SUCCESS; - } - } - if (tile.getSlotStack(i).getItem().equals(ModItems.ironaxehead)) { - if(tile.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == true) { - itemstack.getTagCompound().setInteger("type", 9); - NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy(); - itemstack.getTagCompound().setTag("tags", tags); - itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage()); - //itemstack.getSubCompound("tags").setBoolean("hot", true); - tile.setSlotStack(i, ItemStack.EMPTY); - return EnumActionResult.SUCCESS; - } - } - if (tile.getSlotStack(i).getItem().equals(ModItems.ironshovelhead)) { - if(tile.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == true) { - itemstack.getTagCompound().setInteger("type", 10); - NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy(); - itemstack.getTagCompound().setTag("tags", tags); - itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage()); - //itemstack.getSubCompound("tags").setBoolean("hot", true); - tile.setSlotStack(i, ItemStack.EMPTY); - return EnumActionResult.SUCCESS; - } - } - if (tile.getSlotStack(i).getItem().equals(ModItems.ironhoehead)) { - if(tile.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == true) { - itemstack.getTagCompound().setInteger("type", 11); - NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy(); - itemstack.getTagCompound().setTag("tags", tags); - itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage()); - //itemstack.getSubCompound("tags").setBoolean("hot", true); - tile.setSlotStack(i, ItemStack.EMPTY); - return EnumActionResult.SUCCESS; - } - } - - if (tile.getSlotStack(i).getItem().equals(ModItems.ironcleanchunkhot)) { - tile.setSlotStack(i, ItemStack.EMPTY); - itemstack.getTagCompound().setInteger("type", 16); - return EnumActionResult.SUCCESS; - } - if (tile.getSlotStack(i).getItem().equals(ModItems.ironcleaningotballhot)) { - tile.setSlotStack(i, ItemStack.EMPTY); - itemstack.getTagCompound().setInteger("type", 15); - return EnumActionResult.SUCCESS; - } - if (tile.getSlotStack(i).getItem().equals(ModItems.cleanironpickaxehead)) { - if(tile.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == true) { - itemstack.getTagCompound().setInteger("type", 17); - NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy(); - itemstack.getTagCompound().setTag("tags", tags); - itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage()); - //itemstack.getSubCompound("tags").setBoolean("hot", true); - tile.setSlotStack(i, ItemStack.EMPTY); - return EnumActionResult.SUCCESS; - } - } - if (tile.getSlotStack(i).getItem().equals(ModItems.cleanironaxehead)) { - if(tile.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == true) { - itemstack.getTagCompound().setInteger("type", 18); - NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy(); - itemstack.getTagCompound().setTag("tags", tags); - itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage()); - //itemstack.getSubCompound("tags").setBoolean("hot", true); - tile.setSlotStack(i, ItemStack.EMPTY); - return EnumActionResult.SUCCESS; - } - } - if (tile.getSlotStack(i).getItem().equals(ModItems.cleanironshovelhead)) { - if(tile.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == true) { - itemstack.getTagCompound().setInteger("type", 19); - NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy(); - itemstack.getTagCompound().setTag("tags", tags); - itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage()); - //itemstack.getSubCompound("tags").setBoolean("hot", true); - tile.setSlotStack(i, ItemStack.EMPTY); - return EnumActionResult.SUCCESS; - } - } - if (tile.getSlotStack(i).getItem().equals(ModItems.cleanironhoehead)) { - if(tile.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == true) { - itemstack.getTagCompound().setInteger("type", 20); - NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy(); - itemstack.getTagCompound().setTag("tags", tags); - itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage()); - //itemstack.getSubCompound("tags").setBoolean("hot", true); - tile.setSlotStack(i, ItemStack.EMPTY); - return EnumActionResult.SUCCESS; - } - } - - if (tile.getSlotStack(i).getItem().equals(ModItems.steelchunkhot)) { - tile.setSlotStack(i, ItemStack.EMPTY); - itemstack.getTagCompound().setInteger("type", 25); - return EnumActionResult.SUCCESS; - } - if (tile.getSlotStack(i).getItem().equals(ModItems.steelingotballhot)) { - tile.setSlotStack(i, ItemStack.EMPTY); - itemstack.getTagCompound().setInteger("type", 24); - return EnumActionResult.SUCCESS; - } - if (tile.getSlotStack(i).getItem().equals(ModItems.steelpickaxehead)) { - if(tile.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == true) { - itemstack.getTagCompound().setInteger("type", 26); - NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy(); - itemstack.getTagCompound().setTag("tags", tags); - itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage()); - //itemstack.getSubCompound("tags").setBoolean("hot", true); - tile.setSlotStack(i, ItemStack.EMPTY); - return EnumActionResult.SUCCESS; - } - } - if (tile.getSlotStack(i).getItem().equals(ModItems.steelaxehead)) { - if(tile.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == true) { - itemstack.getTagCompound().setInteger("type", 27); - NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy(); - itemstack.getTagCompound().setTag("tags", tags); - itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage()); - //itemstack.getSubCompound("tags").setBoolean("hot", true); - tile.setSlotStack(i, ItemStack.EMPTY); - return EnumActionResult.SUCCESS; - } - } - if (tile.getSlotStack(i).getItem().equals(ModItems.steelshovelhead)) { - if(tile.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == true) { - itemstack.getTagCompound().setInteger("type", 28); - NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy(); - itemstack.getTagCompound().setTag("tags", tags); - itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage()); - //itemstack.getSubCompound("tags").setBoolean("hot", true); - tile.setSlotStack(i, ItemStack.EMPTY); - return EnumActionResult.SUCCESS; - } - } - if (tile.getSlotStack(i).getItem().equals(ModItems.steelhoehead)) { - if(tile.getSlotStack(i).getSubCompound("tags").getBoolean("hot") == true) { - itemstack.getTagCompound().setInteger("type", 29); - NBTTagCompound tags = tile.getSlotStack(i).getSubCompound("tags").copy(); - itemstack.getTagCompound().setTag("tags", tags); - itemstack.getTagCompound().setInteger("tempDamage", tile.getSlotStack(i).getItemDamage()); - //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")); - } - //System.out.println(player.getHeldItem(hand).getTagCompound().getInteger("type")); - return EnumActionResult.SUCCESS; - - } - - @Override - @SideOnly(Side.CLIENT) - public void addInformation(ItemStack stack, @Nullable World worldIn, List tooltip, ITooltipFlag flagIn) - { - //tooltip.add(ChatFormatting.BLUE + "NBT: " + item.getSubCompound("tags")); - //tooltip.add(ChatFormatting.RED + "NBT: " + item.getTagCompound().getInteger("type")); - } - -} -**/ \ No newline at end of file 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 59ac07b6..44e9e042 100644 --- a/kfc/src/main/java/nmd/primal/forgecraft/items/SlottedTongs.java +++ b/kfc/src/main/java/nmd/primal/forgecraft/items/SlottedTongs.java @@ -5,6 +5,7 @@ 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.SoundEvents; import net.minecraft.item.IItemPropertyGetter; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; @@ -14,12 +15,15 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.*; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; 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.PrimalCore; +import nmd.primal.core.common.helper.FluidHelper; import nmd.primal.core.common.helper.NBTHelper; import nmd.primal.core.common.helper.PlayerHelper; import nmd.primal.core.common.tiles.AbstractTileTank; @@ -286,141 +290,151 @@ public class SlottedTongs extends Item implements IPickup, AnvilHandler{ public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing face, float hitx, float hity, float hitz) { if(!world.isRemote){ - //if (hand.equals(player.swingingHand)) { - IBlockState state = world.getBlockState(pos); - Block block = world.getBlockState(pos).getBlock(); - ItemStack itemstack = player.getHeldItem(hand); + //if (hand.equals(player.swingingHand)) { + IBlockState state = world.getBlockState(pos); + Block block = world.getBlockState(pos).getBlock(); + ItemStack itemstack = player.getHeldItem(hand); + ItemStack slotStack = slotList.get(0); - if (block instanceof AnvilStone) { - TileAnvil tile = (TileAnvil) world.getTileEntity(pos); - doAnvilInventoryManager(itemstack, world, tile, pos, hitx, hity, hitz, state, player); + if (block instanceof AnvilStone) { + TileAnvil tile = (TileAnvil) world.getTileEntity(pos); + doAnvilInventoryManager(itemstack, world, tile, pos, hitx, hity, hitz, state, player); + return EnumActionResult.SUCCESS; + } + + 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()) { - 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)); + } + if (!slotList.get(0).isEmpty()) { + if (slotList.get(0).getItem() instanceof ItemNBTCrucible) { + NBTTagCompound tag = this.slotList.get(0).getSubCompound("BlockEntityTag").copy(); + NBTTagCompound defaultNBT = this.slotList.get(0).getTagCompound(); + 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; } } - if (!slotList.get(0).isEmpty()) { - if (slotList.get(0).getItem() instanceof ItemNBTCrucible) { - NBTTagCompound tag = this.slotList.get(0).getSubCompound("BlockEntityTag").copy(); - NBTTagCompound defaultNBT = this.slotList.get(0).getTagCompound(); - 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); + } + + /***** + TAKES anything out from the Forge + *****/ + if (slotList.get(0).isEmpty()) { + if (world.getBlockState(pos).getBlock() instanceof Forge) { + TileForge tile = (TileForge) world.getTileEntity(pos); + for (int i = 2; i < tile.getSlotListSize(); i++) { + if (tile.getSlotStack(i) != ItemStack.EMPTY) { + ItemStack tempStack = tile.getSlotStack(i).copy(); + //System.out.println(tempStack); + slotList.set(0, tempStack); + tile.setSlotStack(i, ItemStack.EMPTY); + //System.out.println(slotList.get(0)); return EnumActionResult.SUCCESS; } } } + } - /***** - TAKES anything out from the Forge - *****/ - if (slotList.get(0).isEmpty()) { - if (world.getBlockState(pos).getBlock() instanceof Forge) { - TileForge tile = (TileForge) world.getTileEntity(pos); + /***** + 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 = 2; i < tile.getSlotListSize(); i++) { - if (tile.getSlotStack(i) != ItemStack.EMPTY) { - ItemStack tempStack = tile.getSlotStack(i).copy(); - System.out.println(tempStack); - slotList.set(0, tempStack); - tile.setSlotStack(i, ItemStack.EMPTY); - System.out.println(slotList.get(0)); - 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 = 2; i < tile.getSlotListSize(); i++) { - ItemStack tempStack = slotList.get(0).copy(); - tile.setSlotStack(i, tempStack); - slotList.set(0, ItemStack.EMPTY); - return EnumActionResult.SUCCESS; - } - } - } - } - /***** - PUTS the ToolParts 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); + tile.setSlotStack(i, tempStack); slotList.set(0, ItemStack.EMPTY); return EnumActionResult.SUCCESS; } } } + } + /***** + PUTS the ToolParts into the Forge + *****/ - /***** - DROPS the ToolParts into the World - *****/ - if (!slotList.get(0).isEmpty()) { - if (!(block instanceof AnvilBase)) { - 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; - } - } - } - if (!slotList.get(0).isEmpty()) { - if ((block.equals(Blocks.HOPPER))) { - if (slotList.get(0).getItem() instanceof BaseMultiItem) { - ItemStack tempStack = slotList.get(0).copy(); - PlayerHelper.spawnItemOnGround(world, pos, tempStack); - slotList.set(0, ItemStack.EMPTY); - return EnumActionResult.SUCCESS; - } - } - } - /***** - Cools the Ingots on the Tongs - *****/ - /*if (!slotList.get(0).isEmpty()) { - System.out.println(world.getBlockState(pos).getBlock()); - if (world.getBlockState(pos).getBlock() == PrimalAPI.Blocks.BARREL) { - AbstractTileTank tileTank = (AbstractTileTank) world.getTileEntity(pos); - System.out.println(tileTank.getContainedFluid()); + 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; } } - */ - /***** - DROPS the Ingots into the World - *****/ - if (!slotList.get(0).isEmpty()) { - if (!(block instanceof AnvilBase)) { - if (slotList.get(0).getItem() instanceof BaseMultiItem) { + } + + /***** + DROPS the ToolParts into the World + *****/ + if (!slotList.get(0).isEmpty()) { + if (!(block instanceof AnvilBase)) { + 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; + } + } + } + if (!slotList.get(0).isEmpty()) { + if ((block.equals(Blocks.HOPPER))) { + if (slotList.get(0).getItem() instanceof BaseMultiItem) { + ItemStack tempStack = slotList.get(0).copy(); + PlayerHelper.spawnItemOnGround(world, pos, tempStack); + slotList.set(0, ItemStack.EMPTY); + return EnumActionResult.SUCCESS; + } + } + } + + /***** + Cools the Ingots on the Tongs + *****/ + if (!slotList.get(0).isEmpty()) { + if (world.getBlockState(pos).getBlock() == PrimalAPI.Blocks.BARREL) { + AbstractTileTank tileTank = (AbstractTileTank) world.getTileEntity(pos); + if (slotStack.getTagCompound().getBoolean("hot")) { + if (tileTank.getContainedFluid().getFluid().equals(FluidRegistry.WATER) || + tileTank.getContainedFluid().getFluid().equals(PrimalAPI.Fluids.RAIN_WATER) + ) { ItemStack tempStack = slotList.get(0).copy(); + tempStack.getTagCompound().setBoolean("hot", false); + slotList.set(0, ItemStack.EMPTY); PlayerHelper.spawnItemOnGround(world, pos, tempStack); + world.playSound(null, pos, SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.AMBIENT, 1.0F, PrimalAPI.getRandom().nextFloat() * 0.4F + 0.8F); slotList.set(0, ItemStack.EMPTY); return EnumActionResult.SUCCESS; } } } + } - + /***** + DROPS the Ingots into the World + *****/ + if (!slotList.get(0).isEmpty()) { + if (!(block instanceof AnvilBase)) { + if (slotList.get(0).getItem() instanceof BaseMultiItem) { + 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;