mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-02 14:38:26 +01:00
Setting up BlockHandler for blocks loaded by AnvilLoader
This commit is contained in:
parent
6355f06d53
commit
2f2254ebc2
@ -139,8 +139,12 @@ public class AnvilLoader implements IChunkLoader {
|
|||||||
for (int y = 0; y < Chunk.CHUNK_SECTION_SIZE; y++) {
|
for (int y = 0; y < Chunk.CHUNK_SECTION_SIZE; y++) {
|
||||||
try {
|
try {
|
||||||
final BlockState blockState = section.get(x, y, z);
|
final BlockState blockState = section.get(x, y, z);
|
||||||
final Block block = Objects.requireNonNull(Block.fromNamespaceId(blockState.getName()))
|
Block block = Objects.requireNonNull(Block.fromNamespaceId(blockState.getName()))
|
||||||
.withProperties(blockState.getProperties());
|
.withProperties(blockState.getProperties());
|
||||||
|
BlockHandler handler = MinecraftServer.getBlockManager().getHandler(block.name());
|
||||||
|
if (handler != null) {
|
||||||
|
block = block.withHandler(handler);
|
||||||
|
}
|
||||||
chunk.setBlock(x, y + yOffset, z, block);
|
chunk.setBlock(x, y + yOffset, z, block);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
EXCEPTION_MANAGER.handleException(e);
|
EXCEPTION_MANAGER.handleException(e);
|
||||||
|
Loading…
Reference in New Issue
Block a user