Need to call updateFinal within MovingListener.

Necessary with multiple checks updating the BlockChangeReference/span.
This commit is contained in:
asofold 2016-11-26 14:35:37 +01:00
parent 5939e1e206
commit 371afd91d0
4 changed files with 18 additions and 2 deletions

View File

@ -782,6 +782,16 @@ public class MovingListener extends CheckListener implements TickListener, IRemo
}
}
// Update BlockChangeTracker
/*
* TODO: Set an activation flag earlier on, based on query for
* regions/chunks before running checks (and pass the activation flag to
* those).
*/
if (cc.trackBlockMove && data.blockChangeRef.firstSpanEntry != null) {
data.blockChangeRef.updateFinal(pTo);
}
if (newTo == null) {
// Allowed move.
// Bounce effects.

View File

@ -227,6 +227,7 @@ public class Passable extends Check {
else if (rayTracing.getStepsDone() >= rayTracing.getMaxSteps()) {
debug(player, "Raytracing max steps exceeded (" + tag + "): "+ rayTracing.getCollidingAxis());
}
// TODO: Detect having used past block changes and log or set a tag.
}
private Location checkLegacy(final Player player, final PlayerLocation from, final PlayerLocation to,

View File

@ -656,7 +656,6 @@ public class SurvivalFly extends Check {
|| yDistance <= 1.015 && to.getY() - to.getBlockY() < 0.015)) {
// TODO: Other conditions? [some will be in passable later].
if (from.matchBlockChange(blockChangeTracker, data.blockChangeRef, Direction.Y_POS, Math.min(yDistance, 1.0))) {
data.blockChangeRef.updateFinal(to); // TODO: -> MovingListener (!).
tags.add("blkmv_y_pos");
final double maxDistYPos = yDistance; //1.0 - (from.getY() - from.getBlockY()); // TODO: Margin ?
return new double[]{maxDistYPos, 0.0};
@ -666,7 +665,6 @@ public class SurvivalFly extends Check {
else if (yDistance < 0.0 && yDistance >= -1.0) {
// TODO: Other conditions? [some will be in passable later].
if (from.matchBlockChange(blockChangeTracker, data.blockChangeRef, Direction.Y_NEG, -yDistance)) {
data.blockChangeRef.updateFinal(to); // TODO: -> MovingListener (!).
tags.add("blkmv_y_neg");
final double maxDistYNeg = yDistance; // from.getY() - from.getBlockY(); // TODO: Margin ?
return new double[]{maxDistYNeg, 0.0};

View File

@ -281,6 +281,13 @@ public class BlockChangeTracker {
if (firstSpanEntry == null) {
return;
}
// TODO: Consider a span margin, for which we set last used to first span.
/*
* TODO: What with latest entries, that stay valid until half round
* trip time? Should perhaps keep validity also if entries are the
* latest ones, needs updating in span already - can/should do
* without bounds?
*/
if (lastSpanEntry != null && (lastUsedEntry == null || lastSpanEntry.id > lastUsedEntry.id)) {
lastUsedEntry = lastSpanEntry;
if (to != null && to.isBlockIntersecting(lastSpanEntry.x, lastSpanEntry.y, lastSpanEntry.z)) {