Advertisement
Guest User

Untitled

a guest
Jun 2nd, 2018
504
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. public class BloodySlimeBlock extends BlockBase {
  2.  
  3.  
  4. public BloodySlimeBlock(String name, Material material)
  5. {
  6. super(name, material);
  7. setHardness(1.0f);
  8. setLightLevel(0.0f);
  9. setSoundType(SoundType.SLIME);
  10. setDefaultSlipperiness(0.8f);
  11.  
  12. }
  13.  
  14.  
  15. @SideOnly(Side.CLIENT)
  16. // Thx Mojang for the code below (:
  17.  
  18. public BlockRenderLayer getBlockLayer()
  19. {
  20. return BlockRenderLayer.TRANSLUCENT;
  21. }
  22.  
  23. public void onFallenUpon(World worldIn, BlockPos pos, Entity entityIn, float fallDistance)
  24. {
  25. if (entityIn.isSneaking())
  26. {
  27. super.onFallenUpon(worldIn, pos, entityIn, fallDistance);
  28. }
  29. else
  30. {
  31. entityIn.fall(fallDistance, 0.0F);
  32. }
  33. }
  34.  
  35. public void onLanded(World worldIn, Entity entityIn)
  36. {
  37. if (entityIn.isSneaking())
  38. {
  39. super.onLanded(worldIn, entityIn);
  40. }
  41. else if (entityIn.motionY < 0.0D)
  42. {
  43. entityIn.motionY = -entityIn.motionY;
  44.  
  45. if (!(entityIn instanceof EntityLivingBase))
  46. {
  47. entityIn.motionY *= 0.8D;
  48. }
  49. }
  50. }
  51.  
  52. public void onEntityWalk(World worldIn, BlockPos pos, Entity entityIn)
  53. {
  54. if (Math.abs(entityIn.motionY) < 0.1D && !entityIn.isSneaking())
  55. {
  56. double d0 = 0.4D + Math.abs(entityIn.motionY) * 0.2D;
  57. entityIn.motionX *= d0;
  58. entityIn.motionZ *= d0;
  59. }
  60.  
  61. super.onEntityWalk(worldIn, pos, entityIn);
  62. }
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement