mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-11-05 01:59:44 +01:00
Add specialized convenience methods for isOnGround and standsOnEntity.
This commit is contained in:
parent
57202f81c5
commit
351fbfd79f
@ -394,6 +394,38 @@ public class PlayerLocation {
|
||||
return onGround;
|
||||
}
|
||||
|
||||
/**
|
||||
* Simple block-on-ground check for given margin (no entities). Meant for checking bigger margin than the normal yOnGround.
|
||||
* @param yOnGround Margin below the player.
|
||||
* @return
|
||||
*/
|
||||
public boolean isOnGround(final double yOnGround){
|
||||
return isOnGround(yOnGround, 0D, 0D);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Simple block-on-ground check for given margin (no entities). Meant for checking bigger margin than the normal yOnGround.
|
||||
* @param yOnGround Margin below the player.
|
||||
* @param xzMargin
|
||||
* @param yMargin Extra margin added below and above.
|
||||
* @return
|
||||
*/
|
||||
public boolean isOnGround(final double yOnGround, final double xzMargin, final double yMargin) {
|
||||
return BlockProperties.isOnGround(blockCache, minX - xzMargin, minY - yOnGround - yMargin, minZ - xzMargin, maxX + xzMargin, minY + yMargin, maxZ + xzMargin);
|
||||
}
|
||||
|
||||
/**
|
||||
* Simple check with custom margins (Boat, Minecart).
|
||||
* @param yOnGround Margin below the player.
|
||||
* @param xzMargin
|
||||
* @param yMargin Extra margin added below and above.
|
||||
* @return
|
||||
*/
|
||||
public boolean standsOnEntity(final double yOnGround, final double xzMargin, final double yMargin){
|
||||
return blockCache.standsOnEntity(player, minX - xzMargin, minY - yOnGround - yMargin, minZ - xzMargin, maxX + xzMargin, minY + yMargin, maxZ + xzMargin);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset condition for flying checks (sf + nofall): fluids, web, ladder (not on-ground, though).
|
||||
* @return
|
||||
|
Loading…
Reference in New Issue
Block a user