Merge remote-tracking branch 'origin/master'

This commit is contained in:
Amnet 2013-05-31 13:43:27 +02:00
commit a3e247bde3
5 changed files with 67 additions and 6 deletions

View file

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

View file

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

View file

@ -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();
}
@ -81,6 +85,18 @@ public class BCIntegration {
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);
}

View file

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

View file

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