Skip to content

Commit

Permalink
fix: Use default value when block state palette entry is missing (#608)
Browse files Browse the repository at this point in the history
This mirrors vanilla behavior (see `PalettedContainer.get(index)`).

Fixes #565
  • Loading branch information
Johni0702 authored Mar 27, 2021
1 parent 7b22520 commit 0931c43
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,9 @@ private void populateBlockArrays(int sectionIdx, ChunkSectionPos pos, Chunk chun
state = prevPaletteState;
} else {
state = palette.getByIndex(paletteId);
if (state == null) {
state = container.defaultValue;
}

prevPaletteState = state;
prevPaletteId = paletteId;
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/sodium.accesswidener
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ accessible method net/minecraft/client/render/Frustum isVisible (DDDDDD)Z

accessible field net/minecraft/world/chunk/PalettedContainer data Lnet/minecraft/util/collection/PackedIntegerArray;
accessible field net/minecraft/world/chunk/PalettedContainer palette Lnet/minecraft/world/chunk/Palette;
accessible field net/minecraft/world/chunk/PalettedContainer defaultValue Ljava/lang/Object;

0 comments on commit 0931c43

Please sign in to comment.