2013-07-09 04:10:57 +00:00
|
|
|
package biomesoplenty.fluids;
|
2013-05-25 02:33:57 +00:00
|
|
|
|
2013-05-26 19:36:28 +00:00
|
|
|
import java.util.Random;
|
|
|
|
|
2013-05-28 11:22:54 +00:00
|
|
|
import net.minecraft.block.Block;
|
2013-05-25 02:33:57 +00:00
|
|
|
import net.minecraft.block.material.Material;
|
|
|
|
import net.minecraft.client.renderer.texture.IconRegister;
|
|
|
|
import net.minecraft.entity.Entity;
|
2013-07-03 01:25:33 +00:00
|
|
|
import net.minecraft.entity.EntityLivingBase;
|
2013-05-25 02:33:57 +00:00
|
|
|
import net.minecraft.potion.Potion;
|
|
|
|
import net.minecraft.potion.PotionEffect;
|
|
|
|
import net.minecraft.util.Icon;
|
2013-05-29 01:05:27 +00:00
|
|
|
import net.minecraft.world.IBlockAccess;
|
2013-05-25 02:33:57 +00:00
|
|
|
import net.minecraft.world.World;
|
2013-05-30 09:41:07 +00:00
|
|
|
import net.minecraftforge.fluids.BlockFluidClassic;
|
|
|
|
import net.minecraftforge.fluids.Fluid;
|
|
|
|
import net.minecraftforge.fluids.FluidContainerRegistry;
|
|
|
|
import net.minecraftforge.fluids.FluidStack;
|
2013-05-30 08:18:07 +00:00
|
|
|
import biomesoplenty.BiomesOPlenty;
|
2013-07-09 04:10:57 +00:00
|
|
|
import biomesoplenty.api.Fluids;
|
2013-08-06 08:57:04 +00:00
|
|
|
import biomesoplenty.configuration.BOPConfiguration;
|
2013-05-29 01:05:27 +00:00
|
|
|
import cpw.mods.fml.relauncher.Side;
|
|
|
|
import cpw.mods.fml.relauncher.SideOnly;
|
2013-05-25 02:33:57 +00:00
|
|
|
|
2013-07-05 02:25:22 +00:00
|
|
|
public class BlockFluidSpringWater extends BlockFluidClassic
|
2013-05-25 02:33:57 +00:00
|
|
|
{
|
2013-05-28 11:22:54 +00:00
|
|
|
public static Icon springWaterStillIcon;
|
|
|
|
public static Icon springWaterFlowingIcon;
|
2013-05-31 10:34:02 +00:00
|
|
|
|
|
|
|
public BlockFluidSpringWater(int id, Fluid fluid, Material material)
|
2013-05-28 11:22:54 +00:00
|
|
|
{
|
|
|
|
super(id, fluid, material);
|
2013-05-31 10:34:02 +00:00
|
|
|
stack = new FluidStack(fluid, FluidContainerRegistry.BUCKET_VOLUME);
|
|
|
|
|
2013-05-29 01:05:27 +00:00
|
|
|
for (int i = 8; i < 11; i++)
|
|
|
|
{
|
2013-05-31 10:34:02 +00:00
|
|
|
displacementIds.put(i, false);
|
2013-05-29 01:05:27 +00:00
|
|
|
}
|
2013-05-31 10:34:02 +00:00
|
|
|
|
2013-07-09 04:10:57 +00:00
|
|
|
displacementIds.put(Fluids.liquidPoison.get().blockID, false);
|
2013-05-28 11:22:54 +00:00
|
|
|
}
|
2013-05-31 10:34:02 +00:00
|
|
|
|
2013-05-28 11:22:54 +00:00
|
|
|
@Override
|
|
|
|
@SideOnly(Side.CLIENT)
|
2013-05-31 10:34:02 +00:00
|
|
|
public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random)
|
|
|
|
{
|
|
|
|
super.randomDisplayTick(par1World, par2, par3, par4, par5Random);
|
|
|
|
|
|
|
|
if (par5Random.nextInt(1) == 0)
|
|
|
|
{
|
|
|
|
BiomesOPlenty.proxy.spawnParticle("steam", par2 + par5Random.nextFloat(), par3 + 1.0F, par4 + par5Random.nextFloat());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-05-29 01:05:27 +00:00
|
|
|
@Override
|
2013-05-31 10:34:02 +00:00
|
|
|
public boolean canDisplace(IBlockAccess world, int x, int y, int z) {
|
|
|
|
|
|
|
|
int bId = world.getBlockId(x, y, z);
|
|
|
|
|
|
|
|
if (bId == 0)
|
|
|
|
return true;
|
|
|
|
if (bId == blockID)
|
|
|
|
return false;
|
|
|
|
if (displacementIds.containsKey(bId))
|
|
|
|
return displacementIds.get(bId);
|
|
|
|
Material material = Block.blocksList[bId].blockMaterial;
|
|
|
|
|
|
|
|
if (material.blocksMovement() || material == Material.water || material == Material.lava || material == Material.portal)
|
|
|
|
return false;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2013-07-03 08:20:14 +00:00
|
|
|
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity)
|
2013-05-31 10:34:02 +00:00
|
|
|
{
|
2013-07-03 08:20:14 +00:00
|
|
|
int meta = world.getBlockMetadata(x, y, z);
|
2013-05-31 10:34:02 +00:00
|
|
|
|
2013-08-06 08:57:04 +00:00
|
|
|
if (!world.isRemote && BOPConfiguration.Misc.hotSpringsRegeneration)
|
2013-07-03 01:25:33 +00:00
|
|
|
{
|
2013-07-03 08:20:14 +00:00
|
|
|
if (entity instanceof EntityLivingBase)
|
2013-07-03 01:25:33 +00:00
|
|
|
{
|
2013-08-07 08:54:27 +00:00
|
|
|
if (!((EntityLivingBase)entity).isPotionActive(Potion.regeneration.id))
|
|
|
|
((EntityLivingBase)entity).addPotionEffect(new PotionEffect(Potion.regeneration.id, 50));
|
2013-07-03 01:25:33 +00:00
|
|
|
}
|
2013-05-31 10:34:02 +00:00
|
|
|
}
|
|
|
|
}
|
2013-05-28 11:22:54 +00:00
|
|
|
|
2013-05-25 02:33:57 +00:00
|
|
|
@Override
|
|
|
|
@SideOnly(Side.CLIENT)
|
2013-05-31 10:34:02 +00:00
|
|
|
public void registerIcons(IconRegister iconRegister)
|
2013-05-25 02:33:57 +00:00
|
|
|
{
|
2013-07-03 06:01:28 +00:00
|
|
|
springWaterStillIcon = iconRegister.registerIcon("biomesoplenty:spring_water_still");
|
|
|
|
springWaterFlowingIcon = iconRegister.registerIcon("biomesoplenty:spring_water_flowing");
|
2013-05-25 02:33:57 +00:00
|
|
|
}
|
2013-05-31 10:34:02 +00:00
|
|
|
|
2013-05-26 00:14:33 +00:00
|
|
|
@Override
|
2013-05-28 11:22:54 +00:00
|
|
|
@SideOnly(Side.CLIENT)
|
2013-05-31 10:34:02 +00:00
|
|
|
public Icon getIcon(int par1, int par2)
|
|
|
|
{
|
|
|
|
return par1 != 0 && par1 != 1 ? springWaterFlowingIcon : springWaterStillIcon;
|
|
|
|
}
|
2013-05-25 02:33:57 +00:00
|
|
|
}
|