Skip to content

Commit 2177ddc

Browse files
committed
fix npe
1 parent 83d589e commit 2177ddc

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

src/main/java/ca/spottedleaf/moonrise/mixin/block_counting/LevelChunkSectionMixin.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,14 +124,13 @@ private void updateBlockCallback(final int x, final int y, final int z, final Bl
124124
final boolean oldTicking = oldState.isRandomlyTicking();
125125
final boolean newTicking = newState.isRandomlyTicking();
126126
if (oldTicking != newTicking) {
127+
this.createTickingBlocks();
127128
final ShortList tickingBlocks = this.tickingBlocks;
128129
final short position = (short)(x | (z << 4) | (y << (4+4)));
129130

130131
if (oldTicking) {
131-
this.createTickingBlocks();
132132
tickingBlocks.remove(position);
133133
} else {
134-
this.createTickingBlocks();
135134
tickingBlocks.add(position);
136135
}
137136
}
@@ -200,13 +199,13 @@ public void recalcBlockCounts() {
200199
final short[] raw = coordinates.elements();
201200
final int rawLen = raw.length;
202201

202+
this.createTickingBlocks();
203203
final ShortList tickingBlocks = this.tickingBlocks;
204204

205205
tickingBlocks.setMinCapacity(Math.min((rawLen + tickingBlocks.size()) * 3 / 2, 16*16*16));
206206

207207
Objects.checkFromToIndex(0, paletteCount, rawLen);
208208
for (int i = 0; i < paletteCount; ++i) {
209-
this.createTickingBlocks();
210209
tickingBlocks.add(raw[i]);
211210
}
212211
}

0 commit comments

Comments
 (0)