package gtPlusPlus.core.fluids; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; 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.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fluids.BlockFluidClassic; import net.minecraftforge.fluids.Fluid; public class BlockFluidBase extends BlockFluidClassic { @SideOnly(Side.CLIENT) protected IIcon stillIcon; @SideOnly(Side.CLIENT) protected IIcon flowingIcon; public BlockFluidBase(Fluid fluid, Material material) { super(fluid, material); } @Override public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity ent) { if (!(ent instanceof EntityLivingBase)) { return; } EntityLivingBase player = (EntityLivingBase) ent; int pot = world.rand.nextInt(Potion.potionTypes.length); Potion.potionTypes[pot].performEffect(player, 40); } @Override public IIcon getIcon(int side, int meta) { return (side == 0 || side == 1) ? stillIcon : flowingIcon; } @SideOnly(Side.CLIENT) @Override public void registerBlockIcons(IIconRegister register) { stillIcon = register.registerIcon("chaotica:pureChaosStill"); flowingIcon = register.registerIcon("chaotica:pureChaosFlowing"); } @Override public boolean canDisplace(IBlockAccess world, int x, int y, int z) { if (world.getBlock(x, y, z).getMaterial().isLiquid()) { return false; } return super.canDisplace(world, x, y, z); } @Override public boolean displaceIfPossible(World world, int x, int y, int z) { if (world.getBlock(x, y, z).getMaterial().isLiquid()) { return false; } return super.displaceIfPossible(world, x, y, z); } }