From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Aikar Date: Fri, 17 Jun 2016 20:50:11 -0400 Subject: [PATCH] Fix Old Sign Conversion 1) Sign loading code was trying to parse the JSON before the check for oldSign. That code could then skip the old sign converting code if it triggers a JSON parse exception. 2) New Mojang Schematic system has Tile Entities in the new converted format, but missing the Bukkit.isConverted flag This causes Igloos and such to render broken signs. We fix this by ignoring sign conversion for Defined Structures diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java index 52b4c231faa2f33f766f50399e52e30184fb01a7..67315a86e5db51029d0f355c6dc223e93e4141db 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java @@ -33,6 +33,7 @@ public abstract class BlockEntity implements io.papermc.paper.util.KeyedObject { public CraftPersistentDataContainer persistentDataContainer; // CraftBukkit end private static final Logger LOGGER = LogManager.getLogger(); + public boolean isLoadingStructure = false; // Paper private final BlockEntityType type; @Nullable protected Level level; diff --git a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java index e390cfea5bed64284a97c88a717503f07f073a30..3a2e2adeefe73981b443216724270023408c1feb 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java @@ -93,7 +93,7 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C s = "\"\""; } - if (oldSign) { + if (oldSign && !this.isLoadingStructure) { // Paper - saved structures will be in the new format, but will not have isConverted this.messages[i] = org.bukkit.craftbukkit.util.CraftChatMessage.fromString(s)[0]; continue; } diff --git a/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java b/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java index 06b981d4c6b764d9298adb75ee9944e24a9ba195..2314d858fab555c8cafba6b7c2e8302961c77666 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java +++ b/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java @@ -275,7 +275,9 @@ public class StructureTemplate { definedstructure_blockinfo.nbt.putLong("LootTableSeed", random.nextLong()); } + tileentity.isLoadingStructure = true; // Paper tileentity.load(definedstructure_blockinfo.nbt); + tileentity.isLoadingStructure = false; // Paper } }