Skip to content

Commit

Permalink
feat(BlockStateSafeGetter): use block type's default state
Browse files Browse the repository at this point in the history
  • Loading branch information
smartcmd committed Oct 15, 2024
1 parent 1cb3bb6 commit b52f8f6
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,11 @@ public BlockState blockState() {
// Add missing properties
var updatedStates = updatedNbt.getCompound("states");
var updatedStatesBuilder = updatedStates.toBuilder();
for (var entry : blockType.getProperties().entrySet()) {
if (updatedStatesBuilder.containsKey(entry.getKey())) continue;
updatedStatesBuilder.put(entry.getKey(), entry.getValue().createDefaultValue().getSerializedValue());
for (var entry : blockType.getDefaultState().getPropertyValues().entrySet()) {
if (updatedStatesBuilder.containsKey(entry.getKey().getName())) {
continue;
}
updatedStatesBuilder.put(entry.getKey().getName(), entry.getValue().getSerializedValue());
}
updatedStates = updatedStatesBuilder.build();

Expand Down

0 comments on commit b52f8f6

Please sign in to comment.