Paper/patches/server/0099-Fix-Old-Sign-Conversion.patch
2022-06-07 21:55:39 +02:00

50 lines
3.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
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 c518704386f14cd033307dd976455c35760d7236..148e79ae4e24fe16dbbb17550c3f258d4362c266 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
@@ -32,6 +32,7 @@ public abstract class BlockEntity {
private static final CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new CraftPersistentDataTypeRegistry();
public CraftPersistentDataContainer persistentDataContainer;
// CraftBukkit end
+ public boolean isLoadingStructure = false; // Paper
private static final Logger LOGGER = LogUtils.getLogger();
private final BlockEntityType<?> type;
@Nullable
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 715873e52708762b25c29caf6d41d7cb8f79ce57..39bd98b9496e4a27fd69a2de7c83c40689017ebc 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 71206f52a234a17db13062d975cbf66d1ffebc9a..f3fcd345178efd4917ef79cb141275a987f99e58 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
@@ -284,7 +284,9 @@ public class StructureTemplate {
definedstructure_blockinfo.nbt.putLong("LootTableSeed", random.nextLong());
}
+ tileentity.isLoadingStructure = true; // Paper
tileentity.load(definedstructure_blockinfo.nbt);
+ tileentity.isLoadingStructure = false; // Paper
}
}