fix heightMap bug
This commit is contained in:
parent
557f2e48c3
commit
ff83b42132
@ -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;
|
||||
}
|
||||
}
|
||||
String name = blockToString(blockState.getBlock());
|
||||
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;
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user