diff --git a/common/net/minecraftforge/fluids/ItemFluidContainer.java b/common/net/minecraftforge/fluids/ItemFluidContainer.java index be615d3a10..9729c12263 100644 --- a/common/net/minecraftforge/fluids/ItemFluidContainer.java +++ b/common/net/minecraftforge/fluids/ItemFluidContainer.java @@ -6,9 +6,9 @@ import net.minecraft.nbt.NBTTagCompound; /** * Reference implementation of {@link IFluidContainerItem}. Use/extend this or implement your own. - * + * * @author King Lemming - * + * */ public class ItemFluidContainer extends Item implements IFluidContainerItem { @@ -124,7 +124,7 @@ public class ItemFluidContainer extends Item implements IFluidContainerItem @Override public FluidStack drain(ItemStack container, int maxDrain, boolean doDrain) { - if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Fluid")) + if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Fluid") || maxDrain == 0) { return null; } @@ -135,10 +135,10 @@ public class ItemFluidContainer extends Item implements IFluidContainerItem return null; } - stack.amount = Math.min(stack.amount, maxDrain); + int drained = Math.min(stack.amount, maxDrain); if (doDrain) { - if (maxDrain >= capacity) + if (maxDrain >= stack.amount) { container.stackTagCompound.removeTag("Fluid"); @@ -153,6 +153,7 @@ public class ItemFluidContainer extends Item implements IFluidContainerItem fluidTag.setInteger("Amount", fluidTag.getInteger("Amount") - maxDrain); container.stackTagCompound.setTag("Fluid", fluidTag); } + stack.amount = drained; return stack; } } diff --git a/common/net/minecraftforge/oredict/OreDictionary.java b/common/net/minecraftforge/oredict/OreDictionary.java index 5ec2872fe0..7ba05353c4 100644 --- a/common/net/minecraftforge/oredict/OreDictionary.java +++ b/common/net/minecraftforge/oredict/OreDictionary.java @@ -124,7 +124,11 @@ public class OreDictionary new ItemStack(Block.stoneBrick), new ItemStack(Block.stoneSingleSlab), new ItemStack(Block.stairsCobblestone), - new ItemStack(Block.cobblestoneWall) + new ItemStack(Block.cobblestoneWall), + new ItemStack(Block.stairsWoodOak), + new ItemStack(Block.stairsWoodBirch), + new ItemStack(Block.stairsWoodJungle), + new ItemStack(Block.stairsWoodSpruce) }; List recipes = CraftingManager.getInstance().getRecipeList(); diff --git a/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch b/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch index 89f4e50a87..67171b48d9 100644 --- a/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch +++ b/patches/minecraft/net/minecraft/world/chunk/Chunk.java.patch @@ -145,7 +145,7 @@ - this.worldObj.removeBlockTileEntity(j2, par2, k2); + else if (Block.blocksList[l1] != null && Block.blocksList[l1].hasTileEntity(i2)) + { -+ TileEntity te = worldObj.getBlockTileEntity(j2, par2, k2); ++ TileEntity te = getChunkBlockTileEntityUnsafe(j2 & 0xf, par2, k2 & 0xf); + if (te != null && te.shouldRefresh(l1, par4, i2, par5, worldObj, j2, par2, k2)) + { + this.worldObj.removeBlockTileEntity(j2, par2, k2); @@ -361,7 +361,7 @@ } } -@@ -1468,4 +1585,18 @@ +@@ -1468,4 +1585,44 @@ } } } @@ -378,5 +378,31 @@ + chunkTileEntityMap.remove(position); + } + } ++ } ++ ++ /** FORGE: backport TE false creation fix */ ++ /** ++ * ++ * Retrieves the tile entity, WITHOUT creating it. Good for checking if it ++ * exists. ++ * ++ * @param x ++ * @param y ++ * @param z ++ * @return The tile entity at the specified location, if it exists and is ++ * valid. ++ */ ++ public TileEntity getChunkBlockTileEntityUnsafe(int x, int y, int z) ++ { ++ ChunkPosition chunkposition = new ChunkPosition(x, y, z); ++ TileEntity tileentity = (TileEntity) this.chunkTileEntityMap.get(chunkposition); ++ ++ if (tileentity != null && tileentity.isInvalid()) ++ { ++ chunkTileEntityMap.remove(chunkposition); ++ tileentity = null; ++ } ++ ++ return tileentity; + } }