Advertisement
Guest User

Untitled

a guest
Oct 27th, 2015
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.66 KB | None | 0 0
  1. @Override
  2. public boolean canBlockStay(World world, int x, int y, int z)
  3. {
  4.     if (world.getTileEntity(x, y, z) instanceof TELeatherRack)
  5.     {
  6.         TELeatherRack te = (TELeatherRack) world.getTileEntity(x, y, z);
  7.         if (te.leatherItem == null) // Leather racks that have no hide should not exist.
  8.         {
  9.             return false;
  10.         }
  11.     }
  12.  
  13.     return world.getBlock(x, y - 1, z).getMaterial() == Material.wood; // Leather racks without a log underneath should not exist.
  14. }
  15.  
  16. @Override
  17. public void onNeighborBlockChange(World world, int i, int j, int k, Block par5)
  18. {
  19.     super.onNeighborBlockChange(world, i, j, k, par5);
  20.     if(!canBlockStay(world,i,j,k))
  21.         world.setBlockToAir(i, j, k);
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement