2013-05-25 02:33:57 +00:00
|
|
|
package biomesoplenty.liquids;
|
|
|
|
|
2013-05-26 19:36:28 +00:00
|
|
|
import java.util.Random;
|
|
|
|
|
2013-05-25 02:33:57 +00:00
|
|
|
import cpw.mods.fml.relauncher.Side;
|
|
|
|
import cpw.mods.fml.relauncher.SideOnly;
|
|
|
|
import net.minecraft.block.BlockStationary;
|
|
|
|
import net.minecraft.block.material.Material;
|
|
|
|
import net.minecraft.client.renderer.texture.IconRegister;
|
|
|
|
import net.minecraft.entity.Entity;
|
|
|
|
import net.minecraft.entity.EntityLiving;
|
2013-05-25 08:57:21 +00:00
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
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-25 08:57:21 +00:00
|
|
|
import net.minecraft.world.IBlockAccess;
|
2013-05-25 02:33:57 +00:00
|
|
|
import net.minecraft.world.World;
|
2013-05-26 00:14:33 +00:00
|
|
|
import net.minecraftforge.liquids.ILiquid;
|
2013-05-25 02:33:57 +00:00
|
|
|
|
|
|
|
import biomesoplenty.BiomesOPlenty;
|
2013-05-26 00:14:33 +00:00
|
|
|
import biomesoplenty.api.Liquids;
|
2013-05-25 09:33:37 +00:00
|
|
|
import biomesoplenty.api.Potions;
|
2013-05-25 08:57:21 +00:00
|
|
|
import biomesoplenty.configuration.BOPPotions;
|
2013-05-25 02:33:57 +00:00
|
|
|
|
2013-05-26 00:14:33 +00:00
|
|
|
public class BlockSpringWaterStill extends BlockStationary implements ILiquid
|
2013-05-25 02:33:57 +00:00
|
|
|
{
|
|
|
|
public BlockSpringWaterStill(int id)
|
|
|
|
{
|
|
|
|
super(id, Material.water);
|
|
|
|
|
|
|
|
this.blockHardness = 100F;
|
2013-05-25 04:08:06 +00:00
|
|
|
this.setLightOpacity(0);
|
2013-05-25 02:33:57 +00:00
|
|
|
this.disableStats();
|
|
|
|
}
|
|
|
|
|
2013-05-25 08:57:21 +00:00
|
|
|
@Override
|
|
|
|
public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
|
|
|
|
{
|
|
|
|
return 16777215;
|
|
|
|
}
|
2013-05-26 19:36:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A randomly called display update to be able to add particles or other items for display
|
|
|
|
*/
|
|
|
|
public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random)
|
|
|
|
{
|
|
|
|
super.randomDisplayTick(par1World, par2, par3, par4, par5Random);
|
|
|
|
|
|
|
|
if (par5Random.nextInt(6) == 0)
|
|
|
|
{
|
|
|
|
par1World.spawnParticle("smoke", (double)((float)par2 + par5Random.nextFloat()), (double)((float)par3 + 1.0F), (double)((float)par4 + par5Random.nextFloat()), 0.0D, 0.0D, 0.0D);
|
|
|
|
}
|
|
|
|
}
|
2013-05-25 08:57:21 +00:00
|
|
|
|
2013-05-25 04:08:06 +00:00
|
|
|
@Override
|
|
|
|
public void onBlockAdded(World par1World, int x, int y, int z)
|
|
|
|
{
|
|
|
|
this.setSpringWaterNotStationary(par1World, x, y, z);;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setSpringWaterNotStationary(World par1World, int par2, int par3, int par4)
|
|
|
|
{
|
|
|
|
int l = par1World.getBlockMetadata(par2, par3, par4);
|
|
|
|
par1World.setBlock(par2, par3, par4, this.blockID - 1, l, 2);
|
|
|
|
par1World.scheduleBlockUpdate(par2, par3, par4, this.blockID - 1, this.tickRate(par1World));
|
|
|
|
}
|
|
|
|
|
2013-05-25 02:33:57 +00:00
|
|
|
@Override
|
|
|
|
public void onEntityCollidedWithBlock(World par1World, int x, int y, int z, Entity par5Entity)
|
|
|
|
{
|
|
|
|
int meta = par1World.getBlockMetadata(x, y, z);
|
|
|
|
|
|
|
|
if (par5Entity instanceof EntityLiving)
|
2013-05-26 00:22:12 +00:00
|
|
|
((EntityLiving)par5Entity).addPotionEffect(new PotionEffect(Potion.regeneration.id, 1));
|
2013-05-25 08:57:21 +00:00
|
|
|
|
|
|
|
if (par5Entity instanceof EntityPlayer)
|
2013-05-26 00:22:12 +00:00
|
|
|
((EntityPlayer)par5Entity).addPotionEffect(new PotionEffect(Potions.nourishment.get().id, 1));
|
2013-05-25 02:33:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
public void registerIcons(IconRegister iconRegister)
|
|
|
|
{
|
|
|
|
this.theIcon = new Icon[]{iconRegister.registerIcon("BiomesOPlenty:spring_water_still"), iconRegister.registerIcon("BiomesOPlenty:spring_water_flowing")};
|
|
|
|
}
|
2013-05-26 00:14:33 +00:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public int stillLiquidId()
|
|
|
|
{
|
|
|
|
return Liquids.springWaterStill.get().blockID;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean isMetaSensitive()
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int stillLiquidMeta()
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2013-05-25 02:33:57 +00:00
|
|
|
}
|