mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-01-15 12:01:51 +01:00
Spaces + comments.
This commit is contained in:
parent
b2a6962e73
commit
eaa4154080
@ -49,14 +49,13 @@ public class BlockCacheCBDev extends BlockCache implements IBlockAccess{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double[] fetchBounds(final int x, final int y, final int z){
|
public double[] fetchBounds(final int x, final int y, final int z){
|
||||||
|
|
||||||
// TODO: change api for this / use nodes (!)
|
|
||||||
final int id = getTypeId(x, y, z);
|
final int id = getTypeId(x, y, z);
|
||||||
final net.minecraft.server.v1_7_R4.Block block = net.minecraft.server.v1_7_R4.Block.getById(id);
|
final net.minecraft.server.v1_7_R4.Block block = net.minecraft.server.v1_7_R4.Block.getById(id);
|
||||||
if (block == null) {
|
if (block == null) {
|
||||||
|
// TODO: Convention for null bounds -> full ?
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
block.updateShape(this, x, y, z); // TODO: use THIS instead of world.
|
block.updateShape(this, x, y, z);
|
||||||
|
|
||||||
// minX, minY, minZ, maxX, maxY, maxZ
|
// minX, minY, minZ, maxX, maxY, maxZ
|
||||||
return new double[]{block.x(), block.z(), block.B(), block.y(), block.A(), block.C()};
|
return new double[]{block.x(), block.z(), block.B(), block.y(), block.A(), block.C()};
|
||||||
@ -65,7 +64,7 @@ public class BlockCacheCBDev extends BlockCache implements IBlockAccess{
|
|||||||
@Override
|
@Override
|
||||||
public boolean standsOnEntity(final Entity entity, final double minX, final double minY, final double minZ, final double maxX, final double maxY, final double maxZ){
|
public boolean standsOnEntity(final Entity entity, final double minX, final double minY, final double minZ, final double maxX, final double maxY, final double maxZ){
|
||||||
try{
|
try{
|
||||||
// TODO: Probably check other ids too before doing this ?
|
// TODO: Find some simplification!
|
||||||
|
|
||||||
final net.minecraft.server.v1_7_R4.Entity mcEntity = ((CraftEntity) entity).getHandle();
|
final net.minecraft.server.v1_7_R4.Entity mcEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
|
||||||
|
@ -69,11 +69,7 @@ public abstract class BlockCache {
|
|||||||
|
|
||||||
protected int maxBlockY = 255;
|
protected int maxBlockY = 255;
|
||||||
|
|
||||||
// TODO: switch to nodes with all details on, store a working node ?
|
// TODO: Switch to nodes with all details on?
|
||||||
|
|
||||||
// TODO: maybe make very fast access arrays for the ray tracing checks.
|
|
||||||
// private int[] id = null;
|
|
||||||
// private int[] data = null;
|
|
||||||
|
|
||||||
public BlockCache() {
|
public BlockCache() {
|
||||||
}
|
}
|
||||||
@ -106,6 +102,13 @@ public abstract class BlockCache {
|
|||||||
*/
|
*/
|
||||||
public abstract int fetchData(int x, int y, int z);
|
public abstract int fetchData(int x, int y, int z);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find out bounds for the block, this should not return null for performance reasons.
|
||||||
|
* @param x
|
||||||
|
* @param y
|
||||||
|
* @param z
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public abstract double[] fetchBounds(int x, int y, int z);
|
public abstract double[] fetchBounds(int x, int y, int z);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -198,6 +201,7 @@ public abstract class BlockCache {
|
|||||||
if (pBounds != null) {
|
if (pBounds != null) {
|
||||||
return pBounds;
|
return pBounds;
|
||||||
}
|
}
|
||||||
|
// TODO: Convention for null bounds -> full ?
|
||||||
final double[] nBounds = (y < 0 || y > maxBlockY) ? null : fetchBounds(x, y, z);
|
final double[] nBounds = (y < 0 || y > maxBlockY) ? null : fetchBounds(x, y, z);
|
||||||
boundsMap.put(x, y, z, nBounds);
|
boundsMap.put(x, y, z, nBounds);
|
||||||
return nBounds;
|
return nBounds;
|
||||||
|
Loading…
Reference in New Issue
Block a user