From 38e98bab59c497f74697f2482ad0884ac52d7691 Mon Sep 17 00:00:00 2001 From: DarkGuardsman Date: Tue, 30 Jul 2013 23:10:13 -0400 Subject: [PATCH] Fixed a few issues with the is fillable methods --- src/dark/core/helpers/FluidHelper.java | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/dark/core/helpers/FluidHelper.java b/src/dark/core/helpers/FluidHelper.java index 4dad2b9b1..86512cfb1 100644 --- a/src/dark/core/helpers/FluidHelper.java +++ b/src/dark/core/helpers/FluidHelper.java @@ -143,7 +143,7 @@ public class FluidHelper /** Checks to see if a non-fluid block is able to be filled with fluid */ public static boolean isFillableBlock(World world, Vector3 node) { - if (world == null || node == null || isFillableFluid(world, node)) + if (world == null || node == null) { return false; } @@ -151,11 +151,15 @@ public class FluidHelper int blockID = node.getBlockID(world); int meta = node.getBlockMetadata(world); Block block = Block.blocksList[blockID]; - if (block == null || block.blockID == 0 || block.isAirBlock(world, node.intX(), node.intY(), node.intZ())) + if (drainBlock(world, node, false) != null) + { + return false; + } + else if (block == null || block.blockID == 0 || block.isAirBlock(world, node.intX(), node.intY(), node.intZ())) { return true; } - else if (block.isBlockReplaceable(world, node.intX(), node.intY(), node.intZ()) || replacableBlockMeta.contains(new Pair(blockID, meta)) || replacableBlocks.contains(block)) + else if (!(block instanceof IFluidBlock || block instanceof BlockFluid) && block.isBlockReplaceable(world, node.intX(), node.intY(), node.intZ()) || replacableBlockMeta.contains(new Pair(blockID, meta)) || replacableBlocks.contains(block)) { return true; } @@ -173,10 +177,13 @@ public class FluidHelper int blockID = node.getBlockID(world); int meta = node.getBlockMetadata(world); Block block = Block.blocksList[blockID]; - - if (block instanceof IFluidBlock || block instanceof BlockFluid) + //TODO when added change this to call canFill and fill + if (drainBlock(world, node, false) != null) + { + return false; + } + else if (block instanceof IFluidBlock || block instanceof BlockFluid) { - //TODO when added change this to call canFill and fill return meta != 0; } return false; @@ -211,7 +218,7 @@ public class FluidHelper } } - node.setBlock(world, stack.getFluid().getBlockID(), 0, 2); + node.setBlock(world, stack.getFluid().getBlockID()); } return FluidContainerRegistry.BUCKET_VOLUME; }