diff --git a/src/minecraft/biomesoplenty/configuration/BOPLiquids.java b/src/minecraft/biomesoplenty/configuration/BOPLiquids.java index 24be6d9e9..70d1462e0 100644 --- a/src/minecraft/biomesoplenty/configuration/BOPLiquids.java +++ b/src/minecraft/biomesoplenty/configuration/BOPLiquids.java @@ -5,6 +5,8 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.liquids.LiquidContainerData; +import net.minecraftforge.liquids.LiquidContainerRegistry; import net.minecraftforge.liquids.LiquidDictionary; import net.minecraftforge.liquids.LiquidStack; import biomesoplenty.api.Liquids; @@ -34,22 +36,18 @@ public class BOPLiquids private static void registerFluids() { Liquids.liquidPoisonFluid = Optional.of(new LiquidPoisonFluid("Liquid Poison").setBlockID(BOPConfiguration.liquidPoisonStillID)); - FluidRegistry.registerFluid(Liquids.liquidPoisonFluid.get()); Liquids.springWaterFluid = Optional.of(new SpringWaterFluid("Spring Water").setBlockID(BOPConfiguration.springWaterStillID)); - FluidRegistry.registerFluid(Liquids.springWaterFluid.get()); } private static void initializeLiquids() { Liquids.liquidPoison = Optional.of(new BlockFluidLiquidPoison(BOPConfiguration.liquidPoisonStillID, Liquids.liquidPoisonFluid.get(), Material.water).setUnlocalizedName("Liquid Poison")); - Liquids.liquidPoisonLiquidStack = Optional.of(LiquidDictionary.getOrCreateLiquid("Liquid Poison", new LiquidStack(Liquids.liquidPoisonFluid.get().getBlockID(), 1))); Liquids.springWater = Optional.of(new BlockFluidSpringWater(BOPConfiguration.springWaterStillID, Liquids.springWaterFluid.get(), Material.water).setUnlocalizedName("Spring Water")); - Liquids.springWaterLiquidStack = Optional.of(LiquidDictionary.getOrCreateLiquid("Spring Water", new LiquidStack(Liquids.springWaterFluid.get().getBlockID(), 1))); } @@ -57,6 +55,10 @@ public class BOPLiquids { Liquids.bopBucket = Optional.of((new ItemBOPBucket(BOPConfiguration.bopBucketID).setMaxStackSize(1).setUnlocalizedName("bopBucket").setContainerItem(Item.bucketEmpty))); + //TODO: Remove upon Fluid API being integrated into Forge + LiquidContainerRegistry.registerLiquid(new LiquidContainerData(LiquidDictionary.getLiquid("Spring Water", LiquidContainerRegistry.BUCKET_VOLUME), new ItemStack(Liquids.bopBucket.get(), 1, 0), new ItemStack(Item.bucketEmpty))); + LiquidContainerRegistry.registerLiquid(new LiquidContainerData(LiquidDictionary.getLiquid("Liquid Poison", LiquidContainerRegistry.BUCKET_VOLUME), new ItemStack(Liquids.bopBucket.get(), 1, 1), new ItemStack(Item.bucketEmpty))); + FluidContainerRegistry.registerFluidContainer(Liquids.springWaterFluid.get(), new ItemStack(Liquids.bopBucket.get(), 1, 0), new ItemStack(Item.bucketEmpty)); FluidContainerRegistry.registerFluidContainer(Liquids.liquidPoisonFluid.get(), new ItemStack(Liquids.bopBucket.get(), 1, 1), new ItemStack(Item.bucketEmpty)); } diff --git a/src/minecraft/biomesoplenty/helpers/BOPLiquidHelper.java b/src/minecraft/biomesoplenty/helpers/BOPLiquidHelper.java index d6238bc99..53f1126e1 100644 --- a/src/minecraft/biomesoplenty/helpers/BOPLiquidHelper.java +++ b/src/minecraft/biomesoplenty/helpers/BOPLiquidHelper.java @@ -9,6 +9,7 @@ import net.minecraftforge.event.Event.Result; import net.minecraftforge.event.ForgeSubscribe; import net.minecraftforge.event.entity.player.FillBucketEvent; import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.liquids.LiquidDictionary; import biomesoplenty.api.Liquids; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -22,6 +23,10 @@ public class BOPLiquidHelper //TODO: Remove upon Fluid API being integrated into Forge FluidRegistry.WATER.setIcons(BlockFluid.func_94424_b("water"), BlockFluid.func_94424_b("water_flow")); FluidRegistry.LAVA.setIcons(BlockFluid.func_94424_b("lava"), BlockFluid.func_94424_b("lava_flow")); + + //TODO: Remove upon Fluid API being integrated into Forge + LiquidDictionary.getCanonicalLiquid("Spring Water").setRenderingIcon(Liquids.springWater.get().getBlockTextureFromSide(1)).setTextureSheet("/terrain.png"); + LiquidDictionary.getCanonicalLiquid("Liquid Poison").setRenderingIcon(Liquids.liquidPoison.get().getBlockTextureFromSide(1)).setTextureSheet("/terrain.png"); } @ForgeSubscribe diff --git a/src/minecraft/biomesoplenty/integration/BCIntegration.java b/src/minecraft/biomesoplenty/integration/BCIntegration.java index fff9ed0a1..4f6c8b05f 100644 --- a/src/minecraft/biomesoplenty/integration/BCIntegration.java +++ b/src/minecraft/biomesoplenty/integration/BCIntegration.java @@ -1,7 +1,10 @@ package biomesoplenty.integration; +import java.lang.reflect.Method; + import biomesoplenty.api.Biomes; import biomesoplenty.api.BlockReferences; +import biomesoplenty.api.Liquids; import cpw.mods.fml.common.event.FMLInterModComms; public class BCIntegration { @@ -9,6 +12,7 @@ public class BCIntegration { public static void init() { addFacades(); + addLiquids(); excludeOilGeneration(); } @@ -80,6 +84,18 @@ public class BCIntegration { FMLInterModComms.sendMessage("BuildCraft|Transport", "add-facade", getBID("giantFlowerRed") + "@" + getBMeta("giantFlowerRed")); FMLInterModComms.sendMessage("BuildCraft|Transport", "add-facade", getBID("giantFlowerYellow") + "@" + getBMeta("giantFlowerYellow")); } + + private static void addLiquids() + { + try { + Method method = Class.forName("buildcraft.core.utils.Utils").getMethod("liquidId", int.class); + + method.invoke(Liquids.springWaterFluid.get().getBlockID()); + method.invoke(Liquids.liquidPoisonFluid.get().getBlockID()); + } catch (Exception e) { + e.printStackTrace(); + } + } private static int getBID(String name) { return BlockReferences.getBlockID(name); diff --git a/src/minecraft/biomesoplenty/liquids/BlockFluidLiquidPoison.java b/src/minecraft/biomesoplenty/liquids/BlockFluidLiquidPoison.java index ea5caaeae..824e24f94 100644 --- a/src/minecraft/biomesoplenty/liquids/BlockFluidLiquidPoison.java +++ b/src/minecraft/biomesoplenty/liquids/BlockFluidLiquidPoison.java @@ -13,10 +13,11 @@ import net.minecraft.world.World; import net.minecraftforge.fluids.BlockFluidClassic; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.liquids.ILiquid; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class BlockFluidLiquidPoison extends BlockFluidClassic +public class BlockFluidLiquidPoison extends BlockFluidClassic implements ILiquid { public static Icon liquidPoisonStillIcon; public static Icon liquidPoisonFlowingIcon; @@ -81,4 +82,22 @@ public class BlockFluidLiquidPoison extends BlockFluidClassic { return par1 != 0 && par1 != 1 ? liquidPoisonFlowingIcon : liquidPoisonStillIcon; } + + @Override + public int stillLiquidId() + { + return this.blockID; + } + + @Override + public boolean isMetaSensitive() + { + return false; + } + + @Override + public int stillLiquidMeta() + { + return 0; + } } diff --git a/src/minecraft/biomesoplenty/liquids/BlockFluidSpringWater.java b/src/minecraft/biomesoplenty/liquids/BlockFluidSpringWater.java index 52a0550c5..ffb3bfe86 100644 --- a/src/minecraft/biomesoplenty/liquids/BlockFluidSpringWater.java +++ b/src/minecraft/biomesoplenty/liquids/BlockFluidSpringWater.java @@ -17,13 +17,14 @@ import net.minecraftforge.fluids.BlockFluidClassic; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.liquids.ILiquid; import biomesoplenty.BiomesOPlenty; import biomesoplenty.api.Liquids; import biomesoplenty.api.Potions; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public class BlockFluidSpringWater extends BlockFluidClassic +public class BlockFluidSpringWater extends BlockFluidClassic implements ILiquid { public static Icon springWaterStillIcon; public static Icon springWaterFlowingIcon; @@ -99,4 +100,22 @@ public class BlockFluidSpringWater extends BlockFluidClassic { return par1 != 0 && par1 != 1 ? springWaterFlowingIcon : springWaterStillIcon; } + + @Override + public int stillLiquidId() + { + return this.blockID; + } + + @Override + public boolean isMetaSensitive() + { + return false; + } + + @Override + public int stillLiquidMeta() + { + return 0; + } }