BlockFluidHoney.java 2.1 KB

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