From 3d265ff9b9af5c1eed9d0740cb63bac32f7dd63c Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Fri, 3 Aug 2018 21:18:57 +1000 Subject: [PATCH] Added entity translations --- .../clipboard/io/MCEditSchematicReader.java | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/MCEditSchematicReader.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/MCEditSchematicReader.java index 13d99b452..ba6d5ad3b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/MCEditSchematicReader.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/MCEditSchematicReader.java @@ -261,7 +261,7 @@ public class MCEditSchematicReader extends NBTSchematicReader { for (Tag tag : entityTags) { if (tag instanceof CompoundTag) { CompoundTag compound = (CompoundTag) tag; - String id = compound.getString("id"); + String id = convertEntityId(compound.getString("id")); Location location = NBTConversions.toLocation(clipboard, compound.getListTag("Pos"), compound.getListTag("Rotation")); if (!id.isEmpty()) { @@ -281,6 +281,36 @@ public class MCEditSchematicReader extends NBTSchematicReader { return clipboard; } + private String convertEntityId(String id) { + switch(id) { + case "xp_orb": + return "experience_orb"; + case "xp_bottle": + return "experience_bottle"; + case "eye_of_ender_signal": + return "eye_of_ender"; + case "ender_crystal": + return "end_crystal"; + case "fireworks_rocket": + return "firework_rocket"; + case "commandblock_minecart": + return "command_block_minecart"; + case "snowman": + return "snow_golem"; + case "villager_golem": + return "iron_golem"; + case "evocation_fangs": + return "evoker_fangs"; + case "evocation_illager": + return "evoker"; + case "vindication_illager": + return "vindicator"; + case "illusion_illager": + return "illusioner"; + } + return id; + } + @Override public void close() throws IOException { inputStream.close();