mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-06-26 06:14:42 +02:00
Move + rename updateBlockChangeRef.
This commit is contained in:
parent
30979935ce
commit
9abe1ae3d2
|
@ -43,7 +43,6 @@ import fr.neatmonster.nocheatplus.checks.moving.velocity.FrictionAxisVelocity;
|
|||
import fr.neatmonster.nocheatplus.checks.moving.velocity.SimpleAxisVelocity;
|
||||
import fr.neatmonster.nocheatplus.checks.moving.velocity.SimpleEntry;
|
||||
import fr.neatmonster.nocheatplus.checks.workaround.WRPT;
|
||||
import fr.neatmonster.nocheatplus.compat.blocks.BlockChangeTracker.BlockChangeEntry;
|
||||
import fr.neatmonster.nocheatplus.compat.blocks.BlockChangeTracker.BlockChangeReference;
|
||||
import fr.neatmonster.nocheatplus.components.data.ICanHandleTimeRunningBackwards;
|
||||
import fr.neatmonster.nocheatplus.components.entity.IEntityAccessDimensions;
|
||||
|
@ -53,7 +52,6 @@ import fr.neatmonster.nocheatplus.utilities.TickTask;
|
|||
import fr.neatmonster.nocheatplus.utilities.ds.count.ActionAccumulator;
|
||||
import fr.neatmonster.nocheatplus.utilities.ds.count.ActionFrequency;
|
||||
import fr.neatmonster.nocheatplus.utilities.location.PlayerLocation;
|
||||
import fr.neatmonster.nocheatplus.utilities.location.RichBoundsLocation;
|
||||
import fr.neatmonster.nocheatplus.utilities.location.RichEntityLocation;
|
||||
import fr.neatmonster.nocheatplus.workaround.IWorkaroundRegistry.WorkaroundSet;
|
||||
|
||||
|
@ -1191,27 +1189,6 @@ public class MovingData extends ACheckData {
|
|||
// (ActionFrequency can handle this.)
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the block change tracking reference by the given entry, assuming
|
||||
* to to be the move end-point to continue from next time.
|
||||
*
|
||||
* @param entry
|
||||
* @param to
|
||||
*/
|
||||
public void updateBlockChangeReference(final BlockChangeEntry entry, final RichBoundsLocation to) {
|
||||
// TODO: Move method to BlockChangeReference to keep things easy to overview for now.
|
||||
// TODO: updateBlockChangeReference ... Span(entry, to !?)|Final()
|
||||
if (blockChangeRef.lastUsedEntry == null || blockChangeRef.lastUsedEntry.id < entry.id) {
|
||||
blockChangeRef.lastUsedEntry = entry; // Unchecked.
|
||||
if (to.isBlockIntersecting(entry.x, entry.y, entry.z)) {
|
||||
blockChangeRef.valid = true;
|
||||
}
|
||||
else {
|
||||
blockChangeRef.valid = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the y-axis velocity tracker. Rather for testing purposes.
|
||||
*
|
||||
|
|
|
@ -245,7 +245,7 @@ public class SurvivalFly extends Check {
|
|||
// || to.isHeadObstructed() // Best not have this one.
|
||||
;
|
||||
//}
|
||||
|
||||
|
||||
// HACK: Force sfNoLowJump by a flag.
|
||||
// TODO: Might remove that flag, as the issue for trying this has been resolved differently (F_HEIGHT8_1).
|
||||
// TODO: Consider setting on ground_height always?
|
||||
|
@ -301,7 +301,7 @@ public class SurvivalFly extends Check {
|
|||
data.bunnyhopDelay = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// hacc (if enabled, always update)
|
||||
final double fcmhv = Math.max(1.0, thisMove.hDistance / thisMove.hAllowedDistanceBase);
|
||||
data.combinedMediumHCount ++;
|
||||
|
@ -657,7 +657,7 @@ public class SurvivalFly extends Check {
|
|||
// TODO: Other conditions? [some will be in passable later].
|
||||
final BlockChangeEntry entryYPos = from.matchBlockChange(blockChangeTracker, data.blockChangeRef, Direction.Y_POS, Math.min(yDistance, 1.0));
|
||||
if (entryYPos != null) {
|
||||
data.updateBlockChangeReference(entryYPos, to);
|
||||
data.blockChangeRef.updateFinal(entryYPos, to);
|
||||
tags.add("blkmv_y_pos");
|
||||
final double maxDistYPos = yDistance; //1.0 - (from.getY() - from.getBlockY()); // TODO: Margin ?
|
||||
return new double[]{maxDistYPos, 0.0};
|
||||
|
@ -668,7 +668,7 @@ public class SurvivalFly extends Check {
|
|||
// TODO: Other conditions? [some will be in passable later].
|
||||
final BlockChangeEntry entryYNeg = from.matchBlockChange(blockChangeTracker, data.blockChangeRef, Direction.Y_NEG, -yDistance);
|
||||
if (entryYNeg != null) {
|
||||
data.updateBlockChangeReference(entryYNeg, to);
|
||||
data.blockChangeRef.updateFinal(entryYNeg, to);
|
||||
tags.add("blkmv_y_neg");
|
||||
final double maxDistYNeg = yDistance; // from.getY() - from.getBlockY(); // TODO: Margin ?
|
||||
return new double[]{maxDistYNeg, 0.0};
|
||||
|
|
|
@ -44,6 +44,7 @@ import fr.neatmonster.nocheatplus.utilities.ReflectionUtil;
|
|||
import fr.neatmonster.nocheatplus.utilities.TickTask;
|
||||
import fr.neatmonster.nocheatplus.utilities.ds.map.LinkedCoordHashMap;
|
||||
import fr.neatmonster.nocheatplus.utilities.ds.map.LinkedCoordHashMap.MoveOrder;
|
||||
import fr.neatmonster.nocheatplus.utilities.location.RichBoundsLocation;
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache;
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockCache.IBlockCacheNode;
|
||||
import fr.neatmonster.nocheatplus.utilities.map.BlockProperties;
|
||||
|
@ -239,6 +240,29 @@ public class BlockChangeTracker {
|
|||
return this.lastUsedEntry == null || entry.tick > this.lastUsedEntry.tick || entry.tick == this.lastUsedEntry.tick && valid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update lastUsedEntry by the given entry, assuming <i>to</i> to be the
|
||||
* move end-point to continue from next time. This is meant to finalize
|
||||
* prepared changes/span for use with the next move.
|
||||
*
|
||||
* @param entry
|
||||
* @param to
|
||||
* If not null, allows keeping the latest entry valid, if
|
||||
* intersecting with the bounding box of <i>to</i>.
|
||||
*/
|
||||
public void updateFinal(final BlockChangeEntry entry, final RichBoundsLocation to) {
|
||||
// TODO: updateBlockChangeReference ... Span(entry, to !?)|Final()
|
||||
if (lastUsedEntry == null || lastUsedEntry.id < entry.id) {
|
||||
lastUsedEntry = entry; // Unchecked.
|
||||
if (to != null && to.isBlockIntersecting(entry.x, entry.y, entry.z)) {
|
||||
valid = true;
|
||||
}
|
||||
else {
|
||||
valid = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve a shallow copy of this object.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue
Block a user