From 8b8471fca290a279e3cceb544b3804459b69f9af Mon Sep 17 00:00:00 2001 From: SirSengir Date: Sat, 14 Jul 2012 18:04:30 +0200 Subject: [PATCH] Fixed infinite fuel production. --- .../src/buildcraft/api/liquids/LiquidStack.java | 13 ++++++++++++- .../src/buildcraft/factory/TileRefinery.java | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/common/net/minecraft/src/buildcraft/api/liquids/LiquidStack.java b/common/net/minecraft/src/buildcraft/api/liquids/LiquidStack.java index 86f47663..4518dcc8 100644 --- a/common/net/minecraft/src/buildcraft/api/liquids/LiquidStack.java +++ b/common/net/minecraft/src/buildcraft/api/liquids/LiquidStack.java @@ -92,6 +92,17 @@ public class LiquidStack { return itemID == other.itemID && itemMeta == other.itemMeta; } + /** + * @param other + * @return true if this LiquidStack contains the other liquid (liquids are equal and amount >= other.amount). + */ + public boolean containsLiquid(LiquidStack other) { + if(!isLiquidEqual(other)) + return false; + + return amount >= other.amount; + } + /** * @param other ItemStack containing liquids. * @return true if this LiquidStack contains the same liquid as the one passed in. @@ -102,7 +113,7 @@ public class LiquidStack { return itemID == other.itemID && itemMeta == other.getItemDamage(); } - + /** * @return ItemStack representation of this LiquidStack */ diff --git a/common/net/minecraft/src/buildcraft/factory/TileRefinery.java b/common/net/minecraft/src/buildcraft/factory/TileRefinery.java index 30c80319..d44ac3b0 100644 --- a/common/net/minecraft/src/buildcraft/factory/TileRefinery.java +++ b/common/net/minecraft/src/buildcraft/factory/TileRefinery.java @@ -286,7 +286,7 @@ public class TileRefinery extends TileMachine implements ILiquidContainer, IPowe if(liquid == null) return true; - return liquid.isLiquidEqual(new LiquidStack(slot1.liquidId, slot1.quantity, 0)) || liquid.isLiquidEqual(new LiquidStack(slot2.liquidId, slot2.quantity, 0)); + return new LiquidStack(slot1.liquidId, slot1.quantity, 0).containsLiquid(liquid) || new LiquidStack(slot2.liquidId, slot2.quantity, 0).containsLiquid(liquid); } private boolean consumeInput(LiquidStack liquid) {