Created BOPCFluids

This commit is contained in:
Adubbz 2014-06-04 21:25:48 +10:00
parent a35d20c0d4
commit aedf304dbc
4 changed files with 24 additions and 15 deletions

View file

@ -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;
}

View file

@ -1,5 +1,7 @@
package biomesoplenty.common.core; package biomesoplenty.common.core;
import static biomesoplenty.api.content.BOPCFluids.*;
import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidRegistry;
import biomesoplenty.api.content.BOPCBlocks; import biomesoplenty.api.content.BOPCBlocks;
@ -9,10 +11,6 @@ import biomesoplenty.common.fluids.SpringWaterFluid;
public class BOPFluids public class BOPFluids
{ {
public static Fluid poison;
public static Fluid spring_water;
public static Fluid honey;
public static void preInit() public static void preInit()
{ {
registerFluids(); registerFluids();
@ -25,9 +23,9 @@ public class BOPFluids
private static void registerFluids() private static void registerFluids()
{ {
registerFluid(poison = new PoisonFluid("poison")); poison = registerFluid(new PoisonFluid("poison"));
registerFluid(spring_water = new SpringWaterFluid("spring_water")); spring_water = registerFluid(new SpringWaterFluid("spring_water"));
registerFluid(honey = new HoneyFluid("honey")); honey = registerFluid(new HoneyFluid("honey"));
} }
private static void registerFluidBlocks() private static void registerFluidBlocks()
@ -37,8 +35,10 @@ public class BOPFluids
honey.setBlock(BOPCBlocks.honey); honey.setBlock(BOPCBlocks.honey);
} }
public static void registerFluid(Fluid fluid) public static Fluid registerFluid(Fluid fluid)
{ {
FluidRegistry.registerFluid(fluid); FluidRegistry.registerFluid(fluid);
return fluid;
} }
} }

View file

@ -7,9 +7,8 @@ import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import biomesoplenty.api.BOPItemHelper; import biomesoplenty.api.content.BOPCFluids;
import biomesoplenty.api.content.BOPCItems; import biomesoplenty.api.content.BOPCItems;
import biomesoplenty.common.core.BOPFluids;
import biomesoplenty.common.items.ItemBOPBucket; import biomesoplenty.common.items.ItemBOPBucket;
import cpw.mods.fml.common.eventhandler.Event.Result; import cpw.mods.fml.common.eventhandler.Event.Result;
import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent;
@ -32,7 +31,7 @@ public class BucketEventHandler
if (fluid != null) 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); bopBucket.fill(bopBucketStack, new FluidStack(fluid, FluidContainerRegistry.BUCKET_VOLUME), true);

View file

@ -18,7 +18,7 @@ import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.ItemFluidContainer; import net.minecraftforge.fluids.ItemFluidContainer;
import biomesoplenty.BiomesOPlenty; import biomesoplenty.BiomesOPlenty;
import biomesoplenty.common.core.BOPFluids; import biomesoplenty.api.content.BOPCFluids;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
@ -114,7 +114,7 @@ public class ItemBOPBucket extends ItemFluidContainer
world.func_147480_a(x, y, z, true); 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); world.setBlock(x, y, z, fluid.getFluid().getBlock(), meta, 3);
} }
@ -128,9 +128,9 @@ public class ItemBOPBucket extends ItemFluidContainer
{ {
ItemStack fluid = new ItemStack(item); 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); 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 @Override