mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-02 14:38:26 +01:00
Handle empty list case, let the try-catch handle NPE
This commit is contained in:
parent
bad206d504
commit
efc135f48a
@ -125,16 +125,8 @@ public class AnvilLoader implements IChunkLoader {
|
||||
for (int y = 0; y < Chunk.CHUNK_SECTION_SIZE; y++) {
|
||||
try {
|
||||
final BlockState blockState = section.get(x, y, z);
|
||||
Block block = Block.fromNamespaceId(blockState.getName());
|
||||
if (block == null) {
|
||||
// Invalid block
|
||||
continue;
|
||||
}
|
||||
final var properties = blockState.getProperties();
|
||||
if (!properties.isEmpty()) {
|
||||
block = block.withProperties(properties);
|
||||
}
|
||||
chunk.setBlock(x, y + yOffset, z, block);
|
||||
chunk.setBlock(x, y + yOffset, z,
|
||||
Block.fromNamespaceId(blockState.getName()).withProperties(blockState.getProperties()));
|
||||
} catch (Exception e) {
|
||||
EXCEPTION_MANAGER.handleException(e);
|
||||
}
|
||||
|
@ -58,6 +58,9 @@ final class BlockImpl implements Block {
|
||||
|
||||
@Override
|
||||
public @NotNull Block withProperties(@NotNull Map<@NotNull String, @NotNull String> properties) {
|
||||
if (properties.isEmpty()) {
|
||||
return this;
|
||||
}
|
||||
Block block;
|
||||
if (this.properties.size() == properties.size()) {
|
||||
// Map should be complete
|
||||
|
Loading…
Reference in New Issue
Block a user