mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-11-06 18:50:54 +01:00
Add convenience methods to BlockCache.
This commit is contained in:
parent
68a807a564
commit
5c3f79c09d
@ -12,6 +12,20 @@ import fr.neatmonster.nocheatplus.utilities.ds.CoordMap;
|
||||
*/
|
||||
public abstract class BlockCache {
|
||||
|
||||
/**
|
||||
* Convenience method to check if the bounds as returned by getBounds cover a whole block.
|
||||
* @param bounds Can be null, must have 6 fields.
|
||||
* @return
|
||||
*/
|
||||
public static final boolean isFullBounds(final double[] bounds) {
|
||||
if (bounds == null) return false;
|
||||
for (int i = 0; i < 3; i ++){
|
||||
if (bounds[i] > 0.0) return false;
|
||||
if (bounds[i + 3] < 1.0) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Cached type-ids. */
|
||||
private final CoordMap<Integer> idMap = new CoordMap<Integer>();
|
||||
|
||||
@ -131,6 +145,17 @@ public abstract class BlockCache {
|
||||
return nBounds;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method to check if the bounds for a block cover the full block.
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @return
|
||||
*/
|
||||
public boolean isFullBounds(final int x, final int y, final int z){
|
||||
return isFullBounds(getBounds(x, y, z));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the maximal y coordinate a block can be at (non air).
|
||||
* @return
|
||||
|
Loading…
Reference in New Issue
Block a user