package me.km.fluids; import net.minecraft.block.Block; import net.minecraft.block.BlockColored; import static net.minecraft.block.BlockColored.COLOR; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.init.Blocks; import net.minecraft.init.MobEffects; import net.minecraft.item.EnumDyeColor; import net.minecraft.potion.PotionEffect; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fluids.Fluid; public class BlockFluidPoison extends BlockFluidBase { public BlockFluidPoison(Fluid fluid, Material material) { super(fluid, material); } @Override public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) { super.onEntityCollidedWithBlock(worldIn, pos, state, entityIn); if(entityIn instanceof EntityLivingBase) { ((EntityLivingBase) entityIn).addPotionEffect(new PotionEffect(MobEffects.POISON, 100, 1)); } } @Override protected IBlockState getStrongMixingBlock(Block b, Material m) { if(m == Material.LAVA) { return Blocks.COBBLESTONE.getDefaultState(); } return Blocks.STAINED_HARDENED_CLAY.getDefaultState().withProperty(COLOR, EnumDyeColor.PURPLE); } @Override protected IBlockState getWeakMixingBlock(Block b, Material m) { if(m == Material.LAVA) { return Blocks.COBBLESTONE.getDefaultState(); } return Blocks.STAINED_HARDENED_CLAY.getDefaultState().withProperty(COLOR, EnumDyeColor.PURPLE); } @Override protected IBlockState getFlownOnMixingBlock(Block b, Material m) { if(m == Material.LAVA) { return Blocks.COBBLESTONE.getDefaultState(); } return Blocks.STAINED_HARDENED_CLAY.getDefaultState().withProperty(COLOR, EnumDyeColor.PURPLE); } }