Files
MinecraftForge/patches/minecraft/net/minecraft/tileentity/TileEntityFurnace.java.patch
T

119 lines
4.8 KiB
Diff

--- ../src_base/minecraft/net/minecraft/tileentity/TileEntityFurnace.java
+++ ../src_work/minecraft/net/minecraft/tileentity/TileEntityFurnace.java
@@ -9,6 +9,7 @@
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ContainerWorldly;
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;
@@ -17,7 +18,10 @@
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
-public class TileEntityFurnace extends TileEntity implements ContainerWorldly
+import net.minecraftforge.common.ForgeDirection;
+import net.minecraftforge.common.ISidedInventory;
+
+public class TileEntityFurnace extends TileEntity implements ContainerWorldly, ISidedInventory
{
/**
* The ItemStacks that hold the items currently being used in the furnace
@@ -268,8 +272,7 @@
if (this.furnaceItemStacks[1].stackSize == 0)
{
- Item item = this.furnaceItemStacks[1].getItem().getContainerItem();
- this.furnaceItemStacks[1] = item != null ? new ItemStack(item) : null;
+ this.furnaceItemStacks[1] = this.furnaceItemStacks[1].getItem().getContainerItemStack(furnaceItemStacks[1]);
}
}
}
@@ -315,8 +318,12 @@
}
else
{
- ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(this.furnaceItemStacks[0].getItem().itemID);
- return itemstack == null ? false : (this.furnaceItemStacks[2] == null ? true : (!this.furnaceItemStacks[2].isItemEqual(itemstack) ? false : (this.furnaceItemStacks[2].stackSize < this.getInventoryStackLimit() && this.furnaceItemStacks[2].stackSize < this.furnaceItemStacks[2].getMaxStackSize() ? true : this.furnaceItemStacks[2].stackSize < itemstack.getMaxStackSize())));
+ ItemStack itemstack = FurnaceRecipes.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 <= itemstack.getMaxStackSize());
}
}
@@ -327,15 +334,15 @@
{
if (this.canSmelt())
{
- ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(this.furnaceItemStacks[0].getItem().itemID);
+ ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(this.furnaceItemStacks[0]);
if (this.furnaceItemStacks[2] == null)
{
this.furnaceItemStacks[2] = itemstack.copy();
}
- else if (this.furnaceItemStacks[2].itemID == itemstack.itemID)
- {
- ++this.furnaceItemStacks[2].stackSize;
+ else if (this.furnaceItemStacks[2].isItemEqual(itemstack))
+ {
+ furnaceItemStacks[2].stackSize += itemstack.stackSize;
}
--this.furnaceItemStacks[0].stackSize;
@@ -362,7 +369,7 @@
int i = par0ItemStack.getItem().itemID;
Item item = par0ItemStack.getItem();
- if (i < 256 && Block.blocksList[i] != null)
+ if (par0ItemStack.getItem() instanceof ItemBlock && Block.blocksList[i] != null)
{
Block block = Block.blocksList[i];
@@ -423,4 +430,41 @@
{
return 1;
}
+
+ /***********************************************************************************
+ * This function is here for compatibilities sake, Modders should Check for
+ * Sided before ContainerWorldly, Vanilla Minecraft does not follow the sided standard
+ * that Modding has for a while.
+ *
+ * In vanilla:
+ *
+ * Top: Ores
+ * Sides: Fuel
+ * Bottom: Output
+ *
+ * Standard Modding:
+ * Top: Ores
+ * Sides: Output
+ * Bottom: Fuel
+ *
+ * The Modding one is designed after the GUI, the vanilla one is designed because its
+ * intended use is for the hopper, which logically would take things in from the top.
+ *
+ * This will possibly be removed in future updates, and make vanilla the definitive
+ * standard.
+ */
+
+ @Override
+ public int getStartInventorySide(ForgeDirection side)
+ {
+ if (side == ForgeDirection.DOWN) return 1;
+ if (side == ForgeDirection.UP) return 0;
+ return 2;
+ }
+
+ @Override
+ public int getSizeInventorySide(ForgeDirection side)
+ {
+ return 1;
+ }
}