fix: wrap immutable map in MinecraftStructure writer

- fixes #2781
This commit is contained in:
dordsor21 2024-06-14 19:18:35 +01:00
parent 031fdf2efd
commit 4a5ff8e306
No known key found for this signature in database
GPG Key ID: 1E53E88969FFCF0B

View File

@ -236,11 +236,11 @@ public class MinecraftStructure implements ClipboardReader, ClipboardWriter {
BaseEntity state = entity.getState();
if (state != null) {
CompoundTag nbt = state.getNbtData();
Map<String, Tag> nbtMap = nbt.getValue();
Map<String, Tag> nbtMap = new HashMap<>(nbt.getValue());
// Replace rotation data
nbtMap.put("Rotation", writeRotation(entity.getLocation()));
nbtMap.put("id", new StringTag(state.getType().id()));
Map<String, Object> entityMap = FaweCache.INSTANCE.asMap("pos", pos, "blockPos", blockPos, "nbt", nbt);
Map<String, Object> entityMap = FaweCache.INSTANCE.asMap("pos", pos, "blockPos", blockPos, "nbt", new CompoundTag(nbtMap));
entities.add(entityMap);
}
}