blockstateinterface reorg

This commit is contained in:
Leijurv
2018-09-11 11:56:59 -07:00
parent 3dfde818d3
commit ab1037bcfd
2 changed files with 14 additions and 28 deletions

View File

@@ -74,25 +74,23 @@ public class BlockStateInterface implements Helper {
// same idea here, skip the Long2ObjectOpenHashMap.get if at all possible
// except here, it's 512x512 tiles instead of 16x16, so even better repetition
CachedRegion cached = prevCached;
if (cached != null && cached.getX() == x >> 9 && cached.getZ() == z >> 9) {
IBlockState type = cached.getBlock(x & 511, y, z & 511);
if (type == null) {
if (cached == null || cached.getX() != x >> 9 || cached.getZ() != z >> 9) {
WorldData world = WorldProvider.INSTANCE.getCurrentWorld();
if (world == null) {
return AIR;
}
return type;
}
WorldData world = WorldProvider.INSTANCE.getCurrentWorld();
if (world != null) {
CachedRegion region = world.cache.getRegion(x >> 9, z >> 9);
if (region != null) {
prevCached = region;
IBlockState type = region.getBlock(x & 511, y, z & 511);
if (type != null) {
return type;
}
if (region == null) {
return AIR;
}
prevCached = region;
cached = region;
}
return AIR;
IBlockState type = cached.getBlock(x & 511, y, z & 511);
if (type == null) {
return AIR;
}
return type;
}
public static void clearCachedChunk() {