Updated the basics of fluids

This commit is contained in:
Adubbz 2014-01-30 17:04:09 +11:00
parent 197d97e217
commit 286a2f2824
11 changed files with 303 additions and 10 deletions

View file

@ -13,6 +13,7 @@ import biomesoplenty.common.core.BOPBiomes;
import biomesoplenty.common.core.BOPBlocks; import biomesoplenty.common.core.BOPBlocks;
import biomesoplenty.common.core.BOPCrafting; import biomesoplenty.common.core.BOPCrafting;
import biomesoplenty.common.core.BOPEntities; import biomesoplenty.common.core.BOPEntities;
import biomesoplenty.common.core.BOPFluids;
import biomesoplenty.common.core.BOPItems; import biomesoplenty.common.core.BOPItems;
import biomesoplenty.common.core.BOPPackets; import biomesoplenty.common.core.BOPPackets;
import biomesoplenty.common.core.BOPPotions; import biomesoplenty.common.core.BOPPotions;
@ -63,6 +64,7 @@ public class BiomesOPlenty
BOPPotions.init(); BOPPotions.init();
BOPBlocks.init(); BOPBlocks.init();
BOPItems.init(); BOPItems.init();
BOPFluids.init();
BOPArmor.init(); BOPArmor.init();
BOPCrafting.init(); BOPCrafting.init();
BOPBiomes.init(); BOPBiomes.init();

View file

@ -24,7 +24,7 @@ public class BOPConfigurationMisc
public static boolean enderporterCrafting; public static boolean enderporterCrafting;
public static boolean dartCrafting; public static boolean dartCrafting;
public static boolean flowerbandCrafting; public static boolean flowerbandCrafting;
//public static boolean hotSpringsRegeneration; public static boolean hotSpringsRegeneration;
public static int promisedLandSkyColor; public static int promisedLandSkyColor;
@ -41,7 +41,7 @@ public class BOPConfigurationMisc
//achievements = config.get("Miscellanious Settings", "Add Biomes O\' Plenty Achievements", true).getBoolean(false); //achievements = config.get("Miscellanious Settings", "Add Biomes O\' Plenty Achievements", true).getBoolean(false);
dungeonLoot = config.get("Miscellanious Settings", "Add Custom Dungeon Loot", true).getBoolean(false); dungeonLoot = config.get("Miscellanious Settings", "Add Custom Dungeon Loot", true).getBoolean(false);
//hotSpringsRegeneration = config.get("Miscellanious Settings", "Enable Spring Water Regeneration Effect", true).getBoolean(true); hotSpringsRegeneration = config.get("Miscellanious Settings", "Enable Spring Water Regeneration Effect", true).getBoolean(true);
amethystTools = config.get("Crafting Settings", "Enable Amethyst Tool/Armor Crafting", true).getBoolean(true); amethystTools = config.get("Crafting Settings", "Enable Amethyst Tool/Armor Crafting", true).getBoolean(true);
mudTools = config.get("Crafting Settings", "Enable Mud Tool/Armor Crafting", true).getBoolean(true); mudTools = config.get("Crafting Settings", "Enable Mud Tool/Armor Crafting", true).getBoolean(true);

View file

@ -95,11 +95,11 @@ public class BOPBlocks
{ {
public static void init() public static void init()
{ {
initializeBlocks(); registerBlocks();
setFireInfo(); setFireInfo();
} }
private static void initializeBlocks() private static void registerBlocks()
{ {
// Block declaration // Block declaration

View file

@ -0,0 +1,57 @@
package biomesoplenty.common.core;
import static biomesoplenty.common.core.BOPBlocks.registerBlock;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import biomesoplenty.api.BOPBlockHelper;
import biomesoplenty.common.fluids.HoneyFluid;
import biomesoplenty.common.fluids.PoisonFluid;
import biomesoplenty.common.fluids.SpringWaterFluid;
import biomesoplenty.common.fluids.blocks.BlockHoneyFluid;
import biomesoplenty.common.fluids.blocks.BlockPoisonFluid;
import biomesoplenty.common.fluids.blocks.BlockSpringWaterFluid;
public class BOPFluids
{
public static void init()
{
registerFluids();
registerFluidBlocks();
//initializeContainers();
//registerItems();
}
private static void registerFluids()
{
registerFluid(new PoisonFluid("poison").setBlock(BOPBlockHelper.get("poison")));
registerFluid(new SpringWaterFluid("spring_water").setBlock(BOPBlockHelper.get("springWater")));
registerFluid(new HoneyFluid("honey").setBlock(BOPBlockHelper.get("honey")));
}
private static void registerFluidBlocks()
{
//TODO: setBlockName
registerBlock(new BlockPoisonFluid().func_149663_c("poison"));
registerBlock(new BlockSpringWaterFluid().func_149663_c("springWater"));
registerBlock(new BlockHoneyFluid().func_149663_c("honey"));
}
/*private static void initializeContainers()
{
Fluids.bopBucket = Optional.of((new ItemBOPBucket(BOPConfigurationIDs.bopBucketID).setMaxStackSize(1).setUnlocalizedName("bop.bopBucket")));
FluidContainerRegistry.registerFluidContainer(Fluids.liquidPoisonFluid.get(), new ItemStack(Fluids.bopBucket.get(), 1, 1), new ItemStack(Item.bucketEmpty));
FluidContainerRegistry.registerFluidContainer(Fluids.honeyFluid.get(), new ItemStack(Fluids.bopBucket.get(), 1, 3), new ItemStack(Item.bucketEmpty));
FluidContainerRegistry.registerFluidContainer(Fluids.springWaterFluid.get(), new ItemStack(Fluids.bopBucket.get(), 1, 2), new ItemStack(Fluids.bopBucket.get(), 1, 0));
}
private static void registerItems()
{
registerItem(Fluids.bopBucket.get());
}*/
public static void registerFluid(Fluid fluid)
{
FluidRegistry.registerFluid(fluid);
}
}

View file

@ -0,0 +1,17 @@
package biomesoplenty.common.fluids;
import biomesoplenty.common.fluids.blocks.BlockPoisonFluid;
import biomesoplenty.common.fluids.blocks.BlockSpringWaterFluid;
import net.minecraftforge.fluids.Fluid;
public class HoneyFluid extends Fluid
{
public HoneyFluid(String fluidName)
{
super(fluidName);
this.setViscosity(1500);
this.setIcons(BlockPoisonFluid.liquidPoisonStillIcon, BlockPoisonFluid.liquidPoisonFlowingIcon);
}
}

View file

@ -0,0 +1,14 @@
package biomesoplenty.common.fluids;
import net.minecraftforge.fluids.Fluid;
import biomesoplenty.common.fluids.blocks.BlockPoisonFluid;
public class PoisonFluid extends Fluid
{
public PoisonFluid(String fluidName)
{
super(fluidName);
this.setIcons(BlockPoisonFluid.liquidPoisonStillIcon, BlockPoisonFluid.liquidPoisonFlowingIcon);
}
}

View file

@ -0,0 +1,15 @@
package biomesoplenty.common.fluids;
import net.minecraft.util.IIcon;
import net.minecraftforge.fluids.Fluid;
import biomesoplenty.common.fluids.blocks.BlockSpringWaterFluid;
public class SpringWaterFluid extends Fluid
{
public SpringWaterFluid(String fluidName)
{
super(fluidName);
this.setIcons(BlockSpringWaterFluid.springWaterStillIcon, BlockSpringWaterFluid.springWaterFlowingIcon);
}
}

View file

@ -0,0 +1,55 @@
package biomesoplenty.common.fluids.blocks;
import biomesoplenty.BiomesOPlenty;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import net.minecraftforge.fluids.BlockFluidFinite;
import net.minecraftforge.fluids.FluidRegistry;
public class BlockHoneyFluid extends BlockFluidFinite
{
public static IIcon honeyStillIcon;
public static IIcon honeyFlowingIcon;
public BlockHoneyFluid()
{
//TODO: water
super(FluidRegistry.getFluid("honey"), Material.field_151586_h);
//TODO: setLightOpacity()
this.func_149713_g(1);
}
@Override
//TODO: onEntityCollidedWithBlock()
public void func_149670_a(World world, int x, int y, int z, Entity entity)
{
int meta = world.getBlockMetadata(x, y, z);
if (entity instanceof EntityLivingBase)
{
((EntityLivingBase)entity).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 200, 2));
}
}
@Override
//TODO: registerIcons()
public void func_149651_a(IIconRegister iconRegister)
{
honeyStillIcon = iconRegister.registerIcon("biomesoplenty:honey_still");
honeyFlowingIcon = iconRegister.registerIcon("biomesoplenty:honey_flowing");
}
@Override
//TODO: getIcon()
public IIcon func_149691_a(int side, int meta)
{
return side != 0 && side != 1 ? honeyFlowingIcon : honeyStillIcon;
}
}

View file

@ -0,0 +1,62 @@
package biomesoplenty.common.fluids.blocks;
import javax.swing.Icon;
import biomesoplenty.BiomesOPlenty;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import net.minecraftforge.fluids.BlockFluidClassic;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockPoisonFluid extends BlockFluidClassic
{
public static IIcon liquidPoisonStillIcon;
public static IIcon liquidPoisonFlowingIcon;
public BlockPoisonFluid()
{
//TODO: water
super(FluidRegistry.getFluid("poison"), Material.field_151586_h);
this.quantaPerBlock = 4;
//TODO: setLightOpacity()
this.func_149713_g(3);
}
@Override
//TODO: onEntityCollidedWithBlock()
public void func_149670_a(World world, int x, int y, int z, Entity entity)
{
int meta = world.getBlockMetadata(x, y, z);
if (entity instanceof EntityLivingBase)
{
((EntityLivingBase)entity).addPotionEffect(new PotionEffect(Potion.poison.id, 100));
((EntityLivingBase)entity).addPotionEffect(new PotionEffect(Potion.hunger.id, 100));
}
}
@Override
//TODO: registerIcons()
public void func_149651_a(IIconRegister iconRegister)
{
liquidPoisonStillIcon = iconRegister.registerIcon("biomesoplenty:liquid_poison_still");
liquidPoisonFlowingIcon = iconRegister.registerIcon("biomesoplenty:liquid_poison_flowing");
}
@Override
//TODO: getIcon()
public IIcon func_149691_a(int side, int meta)
{
return side != 0 && side != 1 ? liquidPoisonFlowingIcon : liquidPoisonStillIcon;
}
}

View file

@ -0,0 +1,71 @@
package biomesoplenty.common.fluids.blocks;
import java.util.Random;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import net.minecraftforge.fluids.BlockFluidClassic;
import net.minecraftforge.fluids.FluidRegistry;
import biomesoplenty.BiomesOPlenty;
import biomesoplenty.common.configuration.BOPConfigurationMisc;
public class BlockSpringWaterFluid extends BlockFluidClassic
{
public static IIcon springWaterStillIcon;
public static IIcon springWaterFlowingIcon;
public BlockSpringWaterFluid()
{
//TODO: water
super(FluidRegistry.getFluid("spring_water"), Material.field_151586_h);
}
@Override
//TODO: randomDisplayTick()
public void func_149734_b(World world, int x, int y, int z, Random random)
{
super.func_149734_b(world, x, y, z, random);
if (random.nextInt(1) == 0)
{
BiomesOPlenty.proxy.spawnParticle("steam", x + random.nextFloat(), y + 1.0F, z + random.nextFloat());
}
}
@Override
//TODO: onEntityCollidedWithBlock()
public void func_149670_a(World world, int x, int y, int z, Entity entity)
{
int meta = world.getBlockMetadata(x, y, z);
if (!world.isRemote && BOPConfigurationMisc.hotSpringsRegeneration)
{
if (entity instanceof EntityLivingBase)
{
if (!((EntityLivingBase)entity).isPotionActive(Potion.regeneration.id))
((EntityLivingBase)entity).addPotionEffect(new PotionEffect(Potion.regeneration.id, 50));
}
}
}
@Override
//TODO: registerIcons()
public void func_149651_a(IIconRegister iconRegister)
{
springWaterStillIcon = iconRegister.registerIcon("biomesoplenty:spring_water_still");
springWaterFlowingIcon = iconRegister.registerIcon("biomesoplenty:spring_water_flowing");
}
@Override
//TODO: getIcon()
public IIcon func_149691_a(int side, int meta)
{
return side != 0 && side != 1 ? springWaterFlowingIcon : springWaterStillIcon;
}
}

View file

@ -396,13 +396,13 @@ item.bopBucket.amethyst_spring_water.name=Spring Water Amethyst Bucket
item.bopBucket.liquid_poison.name=Liquid Poison Bucket item.bopBucket.liquid_poison.name=Liquid Poison Bucket
item.bopBucket.honey.name=Honey Bucket item.bopBucket.honey.name=Honey Bucket
tile.bop.liquidPoison.name=Liquid Poison tile.poison.name=Poison
tile.bop.springWater.name=Spring Water tile.springWater.name=Spring Water
tile.bop.honey.name=Honey tile.honey.name=Honey
fluid.bop.liquidPoison=Liquid Poison fluid.poison=Poison
fluid.bop.springWater=Spring Water fluid.springWater=Spring Water
fluid.bop.honey.name=Honey fluid.honey.name=Honey
phrase.bop.promisedPortalOverworld=A gateway to the Promised Land has appeared in the sky above. phrase.bop.promisedPortalOverworld=A gateway to the Promised Land has appeared in the sky above.
phrase.bop.promisedPortalOther=A gateway to the Overworld has appeared in the sky above. phrase.bop.promisedPortalOther=A gateway to the Overworld has appeared in the sky above.