Paper/patches/server/0102-Fix-Old-Sign-Conversion.patch

50 lines
3.3 KiB
Diff
Raw Normal View History

2021-06-11 14:02:28 +02: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-12-07 19:52:24 +01:00
index 63acd109a79ed752a05df3d4f1b99309297c2055..b701a1344db066b9368841f2377ee493514bf282 100644
2021-06-11 14:02:28 +02: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 22:28:38 +02:00
@@ -32,6 +32,7 @@ public abstract class BlockEntity {
2022-03-01 06:43:03 +01:00
private static final CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new CraftPersistentDataTypeRegistry();
2021-06-11 14:02:28 +02:00
public CraftPersistentDataContainer persistentDataContainer;
// CraftBukkit end
+ public boolean isLoadingStructure = false; // Paper
2022-03-01 06:43:03 +01:00
private static final Logger LOGGER = LogUtils.getLogger();
2021-06-12 18:56:13 +02:00
private final BlockEntityType<?> type;
2021-06-11 14:02:28 +02: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
2022-12-07 19:52:24 +01:00
index 15695c9da294caf8531c59f72279aaeda6ceb23b..149728fa6371b4d8b0afaae769aacac27401ea03 100644
2021-06-11 14:02:28 +02: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
2022-12-07 19:52:24 +01:00
@@ -112,7 +112,7 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C
2021-06-12 08:02:49 +02:00
s = "\"\"";
2021-06-11 14:02:28 +02:00
}
2021-06-12 08:02:49 +02: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 14:02:28 +02: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-12-07 19:52:24 +01:00
index 4f3a247a844844aa55d73089595d5f0b7ed49965..76666318690368bab672c2302c90dd3abb050299 100644
2021-06-11 14:02:28 +02: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
2022-12-07 19:52:24 +01:00
@@ -286,7 +286,9 @@ public class StructureTemplate {
2021-06-11 14:02:28 +02:00
definedstructure_blockinfo.nbt.putLong("LootTableSeed", random.nextLong());
}
+ tileentity.isLoadingStructure = true; // Paper
2021-06-12 08:02:49 +02:00
tileentity.load(definedstructure_blockinfo.nbt);
2021-06-11 14:02:28 +02:00
+ tileentity.isLoadingStructure = false; // Paper
}
}