From ff83b42132d107b7721b7e505bb3edb4a15dface Mon Sep 17 00:00:00 2001 From: Leijurv Date: Tue, 28 Aug 2018 13:58:36 -0700 Subject: [PATCH] fix heightMap bug --- src/main/java/baritone/chunk/ChunkPacker.java | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/main/java/baritone/chunk/ChunkPacker.java b/src/main/java/baritone/chunk/ChunkPacker.java index 6bac5529..3cd0b415 100644 --- a/src/main/java/baritone/chunk/ChunkPacker.java +++ b/src/main/java/baritone/chunk/ChunkPacker.java @@ -22,8 +22,6 @@ import baritone.utils.Helper; import baritone.utils.pathing.PathingBlockType; import net.minecraft.block.Block; import net.minecraft.block.BlockAir; -import net.minecraft.block.BlockDoublePlant; -import net.minecraft.block.BlockTallGrass; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; import net.minecraft.util.ResourceLocation; @@ -69,17 +67,17 @@ public final class ChunkPacker implements Helper { //System.out.println("Chunk packing took " + (end - start) + "ms for " + chunk.x + "," + chunk.z); String[] blockNames = new String[256]; for (int z = 0; z < 16; z++) { + outerLoop: for (int x = 0; x < 16; x++) { - int height = chunk.getHeightValue(x, z); - IBlockState blockState = chunk.getBlockState(x, height, z); - for (int y = height; y > 0; y--) { - blockState = chunk.getBlockState(x, y, z); - if (getPathingBlockType(blockState.getBlock()) != PathingBlockType.AIR) { - break; + for (int y = 255; y >= 0; y--) { + int index = CachedChunk.getPositionIndex(x, y, z); + if (!bitSet.get(index) && !bitSet.get(index + 1)) { + String name = blockToString(chunk.getBlockState(x, y, z).getBlock()); + blockNames[z << 4 | x] = name; + continue outerLoop; } } - String name = blockToString(blockState.getBlock()); - blockNames[z << 4 | x] = name; + blockNames[z << 4 | x] = "air"; } } CachedChunk cached = new CachedChunk(chunk.x, chunk.z, bitSet, blockNames, specialBlocks); @@ -116,7 +114,7 @@ public final class ChunkPacker implements Helper { // however, this failed in the nether when you were near a nether fortress // because fences check their adjacent blocks in the world for their fence connection status to determine AABB shape // this caused a nullpointerexception when we saved chunks on unload, because they were unable to check their neighbors - if (block instanceof BlockAir || block instanceof BlockTallGrass || block instanceof BlockDoublePlant) { + if (block instanceof BlockAir) { return PathingBlockType.AIR; }