mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-01-30 11:21:21 +01:00
If neither from nor loc is passable, set back to from (earliest) rather.
This commit is contained in:
parent
f29acd3f00
commit
6c0e1bb6c8
@ -103,7 +103,7 @@ public class Passable extends Check {
|
|||||||
loc = null;
|
loc = null;
|
||||||
tags += "into";
|
tags += "into";
|
||||||
} else if (BlockProperties.isPassable(from.getBlockCache(), loc.getX(), loc.getY(), loc.getZ(), from.getTypeId(lbX, lbY, lbZ))) {
|
} else if (BlockProperties.isPassable(from.getBlockCache(), loc.getX(), loc.getY(), loc.getZ(), from.getTypeId(lbX, lbY, lbZ))) {
|
||||||
// Keep loc.
|
// Keep loc, because it it is passable.
|
||||||
tags += "into_shift";
|
tags += "into_shift";
|
||||||
}
|
}
|
||||||
// } else if (BlockProperties.isPassableExact(from.getBlockCache(), loc.getX(), loc.getY(), loc.getZ(), from.getTypeId(lbX, lbY, lbZ))) {
|
// } else if (BlockProperties.isPassableExact(from.getBlockCache(), loc.getX(), loc.getY(), loc.getZ(), from.getTypeId(lbX, lbY, lbZ))) {
|
||||||
@ -111,12 +111,14 @@ public class Passable extends Check {
|
|||||||
// Keep loc as set-back.
|
// Keep loc as set-back.
|
||||||
// }
|
// }
|
||||||
else if (!from.isSameBlock(lbX, lbY, lbZ)) {
|
else if (!from.isSameBlock(lbX, lbY, lbZ)) {
|
||||||
// Otherwise keep loc as set-back.
|
// Both loc and from are not passable. Use from as set.back (earliest).
|
||||||
tags += "cross_shift";
|
tags += "cross_shift";
|
||||||
|
loc = null;
|
||||||
}
|
}
|
||||||
else if (manhattan == 1 && to.isBlockAbove(from) && BlockProperties.isPassable(from.getBlockCache(), from.getX(), from.getY() + player.getEyeHeight(), from.getZ(), from.getTypeId(from.getBlockX(), Location.locToBlock(from.getY() + player.getEyeHeight()), from.getBlockZ()))) {
|
else if (manhattan == 1 && to.isBlockAbove(from) && BlockProperties.isPassable(from.getBlockCache(), from.getX(), from.getY() + player.getEyeHeight(), from.getZ(), from.getTypeId(from.getBlockX(), Location.locToBlock(from.getY() + player.getEyeHeight()), from.getBlockZ()))) {
|
||||||
// else if (to.isBlockAbove(from) && BlockProperties.isPassableExact(from.getBlockCache(), from.getX(), from.getY() + player.getEyeHeight(), from.getZ(), from.getTypeId(from.getBlockX(), Location.locToBlock(from.getY() + player.getEyeHeight()), from.getBlockZ()))) {
|
// else if (to.isBlockAbove(from) && BlockProperties.isPassableExact(from.getBlockCache(), from.getX(), from.getY() + player.getEyeHeight(), from.getZ(), from.getTypeId(from.getBlockX(), Location.locToBlock(from.getY() + player.getEyeHeight()), from.getBlockZ()))) {
|
||||||
// Allow the move up if the head is free.
|
// Allow the move up if the head is free.
|
||||||
|
// TODO: Better distinguish ray-tracing (through something thin) or check to-head-passable too?
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
else if (manhattan > 0) {
|
else if (manhattan > 0) {
|
||||||
@ -137,6 +139,7 @@ public class Passable extends Check {
|
|||||||
|
|
||||||
// Prefer the set-back location from the data.
|
// Prefer the set-back location from the data.
|
||||||
if (data.hasSetBack()) {
|
if (data.hasSetBack()) {
|
||||||
|
// TODO: Review or make configurable.
|
||||||
final Location ref = data.getSetBack(to);
|
final Location ref = data.getSetBack(to);
|
||||||
if (BlockProperties.isPassable(from.getBlockCache(), ref) || loc == null || TrigUtil.distance(from, loc) > 0.13) {
|
if (BlockProperties.isPassable(from.getBlockCache(), ref) || loc == null || TrigUtil.distance(from, loc) > 0.13) {
|
||||||
// if (BlockProperties.isPassableExact(from.getBlockCache(), ref)) {
|
// if (BlockProperties.isPassableExact(from.getBlockCache(), ref)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user