mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-09-28 22:47:32 +02:00
Rename BlockChangeReference.entry to lastUsedEntry, comments.
This commit is contained in:
parent
7fb1da6dc5
commit
24b45ae5d9
@ -1199,7 +1199,7 @@ public class MovingData extends ACheckData {
|
|||||||
* @param to
|
* @param to
|
||||||
*/
|
*/
|
||||||
public void updateBlockChangeReference(final BlockChangeEntry entry, final RichBoundsLocation to) {
|
public void updateBlockChangeReference(final BlockChangeEntry entry, final RichBoundsLocation to) {
|
||||||
blockChangeRef.entry = entry; // Unchecked.
|
blockChangeRef.lastUsedEntry = entry; // Unchecked.
|
||||||
if (to.isBlockIntersecting(entry.x, entry.y, entry.z)) {
|
if (to.isBlockIntersecting(entry.x, entry.y, entry.z)) {
|
||||||
blockChangeRef.valid = true;
|
blockChangeRef.valid = true;
|
||||||
}
|
}
|
||||||
|
@ -190,8 +190,14 @@ public class BlockChangeTracker {
|
|||||||
*/
|
*/
|
||||||
public static class BlockChangeReference {
|
public static class BlockChangeReference {
|
||||||
|
|
||||||
/** Last used block change id.*/
|
/*
|
||||||
public BlockChangeEntry entry = null;
|
* TODO: public BlockChangeEntry firstUsedEntry = null; // Would the
|
||||||
|
* span suffice? Consider using span + timing or just the span during
|
||||||
|
* one check covering multiple blocks.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** Last used block change entry, highest id.*/
|
||||||
|
public BlockChangeEntry lastUsedEntry = null;
|
||||||
|
|
||||||
/** Indicate if the set id can still be used.*/
|
/** Indicate if the set id can still be used.*/
|
||||||
public boolean valid = false;
|
public boolean valid = false;
|
||||||
@ -207,7 +213,7 @@ public class BlockChangeTracker {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public boolean canUpdateWith(final BlockChangeEntry entry) {
|
public boolean canUpdateWith(final BlockChangeEntry entry) {
|
||||||
return this.entry == null || entry.id > this.entry.id || entry.id == this.entry.id && valid;
|
return this.lastUsedEntry == null || entry.id > this.lastUsedEntry.id || entry.id == this.lastUsedEntry.id && valid;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -217,7 +223,7 @@ public class BlockChangeTracker {
|
|||||||
*/
|
*/
|
||||||
public BlockChangeReference copy() {
|
public BlockChangeReference copy() {
|
||||||
final BlockChangeReference copy = new BlockChangeReference();
|
final BlockChangeReference copy = new BlockChangeReference();
|
||||||
copy.entry = this.entry;
|
copy.lastUsedEntry = this.lastUsedEntry;
|
||||||
copy.valid = this.valid;
|
copy.valid = this.valid;
|
||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
@ -228,7 +234,7 @@ public class BlockChangeTracker {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final BlockChangeReference other = (BlockChangeReference) obj;
|
final BlockChangeReference other = (BlockChangeReference) obj;
|
||||||
return valid == other.valid && (entry != null && entry.equals(other.entry) || entry == null && other.entry == null);
|
return valid == other.valid && (lastUsedEntry != null && lastUsedEntry.equals(other.lastUsedEntry) || lastUsedEntry == null && other.lastUsedEntry == null);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -415,8 +421,7 @@ public class BlockChangeTracker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a block change. Simplistic version (no actual block states/shapes are
|
* Add a block change.
|
||||||
* stored).
|
|
||||||
*
|
*
|
||||||
* @param x
|
* @param x
|
||||||
* @param y
|
* @param y
|
||||||
@ -426,6 +431,7 @@ public class BlockChangeTracker {
|
|||||||
*/
|
*/
|
||||||
private void addBlockChange(final long changeId, final int tick, final WorldNode worldNode, final int x, final int y, final int z, final Direction direction) {
|
private void addBlockChange(final long changeId, final int tick, final WorldNode worldNode, final int x, final int y, final int z, final Direction direction) {
|
||||||
worldNode.lastChangeTick = tick;
|
worldNode.lastChangeTick = tick;
|
||||||
|
// TODO: Efficient way of using a block cache for shapes here (possibly better create the entry in addPistonBlocks).
|
||||||
final BlockChangeEntry entry = new BlockChangeEntry(changeId, tick, x, y, z, direction);
|
final BlockChangeEntry entry = new BlockChangeEntry(changeId, tick, x, y, z, direction);
|
||||||
LinkedList<BlockChangeEntry> entries = worldNode.blocks.get(x, y, z, MoveOrder.END);
|
LinkedList<BlockChangeEntry> entries = worldNode.blocks.get(x, y, z, MoveOrder.END);
|
||||||
if (entries == null) {
|
if (entries == null) {
|
||||||
|
@ -28,6 +28,8 @@ public interface ICollidePassable extends ICollideBlocks, ISetMargins {
|
|||||||
public void setBlockCache(BlockCache blockCache);
|
public void setBlockCache(BlockCache blockCache);
|
||||||
public BlockCache getBlockCache();
|
public BlockCache getBlockCache();
|
||||||
|
|
||||||
|
// TODO: public void (bool?) setBlockChangeReference(tracker, reference).
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convenience: Call set and setBlockCache with the data from the
|
* Convenience: Call set and setBlockCache with the data from the
|
||||||
* PlayerLocation instances. Should use from.getBlockCache() as BlockCache
|
* PlayerLocation instances. Should use from.getBlockCache() as BlockCache
|
||||||
|
@ -47,6 +47,7 @@ public class PassableAxisTracing extends AxisTracing implements ICollidePassable
|
|||||||
if (BlockProperties.isPassableBox(blockCache, blockX, blockY, blockZ, minX, minY, minZ, maxX, maxY, maxZ)) {
|
if (BlockProperties.isPassableBox(blockCache, blockX, blockY, blockZ, minX, minY, minZ, maxX, maxY, maxZ)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
// TODO: if (blockChangeTracker != null && -- check with BlockChangeTracker and BlockChangeReference --
|
||||||
else {
|
else {
|
||||||
collides = true;
|
collides = true;
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user