From e9c9de193bfd55971dfccd67417276d21902abd5 Mon Sep 17 00:00:00 2001 From: AartBluestoke Date: Tue, 14 Aug 2012 09:27:50 +1000 Subject: [PATCH] Update common/buildcraft/energy/OilBucketHandler.java Updated to @ForgeSubscribe to the bucketHandled event, as the base class doesn't exist --- .../buildcraft/energy/OilBucketHandler.java | 30 ++++++++++++++----- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/common/buildcraft/energy/OilBucketHandler.java b/common/buildcraft/energy/OilBucketHandler.java index 62162cdc..9a522e2c 100644 --- a/common/buildcraft/energy/OilBucketHandler.java +++ b/common/buildcraft/energy/OilBucketHandler.java @@ -11,17 +11,31 @@ package buildcraft.energy; import buildcraft.BuildCraftEnergy; import net.minecraft.src.ItemStack; +import net.minecraft.src.MovingObjectPosition; import net.minecraft.src.World; -import net.minecraft.src.forge.IBucketHandler; +import net.minecraftforge.event.ForgeSubscribe; +import net.minecraftforge.event.entity.player.FillBucketEvent; -public class OilBucketHandler implements IBucketHandler { +public class OilBucketHandler{ + + @ForgeSubscribe + public void onBucketFill(FillBucketEvent event){ + ItemStack result=fillCustomBucket(event.world,event.target); + if(result==null) + { + return; + } + event.result=result; + event.setHandeled(); + return; + + } + public ItemStack fillCustomBucket(World w,MovingObjectPosition pos) { + int blockID=w.getBlockId(pos.blockX,pos.blockY,pos.blockZ); + if (( blockID== BuildCraftEnergy.oilStill.blockID || blockID == BuildCraftEnergy.oilMoving.blockID) + && w.getBlockMetadata(pos.blockX,pos.blockY,pos.blockZ) == 0) { - @Override - public ItemStack fillCustomBucket(World w, int i, int j, int k) { - if ((w.getBlockId(i, j, k) == BuildCraftEnergy.oilStill.blockID || w.getBlockId(i, j, k) == BuildCraftEnergy.oilMoving.blockID) - && w.getBlockMetadata(i, j, k) == 0) { - - w.setBlockWithNotify(i, j, k, 0); + w.setBlockWithNotify(pos.blockX,pos.blockY,pos.blockZ, 0); return new ItemStack(BuildCraftEnergy.bucketOil); } else {