|
| 1 | +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Shane Freeder <theboyetronic@gmail.com> |
| 3 | +Date: Sat, 30 Apr 2022 00:38:57 +0100 |
| 4 | +Subject: [PATCH] Sign cleanup filtering |
| 5 | + |
| 6 | +TODO: This logic here should be moved into a DataFixer in the next MC release |
| 7 | +noting to ensure to apply the cleanup logic here, and clean up the added |
| 8 | +tags |
| 9 | + |
| 10 | +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 |
| 11 | +index 6371176fba41218a209ea59b4cafe5b2d4a685fd..d5bcc81a809e3c733c6fc11309bcf0913860edf6 100644 |
| 12 | +--- a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java |
| 13 | ++++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java |
| 14 | +@@ -72,6 +72,7 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C |
| 15 | + } |
| 16 | + // CraftBukkit end |
| 17 | + |
| 18 | ++ nbt.putBoolean("Paper.cleanedFiltered", true); // Paper |
| 19 | + nbt.putString("Color", this.color.getName()); |
| 20 | + nbt.putBoolean("GlowingText", this.hasGlowingText); |
| 21 | + } |
| 22 | +@@ -88,6 +89,7 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C |
| 23 | + boolean oldSign = Boolean.getBoolean("convertLegacySigns") && !nbt.getBoolean("Bukkit.isConverted"); |
| 24 | + // CraftBukkit end |
| 25 | + |
| 26 | ++ boolean cleanedFiltered = nbt.getBoolean("Paper.cleanedFiltered"); // Paper |
| 27 | + for (int i = 0; i < 4; ++i) { |
| 28 | + String s = nbt.getString(SignBlockEntity.RAW_TEXT_FIELD_NAMES[i]); |
| 29 | + // CraftBukkit start |
| 30 | +@@ -105,7 +107,7 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C |
| 31 | + this.messages[i] = ichatbasecomponent; |
| 32 | + String s1 = SignBlockEntity.FILTERED_TEXT_FIELD_NAMES[i]; |
| 33 | + |
| 34 | +- if (nbt.contains(s1, 8)) { |
| 35 | ++ if (cleanedFiltered && nbt.contains(s1, 8)) { // Paper |
| 36 | + this.filteredMessages[i] = this.loadLine(nbt.getString(s1)); |
| 37 | + } else { |
| 38 | + this.filteredMessages[i] = ichatbasecomponent; |
0 commit comments