Advertisement
Guest User

Untitled

a guest
Jun 24th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.59 KB | None | 0 0
  1. public boolean isOverLiquid()
  2.     {
  3.         boolean foundLiquid = false;
  4.         boolean foundSolid = false;
  5.        
  6.         // check collision boxes below player
  7.         for(AxisAlignedBB bb : WMinecraft.getWorld().getCollisionBoxes(
  8.             WMinecraft.getPlayer(),
  9.             WMinecraft.getPlayer().boundingBox.offset(0, -0.5, 0)))
  10.         {
  11.             BlockPos pos = new BlockPos(bb.getCenter());
  12.             Material material = WBlock.getMaterial(pos);
  13.            
  14.             if(material == Material.WATER || material == Material.LAVA)
  15.                 foundLiquid = true;
  16.             else if(material != Material.AIR)
  17.                 foundSolid = true;
  18.         }
  19.        
  20.         return foundLiquid && !foundSolid;
  21.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement