BlockFluidPoison.java 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. package me.km.fluids;
  2. import net.minecraft.block.Block;
  3. import net.minecraft.block.BlockColored;
  4. import static net.minecraft.block.BlockColored.COLOR;
  5. import net.minecraft.block.material.Material;
  6. import net.minecraft.block.state.IBlockState;
  7. import net.minecraft.entity.Entity;
  8. import net.minecraft.entity.EntityLivingBase;
  9. import net.minecraft.init.Blocks;
  10. import net.minecraft.init.MobEffects;
  11. import net.minecraft.item.EnumDyeColor;
  12. import net.minecraft.potion.PotionEffect;
  13. import net.minecraft.util.math.BlockPos;
  14. import net.minecraft.world.World;
  15. import net.minecraftforge.fluids.Fluid;
  16. public class BlockFluidPoison extends BlockFluidBase
  17. {
  18. public BlockFluidPoison(Fluid fluid, Material material)
  19. {
  20. super(fluid, material);
  21. }
  22. @Override
  23. public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn)
  24. {
  25. super.onEntityCollidedWithBlock(worldIn, pos, state, entityIn);
  26. if(entityIn instanceof EntityLivingBase)
  27. {
  28. ((EntityLivingBase) entityIn).addPotionEffect(new PotionEffect(MobEffects.POISON, 100, 1));
  29. }
  30. }
  31. @Override
  32. protected IBlockState getStrongMixingBlock(Block b, Material m)
  33. {
  34. if(m == Material.LAVA)
  35. {
  36. return Blocks.COBBLESTONE.getDefaultState();
  37. }
  38. return Blocks.STAINED_HARDENED_CLAY.getDefaultState().withProperty(COLOR, EnumDyeColor.PURPLE);
  39. }
  40. @Override
  41. protected IBlockState getWeakMixingBlock(Block b, Material m)
  42. {
  43. if(m == Material.LAVA)
  44. {
  45. return Blocks.COBBLESTONE.getDefaultState();
  46. }
  47. return Blocks.STAINED_HARDENED_CLAY.getDefaultState().withProperty(COLOR, EnumDyeColor.PURPLE);
  48. }
  49. @Override
  50. protected IBlockState getFlownOnMixingBlock(Block b, Material m)
  51. {
  52. if(m == Material.LAVA)
  53. {
  54. return Blocks.COBBLESTONE.getDefaultState();
  55. }
  56. return Blocks.STAINED_HARDENED_CLAY.getDefaultState().withProperty(COLOR, EnumDyeColor.PURPLE);
  57. }
  58. }