mirror of
https://github.com/Minestom/Minestom.git
synced 2024-12-26 02:57:37 +01:00
Fix ChunkData including "fake" Block Entities (#556)
This commit is contained in:
parent
90e88dc6e7
commit
b8d51df58e
@ -15,11 +15,15 @@ import org.jglrxavpok.hephaistos.nbt.NBTCompound;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public record ChunkData(@NotNull NBTCompound heightmaps, byte @NotNull [] data,
|
||||
@NotNull Map<Integer, Block> blockEntities) implements Writeable {
|
||||
public ChunkData {
|
||||
blockEntities = Map.copyOf(blockEntities);
|
||||
blockEntities = blockEntities.entrySet()
|
||||
.stream()
|
||||
.filter((entry) -> entry.getValue().registry().isBlockEntity())
|
||||
.collect(Collectors.toUnmodifiableMap(Map.Entry::getKey, Map.Entry::getValue));
|
||||
}
|
||||
|
||||
public ChunkData(BinaryReader reader) {
|
||||
@ -41,7 +45,6 @@ public record ChunkData(@NotNull NBTCompound heightmaps, byte @NotNull [] data,
|
||||
final int index = entry.getKey();
|
||||
final Block block = entry.getValue();
|
||||
final var registry = block.registry();
|
||||
if (!registry.isBlockEntity()) continue;
|
||||
|
||||
final Point point = ChunkUtils.getBlockPosition(index, 0, 0);
|
||||
|
||||
@ -50,7 +53,6 @@ public record ChunkData(@NotNull NBTCompound heightmaps, byte @NotNull [] data,
|
||||
|
||||
writer.writeVarInt(registry.blockEntityId());
|
||||
|
||||
|
||||
NBTCompound resultNbt;
|
||||
// Append handler tags
|
||||
final BlockHandler handler = block.handler();
|
||||
|
Loading…
Reference in New Issue
Block a user