2013-07-09 04:10:57 +00:00
|
|
|
package biomesoplenty.fluids;
|
2013-05-28 11:22:54 +00:00
|
|
|
|
|
|
|
import net.minecraft.block.Block;
|
|
|
|
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-28 11:22:54 +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-28 11:22:54 +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;
|
2013-05-29 01:05:27 +00:00
|
|
|
import cpw.mods.fml.relauncher.Side;
|
|
|
|
import cpw.mods.fml.relauncher.SideOnly;
|
2013-05-28 11:22:54 +00:00
|
|
|
|
2013-07-05 02:25:22 +00:00
|
|
|
public class BlockFluidLiquidPoison extends BlockFluidClassic
|
2013-05-28 11:22:54 +00:00
|
|
|
{
|
|
|
|
public static Icon liquidPoisonStillIcon;
|
|
|
|
public static Icon liquidPoisonFlowingIcon;
|
2013-05-31 10:34:02 +00:00
|
|
|
|
|
|
|
public BlockFluidLiquidPoison(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
|
|
|
|
|
|
|
quantaPerBlock = 4;
|
|
|
|
this.setLightOpacity(3);
|
|
|
|
|
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-28 11:22:54 +00:00
|
|
|
}
|
2013-05-31 10:34:02 +00:00
|
|
|
|
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) {
|
2013-05-29 01:05:27 +00:00
|
|
|
|
2013-05-31 10:34:02 +00:00
|
|
|
int bId = world.getBlockId(x, y, z);
|
2013-05-29 01:05:27 +00:00
|
|
|
|
2013-05-31 10:34:02 +00:00
|
|
|
if (bId == 0)
|
|
|
|
return true;
|
|
|
|
if (bId == blockID)
|
|
|
|
return false;
|
|
|
|
if (displacementIds.containsKey(bId))
|
|
|
|
return displacementIds.get(bId);
|
|
|
|
Material material = Block.blocksList[bId].blockMaterial;
|
2013-05-29 01:05:27 +00:00
|
|
|
|
2013-05-31 10:34:02 +00:00
|
|
|
if (material.blocksMovement() || material == Material.water || material == Material.lava || material == Material.portal)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onEntityCollidedWithBlock(World par1World, int x, int y, int z, Entity par5Entity)
|
|
|
|
{
|
|
|
|
int meta = par1World.getBlockMetadata(x, y, z);
|
|
|
|
|
2013-07-03 01:25:33 +00:00
|
|
|
if (par5Entity instanceof EntityLivingBase)
|
2013-05-31 10:34:02 +00:00
|
|
|
{
|
2013-07-03 01:25:33 +00:00
|
|
|
((EntityLivingBase)par5Entity).addPotionEffect(new PotionEffect(Potion.poison.id, 100));
|
|
|
|
((EntityLivingBase)par5Entity).addPotionEffect(new PotionEffect(Potion.hunger.id, 100));
|
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 registerIcons(IconRegister iconRegister)
|
2013-05-28 11:22:54 +00:00
|
|
|
{
|
2013-07-03 06:01:28 +00:00
|
|
|
liquidPoisonStillIcon = iconRegister.registerIcon("biomesoplenty:liquid_poison_still");
|
|
|
|
liquidPoisonFlowingIcon = iconRegister.registerIcon("biomesoplenty:liquid_poison_flowing");
|
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 Icon getIcon(int par1, int par2)
|
|
|
|
{
|
|
|
|
return par1 != 0 && par1 != 1 ? liquidPoisonFlowingIcon : liquidPoisonStillIcon;
|
|
|
|
}
|
2013-05-28 11:22:54 +00:00
|
|
|
}
|