From 0d15225b1d089dd09fdb36639e4b8d3a5057a0bf Mon Sep 17 00:00:00 2001 From: Leijurv Date: Mon, 4 Mar 2019 21:00:30 -0800 Subject: [PATCH] dont construct one unlesss we need to --- src/main/java/baritone/cache/CachedChunk.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/main/java/baritone/cache/CachedChunk.java b/src/main/java/baritone/cache/CachedChunk.java index 390ea3f3..10c17898 100644 --- a/src/main/java/baritone/cache/CachedChunk.java +++ b/src/main/java/baritone/cache/CachedChunk.java @@ -143,9 +143,13 @@ public final class CachedChunk { this.heightMap = new int[256]; this.specialBlockLocations = specialBlockLocations; this.cacheTimestamp = cacheTimestamp; - this.special = new Int2ObjectOpenHashMap<>(); + if (specialBlockLocations.isEmpty()) { + this.special = null; + } else { + this.special = new Int2ObjectOpenHashMap<>(); + setSpecial(); + } calculateHeightMap(); - setSpecial(); } private final void setSpecial() { @@ -170,9 +174,11 @@ public final class CachedChunk { }*/ return overview[internalPos]; } - String str = special.get(index); - if (str != null) { - return ChunkPacker.stringToBlock(str).getDefaultState(); + if (special != null) { + String str = special.get(index); + if (str != null) { + return ChunkPacker.stringToBlock(str).getDefaultState(); + } } if (type == PathingBlockType.SOLID && y == 127 && dimension == -1) {