From 05693e1b0bad9ab890a986498422c0cd58e0c37b Mon Sep 17 00:00:00 2001 From: fabricator77 Date: Tue, 25 Feb 2014 20:18:39 +1030 Subject: [PATCH] Restore bucket handler so empty buckets fill correctly. By default clicking on any fluid with an empty bucket will fill it with water. BucketHandler matches the fluid block clicked on with the matching fluid filled bucket (item) --- common/buildcraft/BuildCraftEnergy.java | 9 ++++----- common/buildcraft/energy/BucketHandler.java | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/common/buildcraft/BuildCraftEnergy.java b/common/buildcraft/BuildCraftEnergy.java index 2a47cf45..628df3f1 100644 --- a/common/buildcraft/BuildCraftEnergy.java +++ b/common/buildcraft/BuildCraftEnergy.java @@ -186,11 +186,10 @@ public class BuildCraftEnergy extends BuildCraftMod { FluidContainerRegistry.registerFluidContainer(FluidRegistry.getFluidStack("fuel", FluidContainerRegistry.BUCKET_VOLUME), new ItemStack(bucketFuel), new ItemStack(Items.bucket)); } - // TODO: Are these still really necessary? If not, remove the - // BucketHandler class as well. - //BucketHandler.INSTANCE.buckets.put(blockOil, bucketOil); - //BucketHandler.INSTANCE.buckets.put(blockFuel, bucketFuel); - //MinecraftForge.EVENT_BUS.register(BucketHandler.INSTANCE); + // BucketHandler ensures empty buckets fill with the correct liquid. + BucketHandler.INSTANCE.buckets.put(blockOil, bucketOil); + BucketHandler.INSTANCE.buckets.put(blockFuel, bucketFuel); + MinecraftForge.EVENT_BUS.register(BucketHandler.INSTANCE); BuildcraftRecipes.refinery.addRecipe(new FluidStack(fluidOil, 1), new FluidStack(fluidFuel, 1), 12, 1); diff --git a/common/buildcraft/energy/BucketHandler.java b/common/buildcraft/energy/BucketHandler.java index efb86e9b..cb647c15 100644 --- a/common/buildcraft/energy/BucketHandler.java +++ b/common/buildcraft/energy/BucketHandler.java @@ -46,7 +46,7 @@ public class BucketHandler { private ItemStack fillCustomBucket(World world, MovingObjectPosition pos) { Block block = world.getBlock(pos.blockX, pos.blockY, pos.blockZ); - Item bucket = Item.getItemFromBlock(block); + Item bucket = buckets.get(block); if (bucket != null && world.getBlockMetadata(pos.blockX, pos.blockY, pos.blockZ) == 0) { world.setBlockToAir(pos.blockX, pos.blockY, pos.blockZ);