From cdd546ee5e1a3f010b8daf8674c830925c197a03 Mon Sep 17 00:00:00 2001 From: Jordan Date: Thu, 20 Jul 2023 16:55:59 +0100 Subject: [PATCH] fix: correct NBT for spawners (#2362) --- .../worldedit/blocks/MobSpawnerBlock.java | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/MobSpawnerBlock.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/MobSpawnerBlock.java index 929354ab9..0420d0994 100644 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/MobSpawnerBlock.java +++ b/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/MobSpawnerBlock.java @@ -134,15 +134,29 @@ public class MobSpawnerBlock extends BaseBlock { values.put("MaxNearbyEntities", new ShortTag(maxNearbyEntities)); values.put("RequiredPlayerRange", new ShortTag(requiredPlayerRange)); if (spawnData == null) { - values.put("SpawnData", new CompoundTag(ImmutableMap.of("id", new StringTag(mobType)))); + values.put( + "SpawnData", + new CompoundTag(ImmutableMap.of("entity", new CompoundTag(ImmutableMap.of("id", new StringTag(mobType))))) + ); } else { values.put("SpawnData", new CompoundTag(spawnData.getValue())); } if (spawnPotentials == null) { - values.put("SpawnPotentials", new ListTag(CompoundTag.class, ImmutableList.of( - new CompoundTag(ImmutableMap.of("Weight", new IntTag(1), "Entity", - new CompoundTag(ImmutableMap.of("id", new StringTag(mobType))) - ))))); + values.put( + "SpawnPotentials", + new ListTag( + CompoundTag.class, + ImmutableList.of(new CompoundTag(ImmutableMap.of( + "weight", + new IntTag(1), + "data", + new CompoundTag(ImmutableMap.of( + "entity", + new CompoundTag(ImmutableMap.of("id", new StringTag(mobType))) + )) + ))) + ) + ); } else { values.put("SpawnPotentials", new ListTag(CompoundTag.class, spawnPotentials.getValue())); }