mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-11-07 03:02:11 +01:00
Use Location.locToBlock instead of Math.floor.
This commit is contained in:
parent
3d981241eb
commit
4025cd3e55
@ -123,7 +123,7 @@ public class SurvivalFly extends Check {
|
||||
|
||||
// Maybe don't adapt the setback (unless null)!
|
||||
data.setBack = from.getLocation();
|
||||
data.setBack.setY(Math.floor(data.setBack.getY()));
|
||||
data.setBack.setY(Location.locToBlock(data.setBack.getY()));
|
||||
// data.ground ?
|
||||
data.survivalFlyJumpPhase = 0;
|
||||
data.clearAccounting();
|
||||
@ -354,7 +354,7 @@ public class SurvivalFly extends Check {
|
||||
// data.setBack.setY(Math.ceil(data.setBack.getY()));
|
||||
// data.survivalFlyJumpPhase = 0;
|
||||
// data.clearAccounting();
|
||||
// } else if (resetTo && (from.getY() >= to.getY() || data.setBack.getY() <= Math.floor(to.getY()))) {
|
||||
// } else if (resetTo && (from.getY() >= to.getY() || data.setBack.getY() <= Location.locToBlock(to.getY()))) {
|
||||
// // Set set back and jump phase, if:
|
||||
// // 1. Moving onto ladder/vine.
|
||||
// /*
|
||||
|
@ -211,12 +211,9 @@ public class PlayerLocation {
|
||||
*/
|
||||
public boolean isInWeb() {
|
||||
if (inWeb == null) {
|
||||
for (int blockX = (int) Math.floor(boundingBox.a + 0.001D); blockX <= (int) Math
|
||||
.floor(boundingBox.d - 0.001D); blockX++)
|
||||
for (int blockY = (int) Math.floor(boundingBox.b + 0.001D); blockY <= (int) Math
|
||||
.floor(boundingBox.e - 0.001D); blockY++)
|
||||
for (int blockZ = (int) Math.floor(boundingBox.c + 0.001D); blockZ <= (int) Math
|
||||
.floor(boundingBox.f - 0.001D); blockZ++)
|
||||
for (int blockX = Location.locToBlock(boundingBox.a + 0.001D); blockX <= Location.locToBlock(boundingBox.d - 0.001D); blockX++)
|
||||
for (int blockY = Location.locToBlock(boundingBox.b + 0.001D); blockY <= Location.locToBlock(boundingBox.e - 0.001D); blockY++)
|
||||
for (int blockZ = Location.locToBlock(boundingBox.c + 0.001D); blockZ <= Location.locToBlock(boundingBox.f - 0.001D); blockZ++)
|
||||
if (getTypeId(blockX, blockY, blockZ) == Material.WEB.getId())
|
||||
inWeb = true;
|
||||
if (inWeb == null)
|
||||
@ -236,15 +233,6 @@ public class PlayerLocation {
|
||||
boundingBoxGround = boundingBoxGround.d(0D, -getyOnGround(), 0D);
|
||||
onGround = worldServer.getCubes(entity, boundingBoxGround).size() > 0;
|
||||
}
|
||||
// if (!onGround){
|
||||
// double y = this.getY() - this.blockY;
|
||||
// // TODO: maybe make an auxiliary method in BlockProperties (can stand on ? id, boundY)
|
||||
// if (y < 0) y += 1D;
|
||||
// final int id = getTypeId();
|
||||
// final int idBelow = getTypeIdBelow();
|
||||
// if (y >= 0.5 && BlockProperties.isStairs(id)) onGround = true;
|
||||
// else if (y <= 0.002 && BlockProperties.isStairs(idBelow)) onGround = true;
|
||||
// }
|
||||
return onGround;
|
||||
}
|
||||
|
||||
@ -256,7 +244,7 @@ public class PlayerLocation {
|
||||
public boolean isOnIce() {
|
||||
if (onIce == null)
|
||||
if (entity.getBukkitEntity().isSneaking() || entity.getBukkitEntity().isBlocking())
|
||||
onIce = getTypeId(blockX, (int) Math.floor(boundingBox.b - 0.1D), blockZ) == Material.ICE.getId();
|
||||
onIce = getTypeId(blockX, Location.locToBlock(boundingBox.b - 0.1D), blockZ) == Material.ICE.getId();
|
||||
else
|
||||
onIce = getTypeIdBelow() == Material.ICE.getId();
|
||||
return onIce;
|
||||
|
Loading…
Reference in New Issue
Block a user