diff --git a/buildcraft_client/net/minecraft/src/buildcraft/core/CoreProxy.java b/buildcraft_client/net/minecraft/src/buildcraft/core/CoreProxy.java index edbcdd8a..fce5f1f2 100644 --- a/buildcraft_client/net/minecraft/src/buildcraft/core/CoreProxy.java +++ b/buildcraft_client/net/minecraft/src/buildcraft/core/CoreProxy.java @@ -28,6 +28,7 @@ import net.minecraft.src.buildcraft.core.network.BuildCraftPacket; import net.minecraft.src.forge.MinecraftForgeClient; import net.minecraft.src.forge.NetworkMod; import cpw.mods.fml.client.SpriteHelper; +import cpw.mods.fml.common.FMLCommonHandler; public class CoreProxy { @@ -85,10 +86,6 @@ public class CoreProxy { } - public static int addFuel(int id, int dmg) { - return ModLoader.addAllFuel(id, dmg); - } - /** * Adds an override to the buildcraft texture file, mainly to provide pipes * with icons. @@ -104,11 +101,6 @@ public class CoreProxy { return ModLoader.addOverride(DefaultProps.TEXTURE_EXTERNAL, pathToTexture) + 256; } - public static long getHash(IBlockAccess iBlockAccess) { - // return iBlockAccess.func_48454_a(x, z).hashCode(); - return 0; - } - public static void TakenFromCrafting(EntityPlayer entityplayer, ItemStack itemstack, IInventory iinventory) { ModLoader.takenFromCrafting(entityplayer, itemstack, iinventory); } diff --git a/buildcraft_client/net/minecraft/src/buildcraft/factory/GuiRefinery.java b/buildcraft_client/net/minecraft/src/buildcraft/factory/GuiRefinery.java index f96315ab..ffdb1bfb 100644 --- a/buildcraft_client/net/minecraft/src/buildcraft/factory/GuiRefinery.java +++ b/buildcraft_client/net/minecraft/src/buildcraft/factory/GuiRefinery.java @@ -12,8 +12,9 @@ package net.minecraft.src.buildcraft.factory; import net.minecraft.src.InventoryPlayer; import net.minecraft.src.ItemStack; import net.minecraft.src.buildcraft.api.BuildCraftAPI; -import net.minecraft.src.buildcraft.api.RefineryRecipe; import net.minecraft.src.buildcraft.api.liquids.LiquidManager; +import net.minecraft.src.buildcraft.api.liquids.LiquidStack; +import net.minecraft.src.buildcraft.api.recipes.RefineryRecipe; import net.minecraft.src.buildcraft.core.DefaultProps; import net.minecraft.src.buildcraft.core.GuiAdvancedInterface; import net.minecraft.src.buildcraft.core.utils.StringUtil; @@ -100,11 +101,11 @@ public class GuiRefinery extends GuiAdvancedInterface { if (filter1 != null) liquid1Id = filter1.itemID; - RefineryRecipe recipe = BuildCraftAPI.findRefineryRecipe(liquid0Id, BuildCraftAPI.BUCKET_VOLUME, liquid1Id, - BuildCraftAPI.BUCKET_VOLUME); + RefineryRecipe recipe = RefineryRecipe.findRefineryRecipe(new LiquidStack(liquid0Id, BuildCraftAPI.BUCKET_VOLUME, 0), + new LiquidStack(liquid1Id, BuildCraftAPI.BUCKET_VOLUME, 0)); if (recipe != null) - ((ItemSlot) slots[2]).stack = new ItemStack(recipe.resultId, 1, 0); + ((ItemSlot) slots[2]).stack = recipe.result.asItemStack(); else ((ItemSlot) slots[2]).stack = null; } diff --git a/buildcraft_server/net/minecraft/src/buildcraft/core/CoreProxy.java b/buildcraft_server/net/minecraft/src/buildcraft/core/CoreProxy.java index 53773bb4..c2088d70 100644 --- a/buildcraft_server/net/minecraft/src/buildcraft/core/CoreProxy.java +++ b/buildcraft_server/net/minecraft/src/buildcraft/core/CoreProxy.java @@ -81,24 +81,12 @@ public class CoreProxy { return new File("buildcraft/"); } - public static void addLocalization(String s1, String string) { - // TODO Auto-generated method stub - - } - - public static int addFuel(int id, int dmg) { - return ModLoader.addAllFuel(id, dmg); - } + public static void addLocalization(String s1, String string) {} public static int addCustomTexture(String pathToTexture) { return 0; } - public static long getHash(IBlockAccess iBlockAccess) { - // return iBlockAccess.hashCode(); - return 0; - } - public static void TakenFromCrafting(EntityPlayer thePlayer, ItemStack itemstack, IInventory craftMatrix) { ModLoader.takenFromCrafting(thePlayer, itemstack, craftMatrix); diff --git a/common/net/minecraft/src/BuildCraftEnergy.java b/common/net/minecraft/src/BuildCraftEnergy.java index 08f10f9b..5a68098a 100644 --- a/common/net/minecraft/src/BuildCraftEnergy.java +++ b/common/net/minecraft/src/BuildCraftEnergy.java @@ -12,10 +12,12 @@ import java.util.Random; import java.util.TreeMap; import net.minecraft.src.buildcraft.api.BuildCraftAPI; -import net.minecraft.src.buildcraft.api.IronEngineFuel; -import net.minecraft.src.buildcraft.api.LiquidData; -import net.minecraft.src.buildcraft.api.RefineryRecipe; import net.minecraft.src.buildcraft.api.Trigger; +import net.minecraft.src.buildcraft.api.fuels.IronEngineFuel; +import net.minecraft.src.buildcraft.api.liquids.LiquidData; +import net.minecraft.src.buildcraft.api.liquids.LiquidManager; +import net.minecraft.src.buildcraft.api.liquids.LiquidStack; +import net.minecraft.src.buildcraft.api.recipes.RefineryRecipe; import net.minecraft.src.buildcraft.core.BlockIndex; import net.minecraft.src.buildcraft.core.CoreProxy; import net.minecraft.src.buildcraft.core.DefaultProps; @@ -126,14 +128,14 @@ public class BuildCraftEnergy { .setMaxStackSize(1).setContainerItem(Item.bucketEmpty); CoreProxy.addName(bucketFuel, "Fuel Bucket"); - BuildCraftAPI.registerRefineryRecipe(new RefineryRecipe(oilStill.blockID, 1, 0, 0, 10, fuel.shiftedIndex, 1, 1)); + RefineryRecipe.registerRefineryRecipe(new RefineryRecipe(new LiquidStack(oilStill.blockID, 1, 0), null, new LiquidStack(fuel.shiftedIndex, 1, 0), 10, 1)); - BuildCraftAPI.ironEngineFuel.put(Block.lavaStill.blockID, new IronEngineFuel(oilStill.blockID, 1, 20000)); - BuildCraftAPI.ironEngineFuel.put(oilStill.blockID, new IronEngineFuel(oilStill.blockID, 2, 10000)); - BuildCraftAPI.ironEngineFuel.put(fuel.shiftedIndex, new IronEngineFuel(fuel.shiftedIndex, 5, 50000)); + IronEngineFuel.fuels.add(new IronEngineFuel(oilStill.blockID, 1, 20000)); + IronEngineFuel.fuels.add(new IronEngineFuel(oilStill.blockID, 2, 10000)); + IronEngineFuel.fuels.add(new IronEngineFuel(fuel.shiftedIndex, 5, 50000)); - BuildCraftAPI.liquids.add(new LiquidData(oilStill.blockID, oilMoving.blockID, bucketOil)); - BuildCraftAPI.liquids.add(new LiquidData(fuel.shiftedIndex, 0, bucketFuel)); + LiquidManager.liquids.add(new LiquidData(oilStill.blockID, oilMoving.blockID, bucketOil)); + LiquidManager.liquids.add(new LiquidData(fuel.shiftedIndex, 0, bucketFuel)); BuildCraftAPI.softBlocks[oilMoving.blockID] = true; BuildCraftAPI.softBlocks[oilStill.blockID] = true; diff --git a/common/net/minecraft/src/buildcraft/api/BuildCraftAPI.java b/common/net/minecraft/src/buildcraft/api/BuildCraftAPI.java index 56b2d31f..499e0c4d 100644 --- a/common/net/minecraft/src/buildcraft/api/BuildCraftAPI.java +++ b/common/net/minecraft/src/buildcraft/api/BuildCraftAPI.java @@ -32,17 +32,28 @@ public class BuildCraftAPI { // Other BuildCraft global data - @Deprecated - public static LinkedList liquids = new LinkedList(); - public static HashMap ironEngineFuel = new HashMap(); + /** + * This does not do anything anymore. Use buildcraft.api.liquids.LiquidManager! + */ + @Deprecated public static LinkedList liquids = new LinkedList(); + /** + * This does not do anything anymore. Use buildcraft.api.fuels.IronEngineFuel! + */ + @Deprecated public static HashMap ironEngineFuel = new HashMap(); public static Trigger[] triggers = new Trigger[1024]; public static Action[] actions = new Action[1024]; private static EntityPlayer buildCraftPlayer; - private static LinkedList refineryRecipe = new LinkedList(); + /** + * This does not do anything anymore. Use buildcraft.api.recipes.RefineryRecipe! + */ + @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) { @@ -58,6 +69,9 @@ 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) { @@ -69,6 +83,9 @@ 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) { @@ -119,12 +136,20 @@ public class BuildCraftAPI { return buildCraftPlayer; } + /** + * 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; int l2 = qty2 > 0 ? liquid2 : 0; diff --git a/common/net/minecraft/src/buildcraft/api/IronEngineFuel.java b/common/net/minecraft/src/buildcraft/api/IronEngineFuel.java index 7b73535a..b9c520d2 100644 --- a/common/net/minecraft/src/buildcraft/api/IronEngineFuel.java +++ b/common/net/minecraft/src/buildcraft/api/IronEngineFuel.java @@ -9,6 +9,10 @@ package net.minecraft.src.buildcraft.api; +/** + * This does not do anything anymore. Use buildcraft.api.fuels.IronEngineFuel! + */ +@Deprecated public class IronEngineFuel { public final int fuelId; diff --git a/common/net/minecraft/src/buildcraft/api/RefineryRecipe.java b/common/net/minecraft/src/buildcraft/api/RefineryRecipe.java index 6b6ac9d3..4ac045b4 100644 --- a/common/net/minecraft/src/buildcraft/api/RefineryRecipe.java +++ b/common/net/minecraft/src/buildcraft/api/RefineryRecipe.java @@ -9,6 +9,7 @@ package net.minecraft.src.buildcraft.api; +@Deprecated public class RefineryRecipe { public final int sourceId1; diff --git a/common/net/minecraft/src/buildcraft/api/fuels/IronEngineFuel.java b/common/net/minecraft/src/buildcraft/api/fuels/IronEngineFuel.java new file mode 100644 index 00000000..1256a7f3 --- /dev/null +++ b/common/net/minecraft/src/buildcraft/api/fuels/IronEngineFuel.java @@ -0,0 +1,45 @@ +/** + * Copyright (c) SpaceToad, 2011 + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ + +package net.minecraft.src.buildcraft.api.fuels; + +import java.util.HashMap; +import java.util.LinkedList; + +import net.minecraft.src.buildcraft.api.BuildCraftAPI; +import net.minecraft.src.buildcraft.api.liquids.LiquidStack; + +public class IronEngineFuel { + + public static LinkedList fuels = new LinkedList(); + + public static IronEngineFuel getFuelForLiquid(LiquidStack liquid) { + if(liquid == null) + return null; + + for(IronEngineFuel fuel : fuels) + if(fuel.liquid.isLiquidEqual(liquid)) + return fuel; + + return null; + } + + public final LiquidStack liquid; + public final int powerPerCycle; + public final int totalBurningTime; + + public IronEngineFuel(int liquidId, int powerPerCycle, int totalBurningTime) { + this(new LiquidStack(liquidId, BuildCraftAPI.BUCKET_VOLUME, 0), powerPerCycle, totalBurningTime); + } + public IronEngineFuel(LiquidStack liquid, int powerPerCycle, int totalBurningTime) { + this.liquid = liquid; + this.powerPerCycle = powerPerCycle; + this.totalBurningTime = totalBurningTime; + } +} diff --git a/common/net/minecraft/src/buildcraft/api/liquids/LiquidStack.java b/common/net/minecraft/src/buildcraft/api/liquids/LiquidStack.java index 03734650..86f47663 100644 --- a/common/net/minecraft/src/buildcraft/api/liquids/LiquidStack.java +++ b/common/net/minecraft/src/buildcraft/api/liquids/LiquidStack.java @@ -86,6 +86,9 @@ public class LiquidStack { * @return true if this LiquidStack contains the same liquid as the one passed in. */ public boolean isLiquidEqual(LiquidStack other) { + if(other == null) + return false; + return itemID == other.itemID && itemMeta == other.itemMeta; } @@ -94,6 +97,9 @@ public class LiquidStack { * @return true if this LiquidStack contains the same liquid as the one passed in. */ public boolean isLiquidEqual(ItemStack other) { + if(other == null) + return false; + return itemID == other.itemID && itemMeta == other.getItemDamage(); } diff --git a/common/net/minecraft/src/buildcraft/api/recipes/RefineryRecipe.java b/common/net/minecraft/src/buildcraft/api/recipes/RefineryRecipe.java new file mode 100644 index 00000000..e88ff9a7 --- /dev/null +++ b/common/net/minecraft/src/buildcraft/api/recipes/RefineryRecipe.java @@ -0,0 +1,73 @@ +/** + * Copyright (c) SpaceToad, 2011 + * http://www.mod-buildcraft.com + * + * BuildCraft is distributed under the terms of the Minecraft Mod Public + * License 1.0, or MMPL. Please check the contents of the license located in + * http://www.mod-buildcraft.com/MMPL-1.0.txt + */ + +package net.minecraft.src.buildcraft.api.recipes; + +import java.util.LinkedList; + +import net.minecraft.src.buildcraft.api.liquids.LiquidStack; + +public class RefineryRecipe { + + private static LinkedList recipes = new LinkedList(); + + public static void registerRefineryRecipe(RefineryRecipe recipe) { + if (!recipes.contains(recipe)) { + recipes.add(recipe); + } + } + + public static RefineryRecipe findRefineryRecipe(LiquidStack liquid1, LiquidStack liquid2) { + for(RefineryRecipe recipe : recipes) + if(recipe.matches(liquid1, liquid2)) + return recipe; + + return null; + } + + public final LiquidStack ingredient1; + public final LiquidStack ingredient2; + public final LiquidStack result; + + public final int energy; + public final int delay; + + public RefineryRecipe(int ingredientId1, int ingredientQty1, int ingredientId2, int ingredientQty2, int resultId, int resultQty, + int energy, int delay) { + this(new LiquidStack(ingredientId1, ingredientQty1, 0), new LiquidStack(ingredientId2, ingredientQty2, 0), new LiquidStack(resultId, resultQty, 0), energy, delay); + } + public RefineryRecipe(LiquidStack ingredient1, LiquidStack ingredient2, LiquidStack result, int energy, int delay) { + this.ingredient1 = ingredient1; + this.ingredient2 = ingredient2; + this.result = result; + this.energy = energy; + this.delay = delay; + } + + public boolean matches(LiquidStack liquid1, LiquidStack liquid2) { + if(liquid1 == null && liquid2 == null) + return false; + + if((ingredient1 != null && ingredient2 != null) + && (liquid1 == null || liquid2 == null)) + return false; + + if(liquid1 != null) { + + if(liquid2 == null) + return liquid1.isLiquidEqual(ingredient1) || liquid1.isLiquidEqual(ingredient2); + else + return (liquid1.isLiquidEqual(ingredient1) && liquid2.isLiquidEqual(ingredient2)) + || (liquid2.isLiquidEqual(ingredient1) && liquid1.isLiquidEqual(ingredient2)); + + } else + return liquid2.isLiquidEqual(ingredient1) || liquid2.isLiquidEqual(ingredient2); + + } +} diff --git a/common/net/minecraft/src/buildcraft/energy/EngineIron.java b/common/net/minecraft/src/buildcraft/energy/EngineIron.java index 0981b8d3..642bbaea 100644 --- a/common/net/minecraft/src/buildcraft/energy/EngineIron.java +++ b/common/net/minecraft/src/buildcraft/energy/EngineIron.java @@ -14,10 +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.IronEngineFuel; 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.core.DefaultProps; import net.minecraft.src.buildcraft.core.Utils; @@ -75,9 +76,9 @@ public class EngineIron extends Engine { return 0.06F; case Red: return 0.07F; + default: + return 0.0f; } - - return 0; } @Override @@ -88,7 +89,7 @@ public class EngineIron extends Engine { @Override public void burn() { currentOutput = 0; - IronEngineFuel currentFuel = BuildCraftAPI.ironEngineFuel.get(liquidId); + IronEngineFuel currentFuel = IronEngineFuel.getFuelForLiquid(new LiquidStack(liquidId, liquidQty, 0)); if (currentFuel == null) { return; @@ -188,9 +189,8 @@ public class EngineIron extends Engine { return 0; } - if (!BuildCraftAPI.ironEngineFuel.containsKey(id)) { + if (IronEngineFuel.getFuelForLiquid(new LiquidStack(id, quantity, 0)) == null) return 0; - } if (liquidQty + quantity <= MAX_LIQUID) { if (doFill) { diff --git a/common/net/minecraft/src/buildcraft/energy/EngineStone.java b/common/net/minecraft/src/buildcraft/energy/EngineStone.java index e8c8125c..d3567884 100644 --- a/common/net/minecraft/src/buildcraft/energy/EngineStone.java +++ b/common/net/minecraft/src/buildcraft/energy/EngineStone.java @@ -9,6 +9,7 @@ package net.minecraft.src.buildcraft.energy; +import cpw.mods.fml.common.FMLCommonHandler; import net.minecraft.src.Block; import net.minecraft.src.ICrafting; import net.minecraft.src.Item; @@ -94,24 +95,10 @@ public class EngineStone extends Engine { } private int getItemBurnTime(ItemStack itemstack) { - if (itemstack == null) { + if (itemstack == null) return 0; - } - int i = itemstack.getItem().shiftedIndex; - if (i < Block.blocksList.length && Block.blocksList[i] != null && Block.blocksList[i].blockMaterial == Material.wood) { - return 300; - } - if (i == Item.stick.shiftedIndex) { - return 100; - } - if (i == Item.coal.shiftedIndex) { - return 1600; - } - if (i == Item.bucketLava.shiftedIndex) { - return 20000; - } else { - return i == Block.sapling.blockID ? 100 : CoreProxy.addFuel(i, itemstack.getItemDamage()); - } + + return FMLCommonHandler.instance().fuelLookup(itemstack.getItem().shiftedIndex, itemstack.getItemDamage()); } /* SAVING & LOADING */ diff --git a/common/net/minecraft/src/buildcraft/factory/TileRefinery.java b/common/net/minecraft/src/buildcraft/factory/TileRefinery.java index f1efe534..30c80319 100644 --- a/common/net/minecraft/src/buildcraft/factory/TileRefinery.java +++ b/common/net/minecraft/src/buildcraft/factory/TileRefinery.java @@ -24,9 +24,10 @@ import net.minecraft.src.buildcraft.api.LiquidSlot; import net.minecraft.src.buildcraft.api.Orientations; import net.minecraft.src.buildcraft.api.PowerFramework; import net.minecraft.src.buildcraft.api.PowerProvider; -import net.minecraft.src.buildcraft.api.RefineryRecipe; import net.minecraft.src.buildcraft.api.SafeTimeTracker; import net.minecraft.src.buildcraft.api.TileNetworkData; +import net.minecraft.src.buildcraft.api.liquids.LiquidStack; +import net.minecraft.src.buildcraft.api.recipes.RefineryRecipe; import net.minecraft.src.buildcraft.core.IMachine; public class TileRefinery extends TileMachine implements ILiquidContainer, IPowerReceptor, IInventory, IMachine { @@ -234,19 +235,19 @@ public class TileRefinery extends TileMachine implements ILiquidContainer, IPowe RefineryRecipe currentRecipe = null; - currentRecipe = BuildCraftAPI.findRefineryRecipe(slot1.liquidId, slot1.quantity, slot2.liquidId, slot2.quantity); + currentRecipe = RefineryRecipe.findRefineryRecipe(new LiquidStack(slot1.liquidId, slot1.quantity, 0), new LiquidStack(slot2.liquidId, slot2.quantity, 0)); if (currentRecipe == null) { decreaseAnimation(); return; } - if (result.quantity != 0 && result.liquidId != currentRecipe.resultId) { + if (result.quantity != 0 && result.liquidId != currentRecipe.result.itemID) { decreaseAnimation(); return; } - if (result.quantity + currentRecipe.resultQty > LIQUID_PER_SLOT) { + if (result.quantity + currentRecipe.result.amount > LIQUID_PER_SLOT) { decreaseAnimation(); return; } @@ -264,8 +265,8 @@ public class TileRefinery extends TileMachine implements ILiquidContainer, IPowe return; } - if (!containsInput(currentRecipe.sourceId1, currentRecipe.sourceQty1) - || !containsInput(currentRecipe.sourceId2, currentRecipe.sourceQty2)) { + if (!containsInput(currentRecipe.ingredient1) + || !containsInput(currentRecipe.ingredient2)) { decreaseAnimation(); return; } @@ -273,29 +274,33 @@ public class TileRefinery extends TileMachine implements ILiquidContainer, IPowe float energyUsed = powerProvider.useEnergy(currentRecipe.energy, currentRecipe.energy, true); if (energyUsed != 0) { - if (consumeInput(currentRecipe.sourceId1, currentRecipe.sourceQty1) - && consumeInput(currentRecipe.sourceId2, currentRecipe.sourceQty2)) { - result.liquidId = currentRecipe.resultId; - result.quantity += currentRecipe.resultQty; + if (consumeInput(currentRecipe.ingredient1) + && consumeInput(currentRecipe.ingredient2)) { + result.liquidId = currentRecipe.result.itemID; + result.quantity += currentRecipe.result.amount; } } } - private boolean containsInput(int id, int qty) { - return id == 0 || (slot1.liquidId == id && slot1.quantity >= qty) || (slot2.liquidId == id && slot2.quantity >= qty); + private boolean containsInput(LiquidStack liquid) { + if(liquid == null) + return true; + + return liquid.isLiquidEqual(new LiquidStack(slot1.liquidId, slot1.quantity, 0)) || liquid.isLiquidEqual(new LiquidStack(slot2.liquidId, slot2.quantity, 0)); } - private boolean consumeInput(int id, int qty) { - if (id == 0) { + private boolean consumeInput(LiquidStack liquid) { + if(liquid == null) return true; - } else if (slot1.liquidId == id && slot1.quantity >= qty) { - slot1.quantity -= qty; + + if(liquid.isLiquidEqual(new LiquidStack(slot1.liquidId, slot1.quantity, 0))) { + slot1.quantity -= liquid.amount; return true; - } else if (slot2.liquidId == id && slot2.quantity >= qty) { - slot2.quantity -= qty; + } else if(liquid.isLiquidEqual(new LiquidStack(slot2.liquidId, slot2.quantity, 0))) { + slot2.quantity -= liquid.amount; return true; } - + return false; }