diff --git a/src/main/java/biomesoplenty/BiomesOPlenty.java b/src/main/java/biomesoplenty/BiomesOPlenty.java index 54d6ec9e9..d5932c1fe 100644 --- a/src/main/java/biomesoplenty/BiomesOPlenty.java +++ b/src/main/java/biomesoplenty/BiomesOPlenty.java @@ -13,6 +13,7 @@ import biomesoplenty.common.core.BOPBiomes; import biomesoplenty.common.core.BOPBlocks; import biomesoplenty.common.core.BOPCrafting; import biomesoplenty.common.core.BOPEntities; +import biomesoplenty.common.core.BOPFluids; import biomesoplenty.common.core.BOPItems; import biomesoplenty.common.core.BOPPackets; import biomesoplenty.common.core.BOPPotions; @@ -63,6 +64,7 @@ public class BiomesOPlenty BOPPotions.init(); BOPBlocks.init(); BOPItems.init(); + BOPFluids.init(); BOPArmor.init(); BOPCrafting.init(); BOPBiomes.init(); diff --git a/src/main/java/biomesoplenty/common/configuration/BOPConfigurationMisc.java b/src/main/java/biomesoplenty/common/configuration/BOPConfigurationMisc.java index e181fb0ca..b64bc516b 100644 --- a/src/main/java/biomesoplenty/common/configuration/BOPConfigurationMisc.java +++ b/src/main/java/biomesoplenty/common/configuration/BOPConfigurationMisc.java @@ -24,7 +24,7 @@ public class BOPConfigurationMisc public static boolean enderporterCrafting; public static boolean dartCrafting; public static boolean flowerbandCrafting; - //public static boolean hotSpringsRegeneration; + public static boolean hotSpringsRegeneration; public static int promisedLandSkyColor; @@ -41,7 +41,7 @@ public class BOPConfigurationMisc //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); - //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); mudTools = config.get("Crafting Settings", "Enable Mud Tool/Armor Crafting", true).getBoolean(true); diff --git a/src/main/java/biomesoplenty/common/core/BOPBlocks.java b/src/main/java/biomesoplenty/common/core/BOPBlocks.java index 8380652d9..0034c83be 100644 --- a/src/main/java/biomesoplenty/common/core/BOPBlocks.java +++ b/src/main/java/biomesoplenty/common/core/BOPBlocks.java @@ -95,11 +95,11 @@ public class BOPBlocks { public static void init() { - initializeBlocks(); + registerBlocks(); setFireInfo(); } - private static void initializeBlocks() + private static void registerBlocks() { // Block declaration diff --git a/src/main/java/biomesoplenty/common/core/BOPFluids.java b/src/main/java/biomesoplenty/common/core/BOPFluids.java new file mode 100644 index 000000000..4e3ec2ece --- /dev/null +++ b/src/main/java/biomesoplenty/common/core/BOPFluids.java @@ -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); + } +} diff --git a/src/main/java/biomesoplenty/common/fluids/HoneyFluid.java b/src/main/java/biomesoplenty/common/fluids/HoneyFluid.java new file mode 100644 index 000000000..0f182633f --- /dev/null +++ b/src/main/java/biomesoplenty/common/fluids/HoneyFluid.java @@ -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); + } +} diff --git a/src/main/java/biomesoplenty/common/fluids/PoisonFluid.java b/src/main/java/biomesoplenty/common/fluids/PoisonFluid.java new file mode 100644 index 000000000..5fd6b7fd2 --- /dev/null +++ b/src/main/java/biomesoplenty/common/fluids/PoisonFluid.java @@ -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); + } +} diff --git a/src/main/java/biomesoplenty/common/fluids/SpringWaterFluid.java b/src/main/java/biomesoplenty/common/fluids/SpringWaterFluid.java new file mode 100644 index 000000000..2ee4ec39a --- /dev/null +++ b/src/main/java/biomesoplenty/common/fluids/SpringWaterFluid.java @@ -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); + } +} diff --git a/src/main/java/biomesoplenty/common/fluids/blocks/BlockHoneyFluid.java b/src/main/java/biomesoplenty/common/fluids/blocks/BlockHoneyFluid.java new file mode 100644 index 000000000..329c96255 --- /dev/null +++ b/src/main/java/biomesoplenty/common/fluids/blocks/BlockHoneyFluid.java @@ -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; + } +} diff --git a/src/main/java/biomesoplenty/common/fluids/blocks/BlockPoisonFluid.java b/src/main/java/biomesoplenty/common/fluids/blocks/BlockPoisonFluid.java new file mode 100644 index 000000000..bb35d5fab --- /dev/null +++ b/src/main/java/biomesoplenty/common/fluids/blocks/BlockPoisonFluid.java @@ -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; + } +} diff --git a/src/main/java/biomesoplenty/common/fluids/blocks/BlockSpringWaterFluid.java b/src/main/java/biomesoplenty/common/fluids/blocks/BlockSpringWaterFluid.java new file mode 100644 index 000000000..b32a1c85b --- /dev/null +++ b/src/main/java/biomesoplenty/common/fluids/blocks/BlockSpringWaterFluid.java @@ -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; + } +} diff --git a/src/main/resources/assets/biomesoplenty/lang/en_US.lang b/src/main/resources/assets/biomesoplenty/lang/en_US.lang index dbb50a38d..9188fea77 100644 --- a/src/main/resources/assets/biomesoplenty/lang/en_US.lang +++ b/src/main/resources/assets/biomesoplenty/lang/en_US.lang @@ -396,13 +396,13 @@ item.bopBucket.amethyst_spring_water.name=Spring Water Amethyst Bucket item.bopBucket.liquid_poison.name=Liquid Poison Bucket item.bopBucket.honey.name=Honey Bucket -tile.bop.liquidPoison.name=Liquid Poison -tile.bop.springWater.name=Spring Water -tile.bop.honey.name=Honey +tile.poison.name=Poison +tile.springWater.name=Spring Water +tile.honey.name=Honey -fluid.bop.liquidPoison=Liquid Poison -fluid.bop.springWater=Spring Water -fluid.bop.honey.name=Honey +fluid.poison=Poison +fluid.springWater=Spring Water +fluid.honey.name=Honey 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.