From aedf304dbc5d331e1fbe893edc1b158ba1a36c68 Mon Sep 17 00:00:00 2001 From: Adubbz Date: Wed, 4 Jun 2014 21:25:48 +1000 Subject: [PATCH] Created BOPCFluids --- .../biomesoplenty/api/content/BOPCFluids.java | 10 ++++++++++ .../biomesoplenty/common/core/BOPFluids.java | 16 ++++++++-------- .../eventhandler/misc/BucketEventHandler.java | 5 ++--- .../common/items/ItemBOPBucket.java | 8 ++++---- 4 files changed, 24 insertions(+), 15 deletions(-) create mode 100644 src/main/java/biomesoplenty/api/content/BOPCFluids.java diff --git a/src/main/java/biomesoplenty/api/content/BOPCFluids.java b/src/main/java/biomesoplenty/api/content/BOPCFluids.java new file mode 100644 index 000000000..2ce28501a --- /dev/null +++ b/src/main/java/biomesoplenty/api/content/BOPCFluids.java @@ -0,0 +1,10 @@ +package biomesoplenty.api.content; + +import net.minecraftforge.fluids.Fluid; + +public class BOPCFluids +{ + public static Fluid poison; + public static Fluid spring_water; + public static Fluid honey; +} diff --git a/src/main/java/biomesoplenty/common/core/BOPFluids.java b/src/main/java/biomesoplenty/common/core/BOPFluids.java index 228189eb4..2cd064d92 100644 --- a/src/main/java/biomesoplenty/common/core/BOPFluids.java +++ b/src/main/java/biomesoplenty/common/core/BOPFluids.java @@ -1,5 +1,7 @@ package biomesoplenty.common.core; +import static biomesoplenty.api.content.BOPCFluids.*; + import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; import biomesoplenty.api.content.BOPCBlocks; @@ -9,10 +11,6 @@ import biomesoplenty.common.fluids.SpringWaterFluid; public class BOPFluids { - public static Fluid poison; - public static Fluid spring_water; - public static Fluid honey; - public static void preInit() { registerFluids(); @@ -25,9 +23,9 @@ public class BOPFluids private static void registerFluids() { - registerFluid(poison = new PoisonFluid("poison")); - registerFluid(spring_water = new SpringWaterFluid("spring_water")); - registerFluid(honey = new HoneyFluid("honey")); + poison = registerFluid(new PoisonFluid("poison")); + spring_water = registerFluid(new SpringWaterFluid("spring_water")); + honey = registerFluid(new HoneyFluid("honey")); } private static void registerFluidBlocks() @@ -37,8 +35,10 @@ public class BOPFluids honey.setBlock(BOPCBlocks.honey); } - public static void registerFluid(Fluid fluid) + public static Fluid registerFluid(Fluid fluid) { FluidRegistry.registerFluid(fluid); + + return fluid; } } diff --git a/src/main/java/biomesoplenty/common/eventhandler/misc/BucketEventHandler.java b/src/main/java/biomesoplenty/common/eventhandler/misc/BucketEventHandler.java index 4c519795d..45d0ce305 100644 --- a/src/main/java/biomesoplenty/common/eventhandler/misc/BucketEventHandler.java +++ b/src/main/java/biomesoplenty/common/eventhandler/misc/BucketEventHandler.java @@ -7,9 +7,8 @@ import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; -import biomesoplenty.api.BOPItemHelper; +import biomesoplenty.api.content.BOPCFluids; import biomesoplenty.api.content.BOPCItems; -import biomesoplenty.common.core.BOPFluids; import biomesoplenty.common.items.ItemBOPBucket; import cpw.mods.fml.common.eventhandler.Event.Result; import cpw.mods.fml.common.eventhandler.SubscribeEvent; @@ -32,7 +31,7 @@ public class BucketEventHandler if (fluid != null) { - if ((fluid == BOPFluids.poison && world.getBlockMetadata(x, y, z) == 0) || (fluid == BOPFluids.honey && world.getBlockMetadata(x, y, z) == 7)) + if ((fluid == BOPCFluids.poison && world.getBlockMetadata(x, y, z) == 0) || (fluid == BOPCFluids.honey && world.getBlockMetadata(x, y, z) == 7)) { bopBucket.fill(bopBucketStack, new FluidStack(fluid, FluidContainerRegistry.BUCKET_VOLUME), true); diff --git a/src/main/java/biomesoplenty/common/items/ItemBOPBucket.java b/src/main/java/biomesoplenty/common/items/ItemBOPBucket.java index ecbfe9b64..3eeb48b60 100644 --- a/src/main/java/biomesoplenty/common/items/ItemBOPBucket.java +++ b/src/main/java/biomesoplenty/common/items/ItemBOPBucket.java @@ -18,7 +18,7 @@ import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.ItemFluidContainer; import biomesoplenty.BiomesOPlenty; -import biomesoplenty.common.core.BOPFluids; +import biomesoplenty.api.content.BOPCFluids; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -114,7 +114,7 @@ public class ItemBOPBucket extends ItemFluidContainer world.func_147480_a(x, y, z, true); } - int meta = fluid.getFluid() == BOPFluids.honey ? 7 : 0; + int meta = fluid.getFluid() == BOPCFluids.honey ? 7 : 0; world.setBlock(x, y, z, fluid.getFluid().getBlock(), meta, 3); } @@ -128,9 +128,9 @@ public class ItemBOPBucket extends ItemFluidContainer { ItemStack fluid = new ItemStack(item); - this.fill(fluid, new FluidStack(BOPFluids.poison, FluidContainerRegistry.BUCKET_VOLUME), true); list.add(fluid); + this.fill(fluid, new FluidStack(BOPCFluids.poison, FluidContainerRegistry.BUCKET_VOLUME), true); list.add(fluid); fluid = new ItemStack(item); - this.fill(fluid, new FluidStack(BOPFluids.honey, FluidContainerRegistry.BUCKET_VOLUME), true); list.add(fluid); + this.fill(fluid, new FluidStack(BOPCFluids.honey, FluidContainerRegistry.BUCKET_VOLUME), true); list.add(fluid); } @Override