Posted April 6, 201411 yr Alright, allow me elaborate on my dilemma. I'm making a mod and two furnaces are being used in (more in the future). I successfully got the first to work (IronFurnace), but when I tried this morning to add the Gold Furnace, it crashed. I went through all the code and fixed a few things, corrected some Render ID Conflictions, but still came out with an in-game error. While in-game, I could successfully open and use the Gold Furnace. When I went to open the Iron Furnace it lagged, crashed and then posted error The Error is below: ---- Minecraft Crash Report ---- // Oops. Time: 4/6/14 2:31 PM Description: Ticking memory connection java.lang.ClassCastException: com.volt.dev.morefurnaces.ironfurnace.TileEntityIronOven cannot be cast to com.volt.dev.morefurnaces.goldfurnace.TileEntityGoldOven at com.volt.dev.morefurnaces.goldfurnace.GuiHandlerGoldOven.getServerGuiElement(GuiHandlerGoldOven.java:16) at cpw.mods.fml.common.network.NetworkRegistry.getRemoteGuiContainer(NetworkRegistry.java:241) at cpw.mods.fml.common.network.internal.FMLNetworkHandler.openGui(FMLNetworkHandler.java:75) at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2510) at com.volt.dev.morefurnaces.ironfurnace.IronOven.onBlockActivated(IronOven.java:142) at net.minecraft.server.management.ItemInWorldManager.activateBlockOrUseItem(ItemInWorldManager.java:405) at net.minecraft.network.NetHandlerPlayServer.processPlayerBlockPlacement(NetHandlerPlayServer.java:588) at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:74) at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:122) at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:232) at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182) at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:714) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:602) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:481) at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:739) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Stacktrace: at com.volt.dev.morefurnaces.goldfurnace.GuiHandlerGoldOven.getServerGuiElement(GuiHandlerGoldOven.java:16) at cpw.mods.fml.common.network.NetworkRegistry.getRemoteGuiContainer(NetworkRegistry.java:241) at cpw.mods.fml.common.network.internal.FMLNetworkHandler.openGui(FMLNetworkHandler.java:75) at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2510) at com.volt.dev.morefurnaces.ironfurnace.IronOven.onBlockActivated(IronOven.java:142) at net.minecraft.server.management.ItemInWorldManager.activateBlockOrUseItem(ItemInWorldManager.java:405) at net.minecraft.network.NetHandlerPlayServer.processPlayerBlockPlacement(NetHandlerPlayServer.java:588) at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:74) at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:122) at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:232) -- Ticking connection -- Details: Connection: net.minecraft.network.NetworkManager@2723d920 Stacktrace: at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182) at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:714) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:602) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:481) at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:739) -- System Details -- Details: Minecraft Version: 1.7.2 Operating System: Windows 8.1 (amd64) version 6.3 Java Version: 1.8.0, Oracle Corporation Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 935844088 bytes (892 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB) JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M AABB Pool Size: 5004 (280224 bytes; 0 MB) allocated, 4768 (267008 bytes; 0 MB) used IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0 FML: MCP v9.01-pre FML v7.2.137.1054 Minecraft Forge 10.12.0.1054 4 mods loaded, 4 mods active mcp{8.09} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available FML{7.2.137.1054} [Forge Mod Loader] (forgeSrc-1.7.2-10.12.0.1054.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available Forge{10.12.0.1054} [Minecraft Forge] (forgeSrc-1.7.2-10.12.0.1054.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available MoreFurnaces{ALPHA 2.0} [Mo' Furnaces] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available Profiler Position: N/A (disabled) Vec3 Pool Size: 623 (34888 bytes; 0 MB) allocated, 594 (33264 bytes; 0 MB) used Player Count: 1 / 8; [EntityPlayerMP['Player703'/260, l='Furnace Testing', x=-957.48, y=4.00, z=250.78]] Type: Integrated Server (map_client.txt) Is Modded: Definitely; Client brand changed to 'fml,forge' #@!@# Game crashed! Crash report saved to: #@!@# .\crash-reports\crash-2014-04-06_14.31.43-server.txt [14:31:43] [Client Shutdown Thread/INFO]: Stopping server [14:31:43] [Client Shutdown Thread/INFO]: Saving players The code is in the spoilers below: Main Class File package com.volt.dev.morefurnaces.main; import net.minecraft.block.Block; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import com.volt.dev.morefurnaces.goldfurnace.GoldOven; import com.volt.dev.morefurnaces.goldfurnace.GuiHandlerGoldOven; import com.volt.dev.morefurnaces.goldfurnace.RenderGoldOven; import com.volt.dev.morefurnaces.goldfurnace.TileEntityGoldOven; import com.volt.dev.morefurnaces.ironfurnace.GuiHandlerIronOven; import com.volt.dev.morefurnaces.ironfurnace.IronOven; import com.volt.dev.morefurnaces.ironfurnace.RenderIronOven; import com.volt.dev.morefurnaces.ironfurnace.TileEntityIronOven; import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.common.registry.GameRegistry; @Mod(modid = "MoreFurnaces", name = "Mo' Furnaces", version = "ALPHA 2.0") public class MoreFurnaces { @SidedProxy(clientSide = "com.volt.dev.morefurnaces.main.ClientProxy", serverSide = "com.volt.dev.morefurnaces.main.CommonProxy") public static CommonProxy proxy; @Instance("MoreFurnaces") public static MoreFurnaces instance; // Iron Furnace private GuiHandlerIronOven guiHandlerIronOven = new GuiHandlerIronOven(); public static Block ironOven; public static Block ironOvenActive; // Gold Furnace private GuiHandlerGoldOven guiHandlerFurnace = new GuiHandlerGoldOven(); public static Block goldOven; public static Block goldOvenActive; @EventHandler public void load(FMLInitializationEvent event) { // Iron Furnace ironOven = new IronOven(3000, false).setHardness(4.0F).setResistance(15.0F).setBlockName("ironOven").setCreativeTab(CreativeTabs.tabBlock); ironOvenActive = new IronOven(3001, true).setHardness(4.0F).setResistance(15.0F).setBlockName("ironOvenActive"); GameRegistry.registerBlock(ironOven, "ironOven"); GameRegistry.registerBlock(ironOvenActive, "ironOvenActive"); GameRegistry.registerTileEntity(TileEntityIronOven.class, "tileEntityIronOven"); GameRegistry.addRecipe(new ItemStack(ironOven, 1), new Object[] { "AAA", "A A", "AAA", 'A', Items.iron_ingot }); RenderingRegistry.registerBlockHandler(2105, RenderIronOven.INSTANCE); NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandlerIronOven()); //Gold Furnace goldOven = new GoldOven(3500, false).setHardness(2.0F).setResistance(5.0F).setBlockName("goldOven").setCreativeTab(CreativeTabs.tabBlock); goldOvenActive = new GoldOven(3501, true).setHardness(2.0F).setResistance(5.0F).setBlockName("goldOvenActive"); GameRegistry.registerBlock(goldOven, "goldOven"); GameRegistry.registerBlock(goldOvenActive, "goldOvenActive"); GameRegistry.registerTileEntity(TileEntityGoldOven.class, "tileEntityGoldOven"); GameRegistry.addRecipe(new ItemStack(goldOven, 1), new Object[] { "AAA", "A A", "AAA", 'A', Items.gold_ingot }); RenderingRegistry.registerBlockHandler(2106, RenderGoldOven.INSTANCE); NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandlerGoldOven()); } @EventHandler public void PostInit(FMLPostInitializationEvent event) { } } IRON FURNACE ContainerIronOven package com.volt.dev.morefurnaces.ironfurnace; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.ICrafting; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class ContainerIronOven extends Container { private TileEntityIronOven tileFurnace; private int lastCookTime; private int lastBurnTime; private int lastItemBurnTime; private static final String __OBFID = "CL_00001748"; public ContainerIronOven(InventoryPlayer par1InventoryPlayer, TileEntityIronOven par2TileEntityIronOven) { this.tileFurnace = par2TileEntityIronOven; this.addSlotToContainer(new Slot(par2TileEntityIronOven, 0, 56, 17)); this.addSlotToContainer(new Slot(par2TileEntityIronOven, 1, 56, 53)); this.addSlotToContainer(new SlotIronOven(par1InventoryPlayer.player, par2TileEntityIronOven, 2, 116, 35)); int i; for (i = 0; i < 3; ++i) { for (int j = 0; j < 9; ++j) { this.addSlotToContainer(new Slot(par1InventoryPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); } } for (i = 0; i < 9; ++i) { this.addSlotToContainer(new Slot(par1InventoryPlayer, i, 8 + i * 18, 142)); } } public void addCraftingToCrafters(ICrafting par1ICrafting) { super.addCraftingToCrafters(par1ICrafting); par1ICrafting.sendProgressBarUpdate(this, 0, this.tileFurnace.furnaceCookTime); par1ICrafting.sendProgressBarUpdate(this, 1, this.tileFurnace.furnaceBurnTime); par1ICrafting.sendProgressBarUpdate(this, 2, this.tileFurnace.currentItemBurnTime); } /** * Looks for changes made in the container, sends them to every listener. */ public void detectAndSendChanges() { super.detectAndSendChanges(); for (int i = 0; i < this.crafters.size(); ++i) { ICrafting icrafting = (ICrafting)this.crafters.get(i); if (this.lastCookTime != this.tileFurnace.furnaceCookTime) { icrafting.sendProgressBarUpdate(this, 0, this.tileFurnace.furnaceCookTime); } if (this.lastBurnTime != this.tileFurnace.furnaceBurnTime) { icrafting.sendProgressBarUpdate(this, 1, this.tileFurnace.furnaceBurnTime); } if (this.lastItemBurnTime != this.tileFurnace.currentItemBurnTime) { icrafting.sendProgressBarUpdate(this, 2, this.tileFurnace.currentItemBurnTime); } } this.lastCookTime = this.tileFurnace.furnaceCookTime; this.lastBurnTime = this.tileFurnace.furnaceBurnTime; this.lastItemBurnTime = this.tileFurnace.currentItemBurnTime; } @SideOnly(Side.CLIENT) public void updateProgressBar(int par1, int par2) { if (par1 == 0) { this.tileFurnace.furnaceCookTime = par2; } if (par1 == 1) { this.tileFurnace.furnaceBurnTime = par2; } if (par1 == 2) { this.tileFurnace.currentItemBurnTime = par2; } } public boolean canInteractWith(EntityPlayer par1EntityPlayer) { return this.tileFurnace.isUseableByPlayer(par1EntityPlayer); } /** * Called when a player shift-clicks on a slot. You must override this or you will crash when someone does that. */ public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) { ItemStack itemstack = null; Slot slot = (Slot)this.inventorySlots.get(par2); if (slot != null && slot.getHasStack()) { ItemStack itemstack1 = slot.getStack(); itemstack = itemstack1.copy(); if (par2 == 2) { if (!this.mergeItemStack(itemstack1, 3, 39, true)) { return null; } slot.onSlotChange(itemstack1, itemstack); } else if (par2 != 1 && par2 != 0) { if (IronOvenRecipes.smelting().getSmeltingResult(itemstack1) != null) { if (!this.mergeItemStack(itemstack1, 0, 1, false)) { return null; } } else if (TileEntityIronOven.isItemFuel(itemstack1)) { if (!this.mergeItemStack(itemstack1, 1, 2, false)) { return null; } } else if (par2 >= 3 && par2 < 30) { if (!this.mergeItemStack(itemstack1, 30, 39, false)) { return null; } } else if (par2 >= 30 && par2 < 39 && !this.mergeItemStack(itemstack1, 3, 30, false)) { return null; } } else if (!this.mergeItemStack(itemstack1, 3, 39, false)) { return null; } if (itemstack1.stackSize == 0) { slot.putStack((ItemStack)null); } else { slot.onSlotChanged(); } if (itemstack1.stackSize == itemstack.stackSize) { return null; } slot.onPickupFromSlot(par1EntityPlayer, itemstack1); } return itemstack; } } GuiHandlerIronOven package com.volt.dev.morefurnaces.ironfurnace; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import cpw.mods.fml.common.network.IGuiHandler; public class GuiHandlerIronOven implements IGuiHandler { @Override public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) { TileEntity tile_entity = world.getTileEntity(x, y, z); switch(id) { case 0: return new ContainerIronOven(player.inventory, (TileEntityIronOven) tile_entity); } return null; } @Override public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) { TileEntity tile_entity = world.getTileEntity(x, y, z); switch(id) { case 0: return new GuiIronOven(player.inventory, (TileEntityIronOven) tile_entity); } return null; } } GuiIronOven package com.volt.dev.morefurnaces.ironfurnace; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; @SideOnly(Side.CLIENT) public class GuiIronOven extends GuiContainer { private static final ResourceLocation furnaceGuiTextures = new ResourceLocation("textures/gui/container/furnace.png"); private TileEntityIronOven tileFurnace; private static final String __OBFID = "CL_00000758"; public GuiIronOven(InventoryPlayer par1InventoryPlayer, TileEntityIronOven par2TileEntityIronOvenIdle) { super(new ContainerIronOven(par1InventoryPlayer, par2TileEntityIronOvenIdle)); this.tileFurnace = par2TileEntityIronOvenIdle; } /** * Draw the foreground layer for the GuiContainer (everything in front of the items) */ protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) { String s = this.tileFurnace.hasCustomInventoryName() ? this.tileFurnace.getInventoryName() : I18n.format(this.tileFurnace.getInventoryName(), new Object[0]); this.fontRendererObj.drawString(s, this.xSize / 2 - this.fontRendererObj.getStringWidth(s) / 2, 6, 4210752); this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752); } protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(furnaceGuiTextures); int k = (this.width - this.xSize) / 2; int l = (this.height - this.ySize) / 2; this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); int i1; if (this.tileFurnace.isBurning()) { i1 = this.tileFurnace.getBurnTimeRemainingScaled(12); this.drawTexturedModalRect(k + 56, l + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 2); } i1 = this.tileFurnace.getCookProgressScaled(24); this.drawTexturedModalRect(k + 79, l + 34, 176, 14, i1 + 1, 16); } } IronOven package com.volt.dev.morefurnaces.ironfurnace; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.IInventory; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import com.volt.dev.morefurnaces.main.MoreFurnaces; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class IronOven extends BlockContainer { private final Random field_149933_a = new Random(); private final boolean field_149932_b; private static boolean field_149934_M; @SideOnly(Side.CLIENT) private IIcon field_149935_N; @SideOnly(Side.CLIENT) private IIcon field_149936_O; private static final String __OBFID = "CL_00000248"; public IronOven(int i, boolean p_i45407_1_) { super(Material.rock); this.field_149932_b = p_i45407_1_; } public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { return Item.getItemFromBlock(MoreFurnaces.ironOven); } /** * Called whenever the block is added into the world. Args: world, x, y, z */ public void onBlockAdded(World p_149726_1_, int p_149726_2_, int p_149726_3_, int p_149726_4_) { super.onBlockAdded(p_149726_1_, p_149726_2_, p_149726_3_, p_149726_4_); this.func_149930_e(p_149726_1_, p_149726_2_, p_149726_3_, p_149726_4_); } private void func_149930_e(World p_149930_1_, int p_149930_2_, int p_149930_3_, int p_149930_4_) { if (!p_149930_1_.isRemote) { Block block = p_149930_1_.getBlock(p_149930_2_, p_149930_3_, p_149930_4_ - 1); Block block1 = p_149930_1_.getBlock(p_149930_2_, p_149930_3_, p_149930_4_ + 1); Block block2 = p_149930_1_.getBlock(p_149930_2_ - 1, p_149930_3_, p_149930_4_); Block block3 = p_149930_1_.getBlock(p_149930_2_ + 1, p_149930_3_, p_149930_4_); byte b0 = 3; if (block.func_149730_j() && !block1.func_149730_j()) { b0 = 3; } if (block1.func_149730_j() && !block.func_149730_j()) { b0 = 2; } if (block2.func_149730_j() && !block3.func_149730_j()) { b0 = 5; } if (block3.func_149730_j() && !block2.func_149730_j()) { b0 = 4; } p_149930_1_.setBlockMetadataWithNotify(p_149930_2_, p_149930_3_, p_149930_4_, b0, 2); } } /** * Gets the block's texture. Args: side, meta */ @SideOnly(Side.CLIENT) public IIcon getIcon(int p_149691_1_, int p_149691_2_) { return p_149691_1_ == 1 ? this.field_149935_N : (p_149691_1_ == 0 ? this.field_149935_N : (p_149691_1_ != p_149691_2_ ? this.blockIcon : this.field_149936_O)); } @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister p_149651_1_) { this.blockIcon = p_149651_1_.registerIcon("MoreFurnaces:IronFurnace_side"); this.field_149936_O = p_149651_1_.registerIcon(this.field_149932_b ? "MoreFurnaces:IronFurnace_front_active" : "MoreFurnaces:IronFurnace_front_idle"); this.field_149935_N = p_149651_1_.registerIcon("MoreFurnaces:IronFurnace_side"); } /** * Called upon block activation (right click on the block.) */ /*public boolean onBlockActivated(World p_149727_1_, int p_149727_2_, int p_149727_3_, int p_149727_4_, EntityPlayer p_149727_5_, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) { if (p_149727_1_.isRemote) { return true; } else { TileEntityIronOvenIdle tileentityfurnace = (TileEntityIronOvenIdle)p_149727_1_.getTileEntity(p_149727_2_, p_149727_3_, p_149727_4_); if (tileentityfurnace != null) { p_149727_5_.func_146101_a(tileentityfurnace); } return true; } }*/ public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) { if (par1World.isRemote) { return true; } else if (!par5EntityPlayer.isSneaking()) { TileEntityIronOven var10 = (TileEntityIronOven) par1World.getTileEntity(par2, par3, par4); if (var10 != null) { par5EntityPlayer.openGui(MoreFurnaces.instance, 0, par1World, par2, par3, par4); } return true; } else { return false; } } /** * Update which block the furnace is using depending on whether or not it is burning */ public static void updateFurnaceBlockState(boolean p_149931_0_, World p_149931_1_, int p_149931_2_, int p_149931_3_, int p_149931_4_) { int l = p_149931_1_.getBlockMetadata(p_149931_2_, p_149931_3_, p_149931_4_); TileEntity tileentity = p_149931_1_.getTileEntity(p_149931_2_, p_149931_3_, p_149931_4_); field_149934_M = true; if (p_149931_0_) { p_149931_1_.setBlock(p_149931_2_, p_149931_3_, p_149931_4_, MoreFurnaces.ironOvenActive); } else { p_149931_1_.setBlock(p_149931_2_, p_149931_3_, p_149931_4_, MoreFurnaces.ironOven); } field_149934_M = false; p_149931_1_.setBlockMetadataWithNotify(p_149931_2_, p_149931_3_, p_149931_4_, l, 2); if (tileentity != null) { tileentity.validate(); p_149931_1_.setTileEntity(p_149931_2_, p_149931_3_, p_149931_4_, tileentity); } } /** * Returns a new instance of a block's tile entity class. Called on placing the block. */ public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) { return new TileEntityIronOven(); } /** * Called when the block is placed in the world. */ public void onBlockPlacedBy(World p_149689_1_, int p_149689_2_, int p_149689_3_, int p_149689_4_, EntityLivingBase p_149689_5_, ItemStack p_149689_6_) { int l = MathHelper.floor_double((double)(p_149689_5_.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; if (l == 0) { p_149689_1_.setBlockMetadataWithNotify(p_149689_2_, p_149689_3_, p_149689_4_, 2, 2); } if (l == 1) { p_149689_1_.setBlockMetadataWithNotify(p_149689_2_, p_149689_3_, p_149689_4_, 5, 2); } if (l == 2) { p_149689_1_.setBlockMetadataWithNotify(p_149689_2_, p_149689_3_, p_149689_4_, 3, 2); } if (l == 3) { p_149689_1_.setBlockMetadataWithNotify(p_149689_2_, p_149689_3_, p_149689_4_, 4, 2); } if (p_149689_6_.hasDisplayName()) { ((TileEntityIronOven)p_149689_1_.getTileEntity(p_149689_2_, p_149689_3_, p_149689_4_)).func_145951_a(p_149689_6_.getDisplayName()); } } public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_) { if (!field_149934_M) { TileEntityIronOven tileentityironovenidle = (TileEntityIronOven)p_149749_1_.getTileEntity(p_149749_2_, p_149749_3_, p_149749_4_); if (tileentityironovenidle != null) { for (int i1 = 0; i1 < tileentityironovenidle.getSizeInventory(); ++i1) { ItemStack itemstack = tileentityironovenidle.getStackInSlot(i1); if (itemstack != null) { float f = this.field_149933_a.nextFloat() * 0.8F + 0.1F; float f1 = this.field_149933_a.nextFloat() * 0.8F + 0.1F; float f2 = this.field_149933_a.nextFloat() * 0.8F + 0.1F; while (itemstack.stackSize > 0) { int j1 = this.field_149933_a.nextInt(21) + 10; if (j1 > itemstack.stackSize) { j1 = itemstack.stackSize; } itemstack.stackSize -= j1; EntityItem entityitem = new EntityItem(p_149749_1_, (double)((float)p_149749_2_ + f), (double)((float)p_149749_3_ + f1), (double)((float)p_149749_4_ + f2), new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); if (itemstack.hasTagCompound()) { entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy()); } float f3 = 0.05F; entityitem.motionX = (double)((float)this.field_149933_a.nextGaussian() * f3); entityitem.motionY = (double)((float)this.field_149933_a.nextGaussian() * f3 + 0.2F); entityitem.motionZ = (double)((float)this.field_149933_a.nextGaussian() * f3); p_149749_1_.spawnEntityInWorld(entityitem); } } } p_149749_1_.func_147453_f(p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_); } } super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_); } /** * A randomly called display update to be able to add particles or other items for display */ @SideOnly(Side.CLIENT) public void randomDisplayTick(World p_149734_1_, int p_149734_2_, int p_149734_3_, int p_149734_4_, Random p_149734_5_) { if (this.field_149932_b) { int l = p_149734_1_.getBlockMetadata(p_149734_2_, p_149734_3_, p_149734_4_); float f = (float)p_149734_2_ + 0.5F; float f1 = (float)p_149734_3_ + 0.0F + p_149734_5_.nextFloat() * 6.0F / 16.0F; float f2 = (float)p_149734_4_ + 0.5F; float f3 = 0.52F; float f4 = p_149734_5_.nextFloat() * 0.6F - 0.3F; if (l == 4) { p_149734_1_.spawnParticle("smoke", (double)(f - f3), (double)f1, (double)(f2 + f4), 0.0D, 0.0D, 0.0D); p_149734_1_.spawnParticle("flame", (double)(f - f3), (double)f1, (double)(f2 + f4), 0.0D, 0.0D, 0.0D); } else if (l == 5) { p_149734_1_.spawnParticle("smoke", (double)(f + f3), (double)f1, (double)(f2 + f4), 0.0D, 0.0D, 0.0D); p_149734_1_.spawnParticle("flame", (double)(f + f3), (double)f1, (double)(f2 + f4), 0.0D, 0.0D, 0.0D); } else if (l == 2) { p_149734_1_.spawnParticle("smoke", (double)(f + f4), (double)f1, (double)(f2 - f3), 0.0D, 0.0D, 0.0D); p_149734_1_.spawnParticle("flame", (double)(f + f4), (double)f1, (double)(f2 - f3), 0.0D, 0.0D, 0.0D); } else if (l == 3) { p_149734_1_.spawnParticle("smoke", (double)(f + f4), (double)f1, (double)(f2 + f3), 0.0D, 0.0D, 0.0D); p_149734_1_.spawnParticle("flame", (double)(f + f4), (double)f1, (double)(f2 + f3), 0.0D, 0.0D, 0.0D); } } } /** * If this returns true, then comparators facing away from this block will use the value from * getComparatorInputOverride instead of the actual redstone signal strength. */ public boolean hasComparatorInputOverride() { return true; } /** * If hasComparatorInputOverride returns true, the return value from this is used instead of the redstone signal * strength when this block inputs to a comparator. */ public int getComparatorInputOverride(World p_149736_1_, int p_149736_2_, int p_149736_3_, int p_149736_4_, int p_149736_5_) { return Container.calcRedstoneFromInventory((IInventory)p_149736_1_.getTileEntity(p_149736_2_, p_149736_3_, p_149736_4_)); } /** * Gets an item for the block being called on. Args: world, x, y, z */ @SideOnly(Side.CLIENT) public Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_) { return Item.getItemFromBlock(MoreFurnaces.ironOven); } } IronOvenRecipes package com.volt.dev.morefurnaces.ironfurnace; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Map.Entry; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemFishFood; import net.minecraft.item.ItemStack; public class IronOvenRecipes { private static final IronOvenRecipes smeltingBase = new IronOvenRecipes(); /** The list of smelting results. */ private Map smeltingList = new HashMap(); private Map experienceList = new HashMap(); private static final String __OBFID = "CL_00000085"; /** * Used to call methods addSmelting and getSmeltingResult. */ public static IronOvenRecipes smelting() { return smeltingBase; } private IronOvenRecipes() { this.func_151393_a(Blocks.iron_ore, new ItemStack(Items.iron_ingot), 0.7F); this.func_151393_a(Blocks.gold_ore, new ItemStack(Items.gold_ingot), 1.0F); this.func_151393_a(Blocks.diamond_ore, new ItemStack(Items.diamond), 1.0F); this.func_151393_a(Blocks.sand, new ItemStack(Blocks.glass), 0.1F); this.func_151396_a(Items.porkchop, new ItemStack(Items.cooked_porkchop), 0.35F); this.func_151396_a(Items.beef, new ItemStack(Items.cooked_beef), 0.35F); this.func_151396_a(Items.chicken, new ItemStack(Items.cooked_chicken), 0.35F); this.func_151393_a(Blocks.cobblestone, new ItemStack(Blocks.stone), 0.1F); this.func_151396_a(Items.clay_ball, new ItemStack(Items.brick), 0.3F); this.func_151393_a(Blocks.clay, new ItemStack(Blocks.hardened_clay), 0.35F); this.func_151393_a(Blocks.cactus, new ItemStack(Items.dye, 1, 2), 0.2F); this.func_151393_a(Blocks.log, new ItemStack(Items.coal, 1, 1), 0.15F); this.func_151393_a(Blocks.log2, new ItemStack(Items.coal, 1, 1), 0.15F); this.func_151393_a(Blocks.emerald_ore, new ItemStack(Items.emerald), 1.0F); this.func_151396_a(Items.potato, new ItemStack(Items.baked_potato), 0.35F); this.func_151393_a(Blocks.netherrack, new ItemStack(Items.netherbrick), 0.1F); ItemFishFood.FishType[] afishtype = ItemFishFood.FishType.values(); int i = afishtype.length; for (int j = 0; j < i; ++j) { ItemFishFood.FishType fishtype = afishtype[j]; if (fishtype.func_150973_i()) { this.func_151394_a(new ItemStack(Items.fish, 1, fishtype.func_150976_a()), new ItemStack(Items.cooked_fished, 1, fishtype.func_150976_a()), 0.35F); } } this.func_151393_a(Blocks.coal_ore, new ItemStack(Items.coal), 0.1F); this.func_151393_a(Blocks.redstone_ore, new ItemStack(Items.redstone), 0.7F); this.func_151393_a(Blocks.lapis_ore, new ItemStack(Items.dye, 1, 4), 0.2F); this.func_151393_a(Blocks.quartz_ore, new ItemStack(Items.quartz), 0.2F); } public void func_151393_a(Block p_151393_1_, ItemStack p_151393_2_, float p_151393_3_) { this.func_151396_a(Item.getItemFromBlock(p_151393_1_), p_151393_2_, p_151393_3_); } public void func_151396_a(Item p_151396_1_, ItemStack p_151396_2_, float p_151396_3_) { this.func_151394_a(new ItemStack(p_151396_1_, 1, 32767), p_151396_2_, p_151396_3_); } public void func_151394_a(ItemStack p_151394_1_, ItemStack p_151394_2_, float p_151394_3_) { this.smeltingList.put(p_151394_1_, p_151394_2_); this.experienceList.put(p_151394_2_, Float.valueOf(p_151394_3_)); } /** * Returns the smelting result of an item. */ public ItemStack getSmeltingResult(ItemStack p_151395_1_) { Iterator iterator = this.smeltingList.entrySet().iterator(); Entry entry; do { if (!iterator.hasNext()) { return null; } entry = (Entry)iterator.next(); } while (!this.func_151397_a(p_151395_1_, (ItemStack)entry.getKey())); return (ItemStack)entry.getValue(); } private boolean func_151397_a(ItemStack p_151397_1_, ItemStack p_151397_2_) { return p_151397_2_.getItem() == p_151397_1_.getItem() && (p_151397_2_.getItemDamage() == 32767 || p_151397_2_.getItemDamage() == p_151397_1_.getItemDamage()); } public Map getSmeltingList() { return this.smeltingList; } public float func_151398_b(ItemStack p_151398_1_) { float ret = p_151398_1_.getItem().getSmeltingExperience(p_151398_1_); if (ret != -1) return ret; Iterator iterator = this.experienceList.entrySet().iterator(); Entry entry; do { if (!iterator.hasNext()) { return 0.0F; } entry = (Entry)iterator.next(); } while (!this.func_151397_a(p_151398_1_, (ItemStack)entry.getKey())); return ((Float)entry.getValue()).floatValue(); } } RenderIronOven package com.volt.dev.morefurnaces.ironfurnace; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; import net.minecraft.world.IBlockAccess; import org.lwjgl.opengl.GL11; import com.volt.dev.morefurnaces.main.MoreFurnaces; import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; public class RenderIronOven implements ISimpleBlockRenderingHandler { public static final RenderIronOven INSTANCE = new RenderIronOven(); @Override public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { int meta = 3; if (block.getIdFromBlock(block) == MoreFurnaces.ironOvenActive.getIdFromBlock(MoreFurnaces.ironOvenActive)) meta = 1; Tessellator tessellator = Tessellator.instance; block.setBlockBoundsForItemRender(); renderer.setRenderBoundsFromBlock(block); GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); GL11.glTranslatef(-0.5F, -0.5F, -0.5F); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, -1.0F, 0.0F); renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 0, meta)); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 1.0F, 0.0F); renderer.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 1, meta)); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 0.0F, -1.0F); renderer.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 2, meta)); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 0.0F, 1.0F); renderer.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 3, meta)); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(-1.0F, 0.0F, 0.0F); renderer.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 4, meta)); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(1.0F, 0.0F, 0.0F); renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 5, meta)); tessellator.draw(); GL11.glTranslatef(0.5F, 0.5F, 0.5F); } @Override public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { int direction = renderer.blockAccess.getBlockMetadata(x, y, z) & 3; if(direction>0){ renderer.uvRotateTop = direction-1; } else { renderer.uvRotateTop = 3; } boolean flag = renderer.renderStandardBlock(block, x, y, z); renderer.uvRotateTop = 0; return flag; } @Override public int getRenderId() { return 2105; } @Override public boolean shouldRender3DInInventory(int modelId) { return true; } } SlotIronOven package com.volt.dev.morefurnaces.ironfurnace; import cpw.mods.fml.common.FMLCommonHandler; import net.minecraft.entity.item.EntityXPOrb; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import net.minecraft.stats.AchievementList; import net.minecraft.util.MathHelper; public class SlotIronOven extends Slot { /** The player that is using the GUI where this slot resides. */ private EntityPlayer thePlayer; private int field_75228_b; private static final String __OBFID = "CL_00001749"; public SlotIronOven(EntityPlayer par1EntityPlayer, IInventory par2IInventory, int par3, int par4, int par5) { super(par2IInventory, par3, par4, par5); this.thePlayer = par1EntityPlayer; } /** * Check if the stack is a valid item for this slot. Always true beside for the armor slots. */ public boolean isItemValid(ItemStack par1ItemStack) { return false; } /** * Decrease the size of the stack in slot (first int arg) by the amount of the second int arg. Returns the new * stack. */ public ItemStack decrStackSize(int par1) { if (this.getHasStack()) { this.field_75228_b += Math.min(par1, this.getStack().stackSize); } return super.decrStackSize(par1); } public void onPickupFromSlot(EntityPlayer par1EntityPlayer, ItemStack par2ItemStack) { this.onCrafting(par2ItemStack); super.onPickupFromSlot(par1EntityPlayer, par2ItemStack); } /** * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood. Typically increases an * internal count then calls onCrafting(item). */ protected void onCrafting(ItemStack par1ItemStack, int par2) { this.field_75228_b += par2; this.onCrafting(par1ItemStack); } /** * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood. */ protected void onCrafting(ItemStack par1ItemStack) { par1ItemStack.onCrafting(this.thePlayer.worldObj, this.thePlayer, this.field_75228_b); if (!this.thePlayer.worldObj.isRemote) { int i = this.field_75228_b; float f = IronOvenRecipes.smelting().func_151398_b(par1ItemStack); int j; if (f == 0.0F) { i = 0; } else if (f < 1.0F) { j = MathHelper.floor_float((float)i * f); if (j < MathHelper.ceiling_float_int((float)i * f) && (float)Math.random() < (float)i * f - (float)j) { ++j; } i = j; } while (i > 0) { j = EntityXPOrb.getXPSplit(i); i -= j; this.thePlayer.worldObj.spawnEntityInWorld(new EntityXPOrb(this.thePlayer.worldObj, this.thePlayer.posX, this.thePlayer.posY + 0.5D, this.thePlayer.posZ + 0.5D, j)); } } this.field_75228_b = 0; FMLCommonHandler.instance().firePlayerSmeltedEvent(thePlayer, par1ItemStack); if (par1ItemStack.getItem() == Items.iron_ingot) { this.thePlayer.addStat(AchievementList.acquireIron, 1); } if (par1ItemStack.getItem() == Items.cooked_fished) { this.thePlayer.addStat(AchievementList.cookFish, 1); } } } TileEntityIronOven package com.volt.dev.morefurnaces.ironfurnace; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemHoe; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemSword; import net.minecraft.item.ItemTool; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; public class TileEntityIronOven extends TileEntity implements ISidedInventory { private static final int[] slotsTop = new int[] {0}; private static final int[] slotsBottom = new int[] {2, 1}; private static final int[] slotsSides = new int[] {1}; /** * The ItemStacks that hold the items currently being used in the furnace */ private ItemStack[] furnaceItemStacks = new ItemStack[3]; /** The number of ticks that the furnace will keep burning */ public int furnaceBurnTime; /** * The number of ticks that a fresh copy of the currently-burning item would keep the furnace burning for */ public int currentItemBurnTime; /** The number of ticks that the current item has been cooking for */ public int furnaceCookTime; private String field_145958_o; private static final String __OBFID = "CL_00000357"; /** * Returns the number of slots in the inventory. */ public int getSizeInventory() { return this.furnaceItemStacks.length; } /** * Returns the stack in slot i */ public ItemStack getStackInSlot(int par1) { return this.furnaceItemStacks[par1]; } /** * Removes from an inventory slot (first arg) up to a specified number (second arg) of items and returns them in a * new stack. */ public ItemStack decrStackSize(int par1, int par2) { if (this.furnaceItemStacks[par1] != null) { ItemStack itemstack; if (this.furnaceItemStacks[par1].stackSize <= par2) { itemstack = this.furnaceItemStacks[par1]; this.furnaceItemStacks[par1] = null; return itemstack; } else { itemstack = this.furnaceItemStacks[par1].splitStack(par2); if (this.furnaceItemStacks[par1].stackSize == 0) { this.furnaceItemStacks[par1] = null; } return itemstack; } } else { return null; } } /** * When some containers are closed they call this on each slot, then drop whatever it returns as an EntityItem - * like when you close a workbench GUI. */ public ItemStack getStackInSlotOnClosing(int par1) { if (this.furnaceItemStacks[par1] != null) { ItemStack itemstack = this.furnaceItemStacks[par1]; this.furnaceItemStacks[par1] = null; return itemstack; } else { return null; } } /** * Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections). */ public void setInventorySlotContents(int par1, ItemStack par2ItemStack) { this.furnaceItemStacks[par1] = par2ItemStack; if (par2ItemStack != null && par2ItemStack.stackSize > this.getInventoryStackLimit()) { par2ItemStack.stackSize = this.getInventoryStackLimit(); } } /** * Returns the name of the inventory */ public String getInventoryName() { return this.hasCustomInventoryName() ? this.field_145958_o : "container.furnace"; } /** * Returns if the inventory is named */ public boolean hasCustomInventoryName() { return this.field_145958_o != null && this.field_145958_o.length() > 0; } public void func_145951_a(String p_145951_1_) { this.field_145958_o = p_145951_1_; } public void readFromNBT(NBTTagCompound p_145839_1_) { super.readFromNBT(p_145839_1_); NBTTagList nbttaglist = p_145839_1_.getTagList("Items", 10); this.furnaceItemStacks = new ItemStack[this.getSizeInventory()]; for (int i = 0; i < nbttaglist.tagCount(); ++i) { NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i); byte b0 = nbttagcompound1.getByte("Slot"); if (b0 >= 0 && b0 < this.furnaceItemStacks.length) { this.furnaceItemStacks[b0] = ItemStack.loadItemStackFromNBT(nbttagcompound1); } } this.furnaceBurnTime = p_145839_1_.getShort("BurnTime"); this.furnaceCookTime = p_145839_1_.getShort("CookTime"); this.currentItemBurnTime = getItemBurnTime(this.furnaceItemStacks[1]); if (p_145839_1_.hasKey("CustomName", ) { this.field_145958_o = p_145839_1_.getString("CustomName"); } } public void writeToNBT(NBTTagCompound p_145841_1_) { super.writeToNBT(p_145841_1_); p_145841_1_.setShort("BurnTime", (short)this.furnaceBurnTime); p_145841_1_.setShort("CookTime", (short)this.furnaceCookTime); NBTTagList nbttaglist = new NBTTagList(); for (int i = 0; i < this.furnaceItemStacks.length; ++i) { if (this.furnaceItemStacks[i] != null) { NBTTagCompound nbttagcompound1 = new NBTTagCompound(); nbttagcompound1.setByte("Slot", (byte)i); this.furnaceItemStacks[i].writeToNBT(nbttagcompound1); nbttaglist.appendTag(nbttagcompound1); } } p_145841_1_.setTag("Items", nbttaglist); if (this.hasCustomInventoryName()) { p_145841_1_.setString("CustomName", this.field_145958_o); } } /** * Returns the maximum stack size for a inventory slot. */ public int getInventoryStackLimit() { return 64; } /** * Returns an integer between 0 and the passed value representing how close the current item is to being completely * cooked */ @SideOnly(Side.CLIENT) public int getCookProgressScaled(int p_145953_1_) { return this.furnaceCookTime * p_145953_1_ / 200; } /** * Returns an integer between 0 and the passed value representing how much burn time is left on the current fuel * item, where 0 means that the item is exhausted and the passed value means that the item is fresh */ @SideOnly(Side.CLIENT) public int getBurnTimeRemainingScaled(int p_145955_1_) { if (this.currentItemBurnTime == 0) { this.currentItemBurnTime = 200; } return this.furnaceBurnTime * p_145955_1_ / this.currentItemBurnTime; } /** * Furnace isBurning */ public boolean isBurning() { return this.furnaceBurnTime > 0; } public void updateEntity() { boolean flag = this.furnaceBurnTime > 0; boolean flag1 = false; if (this.furnaceBurnTime > 0) { --this.furnaceBurnTime; } if (!this.worldObj.isRemote) { if (this.furnaceBurnTime == 0 && this.canSmelt()) { this.currentItemBurnTime = this.furnaceBurnTime = getItemBurnTime(this.furnaceItemStacks[1]); if (this.furnaceBurnTime > 0) { flag1 = true; if (this.furnaceItemStacks[1] != null) { --this.furnaceItemStacks[1].stackSize; if (this.furnaceItemStacks[1].stackSize == 0) { this.furnaceItemStacks[1] = furnaceItemStacks[1].getItem().getContainerItem(furnaceItemStacks[1]); } } } } if (this.isBurning() && this.canSmelt()) { ++this.furnaceCookTime; if (this.furnaceCookTime == 200) { this.furnaceCookTime = 0; this.smeltItem(); flag1 = true; } } else { this.furnaceCookTime = 0; } if (flag != this.furnaceBurnTime > 0) { flag1 = true; IronOven.updateFurnaceBlockState(this.furnaceBurnTime > 0, this.worldObj, this.xCoord, this.yCoord, this.zCoord); } } if (flag1) { this.markDirty(); } } /** * Returns true if the furnace can smelt an item, i.e. has a source item, destination stack isn't full, etc. */ private boolean canSmelt() { if (this.furnaceItemStacks[0] == null) { return false; } else { ItemStack itemstack = IronOvenRecipes.smelting().getSmeltingResult(this.furnaceItemStacks[0]); if (itemstack == null) return false; if (this.furnaceItemStacks[2] == null) return true; if (!this.furnaceItemStacks[2].isItemEqual(itemstack)) return false; int result = furnaceItemStacks[2].stackSize + itemstack.stackSize; return result <= getInventoryStackLimit() && result <= this.furnaceItemStacks[2].getMaxStackSize(); //Forge BugFix: Make it respect stack sizes properly. } } /** * Turn one item from the furnace source stack into the appropriate smelted item in the furnace result stack */ public void smeltItem() { if (this.canSmelt()) { ItemStack itemstack = IronOvenRecipes.smelting().getSmeltingResult(this.furnaceItemStacks[0]); if (this.furnaceItemStacks[2] == null) { this.furnaceItemStacks[2] = itemstack.copy(); } else if (this.furnaceItemStacks[2].getItem() == itemstack.getItem()) { this.furnaceItemStacks[2].stackSize += itemstack.stackSize; // Forge BugFix: Results may have multiple items } --this.furnaceItemStacks[0].stackSize; if (this.furnaceItemStacks[0].stackSize <= 0) { this.furnaceItemStacks[0] = null; } } } /** * Returns the number of ticks that the supplied fuel item will keep the furnace burning, or 0 if the item isn't * fuel */ public static int getItemBurnTime(ItemStack p_145952_0_) { if (p_145952_0_ == null) { return 0; } else { Item item = p_145952_0_.getItem(); if (item instanceof ItemBlock && Block.getBlockFromItem(item) != Blocks.air) { Block block = Block.getBlockFromItem(item); if (block == Blocks.wooden_slab) { return 150; } if (block.getMaterial() == Material.wood) { return 300; } if (block == Blocks.coal_block) { return 16000; } } if (item instanceof ItemTool && ((ItemTool)item).getToolMaterialName().equals("WOOD")) return 200; if (item instanceof ItemSword && ((ItemSword)item).getToolMaterialName().equals("WOOD")) return 200; if (item instanceof ItemHoe && ((ItemHoe)item).getToolMaterialName().equals("WOOD")) return 200; if (item == Items.stick) return 100; if (item == Items.coal) return 1600; if (item == Items.lava_bucket) return 20000; if (item == Item.getItemFromBlock(Blocks.sapling)) return 100; if (item == Items.blaze_rod) return 2400; return GameRegistry.getFuelValue(p_145952_0_); } } public static boolean isItemFuel(ItemStack p_145954_0_) { /** * Returns the number of ticks that the supplied fuel item will keep the furnace burning, or 0 if the item isn't * fuel */ return getItemBurnTime(p_145954_0_) > 0; } /** * Do not make give this method the name canInteractWith because it clashes with Container */ public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) { return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : par1EntityPlayer.getDistanceSq((double)this.xCoord + 0.5D, (double)this.yCoord + 0.5D, (double)this.zCoord + 0.5D) <= 64.0D; } public void openInventory() {} public void closeInventory() {} /** * Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot. */ public boolean isItemValidForSlot(int par1, ItemStack par2ItemStack) { return par1 == 2 ? false : (par1 == 1 ? isItemFuel(par2ItemStack) : true); } /** * Returns an array containing the indices of the slots that can be accessed by automation on the given side of this * block. */ public int[] getAccessibleSlotsFromSide(int par1) { return par1 == 0 ? slotsBottom : (par1 == 1 ? slotsTop : slotsSides); } /** * Returns true if automation can insert the given item in the given slot from the given side. Args: Slot, item, * side */ public boolean canInsertItem(int par1, ItemStack par2ItemStack, int par3) { return this.isItemValidForSlot(par1, par2ItemStack); } /** * Returns true if automation can extract the given item in the given slot from the given side. Args: Slot, item, * side */ public boolean canExtractItem(int par1, ItemStack par2ItemStack, int par3) { return par3 != 0 || par1 != 1 || par2ItemStack.getItem() == Items.bucket; } } GOLD FURNACE ContainerGoldOven package com.volt.dev.morefurnaces.goldfurnace; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.ICrafting; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class ContainerGoldOven extends Container { private TileEntityGoldOven tileFurnace; private int lastCookTime; private int lastBurnTime; private int lastItemBurnTime; private static final String __OBFID = "CL_00001748"; public ContainerGoldOven(InventoryPlayer par1InventoryPlayer, TileEntityGoldOven par2TileEntityGoldOven) { this.tileFurnace = par2TileEntityGoldOven; this.addSlotToContainer(new Slot(par2TileEntityGoldOven, 0, 56, 17)); this.addSlotToContainer(new Slot(par2TileEntityGoldOven, 1, 56, 53)); this.addSlotToContainer(new SlotGoldOven(par1InventoryPlayer.player, par2TileEntityGoldOven, 2, 116, 35)); int i; for (i = 0; i < 3; ++i) { for (int j = 0; j < 9; ++j) { this.addSlotToContainer(new Slot(par1InventoryPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); } } for (i = 0; i < 9; ++i) { this.addSlotToContainer(new Slot(par1InventoryPlayer, i, 8 + i * 18, 142)); } } public void addCraftingToCrafters(ICrafting par1ICrafting) { super.addCraftingToCrafters(par1ICrafting); par1ICrafting.sendProgressBarUpdate(this, 0, this.tileFurnace.furnaceCookTime); par1ICrafting.sendProgressBarUpdate(this, 1, this.tileFurnace.furnaceBurnTime); par1ICrafting.sendProgressBarUpdate(this, 2, this.tileFurnace.currentItemBurnTime); } /** * Looks for changes made in the container, sends them to every listener. */ public void detectAndSendChanges() { super.detectAndSendChanges(); for (int i = 0; i < this.crafters.size(); ++i) { ICrafting icrafting = (ICrafting)this.crafters.get(i); if (this.lastCookTime != this.tileFurnace.furnaceCookTime) { icrafting.sendProgressBarUpdate(this, 0, this.tileFurnace.furnaceCookTime); } if (this.lastBurnTime != this.tileFurnace.furnaceBurnTime) { icrafting.sendProgressBarUpdate(this, 1, this.tileFurnace.furnaceBurnTime); } if (this.lastItemBurnTime != this.tileFurnace.currentItemBurnTime) { icrafting.sendProgressBarUpdate(this, 2, this.tileFurnace.currentItemBurnTime); } } this.lastCookTime = this.tileFurnace.furnaceCookTime; this.lastBurnTime = this.tileFurnace.furnaceBurnTime; this.lastItemBurnTime = this.tileFurnace.currentItemBurnTime; } @SideOnly(Side.CLIENT) public void updateProgressBar(int par1, int par2) { if (par1 == 0) { this.tileFurnace.furnaceCookTime = par2; } if (par1 == 1) { this.tileFurnace.furnaceBurnTime = par2; } if (par1 == 2) { this.tileFurnace.currentItemBurnTime = par2; } } public boolean canInteractWith(EntityPlayer par1EntityPlayer) { return this.tileFurnace.isUseableByPlayer(par1EntityPlayer); } /** * Called when a player shift-clicks on a slot. You must override this or you will crash when someone does that. */ public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) { ItemStack itemstack = null; Slot slot = (Slot)this.inventorySlots.get(par2); if (slot != null && slot.getHasStack()) { ItemStack itemstack1 = slot.getStack(); itemstack = itemstack1.copy(); if (par2 == 2) { if (!this.mergeItemStack(itemstack1, 3, 39, true)) { return null; } slot.onSlotChange(itemstack1, itemstack); } else if (par2 != 1 && par2 != 0) { if (GoldOvenRecipes.smelting().getSmeltingResult(itemstack1) != null) { if (!this.mergeItemStack(itemstack1, 0, 1, false)) { return null; } } else if (TileEntityGoldOven.isItemFuel(itemstack1)) { if (!this.mergeItemStack(itemstack1, 1, 2, false)) { return null; } } else if (par2 >= 3 && par2 < 30) { if (!this.mergeItemStack(itemstack1, 30, 39, false)) { return null; } } else if (par2 >= 30 && par2 < 39 && !this.mergeItemStack(itemstack1, 3, 30, false)) { return null; } } else if (!this.mergeItemStack(itemstack1, 3, 39, false)) { return null; } if (itemstack1.stackSize == 0) { slot.putStack((ItemStack)null); } else { slot.onSlotChanged(); } if (itemstack1.stackSize == itemstack.stackSize) { return null; } slot.onPickupFromSlot(par1EntityPlayer, itemstack1); } return itemstack; } } GoldOven package com.volt.dev.morefurnaces.goldfurnace; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.IInventory; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import com.volt.dev.morefurnaces.main.MoreFurnaces; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class GoldOven extends BlockContainer { private final Random field_149933_a = new Random(); private final boolean field_149932_b; private static boolean field_149934_M; @SideOnly(Side.CLIENT) private IIcon field_149935_N; @SideOnly(Side.CLIENT) private IIcon field_149936_O; private static final String __OBFID = "CL_00000248"; public GoldOven(int i, boolean p_i45407_1_) { super(Material.rock); this.field_149932_b = p_i45407_1_; } public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { return Item.getItemFromBlock(MoreFurnaces.goldOven); } /** * Called whenever the block is added into the world. Args: world, x, y, z */ public void onBlockAdded(World p_149726_1_, int p_149726_2_, int p_149726_3_, int p_149726_4_) { super.onBlockAdded(p_149726_1_, p_149726_2_, p_149726_3_, p_149726_4_); this.func_149930_e(p_149726_1_, p_149726_2_, p_149726_3_, p_149726_4_); } private void func_149930_e(World p_149930_1_, int p_149930_2_, int p_149930_3_, int p_149930_4_) { if (!p_149930_1_.isRemote) { Block block = p_149930_1_.getBlock(p_149930_2_, p_149930_3_, p_149930_4_ - 1); Block block1 = p_149930_1_.getBlock(p_149930_2_, p_149930_3_, p_149930_4_ + 1); Block block2 = p_149930_1_.getBlock(p_149930_2_ - 1, p_149930_3_, p_149930_4_); Block block3 = p_149930_1_.getBlock(p_149930_2_ + 1, p_149930_3_, p_149930_4_); byte b0 = 3; if (block.func_149730_j() && !block1.func_149730_j()) { b0 = 3; } if (block1.func_149730_j() && !block.func_149730_j()) { b0 = 2; } if (block2.func_149730_j() && !block3.func_149730_j()) { b0 = 5; } if (block3.func_149730_j() && !block2.func_149730_j()) { b0 = 4; } p_149930_1_.setBlockMetadataWithNotify(p_149930_2_, p_149930_3_, p_149930_4_, b0, 2); } } /** * Gets the block's texture. Args: side, meta */ @SideOnly(Side.CLIENT) public IIcon getIcon(int p_149691_1_, int p_149691_2_) { return p_149691_1_ == 1 ? this.field_149935_N : (p_149691_1_ == 0 ? this.field_149935_N : (p_149691_1_ != p_149691_2_ ? this.blockIcon : this.field_149936_O)); } @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister p_149651_1_) { this.blockIcon = p_149651_1_.registerIcon("MoreFurnaces:GoldFurnace_side"); this.field_149936_O = p_149651_1_.registerIcon(this.field_149932_b ? "MoreFurnaces:GoldFurnace_front_active" : "MoreFurnaces:GoldFurnace_front_idle"); this.field_149935_N = p_149651_1_.registerIcon("MoreFurnaces:GoldFurnace_side"); } /** * Called upon block activation (right click on the block.) */ /*public boolean onBlockActivated(World p_149727_1_, int p_149727_2_, int p_149727_3_, int p_149727_4_, EntityPlayer p_149727_5_, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) { if (p_149727_1_.isRemote) { return true; } else { TileEntityIronOvenIdle tileentityfurnace = (TileEntityIronOvenIdle)p_149727_1_.getTileEntity(p_149727_2_, p_149727_3_, p_149727_4_); if (tileentityfurnace != null) { p_149727_5_.func_146101_a(tileentityfurnace); } return true; } }*/ public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) { if (par1World.isRemote) { return true; } else if (!par5EntityPlayer.isSneaking()) { TileEntityGoldOven var10 = (TileEntityGoldOven) par1World.getTileEntity(par2, par3, par4); if (var10 != null) { par5EntityPlayer.openGui(MoreFurnaces.instance, 0, par1World, par2, par3, par4); } return true; } else { return false; } } /** * Update which block the furnace is using depending on whether or not it is burning */ public static void updateFurnaceBlockState(boolean p_149931_0_, World p_149931_1_, int p_149931_2_, int p_149931_3_, int p_149931_4_) { int l = p_149931_1_.getBlockMetadata(p_149931_2_, p_149931_3_, p_149931_4_); TileEntity tileentity = p_149931_1_.getTileEntity(p_149931_2_, p_149931_3_, p_149931_4_); field_149934_M = true; if (p_149931_0_) { p_149931_1_.setBlock(p_149931_2_, p_149931_3_, p_149931_4_, MoreFurnaces.goldOvenActive); } else { p_149931_1_.setBlock(p_149931_2_, p_149931_3_, p_149931_4_, MoreFurnaces.goldOven); } field_149934_M = false; p_149931_1_.setBlockMetadataWithNotify(p_149931_2_, p_149931_3_, p_149931_4_, l, 2); if (tileentity != null) { tileentity.validate(); p_149931_1_.setTileEntity(p_149931_2_, p_149931_3_, p_149931_4_, tileentity); } } /** * Returns a new instance of a block's tile entity class. Called on placing the block. */ public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) { return new TileEntityGoldOven(); } /** * Called when the block is placed in the world. */ public void onBlockPlacedBy(World p_149689_1_, int p_149689_2_, int p_149689_3_, int p_149689_4_, EntityLivingBase p_149689_5_, ItemStack p_149689_6_) { int l = MathHelper.floor_double((double)(p_149689_5_.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; if (l == 0) { p_149689_1_.setBlockMetadataWithNotify(p_149689_2_, p_149689_3_, p_149689_4_, 2, 2); } if (l == 1) { p_149689_1_.setBlockMetadataWithNotify(p_149689_2_, p_149689_3_, p_149689_4_, 5, 2); } if (l == 2) { p_149689_1_.setBlockMetadataWithNotify(p_149689_2_, p_149689_3_, p_149689_4_, 3, 2); } if (l == 3) { p_149689_1_.setBlockMetadataWithNotify(p_149689_2_, p_149689_3_, p_149689_4_, 4, 2); } if (p_149689_6_.hasDisplayName()) { ((TileEntityGoldOven)p_149689_1_.getTileEntity(p_149689_2_, p_149689_3_, p_149689_4_)).func_145951_a(p_149689_6_.getDisplayName()); } } public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_) { if (!field_149934_M) { TileEntityGoldOven tileentitygoldoven = (TileEntityGoldOven)p_149749_1_.getTileEntity(p_149749_2_, p_149749_3_, p_149749_4_); if (tileentitygoldoven != null) { for (int i1 = 0; i1 < tileentitygoldoven.getSizeInventory(); ++i1) { ItemStack itemstack = tileentitygoldoven.getStackInSlot(i1); if (itemstack != null) { float f = this.field_149933_a.nextFloat() * 0.8F + 0.1F; float f1 = this.field_149933_a.nextFloat() * 0.8F + 0.1F; float f2 = this.field_149933_a.nextFloat() * 0.8F + 0.1F; while (itemstack.stackSize > 0) { int j1 = this.field_149933_a.nextInt(21) + 10; if (j1 > itemstack.stackSize) { j1 = itemstack.stackSize; } itemstack.stackSize -= j1; EntityItem entityitem = new EntityItem(p_149749_1_, (double)((float)p_149749_2_ + f), (double)((float)p_149749_3_ + f1), (double)((float)p_149749_4_ + f2), new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); if (itemstack.hasTagCompound()) { entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy()); } float f3 = 0.05F; entityitem.motionX = (double)((float)this.field_149933_a.nextGaussian() * f3); entityitem.motionY = (double)((float)this.field_149933_a.nextGaussian() * f3 + 0.2F); entityitem.motionZ = (double)((float)this.field_149933_a.nextGaussian() * f3); p_149749_1_.spawnEntityInWorld(entityitem); } } } p_149749_1_.func_147453_f(p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_); } } super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_); } /** * A randomly called display update to be able to add particles or other items for display */ @SideOnly(Side.CLIENT) public void randomDisplayTick(World p_149734_1_, int p_149734_2_, int p_149734_3_, int p_149734_4_, Random p_149734_5_) { if (this.field_149932_b) { int l = p_149734_1_.getBlockMetadata(p_149734_2_, p_149734_3_, p_149734_4_); float f = (float)p_149734_2_ + 0.5F; float f1 = (float)p_149734_3_ + 0.0F + p_149734_5_.nextFloat() * 6.0F / 16.0F; float f2 = (float)p_149734_4_ + 0.5F; float f3 = 0.52F; float f4 = p_149734_5_.nextFloat() * 0.6F - 0.3F; if (l == 4) { p_149734_1_.spawnParticle("smoke", (double)(f - f3), (double)f1, (double)(f2 + f4), 0.0D, 0.0D, 0.0D); p_149734_1_.spawnParticle("flame", (double)(f - f3), (double)f1, (double)(f2 + f4), 0.0D, 0.0D, 0.0D); } else if (l == 5) { p_149734_1_.spawnParticle("smoke", (double)(f + f3), (double)f1, (double)(f2 + f4), 0.0D, 0.0D, 0.0D); p_149734_1_.spawnParticle("flame", (double)(f + f3), (double)f1, (double)(f2 + f4), 0.0D, 0.0D, 0.0D); } else if (l == 2) { p_149734_1_.spawnParticle("smoke", (double)(f + f4), (double)f1, (double)(f2 - f3), 0.0D, 0.0D, 0.0D); p_149734_1_.spawnParticle("flame", (double)(f + f4), (double)f1, (double)(f2 - f3), 0.0D, 0.0D, 0.0D); } else if (l == 3) { p_149734_1_.spawnParticle("smoke", (double)(f + f4), (double)f1, (double)(f2 + f3), 0.0D, 0.0D, 0.0D); p_149734_1_.spawnParticle("flame", (double)(f + f4), (double)f1, (double)(f2 + f3), 0.0D, 0.0D, 0.0D); } } } /** * If this returns true, then comparators facing away from this block will use the value from * getComparatorInputOverride instead of the actual redstone signal strength. */ public boolean hasComparatorInputOverride() { return true; } /** * If hasComparatorInputOverride returns true, the return value from this is used instead of the redstone signal * strength when this block inputs to a comparator. */ public int getComparatorInputOverride(World p_149736_1_, int p_149736_2_, int p_149736_3_, int p_149736_4_, int p_149736_5_) { return Container.calcRedstoneFromInventory((IInventory)p_149736_1_.getTileEntity(p_149736_2_, p_149736_3_, p_149736_4_)); } /** * Gets an item for the block being called on. Args: world, x, y, z */ @SideOnly(Side.CLIENT) public Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_) { return Item.getItemFromBlock(MoreFurnaces.goldOven); } } GoldOvenRecipes package com.volt.dev.morefurnaces.goldfurnace; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Map.Entry; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemFishFood; import net.minecraft.item.ItemStack; public class GoldOvenRecipes { private static final GoldOvenRecipes smeltingBase = new GoldOvenRecipes(); /** The list of smelting results. */ private Map smeltingList = new HashMap(); private Map experienceList = new HashMap(); private static final String __OBFID = "CL_00000085"; /** * Used to call methods addSmelting and getSmeltingResult. */ public static GoldOvenRecipes smelting() { return smeltingBase; } private GoldOvenRecipes() { this.func_151393_a(Blocks.iron_ore, new ItemStack(Items.iron_ingot), 0.7F); this.func_151393_a(Blocks.gold_ore, new ItemStack(Items.gold_ingot), 1.0F); this.func_151393_a(Blocks.diamond_ore, new ItemStack(Items.diamond), 1.0F); this.func_151393_a(Blocks.sand, new ItemStack(Blocks.glass), 0.1F); this.func_151396_a(Items.porkchop, new ItemStack(Items.cooked_porkchop), 0.35F); this.func_151396_a(Items.beef, new ItemStack(Items.cooked_beef), 0.35F); this.func_151396_a(Items.chicken, new ItemStack(Items.cooked_chicken), 0.35F); this.func_151393_a(Blocks.cobblestone, new ItemStack(Blocks.stone), 0.1F); this.func_151396_a(Items.clay_ball, new ItemStack(Items.brick), 0.3F); this.func_151393_a(Blocks.clay, new ItemStack(Blocks.hardened_clay), 0.35F); this.func_151393_a(Blocks.cactus, new ItemStack(Items.dye, 1, 2), 0.2F); this.func_151393_a(Blocks.log, new ItemStack(Items.coal, 1, 1), 0.15F); this.func_151393_a(Blocks.log2, new ItemStack(Items.coal, 1, 1), 0.15F); this.func_151393_a(Blocks.emerald_ore, new ItemStack(Items.emerald), 1.0F); this.func_151396_a(Items.potato, new ItemStack(Items.baked_potato), 0.35F); this.func_151393_a(Blocks.netherrack, new ItemStack(Items.netherbrick), 0.1F); ItemFishFood.FishType[] afishtype = ItemFishFood.FishType.values(); int i = afishtype.length; for (int j = 0; j < i; ++j) { ItemFishFood.FishType fishtype = afishtype[j]; if (fishtype.func_150973_i()) { this.func_151394_a(new ItemStack(Items.fish, 1, fishtype.func_150976_a()), new ItemStack(Items.cooked_fished, 1, fishtype.func_150976_a()), 0.35F); } } this.func_151393_a(Blocks.coal_ore, new ItemStack(Items.coal), 0.1F); this.func_151393_a(Blocks.redstone_ore, new ItemStack(Items.redstone), 0.7F); this.func_151393_a(Blocks.lapis_ore, new ItemStack(Items.dye, 1, 4), 0.2F); this.func_151393_a(Blocks.quartz_ore, new ItemStack(Items.quartz), 0.2F); } public void func_151393_a(Block p_151393_1_, ItemStack p_151393_2_, float p_151393_3_) { this.func_151396_a(Item.getItemFromBlock(p_151393_1_), p_151393_2_, p_151393_3_); } public void func_151396_a(Item p_151396_1_, ItemStack p_151396_2_, float p_151396_3_) { this.func_151394_a(new ItemStack(p_151396_1_, 1, 32767), p_151396_2_, p_151396_3_); } public void func_151394_a(ItemStack p_151394_1_, ItemStack p_151394_2_, float p_151394_3_) { this.smeltingList.put(p_151394_1_, p_151394_2_); this.experienceList.put(p_151394_2_, Float.valueOf(p_151394_3_)); } /** * Returns the smelting result of an item. */ public ItemStack getSmeltingResult(ItemStack p_151395_1_) { Iterator iterator = this.smeltingList.entrySet().iterator(); Entry entry; do { if (!iterator.hasNext()) { return null; } entry = (Entry)iterator.next(); } while (!this.func_151397_a(p_151395_1_, (ItemStack)entry.getKey())); return (ItemStack)entry.getValue(); } private boolean func_151397_a(ItemStack p_151397_1_, ItemStack p_151397_2_) { return p_151397_2_.getItem() == p_151397_1_.getItem() && (p_151397_2_.getItemDamage() == 32767 || p_151397_2_.getItemDamage() == p_151397_1_.getItemDamage()); } public Map getSmeltingList() { return this.smeltingList; } public float func_151398_b(ItemStack p_151398_1_) { float ret = p_151398_1_.getItem().getSmeltingExperience(p_151398_1_); if (ret != -1) return ret; Iterator iterator = this.experienceList.entrySet().iterator(); Entry entry; do { if (!iterator.hasNext()) { return 0.0F; } entry = (Entry)iterator.next(); } while (!this.func_151397_a(p_151398_1_, (ItemStack)entry.getKey())); return ((Float)entry.getValue()).floatValue(); } } GuiGoldOven package com.volt.dev.morefurnaces.goldfurnace; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; @SideOnly(Side.CLIENT) public class GuiGoldOven extends GuiContainer { private static final ResourceLocation furnaceGuiTextures = new ResourceLocation("textures/gui/container/furnace.png"); private TileEntityGoldOven tileFurnace; private static final String __OBFID = "CL_00000758"; public GuiGoldOven(InventoryPlayer par1InventoryPlayer, TileEntityGoldOven par2TileEntityGoldOven) { super(new ContainerGoldOven(par1InventoryPlayer, par2TileEntityGoldOven)); this.tileFurnace = par2TileEntityGoldOven; } /** * Draw the foreground layer for the GuiContainer (everything in front of the items) */ protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) { String s = this.tileFurnace.hasCustomInventoryName() ? this.tileFurnace.getInventoryName() : I18n.format(this.tileFurnace.getInventoryName(), new Object[0]); this.fontRendererObj.drawString(s, this.xSize / 2 - this.fontRendererObj.getStringWidth(s) / 2, 6, 4210752); this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752); } protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(furnaceGuiTextures); int k = (this.width - this.xSize) / 2; int l = (this.height - this.ySize) / 2; this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); int i1; if (this.tileFurnace.isBurning()) { i1 = this.tileFurnace.getBurnTimeRemainingScaled(12); this.drawTexturedModalRect(k + 56, l + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 2); } i1 = this.tileFurnace.getCookProgressScaled(24); this.drawTexturedModalRect(k + 79, l + 34, 176, 14, i1 + 1, 16); } } GuiHandlerGoldOven package com.volt.dev.morefurnaces.goldfurnace; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import cpw.mods.fml.common.network.IGuiHandler; public class GuiHandlerGoldOven implements IGuiHandler { @Override public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) { TileEntity tile_entity = world.getTileEntity(x, y, z); switch(id) { case 0: return new ContainerGoldOven(player.inventory, (TileEntityGoldOven) tile_entity); } return null; } @Override public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) { TileEntity tile_entity = world.getTileEntity(x, y, z); switch(id) { case 0: return new GuiGoldOven(player.inventory, (TileEntityGoldOven) tile_entity); } return null; } } RenderGoldOven package com.volt.dev.morefurnaces.goldfurnace; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; import net.minecraft.world.IBlockAccess; import org.lwjgl.opengl.GL11; import com.volt.dev.morefurnaces.main.MoreFurnaces; import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; public class RenderGoldOven implements ISimpleBlockRenderingHandler { public static final RenderGoldOven INSTANCE = new RenderGoldOven(); @Override public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { int meta = 3; if (block.getIdFromBlock(block) == MoreFurnaces.goldOvenActive.getIdFromBlock(MoreFurnaces.goldOvenActive)) meta = 1; Tessellator tessellator = Tessellator.instance; block.setBlockBoundsForItemRender(); renderer.setRenderBoundsFromBlock(block); GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); GL11.glTranslatef(-0.5F, -0.5F, -0.5F); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, -1.0F, 0.0F); renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 0, meta)); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 1.0F, 0.0F); renderer.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 1, meta)); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 0.0F, -1.0F); renderer.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 2, meta)); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 0.0F, 1.0F); renderer.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 3, meta)); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(-1.0F, 0.0F, 0.0F); renderer.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 4, meta)); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(1.0F, 0.0F, 0.0F); renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 5, meta)); tessellator.draw(); GL11.glTranslatef(0.5F, 0.5F, 0.5F); } @Override public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { int direction = renderer.blockAccess.getBlockMetadata(x, y, z) & 3; if(direction>0){ renderer.uvRotateTop = direction-1; } else { renderer.uvRotateTop = 3; } boolean flag = renderer.renderStandardBlock(block, x, y, z); renderer.uvRotateTop = 0; return flag; } @Override public int getRenderId() { return 2106; } @Override public boolean shouldRender3DInInventory(int modelId) { return true; } } SlotGoldOven package com.volt.dev.morefurnaces.goldfurnace; import cpw.mods.fml.common.FMLCommonHandler; import net.minecraft.entity.item.EntityXPOrb; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import net.minecraft.stats.AchievementList; import net.minecraft.util.MathHelper; public class SlotGoldOven extends Slot { /** The player that is using the GUI where this slot resides. */ private EntityPlayer thePlayer; private int field_75228_b; private static final String __OBFID = "CL_00001749"; public SlotGoldOven(EntityPlayer par1EntityPlayer, IInventory par2IInventory, int par3, int par4, int par5) { super(par2IInventory, par3, par4, par5); this.thePlayer = par1EntityPlayer; } /** * Check if the stack is a valid item for this slot. Always true beside for the armor slots. */ public boolean isItemValid(ItemStack par1ItemStack) { return false; } /** * Decrease the size of the stack in slot (first int arg) by the amount of the second int arg. Returns the new * stack. */ public ItemStack decrStackSize(int par1) { if (this.getHasStack()) { this.field_75228_b += Math.min(par1, this.getStack().stackSize); } return super.decrStackSize(par1); } public void onPickupFromSlot(EntityPlayer par1EntityPlayer, ItemStack par2ItemStack) { this.onCrafting(par2ItemStack); super.onPickupFromSlot(par1EntityPlayer, par2ItemStack); } /** * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood. Typically increases an * internal count then calls onCrafting(item). */ protected void onCrafting(ItemStack par1ItemStack, int par2) { this.field_75228_b += par2; this.onCrafting(par1ItemStack); } /** * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood. */ protected void onCrafting(ItemStack par1ItemStack) { par1ItemStack.onCrafting(this.thePlayer.worldObj, this.thePlayer, this.field_75228_b); if (!this.thePlayer.worldObj.isRemote) { int i = this.field_75228_b; float f = GoldOvenRecipes.smelting().func_151398_b(par1ItemStack); int j; if (f == 0.0F) { i = 0; } else if (f < 1.0F) { j = MathHelper.floor_float((float)i * f); if (j < MathHelper.ceiling_float_int((float)i * f) && (float)Math.random() < (float)i * f - (float)j) { ++j; } i = j; } while (i > 0) { j = EntityXPOrb.getXPSplit(i); i -= j; this.thePlayer.worldObj.spawnEntityInWorld(new EntityXPOrb(this.thePlayer.worldObj, this.thePlayer.posX, this.thePlayer.posY + 0.5D, this.thePlayer.posZ + 0.5D, j)); } } this.field_75228_b = 0; FMLCommonHandler.instance().firePlayerSmeltedEvent(thePlayer, par1ItemStack); if (par1ItemStack.getItem() == Items.iron_ingot) { this.thePlayer.addStat(AchievementList.acquireIron, 1); } if (par1ItemStack.getItem() == Items.cooked_fished) { this.thePlayer.addStat(AchievementList.cookFish, 1); } } } TileEntityGoldOven package com.volt.dev.morefurnaces.goldfurnace; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemHoe; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemSword; import net.minecraft.item.ItemTool; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; public class TileEntityGoldOven extends TileEntity implements ISidedInventory { private static final int[] slotsTop = new int[] {0}; private static final int[] slotsBottom = new int[] {2, 1}; private static final int[] slotsSides = new int[] {1}; /** * The ItemStacks that hold the items currently being used in the furnace */ private ItemStack[] furnaceItemStacks = new ItemStack[3]; /** The number of ticks that the furnace will keep burning */ public int furnaceBurnTime; /** * The number of ticks that a fresh copy of the currently-burning item would keep the furnace burning for */ public int currentItemBurnTime; /** The number of ticks that the current item has been cooking for */ public int furnaceCookTime; private String field_145958_o; private static final String __OBFID = "CL_00000357"; /** * Returns the number of slots in the inventory. */ public int getSizeInventory() { return this.furnaceItemStacks.length; } /** * Returns the stack in slot i */ public ItemStack getStackInSlot(int par1) { return this.furnaceItemStacks[par1]; } /** * Removes from an inventory slot (first arg) up to a specified number (second arg) of items and returns them in a * new stack. */ public ItemStack decrStackSize(int par1, int par2) { if (this.furnaceItemStacks[par1] != null) { ItemStack itemstack; if (this.furnaceItemStacks[par1].stackSize <= par2) { itemstack = this.furnaceItemStacks[par1]; this.furnaceItemStacks[par1] = null; return itemstack; } else { itemstack = this.furnaceItemStacks[par1].splitStack(par2); if (this.furnaceItemStacks[par1].stackSize == 0) { this.furnaceItemStacks[par1] = null; } return itemstack; } } else { return null; } } /** * When some containers are closed they call this on each slot, then drop whatever it returns as an EntityItem - * like when you close a workbench GUI. */ public ItemStack getStackInSlotOnClosing(int par1) { if (this.furnaceItemStacks[par1] != null) { ItemStack itemstack = this.furnaceItemStacks[par1]; this.furnaceItemStacks[par1] = null; return itemstack; } else { return null; } } /** * Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections). */ public void setInventorySlotContents(int par1, ItemStack par2ItemStack) { this.furnaceItemStacks[par1] = par2ItemStack; if (par2ItemStack != null && par2ItemStack.stackSize > this.getInventoryStackLimit()) { par2ItemStack.stackSize = this.getInventoryStackLimit(); } } /** * Returns the name of the inventory */ public String getInventoryName() { return this.hasCustomInventoryName() ? this.field_145958_o : "container.furnace"; } /** * Returns if the inventory is named */ public boolean hasCustomInventoryName() { return this.field_145958_o != null && this.field_145958_o.length() > 0; } public void func_145951_a(String p_145951_1_) { this.field_145958_o = p_145951_1_; } public void readFromNBT(NBTTagCompound p_145839_1_) { super.readFromNBT(p_145839_1_); NBTTagList nbttaglist = p_145839_1_.getTagList("Items", 10); this.furnaceItemStacks = new ItemStack[this.getSizeInventory()]; for (int i = 0; i < nbttaglist.tagCount(); ++i) { NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i); byte b0 = nbttagcompound1.getByte("Slot"); if (b0 >= 0 && b0 < this.furnaceItemStacks.length) { this.furnaceItemStacks[b0] = ItemStack.loadItemStackFromNBT(nbttagcompound1); } } this.furnaceBurnTime = p_145839_1_.getShort("BurnTime"); this.furnaceCookTime = p_145839_1_.getShort("CookTime"); this.currentItemBurnTime = getItemBurnTime(this.furnaceItemStacks[1]); if (p_145839_1_.hasKey("CustomName", ) { this.field_145958_o = p_145839_1_.getString("CustomName"); } } public void writeToNBT(NBTTagCompound p_145841_1_) { super.writeToNBT(p_145841_1_); p_145841_1_.setShort("BurnTime", (short)this.furnaceBurnTime); p_145841_1_.setShort("CookTime", (short)this.furnaceCookTime); NBTTagList nbttaglist = new NBTTagList(); for (int i = 0; i < this.furnaceItemStacks.length; ++i) { if (this.furnaceItemStacks[i] != null) { NBTTagCompound nbttagcompound1 = new NBTTagCompound(); nbttagcompound1.setByte("Slot", (byte)i); this.furnaceItemStacks[i].writeToNBT(nbttagcompound1); nbttaglist.appendTag(nbttagcompound1); } } p_145841_1_.setTag("Items", nbttaglist); if (this.hasCustomInventoryName()) { p_145841_1_.setString("CustomName", this.field_145958_o); } } /** * Returns the maximum stack size for a inventory slot. */ public int getInventoryStackLimit() { return 64; } /** * Returns an integer between 0 and the passed value representing how close the current item is to being completely * cooked */ @SideOnly(Side.CLIENT) public int getCookProgressScaled(int p_145953_1_) { return this.furnaceCookTime * p_145953_1_ / 200; } /** * Returns an integer between 0 and the passed value representing how much burn time is left on the current fuel * item, where 0 means that the item is exhausted and the passed value means that the item is fresh */ @SideOnly(Side.CLIENT) public int getBurnTimeRemainingScaled(int p_145955_1_) { if (this.currentItemBurnTime == 0) { this.currentItemBurnTime = 200; } return this.furnaceBurnTime * p_145955_1_ / this.currentItemBurnTime; } /** * Furnace isBurning */ public boolean isBurning() { return this.furnaceBurnTime > 0; } public void updateEntity() { boolean flag = this.furnaceBurnTime > 0; boolean flag1 = false; if (this.furnaceBurnTime > 0) { --this.furnaceBurnTime; } if (!this.worldObj.isRemote) { if (this.furnaceBurnTime == 0 && this.canSmelt()) { this.currentItemBurnTime = this.furnaceBurnTime = getItemBurnTime(this.furnaceItemStacks[1]); if (this.furnaceBurnTime > 0) { flag1 = true; if (this.furnaceItemStacks[1] != null) { --this.furnaceItemStacks[1].stackSize; if (this.furnaceItemStacks[1].stackSize == 0) { this.furnaceItemStacks[1] = furnaceItemStacks[1].getItem().getContainerItem(furnaceItemStacks[1]); } } } } if (this.isBurning() && this.canSmelt()) { ++this.furnaceCookTime; if (this.furnaceCookTime == 200) { this.furnaceCookTime = 0; this.smeltItem(); flag1 = true; } } else { this.furnaceCookTime = 0; } if (flag != this.furnaceBurnTime > 0) { flag1 = true; GoldOven.updateFurnaceBlockState(this.furnaceBurnTime > 0, this.worldObj, this.xCoord, this.yCoord, this.zCoord); } } if (flag1) { this.markDirty(); } } /** * Returns true if the furnace can smelt an item, i.e. has a source item, destination stack isn't full, etc. */ private boolean canSmelt() { if (this.furnaceItemStacks[0] == null) { return false; } else { ItemStack itemstack = GoldOvenRecipes.smelting().getSmeltingResult(this.furnaceItemStacks[0]); if (itemstack == null) return false; if (this.furnaceItemStacks[2] == null) return true; if (!this.furnaceItemStacks[2].isItemEqual(itemstack)) return false; int result = furnaceItemStacks[2].stackSize + itemstack.stackSize; return result <= getInventoryStackLimit() && result <= this.furnaceItemStacks[2].getMaxStackSize(); //Forge BugFix: Make it respect stack sizes properly. } } /** * Turn one item from the furnace source stack into the appropriate smelted item in the furnace result stack */ public void smeltItem() { if (this.canSmelt()) { ItemStack itemstack = GoldOvenRecipes.smelting().getSmeltingResult(this.furnaceItemStacks[0]); if (this.furnaceItemStacks[2] == null) { this.furnaceItemStacks[2] = itemstack.copy(); } else if (this.furnaceItemStacks[2].getItem() == itemstack.getItem()) { this.furnaceItemStacks[2].stackSize += itemstack.stackSize; // Forge BugFix: Results may have multiple items } --this.furnaceItemStacks[0].stackSize; if (this.furnaceItemStacks[0].stackSize <= 0) { this.furnaceItemStacks[0] = null; } } } /** * Returns the number of ticks that the supplied fuel item will keep the furnace burning, or 0 if the item isn't * fuel */ public static int getItemBurnTime(ItemStack p_145952_0_) { if (p_145952_0_ == null) { return 0; } else { Item item = p_145952_0_.getItem(); if (item instanceof ItemBlock && Block.getBlockFromItem(item) != Blocks.air) { Block block = Block.getBlockFromItem(item); if (block == Blocks.wooden_slab) { return 150; } if (block.getMaterial() == Material.wood) { return 300; } if (block == Blocks.coal_block) { return 16000; } } if (item instanceof ItemTool && ((ItemTool)item).getToolMaterialName().equals("WOOD")) return 200; if (item instanceof ItemSword && ((ItemSword)item).getToolMaterialName().equals("WOOD")) return 200; if (item instanceof ItemHoe && ((ItemHoe)item).getToolMaterialName().equals("WOOD")) return 200; if (item == Items.stick) return 100; if (item == Items.coal) return 1600; if (item == Items.lava_bucket) return 20000; if (item == Item.getItemFromBlock(Blocks.sapling)) return 100; if (item == Items.blaze_rod) return 2400; return GameRegistry.getFuelValue(p_145952_0_); } } public static boolean isItemFuel(ItemStack p_145954_0_) { /** * Returns the number of ticks that the supplied fuel item will keep the furnace burning, or 0 if the item isn't * fuel */ return getItemBurnTime(p_145954_0_) > 0; } /** * Do not make give this method the name canInteractWith because it clashes with Container */ public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) { return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : par1EntityPlayer.getDistanceSq((double)this.xCoord + 0.5D, (double)this.yCoord + 0.5D, (double)this.zCoord + 0.5D) <= 64.0D; } public void openInventory() {} public void closeInventory() {} /** * Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot. */ public boolean isItemValidForSlot(int par1, ItemStack par2ItemStack) { return par1 == 2 ? false : (par1 == 1 ? isItemFuel(par2ItemStack) : true); } /** * Returns an array containing the indices of the slots that can be accessed by automation on the given side of this * block. */ public int[] getAccessibleSlotsFromSide(int par1) { return par1 == 0 ? slotsBottom : (par1 == 1 ? slotsTop : slotsSides); } /** * Returns true if automation can insert the given item in the given slot from the given side. Args: Slot, item, * side */ public boolean canInsertItem(int par1, ItemStack par2ItemStack, int par3) { return this.isItemValidForSlot(par1, par2ItemStack); } /** * Returns true if automation can extract the given item in the given slot from the given side. Args: Slot, item, * side */ public boolean canExtractItem(int par1, ItemStack par2ItemStack, int par3) { return par3 != 0 || par1 != 1 || par2ItemStack.getItem() == Items.bucket; } } There we go. All code (most) from my mod is pasted in this description I hope you can find the problem... I can't.. Thank you in advance! Check out my website at: http://mattkx4.github.io/
April 6, 201411 yr Your log gives a pretty good clue as to what is happening. You are opening a GoldOven gui when you click on an IronOven, it fails because the TE is not, in fact, a GoldOven at all. at com.volt.dev.morefurnaces.goldfurnace.GuiHandlerGoldOven.getServerGuiElement(GuiHandlerGoldOven.java:16) <-- your GoldOven gui opens (5) at cpw.mods.fml.common.network.NetworkRegistry.getRemoteGuiContainer(NetworkRegistry.java:241) <-- server triggers container (4) at cpw.mods.fml.common.network.internal.FMLNetworkHandler.openGui(FMLNetworkHandler.java:75) <-- server got arguments (3) at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2510) <-- opening GUI with given argument (2) at com.volt.dev.morefurnaces.ironfurnace.IronOven.onBlockActivated(IronOven.java:142) <-- clicked on IronOven (1) You need to make sure you open the correct Gui when you activate a furnace. When you register a guiHandler (two different times) the second one overwrites the first. You only get one GuiHandler per mod. Use it to open all Gui's. -S- (if I helped, please click Thank and applaud) http://6upnqa.dm2301.livefilestore.com/y2mtf-vG7Tqq1TiiVpIm53KWj7294NDPoHfSHHb4PzZiMAUfRCfK0UY0MwOu7Q3zTBNVTKqWjr2-xgBfFRpQT5p-QivtvknPpoABMNUw9br9WuZcBFkjePhnAbW500gVm-P/sequiturian.png[/img]
April 6, 201411 yr Author Your log gives a pretty good clue as to what is happening. You are opening a GoldOven gui when you click on an IronOven, it fails because the TE is not, in fact, a GoldOven at all. at com.volt.dev.morefurnaces.goldfurnace.GuiHandlerGoldOven.getServerGuiElement(GuiHandlerGoldOven.java:16) <-- your GoldOven gui opens (5) at cpw.mods.fml.common.network.NetworkRegistry.getRemoteGuiContainer(NetworkRegistry.java:241) <-- server triggers container (4) at cpw.mods.fml.common.network.internal.FMLNetworkHandler.openGui(FMLNetworkHandler.java:75) <-- server got arguments (3) at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2510) <-- opening GUI with given argument (2) at com.volt.dev.morefurnaces.ironfurnace.IronOven.onBlockActivated(IronOven.java:142) <-- clicked on IronOven (1) You need to make sure you open the correct Gui when you activate a furnace. When you register a guiHandler (two different times) the second one overwrites the first. You only get one GuiHandler per mod. Use it to open all Gui's. I know my problem (thanks to you but I don't know how to fix it. In the GUI Handler class, there is the switch statement. I now know that each furnace should have it's own individual id. Only problem I've run into is, I don't know where the GUI ID is that I need to change..... I f you could help that'd be awesome! Check out my website at: http://mattkx4.github.io/
April 7, 201411 yr There is an ID in there ... V ... par5EntityPlayer.openGui(MoreFurnaces.instance, 0, par1World, par2, par3, par4); And it is 0 in both furnaces. -S- (if I helped, please click Thank and applaud) http://6upnqa.dm2301.livefilestore.com/y2mtf-vG7Tqq1TiiVpIm53KWj7294NDPoHfSHHb4PzZiMAUfRCfK0UY0MwOu7Q3zTBNVTKqWjr2-xgBfFRpQT5p-QivtvknPpoABMNUw9br9WuZcBFkjePhnAbW500gVm-P/sequiturian.png[/img]
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.