Spaces + comments.

This commit is contained in:
asofold 2014-08-04 18:38:45 +02:00
parent b2a6962e73
commit eaa4154080
2 changed files with 252 additions and 249 deletions

View File

@ -49,14 +49,13 @@ public class BlockCacheCBDev extends BlockCache implements IBlockAccess{
@Override
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 net.minecraft.server.v1_7_R4.Block block = net.minecraft.server.v1_7_R4.Block.getById(id);
if (block == null) {
// TODO: Convention for null bounds -> full ?
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
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
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{
// 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();

View File

@ -69,11 +69,7 @@ public abstract class BlockCache {
protected int maxBlockY = 255;
// TODO: switch to nodes with all details on, store a working node ?
// TODO: maybe make very fast access arrays for the ray tracing checks.
// private int[] id = null;
// private int[] data = null;
// TODO: Switch to nodes with all details on?
public BlockCache() {
}
@ -106,6 +102,13 @@ public abstract class BlockCache {
*/
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);
/**
@ -198,6 +201,7 @@ public abstract class BlockCache {
if (pBounds != null) {
return pBounds;
}
// TODO: Convention for null bounds -> full ?
final double[] nBounds = (y < 0 || y > maxBlockY) ? null : fetchBounds(x, y, z);
boundsMap.put(x, y, z, nBounds);
return nBounds;