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

50 Zeilen
3.3 KiB
Diff

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
2021-06-12 08:02:49 +02:00
index d6a4a2a59f1be0cc2e373dc326287b60db5559d2..9d777fce673c8f6b3ee2d69f5a6360a8a5ad8e84 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
2021-06-12 08:02:49 +02:00
@@ -30,6 +30,7 @@ public abstract class BlockEntity implements net.minecraft.server.KeyedObject {
2021-06-11 14:02:28 +02:00
public CraftPersistentDataContainer persistentDataContainer;
// CraftBukkit end
private static final Logger LOGGER = LogManager.getLogger();
+ public boolean isLoadingStructure = false; // Paper
private final BlockEntityType<?> type; public BlockEntityType getTileEntityType() { return type; } // Paper - OBFHELPER
@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
2021-06-12 08:02:49 +02:00
index dbb59775422b80fb4b60a8cfd2c0bd81c1646e88..589fbdd5c86655244aa92a42e5f45747b5c5026e 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
2021-06-12 08:02:49 +02:00
@@ -95,7 +95,7 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C
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
2021-06-12 08:02:49 +02:00
index e396c3aede9ca22ec98e1bd25c7da35ed6406f4f..80d3787d9c07f8dd740c2e5979e1cc14891b8829 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
2021-06-12 08:02:49 +02:00
@@ -283,7 +283,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
}
}