testserver/patches/server/0098-Fix-Old-Sign-Conversio...

50 lines
3.3 KiB
Diff
Raw Normal View History

2021-06-11 12:02:28 +00:00
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
2022-03-30 20:28:38 +00:00
index c518704386f14cd033307dd976455c35760d7236..148e79ae4e24fe16dbbb17550c3f258d4362c266 100644
2021-06-11 12:02:28 +00:00
--- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
2022-03-30 20:28:38 +00:00
@@ -32,6 +32,7 @@ public abstract class BlockEntity {
2022-03-01 05:43:03 +00:00
private static final CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new CraftPersistentDataTypeRegistry();
2021-06-11 12:02:28 +00:00
public CraftPersistentDataContainer persistentDataContainer;
// CraftBukkit end
+ public boolean isLoadingStructure = false; // Paper
2022-03-01 05:43:03 +00:00
private static final Logger LOGGER = LogUtils.getLogger();
2021-06-12 16:56:13 +00:00
private final BlockEntityType<?> type;
2021-06-11 12:02:28 +00:00
@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
2021-11-23 13:22:49 +00:00
index e390cfea5bed64284a97c88a717503f07f073a30..3a2e2adeefe73981b443216724270023408c1feb 100644
2021-06-11 12:02:28 +00:00
--- a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
2021-11-23 13:22:49 +00:00
@@ -93,7 +93,7 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C
2021-06-12 06:02:49 +00:00
s = "\"\"";
2021-06-11 12:02:28 +00:00
}
2021-06-12 06:02:49 +00:00
- 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;
}
2021-06-11 12:02:28 +00:00
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
2022-03-01 05:43:03 +00:00
index cf8a38b7d55d229ac556f8a93b25c155381df3a2..129ebb095c2280376a59b54920e5ff90cf1f465a 100644
2021-06-11 12:02:28 +00:00
--- 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 {
2021-06-11 12:02:28 +00:00
definedstructure_blockinfo.nbt.putLong("LootTableSeed", random.nextLong());
}
+ tileentity.isLoadingStructure = true; // Paper
2021-06-12 06:02:49 +00:00
tileentity.load(definedstructure_blockinfo.nbt);
2021-06-11 12:02:28 +00:00
+ tileentity.isLoadingStructure = false; // Paper
}
}