hubeb

sandblock

Oct 25th, 2011
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.51 KB | None | 0 0
  1. // Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
  2. // Jad home page: http://www.kpdus.com/jad.html
  3. // Decompiler options: packimports(3) braces deadcode
  4.  
  5. package net.minecraft.src;
  6.  
  7. import java.util.Random;
  8.  
  9. // Referenced classes of package net.minecraft.src:
  10. // Block, Material, World, EntityFallingSand,
  11. // BlockFire
  12.  
  13. public class BlockSand extends Block
  14. {
  15.  
  16. public BlockSand(int i, int j)
  17. {
  18. super(i, j, Material.sand);
  19. }
  20.  
  21. public void onBlockAdded(World world, int i, int j, int k)
  22. {
  23. world.scheduleBlockUpdate(i, j, k, blockID, tickRate());
  24. }
  25.  
  26. public void onNeighborBlockChange(World world, int i, int j, int k, int l)
  27. {
  28. world.scheduleBlockUpdate(i, j, k, blockID, tickRate());
  29. }
  30.  
  31. public void updateTick(World world, int i, int j, int k, Random random)
  32. {
  33. tryToFall(world, i, j, k);
  34. }
  35.  
  36. private void tryToFall(World world, int i, int j, int k)
  37. {
  38. int l = i;
  39. int i1 = j;
  40. int j1 = k;
  41. if(canFallBelow(world, l, i1 - 1, j1) && i1 >= 0)
  42. {
  43. byte byte0 = 32;
  44. if(fallInstantly || !world.checkChunksExist(i - byte0, j - byte0, k - byte0, i + byte0, j + byte0, k + byte0))
  45. {
  46. world.setBlockWithNotify(i, j, k, 0);
  47. for(; canFallBelow(world, i, j - 1, k) && j > 0; j--) { }
  48. if(j > 0)
  49. {
  50. world.setBlockWithNotify(i, j, k, blockID);
  51. }
  52. } else
  53. {
  54. EntityFallingSand entityfallingsand = new EntityFallingSand(world, (float)i + 0.5F, (float)j + 0.5F, (float)k + 0.5F, blockID);
  55. world.entityJoinedWorld(entityfallingsand);
  56. }
  57. }
  58. }
  59.  
  60. public int tickRate()
  61. {
  62. return 3;
  63. }
  64.  
  65. public static boolean canFallBelow(World world, int i, int j, int k)
  66. {
  67. int l = world.getBlockId(i, j, k);
  68. if(l == 0)
  69. {
  70. return true;
  71. }
  72. if(l == Block.fire.blockID)
  73. {
  74. return true;
  75. }
  76. Material material = Block.blocksList[l].blockMaterial;
  77. if(material == Material.water)
  78. {
  79. return true;
  80. }
  81. return material == Material.lava;
  82. }
  83. public int idDropped(int i, Random random)
  84. {
  85.  
  86. return mod_modname.Salt.shiftedIndex;
  87.  
  88. }
  89.  
  90. public static boolean fallInstantly = false;
  91.  
  92. }
  93.  
  94.  
Advertisement
Add Comment
Please, Sign In to add comment