From 44d166f382287f8875f43995b27ed72e4e70c58f Mon Sep 17 00:00:00 2001 From: psxlover Date: Sun, 15 Jul 2012 19:44:25 +0300 Subject: [PATCH 01/12] Set the brightness before rendering a marker. Should fix issue #73 --- buildcraft_client/net/minecraft/src/mod_BuildCraftCore.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/buildcraft_client/net/minecraft/src/mod_BuildCraftCore.java b/buildcraft_client/net/minecraft/src/mod_BuildCraftCore.java index 1f4f9925..954fd521 100644 --- a/buildcraft_client/net/minecraft/src/mod_BuildCraftCore.java +++ b/buildcraft_client/net/minecraft/src/mod_BuildCraftCore.java @@ -594,6 +594,8 @@ public class mod_BuildCraftCore extends NetworkMod { x += 0.5D; z += 0.5D; + tessellator.setBrightness(block.getMixedBrightnessForBlock(iblockaccess, xCoord, yCoord, zCoord)); + double s = 0.0625D; if (meta == 5) { From be7bb5d31b207b4e32c55b226292caf60899fea3 Mon Sep 17 00:00:00 2001 From: SirSengir Date: Thu, 19 Jul 2012 14:18:43 +0200 Subject: [PATCH 02/12] More work on inventory interfaces. --- .../api/inventory/ISecuredInventory.java | 15 +++++++++++++++ .../api/inventory/ISelectiveInventory.java | 6 +++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/common/net/minecraft/src/buildcraft/api/inventory/ISecuredInventory.java b/common/net/minecraft/src/buildcraft/api/inventory/ISecuredInventory.java index 5d7d09d7..ed1de442 100644 --- a/common/net/minecraft/src/buildcraft/api/inventory/ISecuredInventory.java +++ b/common/net/minecraft/src/buildcraft/api/inventory/ISecuredInventory.java @@ -1,5 +1,20 @@ package net.minecraft.src.buildcraft.api.inventory; +import net.minecraft.src.buildcraft.api.Orientations; + public interface ISecuredInventory { + + /** + * @param name + * @return true if the user/player with the given name has access permissions on this machine. + */ boolean canAccess(String name); + + /** + * Informs the inventory with whose permissions the next item or liquid transaction will be performed. It is up to the inventory to determine the effect. + * @param orientation Orientation the transaction will be performed from. + * @param name Name of the user/player who owns the transaction. + */ + void prepareTransaction(Orientations orientation, String name); + } diff --git a/common/net/minecraft/src/buildcraft/api/inventory/ISelectiveInventory.java b/common/net/minecraft/src/buildcraft/api/inventory/ISelectiveInventory.java index e604db24..49c36d86 100644 --- a/common/net/minecraft/src/buildcraft/api/inventory/ISelectiveInventory.java +++ b/common/net/minecraft/src/buildcraft/api/inventory/ISelectiveInventory.java @@ -6,12 +6,12 @@ import net.minecraft.src.buildcraft.api.Orientations; public interface ISelectiveInventory extends ISpecialInventory { /** * Requests specified items to be extracted from the inventory - * @param desired Array which can contain ItemStacks, Items, or classes describing the type of item accepted. + * @param desired Array which can contain ItemStacks, Items, or classes describing the type of item accepted or excluded. + * @param exclusion If true desired items are not eligible for returning. * @param doRemove If false no actual extraction may occur. * @param from Orientation the ItemStack is requested from. * @param maxItemCount Maximum amount of items to extract (spread over all returned item stacks) * @return Array of item stacks extracted from the inventory */ - ItemStack[] extractItem(Object[] desired, boolean doRemove, Orientations from, int maxItemCount); - + ItemStack[] extractItem(Object[] desired, boolean exclusion, boolean doRemove, Orientations from, int maxItemCount); } From 4efd07332acd33ab9eb58415c2061b0d9f217b7a Mon Sep 17 00:00:00 2001 From: SirSengir Date: Thu, 19 Jul 2012 21:24:56 +0200 Subject: [PATCH 03/12] Refactored everything outside of .transport to use ITankContainer and new ISpecialInventory. --- .../src/buildcraft/factory/RenderTank.java | 26 +-- .../src/buildcraft/api/BuildCraftAPI.java | 20 ++- .../src/buildcraft/builders/TileFiller.java | 132 ++++++++------- .../core/DefaultTriggerProvider.java | 4 +- .../src/buildcraft/core/StackUtil.java | 23 ++- .../core/TriggerLiquidContainer.java | 32 ++-- .../src/buildcraft/energy/Engine.java | 11 +- .../src/buildcraft/energy/EngineIron.java | 144 ++++++++-------- .../src/buildcraft/energy/TileEngine.java | 76 +++++---- .../src/buildcraft/factory/BlockRefinery.java | 8 +- .../src/buildcraft/factory/BlockTank.java | 8 +- .../buildcraft/factory/TileAutoWorkbench.java | 77 ++++----- .../src/buildcraft/factory/TileHopper.java | 4 +- .../src/buildcraft/factory/TilePump.java | 5 - .../src/buildcraft/factory/TileRefinery.java | 74 +------- .../src/buildcraft/factory/TileTank.java | 159 ++++++++---------- 16 files changed, 363 insertions(+), 440 deletions(-) diff --git a/buildcraft_client/net/minecraft/src/buildcraft/factory/RenderTank.java b/buildcraft_client/net/minecraft/src/buildcraft/factory/RenderTank.java index 79108812..670f16b2 100644 --- a/buildcraft_client/net/minecraft/src/buildcraft/factory/RenderTank.java +++ b/buildcraft_client/net/minecraft/src/buildcraft/factory/RenderTank.java @@ -17,6 +17,7 @@ import net.minecraft.src.Item; import net.minecraft.src.TileEntity; import net.minecraft.src.TileEntitySpecialRenderer; import net.minecraft.src.World; +import net.minecraft.src.buildcraft.api.liquids.LiquidStack; import net.minecraft.src.buildcraft.core.RenderEntityBlock; import net.minecraft.src.buildcraft.core.RenderEntityBlock.BlockInterface; import net.minecraft.src.forge.ITextureProvider; @@ -30,7 +31,7 @@ public class RenderTank extends TileEntitySpecialRenderer { private HashMap stage = new HashMap(); - private int[] getDisplayLists(int liquidId, World world) { + private int[] getDisplayLists(int liquidId, int damage, World world) { if (stage.containsKey(liquidId)) return stage.get(liquidId); @@ -42,7 +43,7 @@ public class RenderTank extends TileEntitySpecialRenderer { if (liquidId < Block.blocksList.length && Block.blocksList[liquidId] != null) block.texture = Block.blocksList[liquidId].blockIndexInTexture; else - block.texture = Item.itemsList[liquidId].getIconFromDamage(0); + block.texture = Item.itemsList[liquidId].getIconFromDamage(damage); for (int s = 0; s < displayStages; ++s) { d[s] = GLAllocation.generateDisplayLists(1); @@ -69,31 +70,32 @@ public class RenderTank extends TileEntitySpecialRenderer { TileTank tank = ((TileTank) tileentity); - int liquidId = tank.getLiquidId(); + LiquidStack liquid = tank.getLiquid(); - if (tank.getLiquidQuantity() == 0 || liquidId == 0) + if (liquid == null || liquid.amount <= 0 + || liquid.itemID <= 0) return; - int[] d = getDisplayLists(tank.getLiquidId(), tileentity.worldObj); + int[] displayList = getDisplayLists(liquid.itemID, liquid.itemMeta, tileentity.worldObj); GL11.glPushMatrix(); GL11.glDisable(2896 /* GL_LIGHTING */); - Object o = null; + Object obj = null; - if (liquidId < Block.blocksList.length && Block.blocksList[liquidId] != null) - o = Block.blocksList[liquidId]; + if (liquid.itemID < Block.blocksList.length && Block.blocksList[liquid.itemID] != null) + obj = Block.blocksList[liquid.itemID]; else - o = Item.itemsList[liquidId]; + obj = Item.itemsList[liquid.itemID]; - if (o instanceof ITextureProvider) - MinecraftForgeClient.bindTexture(((ITextureProvider) o).getTextureFile()); + if (obj instanceof ITextureProvider) + MinecraftForgeClient.bindTexture(((ITextureProvider) obj).getTextureFile()); else MinecraftForgeClient.bindTexture("/terrain.png"); GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.5F); - GL11.glCallList(d[(int) ((float) tank.getLiquidQuantity() / (float) (tank.getTankCapacity()) * (displayStages - 1))]); + GL11.glCallList(displayList[(int) ((float) liquid.amount / (float) (tank.getTankCapacity()) * (displayStages - 1))]); GL11.glEnable(2896 /* GL_LIGHTING */); GL11.glPopMatrix(); diff --git a/common/net/minecraft/src/buildcraft/api/BuildCraftAPI.java b/common/net/minecraft/src/buildcraft/api/BuildCraftAPI.java index 499e0c4d..a67badda 100644 --- a/common/net/minecraft/src/buildcraft/api/BuildCraftAPI.java +++ b/common/net/minecraft/src/buildcraft/api/BuildCraftAPI.java @@ -35,7 +35,7 @@ public class BuildCraftAPI { /** * This does not do anything anymore. Use buildcraft.api.liquids.LiquidManager! */ - @Deprecated public static LinkedList liquids = new LinkedList(); + //@Deprecated public static LinkedList liquids = new LinkedList(); /** * This does not do anything anymore. Use buildcraft.api.fuels.IronEngineFuel! */ @@ -47,13 +47,14 @@ public class BuildCraftAPI { /** * This does not do anything anymore. Use buildcraft.api.recipes.RefineryRecipe! */ - @Deprecated private static LinkedList refineryRecipe = new LinkedList(); + //@Deprecated private static LinkedList refineryRecipe = new LinkedList(); private static LinkedList triggerProviders = new LinkedList(); private static LinkedList actionProviders = new LinkedList(); /** * This does not do anything anymore. Use buildcraft.api.liquids.LiquidManager! */ + /* @Deprecated public static int getLiquidForFilledItem(ItemStack filledItem) { if (filledItem == null) { @@ -67,11 +68,12 @@ public class BuildCraftAPI { } return 0; - } + }*/ /** * This does not do anything anymore. Use buildcraft.api.liquids.LiquidManager! */ + /* @Deprecated public static ItemStack getFilledItemForLiquid(int liquidId) { for (LiquidData d : liquids) { @@ -81,11 +83,12 @@ public class BuildCraftAPI { } return null; - } + } */ /** * This does not do anything anymore. Use buildcraft.api.liquids.LiquidManager! */ + /* @Deprecated public static boolean isLiquid(int blockId) { if (blockId == 0) { @@ -99,7 +102,7 @@ public class BuildCraftAPI { } return false; - } + } */ /** * Return true if the block given in parameter is pass through (e.g. air, @@ -139,16 +142,18 @@ public class BuildCraftAPI { /** * This does not do anything anymore. Use buildcraft.api.recipes.RefineryRecipe! */ + /* @Deprecated public static void registerRefineryRecipe(RefineryRecipe recipe) { if (!refineryRecipe.contains(recipe)) { refineryRecipe.add(recipe); } - } + } */ /** * This does not do anything anymore. Use buildcraft.api.recipes.RefineryRecipe! */ + /* @Deprecated public static RefineryRecipe findRefineryRecipe(int liquid1, int qty1, int liquid2, int qty2) { int l1 = qty1 > 0 ? liquid1 : 0; @@ -177,7 +182,8 @@ public class BuildCraftAPI { return null; } - + */ + public static BlockSignature getBlockSignature(Block block) { return blockBptProps[0].getSignature(block); } diff --git a/common/net/minecraft/src/buildcraft/builders/TileFiller.java b/common/net/minecraft/src/buildcraft/builders/TileFiller.java index a8189138..c1b49fbb 100644 --- a/common/net/minecraft/src/buildcraft/builders/TileFiller.java +++ b/common/net/minecraft/src/buildcraft/builders/TileFiller.java @@ -17,12 +17,12 @@ import net.minecraft.src.buildcraft.api.APIProxy; import net.minecraft.src.buildcraft.api.Action; import net.minecraft.src.buildcraft.api.IActionReceptor; import net.minecraft.src.buildcraft.api.IAreaProvider; -import net.minecraft.src.buildcraft.api.ISpecialInventory; import net.minecraft.src.buildcraft.api.LaserKind; import net.minecraft.src.buildcraft.api.Orientations; import net.minecraft.src.buildcraft.api.TileNetworkData; import net.minecraft.src.buildcraft.api.filler.FillerManager; import net.minecraft.src.buildcraft.api.filler.IFillerPattern; +import net.minecraft.src.buildcraft.api.inventory.ISpecialInventory; import net.minecraft.src.buildcraft.api.power.IPowerProvider; import net.minecraft.src.buildcraft.api.power.IPowerReceptor; import net.minecraft.src.buildcraft.api.power.PowerFramework; @@ -302,70 +302,6 @@ public class TileFiller extends TileBuildCraft implements ISpecialInventory, IPo } } - @Override - public boolean addItem(ItemStack stack, boolean doAdd, Orientations from) { - StackUtil stackUtil = new StackUtil(stack); - - boolean added = false; - - for (int i = 9; i < contents.length; ++i) { - if (stackUtil.tryAdding(this, i, doAdd, false)) { - added = true; - break; - } - } - - if (added) { - if (!doAdd) { - return true; - } else if (stack.stackSize == 0) { - return true; - } else { - addItem(stack, added, from); - - return true; - } - } - - if (!added) { - for (int i = 9; i < contents.length; ++i) { - if (stackUtil.tryAdding(this, i, doAdd, true)) { - added = true; - break; - } - } - } - - if (added) { - if (!doAdd) { - return true; - } else if (stack.stackSize == 0) { - return true; - } else { - addItem(stack, added, from); - - return true; - } - } - - return false; - } - - @Override - public ItemStack extractItem(boolean doRemove, Orientations from) { - for (int i = 9; i < contents.length; ++i) { - if (contents[i] != null) { - if (doRemove) { - return decrStackSize(i, 1); - } else { - return contents[i]; - } - } - } - - return null; - } - @Override public void handleDescriptionPacket(PacketUpdate packet) { boolean initialized = box.isInitialized(); @@ -453,4 +389,70 @@ public class TileFiller extends TileBuildCraft implements ISpecialInventory, IPo public boolean allowActions() { return true; } + + /* ISPECIALINVENTORY */ + @Override + public int addItem(ItemStack stack, boolean doAdd, Orientations from) { + StackUtil stackUtil = new StackUtil(stack); + + boolean added = false; + + for (int i = 9; i < contents.length; ++i) { + if (stackUtil.tryAdding(this, i, doAdd, false)) { + added = true; + break; + } + } + + if (added) { + if (!doAdd) { + return stackUtil.itemsAdded; + } else if (stack.stackSize - stackUtil.itemsAdded <= 0) { + return stackUtil.itemsAdded; + } else { + addItem(stack, added, from); + + return stackUtil.itemsAdded; + } + } + + if (!added) { + for (int i = 9; i < contents.length; ++i) { + if (stackUtil.tryAdding(this, i, doAdd, true)) { + added = true; + break; + } + } + } + + if (added) { + if (!doAdd) { + return stackUtil.itemsAdded; + } else if (stack.stackSize - stackUtil.itemsAdded <= 0) { + return stackUtil.itemsAdded; + } else { + addItem(stack, added, from); + + return stackUtil.itemsAdded; + } + } + + return 0; + } + + @Override + public ItemStack[] extractItem(boolean doRemove, Orientations from, int maxItemCount) { + for (int i = 9; i < contents.length; ++i) { + if (contents[i] != null) { + if (doRemove) { + return new ItemStack[] { decrStackSize(i, 1) }; + } else { + return new ItemStack[] { contents[i] }; + } + } + } + + return null; + } + } diff --git a/common/net/minecraft/src/buildcraft/core/DefaultTriggerProvider.java b/common/net/minecraft/src/buildcraft/core/DefaultTriggerProvider.java index 7a0ff446..79c727aa 100644 --- a/common/net/minecraft/src/buildcraft/core/DefaultTriggerProvider.java +++ b/common/net/minecraft/src/buildcraft/core/DefaultTriggerProvider.java @@ -6,7 +6,7 @@ import net.minecraft.src.Block; import net.minecraft.src.BuildCraftCore; import net.minecraft.src.IInventory; import net.minecraft.src.TileEntity; -import net.minecraft.src.buildcraft.api.ILiquidContainer; +import net.minecraft.src.buildcraft.api.liquids.ITankContainer; import net.minecraft.src.buildcraft.api.IOverrideDefaultTriggers; import net.minecraft.src.buildcraft.api.IPipe; import net.minecraft.src.buildcraft.api.ITriggerProvider; @@ -28,7 +28,7 @@ public class DefaultTriggerProvider implements ITriggerProvider { res.add(BuildCraftCore.triggerFullInventory); } - if (tile instanceof ILiquidContainer && ((ILiquidContainer) tile).getLiquidSlots().length > 0) { + if (tile instanceof ITankContainer && ((ITankContainer) tile).getTanks().length > 0) { res.add(BuildCraftCore.triggerEmptyLiquid); res.add(BuildCraftCore.triggerContainsLiquid); res.add(BuildCraftCore.triggerSpaceLiquid); diff --git a/common/net/minecraft/src/buildcraft/core/StackUtil.java b/common/net/minecraft/src/buildcraft/core/StackUtil.java index ea8005a4..4215d6f0 100644 --- a/common/net/minecraft/src/buildcraft/core/StackUtil.java +++ b/common/net/minecraft/src/buildcraft/core/StackUtil.java @@ -15,14 +15,15 @@ import net.minecraft.src.IInventory; import net.minecraft.src.ItemStack; import net.minecraft.src.TileEntity; import net.minecraft.src.World; -import net.minecraft.src.buildcraft.api.ISpecialInventory; import net.minecraft.src.buildcraft.api.Orientations; import net.minecraft.src.buildcraft.api.Position; +import net.minecraft.src.buildcraft.api.inventory.ISpecialInventory; import net.minecraft.src.forge.ISidedInventory; public class StackUtil { public ItemStack items; + public int itemsAdded; public StackUtil(ItemStack stack) { this.items = stack; @@ -51,7 +52,7 @@ public class StackUtil { TileEntity tileInventory = w.getBlockTileEntity((int) pos.x, (int) pos.y, (int) pos.z); if (tileInventory instanceof ISpecialInventory) - if (((ISpecialInventory) tileInventory).addItem(items, false, from)) + if (((ISpecialInventory) tileInventory).addItem(items, false, from) > 0) possibleInventories.add(pos.orientation); if (tileInventory instanceof IInventory) @@ -87,8 +88,14 @@ public class StackUtil { public boolean checkAvailableSlot(IInventory inventory, boolean add, Orientations from) { // First, look for a similar pile - if (inventory instanceof ISpecialInventory) - return ((ISpecialInventory) inventory).addItem(items, add, from); + if (inventory instanceof ISpecialInventory) { + int used = ((ISpecialInventory) inventory).addItem(items, add, from); + if(used <= 0) + return false; + + items.stackSize -= used; + return true; + } boolean added = false; @@ -136,7 +143,7 @@ public class StackUtil { if (added) if (!add) return true; - else if (items.stackSize == 0) + else if (items.stackSize - itemsAdded == 0) return true; else { checkAvailableSlot(inventory, added, from); @@ -192,7 +199,7 @@ public class StackUtil { if (added) { if (!add) return true; - else if (items.stackSize == 0) + else if (items.stackSize - itemsAdded == 0) return true; else { checkAvailableSlot(inventory, added, from); @@ -221,7 +228,7 @@ public class StackUtil { if (doAdd) { stack.stackSize++; - items.stackSize--; + itemsAdded++; } return true; @@ -232,7 +239,7 @@ public class StackUtil { stack = items.copy(); stack.stackSize = 1; - items.stackSize--; + itemsAdded++; inventory.setInventorySlotContents(stackIndex, stack); } diff --git a/common/net/minecraft/src/buildcraft/core/TriggerLiquidContainer.java b/common/net/minecraft/src/buildcraft/core/TriggerLiquidContainer.java index e0c89e8d..6de1944f 100644 --- a/common/net/minecraft/src/buildcraft/core/TriggerLiquidContainer.java +++ b/common/net/minecraft/src/buildcraft/core/TriggerLiquidContainer.java @@ -11,10 +11,10 @@ package net.minecraft.src.buildcraft.core; import net.minecraft.src.TileEntity; import net.minecraft.src.buildcraft.api.BuildCraftAPI; -import net.minecraft.src.buildcraft.api.ILiquidContainer; -import net.minecraft.src.buildcraft.api.LiquidSlot; import net.minecraft.src.buildcraft.api.Trigger; import net.minecraft.src.buildcraft.api.TriggerParameter; +import net.minecraft.src.buildcraft.api.liquids.ILiquidTank; +import net.minecraft.src.buildcraft.api.liquids.ITankContainer; import net.minecraft.src.buildcraft.api.liquids.LiquidManager; public class TriggerLiquidContainer extends Trigger { @@ -68,15 +68,15 @@ public class TriggerLiquidContainer extends Trigger { @Override public boolean isTriggerActive(TileEntity tile, TriggerParameter parameter) { - if (tile instanceof ILiquidContainer) { - ILiquidContainer container = (ILiquidContainer) tile; + if (tile instanceof ITankContainer) { + ITankContainer container = (ITankContainer) tile; int seachedLiquidId = 0; if (parameter != null && parameter.getItem() != null) seachedLiquidId = LiquidManager.getLiquidIDForFilledItem(parameter.getItem()); - LiquidSlot[] liquids = container.getLiquidSlots(); + ILiquidTank[] liquids = container.getTanks(); if (liquids == null || liquids.length == 0) return false; @@ -85,33 +85,33 @@ public class TriggerLiquidContainer extends Trigger { case Empty: if (liquids != null && liquids.length > 0) { - for (LiquidSlot c : liquids) - if (c.getLiquidQty() != 0) + for (ILiquidTank c : liquids) + if (c.getLiquid().amount != 0) return false; return true; } else return false; case Contains: - for (LiquidSlot c : liquids) - if (c.getLiquidQty() != 0) - if (seachedLiquidId == 0 || seachedLiquidId == c.getLiquidId()) + for (ILiquidTank c : liquids) + if (c.getLiquid().amount != 0) + if (seachedLiquidId == 0 || seachedLiquidId == c.getLiquid().itemID) return true; return false; case Space: - for (LiquidSlot c : liquids) - if (c.getLiquidQty() == 0) + for (ILiquidTank c : liquids) + if (c.getLiquid().amount == 0) return true; - else if (c.getLiquidQty() < c.getCapacity()) - if (seachedLiquidId == 0 || seachedLiquidId == c.getLiquidId()) + else if (c.getLiquid().amount < c.getCapacity()) + if (seachedLiquidId == 0 || seachedLiquidId == c.getLiquid().itemID) return true; return false; case Full: - for (LiquidSlot c : liquids) - if (c.getLiquidQty() < c.getCapacity()) + for (ILiquidTank c : liquids) + if (c.getLiquid().amount < c.getCapacity()) return false; return true; diff --git a/common/net/minecraft/src/buildcraft/energy/Engine.java b/common/net/minecraft/src/buildcraft/energy/Engine.java index 531117fa..fa6891be 100644 --- a/common/net/minecraft/src/buildcraft/energy/Engine.java +++ b/common/net/minecraft/src/buildcraft/energy/Engine.java @@ -13,9 +13,9 @@ import net.minecraft.src.ICrafting; import net.minecraft.src.ItemStack; import net.minecraft.src.NBTTagCompound; import net.minecraft.src.buildcraft.api.APIProxy; -import net.minecraft.src.buildcraft.api.LiquidSlot; import net.minecraft.src.buildcraft.api.Orientations; import net.minecraft.src.buildcraft.api.TileNetworkData; +import net.minecraft.src.buildcraft.api.liquids.LiquidTank; public abstract class Engine { @@ -146,10 +146,6 @@ public abstract class Engine { } - public LiquidSlot[] getLiquidSlots() { - return new LiquidSlot[0]; - } - public boolean isActive() { return true; } @@ -166,6 +162,11 @@ public abstract class Engine { return currentOutput; } + /* ILIQUIDCONTAINER */ + public LiquidTank[] getLiquidSlots() { + return new LiquidTank[0]; + } + /* IINVENTORY */ public int getSizeInventory() { return 0; } public ItemStack getStackInSlot(int i) { return null; } diff --git a/common/net/minecraft/src/buildcraft/energy/EngineIron.java b/common/net/minecraft/src/buildcraft/energy/EngineIron.java index a0a5126c..ab1c877b 100644 --- a/common/net/minecraft/src/buildcraft/energy/EngineIron.java +++ b/common/net/minecraft/src/buildcraft/energy/EngineIron.java @@ -14,11 +14,11 @@ import net.minecraft.src.ICrafting; import net.minecraft.src.ItemStack; import net.minecraft.src.NBTTagCompound; import net.minecraft.src.buildcraft.api.BuildCraftAPI; -import net.minecraft.src.buildcraft.api.LiquidSlot; import net.minecraft.src.buildcraft.api.Orientations; import net.minecraft.src.buildcraft.api.fuels.IronEngineFuel; import net.minecraft.src.buildcraft.api.liquids.LiquidManager; import net.minecraft.src.buildcraft.api.liquids.LiquidStack; +import net.minecraft.src.buildcraft.api.liquids.LiquidTank; import net.minecraft.src.buildcraft.core.DefaultProps; import net.minecraft.src.buildcraft.core.Utils; @@ -125,12 +125,11 @@ public class EngineIron extends Engine { super.update(); if (itemInInventory != null) { - int liquidId = LiquidManager.getLiquidIDForFilledItem(itemInInventory); - - if (liquidId != 0) { - if (fill(Orientations.Unknown, BuildCraftAPI.BUCKET_VOLUME, liquidId, false) == BuildCraftAPI.BUCKET_VOLUME) { - fill(Orientations.Unknown, BuildCraftAPI.BUCKET_VOLUME, liquidId, true); + LiquidStack liquid = LiquidManager.getLiquidForFilledItem(itemInInventory); + if (liquid != null) { + if (fill(Orientations.Unknown, liquid, false) == BuildCraftAPI.BUCKET_VOLUME) { + fill(Orientations.Unknown, liquid, true); tile.setInventorySlotContents(0, Utils.consumeItem(itemInInventory)); } } @@ -178,65 +177,6 @@ public class EngineIron extends Engine { return (int) (((float) liquidQty / (float) (MAX_LIQUID)) * i); } - public int fill(Orientations from, int quantity, int id, boolean doFill) { - if (id == Block.waterStill.blockID) { - return fillCoolant(from, quantity, id, doFill); - } - - int res = 0; - - if (liquidQty > 0 && liquidId != id) { - return 0; - } - - if (IronEngineFuel.getFuelForLiquid(new LiquidStack(id, quantity, 0)) == null) - return 0; - - if (liquidQty + quantity <= MAX_LIQUID) { - if (doFill) { - liquidQty += quantity; - } - - res = quantity; - } else { - res = MAX_LIQUID - liquidQty; - - if (doFill) { - liquidQty = MAX_LIQUID; - } - } - - liquidId = id; - - return res; - } - - private int fillCoolant(Orientations from, int quantity, int id, boolean doFill) { - int res = 0; - - if (coolantQty > 0 && coolantId != id) { - return 0; - } - - if (coolantQty + quantity <= MAX_LIQUID) { - if (doFill) { - coolantQty += quantity; - } - - res = quantity; - } else { - res = MAX_LIQUID - coolantQty; - - if (doFill) { - coolantQty = MAX_LIQUID; - } - } - - coolantId = id; - - return res; - } - @Override public void readFromNBT(NBTTagCompound nbttagcompound) { liquidId = nbttagcompound.getInteger("liquidId"); @@ -319,12 +259,6 @@ public class EngineIron extends Engine { iCrafting.updateCraftingInventoryInfo(containerEngine, 6, coolantId); } - @Override - public LiquidSlot[] getLiquidSlots() { - return new LiquidSlot[] { new LiquidSlot(liquidId, liquidQty, MAX_LIQUID), - new LiquidSlot(coolantId, coolantQty, MAX_LIQUID) }; - } - @Override public boolean isActive() { return penaltyCooling <= 0; @@ -335,6 +269,74 @@ public class EngineIron extends Engine { return heat; } + /* ITANKCONTAINER */ + public int fill(Orientations from, LiquidStack resource, boolean doFill) { + + // Handle coolant + if (resource.itemID == Block.waterStill.blockID) + return fillCoolant(from, resource, doFill); + + int res = 0; + + if (liquidQty > 0 && liquidId != resource.itemID) { + return 0; + } + + if (IronEngineFuel.getFuelForLiquid(resource) == null) + return 0; + + if (liquidQty + resource.amount <= MAX_LIQUID) { + if (doFill) { + liquidQty += resource.amount; + } + + res = resource.amount; + } else { + res = MAX_LIQUID - liquidQty; + + if (doFill) { + liquidQty = MAX_LIQUID; + } + } + + liquidId = resource.itemID; + + return res; + } + + private int fillCoolant(Orientations from, LiquidStack resource, boolean doFill) { + int res = 0; + + if (coolantQty > 0 && coolantId != resource.itemID) { + return 0; + } + + if (coolantQty + resource.amount <= MAX_LIQUID) { + if (doFill) { + coolantQty += resource.amount; + } + + res = resource.amount; + } else { + res = MAX_LIQUID - coolantQty; + + if (doFill) { + coolantQty = MAX_LIQUID; + } + } + + coolantId = resource.itemID; + + return res; + } + + @Override + public LiquidTank[] getLiquidSlots() { + return new LiquidTank[] { new LiquidTank(liquidId, liquidQty, MAX_LIQUID), + new LiquidTank(coolantId, coolantQty, MAX_LIQUID) }; + } + + /* IINVENTORY */ @Override public int getSizeInventory() { return 1; } @Override public ItemStack getStackInSlot(int i) { return itemInInventory; } diff --git a/common/net/minecraft/src/buildcraft/energy/TileEngine.java b/common/net/minecraft/src/buildcraft/energy/TileEngine.java index ec179383..7c4c9696 100644 --- a/common/net/minecraft/src/buildcraft/energy/TileEngine.java +++ b/common/net/minecraft/src/buildcraft/energy/TileEngine.java @@ -20,14 +20,16 @@ import net.minecraft.src.NBTTagCompound; import net.minecraft.src.Packet; import net.minecraft.src.TileEntity; import net.minecraft.src.buildcraft.api.APIProxy; -import net.minecraft.src.buildcraft.api.ILiquidContainer; import net.minecraft.src.buildcraft.api.IOverrideDefaultTriggers; import net.minecraft.src.buildcraft.api.IPipeConnection; -import net.minecraft.src.buildcraft.api.LiquidSlot; import net.minecraft.src.buildcraft.api.Orientations; import net.minecraft.src.buildcraft.api.Position; import net.minecraft.src.buildcraft.api.TileNetworkData; import net.minecraft.src.buildcraft.api.Trigger; +import net.minecraft.src.buildcraft.api.liquids.ILiquidTank; +import net.minecraft.src.buildcraft.api.liquids.ITankContainer; +import net.minecraft.src.buildcraft.api.liquids.LiquidStack; +import net.minecraft.src.buildcraft.api.liquids.LiquidTank; import net.minecraft.src.buildcraft.api.power.IPowerProvider; import net.minecraft.src.buildcraft.api.power.IPowerReceptor; import net.minecraft.src.buildcraft.api.power.PowerFramework; @@ -38,7 +40,7 @@ import net.minecraft.src.buildcraft.core.network.PacketUpdate; //TODO: All Engines need to take func_48081_b into account -public class TileEngine extends TileBuildCraft implements IPowerReceptor, IInventory, ILiquidContainer, IEngineProvider, +public class TileEngine extends TileBuildCraft implements IPowerReceptor, IInventory, ITankContainer, IEngineProvider, IOverrideDefaultTriggers, IPipeConnection, IBuilderInventory { public @TileNetworkData @@ -378,30 +380,6 @@ public class TileEngine extends TileBuildCraft implements IPowerReceptor, IInven return false; } - @Override - public int fill(Orientations from, int quantity, int id, boolean doFill) { - if (engine instanceof EngineIron) { - return ((EngineIron) engine).fill(from, quantity, id, doFill); - } else { - return 0; - } - } - - @Override - public int empty(int quantityMax, boolean doEmpty) { - return 0; - } - - @Override - public int getLiquidQuantity() { - return 0; - } - - @Override - public int getLiquidId() { - return 0; - } - @Override public void openChest() { @@ -446,15 +424,6 @@ public class TileEngine extends TileBuildCraft implements IPowerReceptor, IInven return triggers; } - @Override - public LiquidSlot[] getLiquidSlots() { - if (engine == null) { - return new LiquidSlot[0]; - } else { - return engine.getLiquidSlots(); - } - } - @Override public boolean isPipeConnected(Orientations with) { if (engine instanceof EngineWood) { @@ -472,4 +441,39 @@ public class TileEngine extends TileBuildCraft implements IPowerReceptor, IInven public void checkRedstonePower() { isRedstonePowered = worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord); } + + /* ILIQUIDCONTAINER */ + @Override + public int fill(Orientations from, LiquidStack resource, boolean doFill) { + if (engine instanceof EngineIron) { + return ((EngineIron) engine).fill(from, resource, doFill); + } else { + return 0; + } + } + + @Override + public int fill(int tankIndex, LiquidStack resource, boolean doFill) { + // TODO Auto-generated method stub + return 0; + } + + @Override + public LiquidStack drain(Orientations from, int maxDrain, boolean doDrain) { + return null; + } + @Override + public LiquidStack drain(int tankIndex, int maxDrain, boolean doDrain) { + return null; + } + + @Override + public LiquidTank[] getTanks() { + if (engine == null) { + return new LiquidTank[0]; + } else { + return engine.getLiquidSlots(); + } + } + } diff --git a/common/net/minecraft/src/buildcraft/factory/BlockRefinery.java b/common/net/minecraft/src/buildcraft/factory/BlockRefinery.java index 92046c83..705d2b52 100644 --- a/common/net/minecraft/src/buildcraft/factory/BlockRefinery.java +++ b/common/net/minecraft/src/buildcraft/factory/BlockRefinery.java @@ -26,6 +26,7 @@ import net.minecraft.src.buildcraft.api.BuildCraftAPI; import net.minecraft.src.buildcraft.api.Orientations; import net.minecraft.src.buildcraft.api.Position; import net.minecraft.src.buildcraft.api.liquids.LiquidManager; +import net.minecraft.src.buildcraft.api.liquids.LiquidStack; import net.minecraft.src.buildcraft.api.tools.IToolWrench; import net.minecraft.src.buildcraft.core.GuiIds; import net.minecraft.src.buildcraft.core.Utils; @@ -103,11 +104,10 @@ public class BlockRefinery extends BlockContainer { return true; } else { - int liquidId = LiquidManager.getLiquidIDForFilledItem(entityplayer.getCurrentEquippedItem()); + LiquidStack liquid = LiquidManager.getLiquidForFilledItem(entityplayer.getCurrentEquippedItem()); - if (liquidId != 0) { - int qty = ((TileRefinery) world.getBlockTileEntity(i, j, k)).fill(Orientations.Unknown, - BuildCraftAPI.BUCKET_VOLUME, liquidId, true); + if (liquid != null) { + int qty = ((TileRefinery) world.getBlockTileEntity(i, j, k)).fill(Orientations.Unknown, liquid, true); if (qty != 0 && !BuildCraftCore.debugMode) { entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, diff --git a/common/net/minecraft/src/buildcraft/factory/BlockTank.java b/common/net/minecraft/src/buildcraft/factory/BlockTank.java index d33cdf41..155053ec 100644 --- a/common/net/minecraft/src/buildcraft/factory/BlockTank.java +++ b/common/net/minecraft/src/buildcraft/factory/BlockTank.java @@ -99,7 +99,7 @@ public class BlockTank extends BlockContainer implements ITextureProvider { // Handle filled containers if (liquid != null) { - int qty = tank.fill(Orientations.Unknown, liquid.amount, liquid.itemID, true); + int qty = tank.fill(Orientations.Unknown, liquid, true); if (qty != 0 && !BuildCraftCore.debugMode) { entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, @@ -111,8 +111,8 @@ public class BlockTank extends BlockContainer implements ITextureProvider { // Handle empty containers } else { - ItemStack filled = LiquidManager.fillLiquidContainer(new LiquidStack(tank.getLiquidId(), - tank.empty(BuildCraftAPI.BUCKET_VOLUME, false)), current); + LiquidStack available = tank.drain(Orientations.Unknown, BuildCraftAPI.BUCKET_VOLUME, false); + ItemStack filled = LiquidManager.fillLiquidContainer(available, current); liquid = LiquidManager.getLiquidForFilledItem(filled); if(liquid != null) { @@ -129,7 +129,7 @@ public class BlockTank extends BlockContainer implements ITextureProvider { entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, filled); } - tank.empty(liquid.amount, true); + tank.drain(Orientations.Unknown, liquid.amount, true); return true; } } diff --git a/common/net/minecraft/src/buildcraft/factory/TileAutoWorkbench.java b/common/net/minecraft/src/buildcraft/factory/TileAutoWorkbench.java index ab689b50..0116e550 100644 --- a/common/net/minecraft/src/buildcraft/factory/TileAutoWorkbench.java +++ b/common/net/minecraft/src/buildcraft/factory/TileAutoWorkbench.java @@ -19,9 +19,9 @@ import net.minecraft.src.InventoryCrafting; import net.minecraft.src.ItemStack; import net.minecraft.src.NBTTagCompound; import net.minecraft.src.TileEntity; -import net.minecraft.src.buildcraft.api.ISpecialInventory; import net.minecraft.src.buildcraft.api.Orientations; import net.minecraft.src.buildcraft.api.Position; +import net.minecraft.src.buildcraft.api.inventory.ISpecialInventory; import net.minecraft.src.buildcraft.core.StackUtil; import net.minecraft.src.buildcraft.core.Utils; @@ -122,38 +122,6 @@ public class TileAutoWorkbench extends TileEntity implements ISpecialInventory { Utils.writeStacksToNBT(nbttagcompound, "stackList", stackList); } - @Override - public boolean addItem(ItemStack stack, boolean doAdd, Orientations from) { - StackUtil stackUtils = new StackUtil(stack); - - int minSimilar = Integer.MAX_VALUE; - int minSlot = -1; - - for (int j = 0; j < getSizeInventory(); ++j) { - ItemStack stackInInventory = getStackInSlot(j); - - if (stackInInventory != null && stackInInventory.stackSize > 0 && stackInInventory.itemID == stack.itemID - && stackInInventory.getItemDamage() == stack.getItemDamage() && stackInInventory.stackSize < minSimilar) { - minSimilar = stackInInventory.stackSize; - minSlot = j; - } - } - - if (minSlot != -1) { - if (stackUtils.tryAdding(this, minSlot, doAdd, false)) { - if (doAdd && stack.stackSize != 0) { - addItem(stack, doAdd, from); - } - - return true; - } else { - return false; - } - } else { - return false; - } - } - class StackPointer { IInventory inventory; @@ -229,11 +197,6 @@ public class TileAutoWorkbench extends TileEntity implements ISpecialInventory { return resultStack; } - @Override - public ItemStack extractItem(boolean doRemove, Orientations from) { - return extractItem(doRemove, false); - } - public void resetPointers(LinkedList pointers) { for (StackPointer p : pointers) { ItemStack item = p.inventory.getStackInSlot(p.index); @@ -316,4 +279,42 @@ public class TileAutoWorkbench extends TileEntity implements ISpecialInventory { } + /* ISPECIALINVENTORY */ + @Override + public int addItem(ItemStack stack, boolean doAdd, Orientations from) { + StackUtil stackUtils = new StackUtil(stack); + + int minSimilar = Integer.MAX_VALUE; + int minSlot = -1; + + for (int j = 0; j < getSizeInventory(); ++j) { + ItemStack stackInInventory = getStackInSlot(j); + + if (stackInInventory != null && stackInInventory.stackSize > 0 && stackInInventory.itemID == stack.itemID + && stackInInventory.getItemDamage() == stack.getItemDamage() && stackInInventory.stackSize < minSimilar) { + minSimilar = stackInInventory.stackSize; + minSlot = j; + } + } + + if (minSlot != -1) { + if (stackUtils.tryAdding(this, minSlot, doAdd, false)) { + if (doAdd && stack.stackSize != 0) { + addItem(stack, doAdd, from); + } + + return stackUtils.itemsAdded; + } else { + return stackUtils.itemsAdded; + } + } else { + return 0; + } + } + + @Override + public ItemStack[] extractItem(boolean doRemove, Orientations from, int maxItemCount) { + return new ItemStack[] { extractItem(doRemove, false) }; + } + } diff --git a/common/net/minecraft/src/buildcraft/factory/TileHopper.java b/common/net/minecraft/src/buildcraft/factory/TileHopper.java index 52e9b972..c6a1512e 100644 --- a/common/net/minecraft/src/buildcraft/factory/TileHopper.java +++ b/common/net/minecraft/src/buildcraft/factory/TileHopper.java @@ -6,8 +6,8 @@ import net.minecraft.src.ItemStack; import net.minecraft.src.NBTTagCompound; import net.minecraft.src.TileEntity; import net.minecraft.src.buildcraft.api.APIProxy; -import net.minecraft.src.buildcraft.api.ISpecialInventory; import net.minecraft.src.buildcraft.api.Orientations; +import net.minecraft.src.buildcraft.api.inventory.ISpecialInventory; import net.minecraft.src.buildcraft.core.TileBuildCraft; import net.minecraft.src.buildcraft.core.utils.InventoryUtil; import net.minecraft.src.buildcraft.core.utils.SidedInventoryAdapter; @@ -48,7 +48,7 @@ public class TileHopper extends TileBuildCraft implements IInventory { if (tile instanceof ISpecialInventory) { ISpecialInventory special = (ISpecialInventory) tile; ItemStack clonedStack = _inventory.getStackInSlot(internalSlot).copy().splitStack(1); - if (special.addItem(clonedStack, true, Orientations.YPos)) { + if (special.addItem(clonedStack, true, Orientations.YPos) > 0) { _inventory.decrStackSize(internalSlot, 1); } return; diff --git a/common/net/minecraft/src/buildcraft/factory/TilePump.java b/common/net/minecraft/src/buildcraft/factory/TilePump.java index 9525cde3..7c2891e1 100644 --- a/common/net/minecraft/src/buildcraft/factory/TilePump.java +++ b/common/net/minecraft/src/buildcraft/factory/TilePump.java @@ -19,7 +19,6 @@ import net.minecraft.src.NBTTagCompound; import net.minecraft.src.TileEntity; import net.minecraft.src.buildcraft.api.APIProxy; import net.minecraft.src.buildcraft.api.BuildCraftAPI; -import net.minecraft.src.buildcraft.api.ILiquidContainer; import net.minecraft.src.buildcraft.api.Orientations; import net.minecraft.src.buildcraft.api.Position; import net.minecraft.src.buildcraft.api.TileNetworkData; @@ -135,10 +134,6 @@ public class TilePump extends TileMachine implements IMachine, IPowerReceptor { internalLiquid -= ((ITankContainer)tile).fill(p.orientation.reverse(), new LiquidStack(liquidId, internalLiquid), true); if(internalLiquid <= 0) break; - } else if (tile instanceof ILiquidContainer) { - internalLiquid -= ((ILiquidContainer) tile).fill(p.orientation.reverse(), internalLiquid, liquidId, true); - if (internalLiquid <= 0) - break; } } } diff --git a/common/net/minecraft/src/buildcraft/factory/TileRefinery.java b/common/net/minecraft/src/buildcraft/factory/TileRefinery.java index 7bd58603..a9c72661 100644 --- a/common/net/minecraft/src/buildcraft/factory/TileRefinery.java +++ b/common/net/minecraft/src/buildcraft/factory/TileRefinery.java @@ -18,8 +18,6 @@ import net.minecraft.src.ItemStack; import net.minecraft.src.NBTTagCompound; import net.minecraft.src.buildcraft.api.APIProxy; import net.minecraft.src.buildcraft.api.BuildCraftAPI; -import net.minecraft.src.buildcraft.api.ILiquidContainer; -import net.minecraft.src.buildcraft.api.LiquidSlot; import net.minecraft.src.buildcraft.api.Orientations; import net.minecraft.src.buildcraft.api.SafeTimeTracker; import net.minecraft.src.buildcraft.api.TileNetworkData; @@ -34,7 +32,7 @@ import net.minecraft.src.buildcraft.api.power.PowerProvider; import net.minecraft.src.buildcraft.api.recipes.RefineryRecipe; import net.minecraft.src.buildcraft.core.IMachine; -public class TileRefinery extends TileMachine implements ILiquidContainer, ITankContainer, IPowerReceptor, IInventory, IMachine { +public class TileRefinery extends TileMachine implements ITankContainer, IPowerReceptor, IInventory, IMachine { private int[] filters = new int[2]; @@ -388,76 +386,6 @@ public class TileRefinery extends TileMachine implements ILiquidContainer, ITank iCrafting.updateCraftingInventoryInfo(container, 1, filters[1]); } - /* ILIQUIDCONTAINER */ - @Override - public int fill(Orientations from, int quantity, int id, boolean doFill) { - int used = 0; - - if (filters[0] != 0 || filters[1] != 0) { - if (filters[0] == id) { - used += slot1.fill(from, quantity, id, doFill); - } - - if (filters[1] == id) { - used += slot2.fill(from, quantity - used, id, doFill); - } - } else { - used += slot1.fill(from, quantity, id, doFill); - used += slot2.fill(from, quantity - used, id, doFill); - } - - if (doFill && used > 0) { - updateNetworkTime.markTime(worldObj); - sendNetworkUpdate(); - } - - return used; - } - - @Override - public int empty(int quantityMax, boolean doEmpty) { - int res = 0; - - if (result.quantity >= quantityMax) { - res = quantityMax; - - if (doEmpty) { - result.quantity -= quantityMax; - } - } else { - res = result.quantity; - - if (doEmpty) { - result.quantity = 0; - } - } - - if (doEmpty && res > 0) { - updateNetworkTime.markTime(worldObj); - sendNetworkUpdate(); - } - - return res; - } - - @Override - public int getLiquidQuantity() { - return result.quantity; - } - - @Override - public int getLiquidId() { - return result.liquidId; - } - - @Override - public LiquidSlot[] getLiquidSlots() { - return new LiquidSlot[] { new LiquidSlot(slot1.liquidId, slot1.quantity, LIQUID_PER_SLOT), - new LiquidSlot(slot2.liquidId, slot2.quantity, LIQUID_PER_SLOT), - new LiquidSlot(result.liquidId, result.quantity, LIQUID_PER_SLOT) }; - } - - /* ITANKCONTAINER */ @Override public int fill(Orientations from, LiquidStack resource, boolean doFill) { diff --git a/common/net/minecraft/src/buildcraft/factory/TileTank.java b/common/net/minecraft/src/buildcraft/factory/TileTank.java index 56806cbb..8ffa4edb 100644 --- a/common/net/minecraft/src/buildcraft/factory/TileTank.java +++ b/common/net/minecraft/src/buildcraft/factory/TileTank.java @@ -15,8 +15,6 @@ import net.minecraft.src.NBTTagCompound; import net.minecraft.src.TileEntity; import net.minecraft.src.buildcraft.api.APIProxy; import net.minecraft.src.buildcraft.api.BuildCraftAPI; -import net.minecraft.src.buildcraft.api.ILiquidContainer; -import net.minecraft.src.buildcraft.api.LiquidSlot; import net.minecraft.src.buildcraft.api.Orientations; import net.minecraft.src.buildcraft.api.SafeTimeTracker; import net.minecraft.src.buildcraft.api.TileNetworkData; @@ -27,7 +25,7 @@ import net.minecraft.src.buildcraft.api.liquids.LiquidTank; import net.minecraft.src.buildcraft.core.DefaultProps; import net.minecraft.src.buildcraft.core.TileBuildCraft; -public class TileTank extends TileBuildCraft implements ILiquidContainer, ITankContainer { +public class TileTank extends TileBuildCraft implements ITankContainer { public @TileNetworkData int stored = 0; @@ -128,95 +126,6 @@ public class TileTank extends TileBuildCraft implements ILiquidContainer, ITankC below.stored += moved; } - - /* ILIQUIDCONTAINER */ - @Override - public int fill(Orientations from, int quantity, int id, boolean doFill) { - return getBottomTank().actualFill(from, quantity, id, doFill); - } - - private int actualFill(Orientations from, int quantity, int id, boolean doFill) { - if (stored != 0 && id != liquidId) - return 0; - - liquidId = id; - int used = 0; - - TileTank above = getTankAbove(this); - - if (stored + quantity <= getTankCapacity()) { - if (doFill) { - stored += quantity; - hasUpdate = true; - } - - used = quantity; - } else if (stored <= getTankCapacity()) { - used = getTankCapacity() - stored; - - if (doFill) { - stored = getTankCapacity(); - hasUpdate = true; - } - } - - if (used < quantity && above != null) - used = used + above.actualFill(from, quantity - used, id, doFill); - - return used; - } - - @Override - public int getLiquidQuantity() { - return stored; - } - - public int getTankCapacity() { - return BuildCraftAPI.BUCKET_VOLUME * 16; - } - - @Override - public int empty(int quantityMax, boolean doEmpty) { - return getBottomTank().actualEmtpy(quantityMax, doEmpty); - } - - private int actualEmtpy(int quantityMax, boolean doEmpty) { - - if (stored >= quantityMax) { - if (doEmpty) { - stored -= quantityMax; - hasUpdate = true; - } - - return quantityMax; - - } else { - int result = stored; - - if (doEmpty) { - stored = 0; - hasUpdate = true; - } - - TileTank below = getTankBelow(this); - - if (below != null) - result += below.actualEmtpy(quantityMax - result, doEmpty); - - return result; - } - } - - @Override - public int getLiquidId() { - return liquidId; - } - - @Override - public LiquidSlot[] getLiquidSlots() { - ILiquidTank tank = getTanks()[0]; - return new LiquidSlot[] { new LiquidSlot(tank.getLiquid().itemID, tank.getLiquid().amount, tank.getCapacity()) }; - } /* ITANKCONTAINER */ @Override @@ -286,5 +195,71 @@ public class TileTank extends TileBuildCraft implements ILiquidContainer, ITankC return new ILiquidTank[] { new LiquidTank(resultLiquidId, resultLiquidQty, resultCapacity) }; } + + private int actualFill(Orientations from, int quantity, int id, boolean doFill) { + if (stored != 0 && id != liquidId) + return 0; + + liquidId = id; + int used = 0; + + TileTank above = getTankAbove(this); + + if (stored + quantity <= getTankCapacity()) { + if (doFill) { + stored += quantity; + hasUpdate = true; + } + + used = quantity; + } else if (stored <= getTankCapacity()) { + used = getTankCapacity() - stored; + + if (doFill) { + stored = getTankCapacity(); + hasUpdate = true; + } + } + + if (used < quantity && above != null) + used = used + above.actualFill(from, quantity - used, id, doFill); + + return used; + } + + public int getTankCapacity() { + return BuildCraftAPI.BUCKET_VOLUME * 16; + } + + public LiquidStack getLiquid() { + return new LiquidStack(liquidId, stored, 0); + } + + private int actualEmtpy(int quantityMax, boolean doEmpty) { + + if (stored >= quantityMax) { + if (doEmpty) { + stored -= quantityMax; + hasUpdate = true; + } + + return quantityMax; + + } else { + int result = stored; + + if (doEmpty) { + stored = 0; + hasUpdate = true; + } + + TileTank below = getTankBelow(this); + + if (below != null) + result += below.actualEmtpy(quantityMax - result, doEmpty); + + return result; + } + } } From 47eff20cb59f685499ecd20896c2dfd94aa8e1d9 Mon Sep 17 00:00:00 2001 From: CovertJaguar Date: Thu, 19 Jul 2012 19:02:33 -0700 Subject: [PATCH 04/12] Added distance check to pipe render code limiting rendering to 32 blocks away. --- .../net/minecraft/src/buildcraft/transport/RenderPipe.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/buildcraft_client/net/minecraft/src/buildcraft/transport/RenderPipe.java b/buildcraft_client/net/minecraft/src/buildcraft/transport/RenderPipe.java index f77aeab6..54ca0d7d 100644 --- a/buildcraft_client/net/minecraft/src/buildcraft/transport/RenderPipe.java +++ b/buildcraft_client/net/minecraft/src/buildcraft/transport/RenderPipe.java @@ -45,7 +45,9 @@ public class RenderPipe extends TileEntitySpecialRenderer { final static private int maxPower = 1000; - final static private int displayLiquidStages = 40; + final static private int displayLiquidStages = 40; + + final static private int renderDistanceSq = 1024; // 32 tiles private final static EntityItem dummyEntityItem = new EntityItem(null); @@ -214,6 +216,9 @@ public class RenderPipe extends TileEntitySpecialRenderer { if (BuildCraftCore.render == RenderMode.NoDynamic) return; + + if(tileentity.getDistanceFrom(tileEntityRenderer.playerX, tileEntityRenderer.playerY, tileEntityRenderer.playerZ) >= renderDistanceSq) + return; initializeDisplayPowerList(tileentity.worldObj); From ecf58dc38f167fbebdb7655fde1b1bc17f5dddb6 Mon Sep 17 00:00:00 2001 From: CovertJaguar Date: Thu, 19 Jul 2012 19:33:49 -0700 Subject: [PATCH 05/12] Various efficiency improvements to pipe rendering. --- .../src/buildcraft/transport/RenderPipe.java | 28 +++++++++---------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/buildcraft_client/net/minecraft/src/buildcraft/transport/RenderPipe.java b/buildcraft_client/net/minecraft/src/buildcraft/transport/RenderPipe.java index 54ca0d7d..072ffd90 100644 --- a/buildcraft_client/net/minecraft/src/buildcraft/transport/RenderPipe.java +++ b/buildcraft_client/net/minecraft/src/buildcraft/transport/RenderPipe.java @@ -227,14 +227,15 @@ public class RenderPipe extends TileEntitySpecialRenderer { if (pipe.pipe == null) return; - if (pipe.pipe.transport instanceof PipeTransportLiquids) - renderLiquids(pipe.pipe, x, y, z); - - if (pipe.pipe.transport instanceof PipeTransportItems) + if (pipe.pipe.transport instanceof PipeTransportItems) renderSolids(pipe.pipe, x, y, z); - if (pipe.pipe.transport instanceof PipeTransportPower) + else if (pipe.pipe.transport instanceof PipeTransportLiquids) + renderLiquids(pipe.pipe, x, y, z); + + else if (pipe.pipe.transport instanceof PipeTransportPower) renderPower(pipe.pipe, x, y, z); + } private void renderPower(Pipe pipe, double x, double y, double z) { @@ -355,11 +356,10 @@ public class RenderPipe extends TileEntitySpecialRenderer { o = Block.blocksList[liquidId]; else o = Item.itemsList[liquidId]; - - if (o instanceof ITextureProvider) - MinecraftForgeClient.bindTexture(((ITextureProvider) o).getTextureFile()); - else - MinecraftForgeClient.bindTexture("/terrain.png"); + + // should be safe, items and block all implement ITextureProvider now + // and if o is null, something else is wrong somewhere + MinecraftForgeClient.bindTexture(((ITextureProvider) o).getTextureFile()); return getDisplayLiquidLists(liquidId, world); } @@ -367,10 +367,12 @@ public class RenderPipe extends TileEntitySpecialRenderer { private void renderSolids(Pipe pipe, double x, double y, double z) { GL11.glPushMatrix(); GL11.glDisable(2896 /* GL_LIGHTING */); + + float light = pipe.worldObj.getLightBrightness(pipe.xCoord, pipe.yCoord, pipe.zCoord); for (EntityData data : ((PipeTransportItems) pipe.transport).travelingEntities.values()) doRenderItem(data.item, x + data.item.posX - pipe.xCoord, y + data.item.posY - pipe.yCoord, z + data.item.posZ - - pipe.zCoord, pipe.worldObj.getLightBrightness(pipe.xCoord, pipe.yCoord, pipe.zCoord)); + - pipe.zCoord, light); GL11.glEnable(2896 /* GL_LIGHTING */); GL11.glPopMatrix(); @@ -391,10 +393,6 @@ public class RenderPipe extends TileEntitySpecialRenderer { byte quantity = 1; if (entityitem.item.stackSize > 1) quantity = 2; - if (entityitem.item.stackSize > 5) - quantity = 3; - if (entityitem.item.stackSize > 20) - quantity = 4; GL11.glTranslatef((float) d, (float) d1, (float) d2); GL11.glEnable(32826 /* GL_RESCALE_NORMAL_EXT */); From 1482cc41acb4a93d28527eb8260a3a83d283bd33 Mon Sep 17 00:00:00 2001 From: CovertJaguar Date: Thu, 19 Jul 2012 20:09:15 -0700 Subject: [PATCH 06/12] Limited number of items that can be rendered. --- .../src/buildcraft/transport/RenderPipe.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/buildcraft_client/net/minecraft/src/buildcraft/transport/RenderPipe.java b/buildcraft_client/net/minecraft/src/buildcraft/transport/RenderPipe.java index 072ffd90..3b4df6b2 100644 --- a/buildcraft_client/net/minecraft/src/buildcraft/transport/RenderPipe.java +++ b/buildcraft_client/net/minecraft/src/buildcraft/transport/RenderPipe.java @@ -45,9 +45,11 @@ public class RenderPipe extends TileEntitySpecialRenderer { final static private int maxPower = 1000; - final static private int displayLiquidStages = 40; + final static private int displayLiquidStages = 40; final static private int renderDistanceSq = 1024; // 32 tiles + + final static private int numItemsToRender = 3; private final static EntityItem dummyEntityItem = new EntityItem(null); @@ -370,9 +372,15 @@ public class RenderPipe extends TileEntitySpecialRenderer { float light = pipe.worldObj.getLightBrightness(pipe.xCoord, pipe.yCoord, pipe.zCoord); - for (EntityData data : ((PipeTransportItems) pipe.transport).travelingEntities.values()) + int count = 0; + for (EntityData data : ((PipeTransportItems) pipe.transport).travelingEntities.values()) { + if(count >= numItemsToRender) + break; + doRenderItem(data.item, x + data.item.posX - pipe.xCoord, y + data.item.posY - pipe.yCoord, z + data.item.posZ - pipe.zCoord, light); + count++; + } GL11.glEnable(2896 /* GL_LIGHTING */); GL11.glPopMatrix(); From e090b748b8ef50fa554fc65e9fb4acbf61ea53bd Mon Sep 17 00:00:00 2001 From: CovertJaguar Date: Thu, 19 Jul 2012 20:25:40 -0700 Subject: [PATCH 07/12] Reduced render distance. --- .../net/minecraft/src/buildcraft/transport/RenderPipe.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildcraft_client/net/minecraft/src/buildcraft/transport/RenderPipe.java b/buildcraft_client/net/minecraft/src/buildcraft/transport/RenderPipe.java index 3b4df6b2..e9cb8f0f 100644 --- a/buildcraft_client/net/minecraft/src/buildcraft/transport/RenderPipe.java +++ b/buildcraft_client/net/minecraft/src/buildcraft/transport/RenderPipe.java @@ -47,7 +47,7 @@ public class RenderPipe extends TileEntitySpecialRenderer { final static private int displayLiquidStages = 40; - final static private int renderDistanceSq = 1024; // 32 tiles + final static private int renderDistanceSq = 256; // 16 tiles final static private int numItemsToRender = 3; From ec95590e0f5a28ddd0e14282c78607749f289b85 Mon Sep 17 00:00:00 2001 From: CovertJaguar Date: Thu, 19 Jul 2012 22:00:07 -0700 Subject: [PATCH 08/12] Increased render distance. --- .../net/minecraft/src/buildcraft/transport/RenderPipe.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildcraft_client/net/minecraft/src/buildcraft/transport/RenderPipe.java b/buildcraft_client/net/minecraft/src/buildcraft/transport/RenderPipe.java index e9cb8f0f..8e66c1f7 100644 --- a/buildcraft_client/net/minecraft/src/buildcraft/transport/RenderPipe.java +++ b/buildcraft_client/net/minecraft/src/buildcraft/transport/RenderPipe.java @@ -47,7 +47,7 @@ public class RenderPipe extends TileEntitySpecialRenderer { final static private int displayLiquidStages = 40; - final static private int renderDistanceSq = 256; // 16 tiles + final static private int renderDistanceSq = 24 * 24; final static private int numItemsToRender = 3; From 5631c80eb6c5a4ce2cc59dfaf498f98643378324 Mon Sep 17 00:00:00 2001 From: CovertJaguar Date: Thu, 19 Jul 2012 22:20:46 -0700 Subject: [PATCH 09/12] Increased max number of items rendered from 3 to 5. --- .../net/minecraft/src/buildcraft/transport/RenderPipe.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildcraft_client/net/minecraft/src/buildcraft/transport/RenderPipe.java b/buildcraft_client/net/minecraft/src/buildcraft/transport/RenderPipe.java index 8e66c1f7..0d6d0b9e 100644 --- a/buildcraft_client/net/minecraft/src/buildcraft/transport/RenderPipe.java +++ b/buildcraft_client/net/minecraft/src/buildcraft/transport/RenderPipe.java @@ -49,7 +49,7 @@ public class RenderPipe extends TileEntitySpecialRenderer { final static private int renderDistanceSq = 24 * 24; - final static private int numItemsToRender = 3; + final static private int numItemsToRender = 5; private final static EntityItem dummyEntityItem = new EntityItem(null); From 2e6f9acf6072605fc09c4aeac86aa890e2dc94ba Mon Sep 17 00:00:00 2001 From: CovertJaguar Date: Thu, 19 Jul 2012 22:46:27 -0700 Subject: [PATCH 10/12] Increased number of items for render from 5 to 10 --- .../net/minecraft/src/buildcraft/transport/RenderPipe.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildcraft_client/net/minecraft/src/buildcraft/transport/RenderPipe.java b/buildcraft_client/net/minecraft/src/buildcraft/transport/RenderPipe.java index 0d6d0b9e..8c770a19 100644 --- a/buildcraft_client/net/minecraft/src/buildcraft/transport/RenderPipe.java +++ b/buildcraft_client/net/minecraft/src/buildcraft/transport/RenderPipe.java @@ -49,7 +49,7 @@ public class RenderPipe extends TileEntitySpecialRenderer { final static private int renderDistanceSq = 24 * 24; - final static private int numItemsToRender = 5; + final static private int numItemsToRender = 10; private final static EntityItem dummyEntityItem = new EntityItem(null); From 22d7a716fe14d4cf65d58904f9c90bd3accb72dd Mon Sep 17 00:00:00 2001 From: SirSengir Date: Fri, 20 Jul 2012 09:19:46 +0200 Subject: [PATCH 11/12] Replaced old ISpecialInventory in transport. --- .../transport/PipeLogicDiamond.java | 11 ++-- .../transport/pipes/PipeItemsWood.java | 50 ++++++++++--------- 2 files changed, 31 insertions(+), 30 deletions(-) diff --git a/common/net/minecraft/src/buildcraft/transport/PipeLogicDiamond.java b/common/net/minecraft/src/buildcraft/transport/PipeLogicDiamond.java index c27b2b21..e4763cd6 100644 --- a/common/net/minecraft/src/buildcraft/transport/PipeLogicDiamond.java +++ b/common/net/minecraft/src/buildcraft/transport/PipeLogicDiamond.java @@ -18,10 +18,10 @@ import net.minecraft.src.NBTTagList; import net.minecraft.src.Packet; import net.minecraft.src.mod_BuildCraftTransport; import net.minecraft.src.buildcraft.api.APIProxy; -import net.minecraft.src.buildcraft.api.ISpecialInventory; import net.minecraft.src.buildcraft.api.Orientations; import net.minecraft.src.buildcraft.api.SafeTimeTracker; import net.minecraft.src.buildcraft.api.TileNetworkData; +import net.minecraft.src.buildcraft.api.inventory.ISpecialInventory; import net.minecraft.src.buildcraft.core.CoreProxy; import net.minecraft.src.buildcraft.core.DefaultProps; import net.minecraft.src.buildcraft.core.GuiIds; @@ -79,13 +79,12 @@ public class PipeLogicDiamond extends PipeLogic implements ISpecialInventory { /* ISPECIALINVENTORY */ @Override - public boolean addItem(ItemStack stack, boolean doAdd, Orientations from) { - return false; + public int addItem(ItemStack stack, boolean doAdd, Orientations from) { + return 0; } - @Override - public ItemStack extractItem(boolean doRemove, Orientations from) { - return null; + public ItemStack[] extractItem(boolean doRemove, Orientations from, int maxItemCount) { + return new ItemStack[0]; } /* IINVENTORY IMPLEMENTATION */ diff --git a/common/net/minecraft/src/buildcraft/transport/pipes/PipeItemsWood.java b/common/net/minecraft/src/buildcraft/transport/pipes/PipeItemsWood.java index 080c9700..66a9f1c6 100644 --- a/common/net/minecraft/src/buildcraft/transport/pipes/PipeItemsWood.java +++ b/common/net/minecraft/src/buildcraft/transport/pipes/PipeItemsWood.java @@ -14,10 +14,10 @@ import net.minecraft.src.ItemStack; import net.minecraft.src.TileEntity; import net.minecraft.src.World; import net.minecraft.src.buildcraft.api.EntityPassiveItem; -import net.minecraft.src.buildcraft.api.ILiquidContainer; -import net.minecraft.src.buildcraft.api.ISpecialInventory; import net.minecraft.src.buildcraft.api.Orientations; import net.minecraft.src.buildcraft.api.Position; +import net.minecraft.src.buildcraft.api.inventory.ISpecialInventory; +import net.minecraft.src.buildcraft.api.liquids.ITankContainer; import net.minecraft.src.buildcraft.api.power.IPowerProvider; import net.minecraft.src.buildcraft.api.power.IPowerReceptor; import net.minecraft.src.buildcraft.api.power.PowerFramework; @@ -95,28 +95,30 @@ public class PipeItemsWood extends Pipe implements IPowerReceptor { int blockId = w.getBlockId((int) pos.x, (int) pos.y, (int) pos.z); TileEntity tile = w.getBlockTileEntity((int) pos.x, (int) pos.y, (int) pos.z); - if (tile == null || !(tile instanceof IInventory || tile instanceof ILiquidContainer) + if (tile == null || !(tile instanceof IInventory || tile instanceof ITankContainer) || PipeLogicWood.isExcludedFromExtraction(Block.blocksList[blockId])) return; if (tile instanceof IInventory) { IInventory inventory = (IInventory) tile; - ItemStack stack = checkExtract(inventory, true, pos.orientation.reverse()); + ItemStack[] extracted = checkExtract(inventory, true, pos.orientation.reverse()); - if (stack == null || stack.stackSize == 0) { - powerProvider.useEnergy(1, 1, false); - return; + for(ItemStack stack : extracted) { + if (stack == null || stack.stackSize == 0) { + powerProvider.useEnergy(1, 1, false); + continue; + } + + Position entityPos = new Position(pos.x + 0.5, pos.y + Utils.getPipeFloorOf(stack), pos.z + 0.5, + pos.orientation.reverse()); + + entityPos.moveForwards(0.5); + + EntityPassiveItem entity = new EntityPassiveItem(w, entityPos.x, entityPos.y, entityPos.z, stack); + + ((PipeTransportItems) transport).entityEntering(entity, entityPos.orientation); } - - Position entityPos = new Position(pos.x + 0.5, pos.y + Utils.getPipeFloorOf(stack), pos.z + 0.5, - pos.orientation.reverse()); - - entityPos.moveForwards(0.5); - - EntityPassiveItem entity = new EntityPassiveItem(w, entityPos.x, entityPos.y, entityPos.z, stack); - - ((PipeTransportItems) transport).entityEntering(entity, entityPos.orientation); } } @@ -125,10 +127,10 @@ public class PipeItemsWood extends Pipe implements IPowerReceptor { * inventory, null if none. On certain cases, the extractable slot depends * on the position of the pipe. */ - public ItemStack checkExtract(IInventory inventory, boolean doRemove, Orientations from) { + public ItemStack[] checkExtract(IInventory inventory, boolean doRemove, Orientations from) { if (inventory instanceof ISpecialInventory) // TAKE INTO ACCOUNT SPECIAL INVENTORIES!!! - return ((ISpecialInventory) inventory).extractItem(doRemove, from); + return ((ISpecialInventory) inventory).extractItem(doRemove, from, 1); if (inventory instanceof ISidedInventory) { ISidedInventory sidedInv = (ISidedInventory) inventory; @@ -141,7 +143,7 @@ public class PipeItemsWood extends Pipe implements IPowerReceptor { ItemStack result = checkExtractGeneric(inv, doRemove, from, first, last); if (result != null) - return result; + return new ItemStack[] { result }; } else if (inventory.getSizeInventory() == 2) { // This is an input-output inventory @@ -156,9 +158,9 @@ public class PipeItemsWood extends Pipe implements IPowerReceptor { if (slot != null && slot.stackSize > 0) if (doRemove) - return inventory.decrStackSize(slotIndex, (int) powerProvider.useEnergy(1, slot.stackSize, true)); + return new ItemStack[] { inventory.decrStackSize(slotIndex, (int) powerProvider.useEnergy(1, slot.stackSize, true)) }; else - return slot; + return new ItemStack[] { slot }; } else if (inventory.getSizeInventory() == 3) { // This is a furnace-like inventory @@ -175,9 +177,9 @@ public class PipeItemsWood extends Pipe implements IPowerReceptor { if (slot != null && slot.stackSize > 0) if (doRemove) - return inventory.decrStackSize(slotIndex, (int) powerProvider.useEnergy(1, slot.stackSize, true)); + return new ItemStack[] { inventory.decrStackSize(slotIndex, (int) powerProvider.useEnergy(1, slot.stackSize, true)) }; else - return slot; + return new ItemStack[] { slot }; } else { // This is a generic inventory IInventory inv = Utils.getInventory(inventory); @@ -185,7 +187,7 @@ public class PipeItemsWood extends Pipe implements IPowerReceptor { ItemStack result = checkExtractGeneric(inv, doRemove, from, 0, inv.getSizeInventory() - 1); if (result != null) - return result; + return new ItemStack[] { result }; } return null; From 372d090a6723800e74d3b553fd305ed1a2eca5f6 Mon Sep 17 00:00:00 2001 From: SirSengir Date: Fri, 20 Jul 2012 16:02:04 +0200 Subject: [PATCH 12/12] Fixed addition to generic inventories. --- .../src/buildcraft/core/StackUtil.java | 30 +++++++++++-------- .../transport/pipes/PipeItemsWood.java | 3 +- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/common/net/minecraft/src/buildcraft/core/StackUtil.java b/common/net/minecraft/src/buildcraft/core/StackUtil.java index 4215d6f0..1d8bff53 100644 --- a/common/net/minecraft/src/buildcraft/core/StackUtil.java +++ b/common/net/minecraft/src/buildcraft/core/StackUtil.java @@ -93,7 +93,8 @@ public class StackUtil { if(used <= 0) return false; - items.stackSize -= used; + if(add) + items.stackSize -= used; return true; } @@ -132,7 +133,7 @@ public class StackUtil { } else { // This is a generic inventory IInventory inv = Utils.getInventory(inventory); - + for (int j = 0; j < inv.getSizeInventory(); ++j) if (tryAdding(inv, j, add, false)) { added = true; @@ -143,12 +144,14 @@ public class StackUtil { if (added) if (!add) return true; - else if (items.stackSize - itemsAdded == 0) - return true; else { - checkAvailableSlot(inventory, added, from); - - return true; + items.stackSize -= itemsAdded; + itemsAdded = 0; + if (items.stackSize == 0) + return true; + else + checkAvailableSlot(inventory, added, from); + return true; } // If none, then create a new thing @@ -186,6 +189,7 @@ public class StackUtil { } else { // This is a generic inventory IInventory inv = Utils.getInventory(inventory); + System.out.println("Adding to generic inventory."); for (int j = 0; j < inv.getSizeInventory(); ++j) if (tryAdding(inv, j, add, true)) { @@ -195,15 +199,17 @@ public class StackUtil { } // If the inventory if full, return false - if (added) { if (!add) return true; - else if (items.stackSize - itemsAdded == 0) - return true; else { - checkAvailableSlot(inventory, added, from); - return true; + items.stackSize -= itemsAdded; + itemsAdded = 0; + if (items.stackSize == 0) + return true; + else + checkAvailableSlot(inventory, added, from); + return true; } } else return false; diff --git a/common/net/minecraft/src/buildcraft/transport/pipes/PipeItemsWood.java b/common/net/minecraft/src/buildcraft/transport/pipes/PipeItemsWood.java index 66a9f1c6..00ff41b1 100644 --- a/common/net/minecraft/src/buildcraft/transport/pipes/PipeItemsWood.java +++ b/common/net/minecraft/src/buildcraft/transport/pipes/PipeItemsWood.java @@ -128,8 +128,9 @@ public class PipeItemsWood extends Pipe implements IPowerReceptor { * on the position of the pipe. */ public ItemStack[] checkExtract(IInventory inventory, boolean doRemove, Orientations from) { + + /// ISPECIALINVENTORY if (inventory instanceof ISpecialInventory) - // TAKE INTO ACCOUNT SPECIAL INVENTORIES!!! return ((ISpecialInventory) inventory).extractItem(doRemove, from, 1); if (inventory instanceof ISidedInventory) {