aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-spigotflower-stripped/net/minecraft/world/LockCode.java.patch
diff options
context:
space:
mode:
authorMiniDigger | Martin <[email protected]>2024-01-14 11:04:49 +0100
committerMiniDigger | Martin <[email protected]>2024-01-14 11:04:49 +0100
commitbee74680e607c2e29b038329f62181238911cd83 (patch)
tree708fd1a4a0227d9071243adf2a42d5e9e96cde4a /patch-remap/mache-spigotflower-stripped/net/minecraft/world/LockCode.java.patch
parent0a44692ef6ff6e255d48eb3ba1bb114166eafda9 (diff)
downloadPaper-bee74680e607c2e29b038329f62181238911cd83.tar.gz
Paper-bee74680e607c2e29b038329f62181238911cd83.zip
add remapped patches as a testsoftspoon
Diffstat (limited to 'patch-remap/mache-spigotflower-stripped/net/minecraft/world/LockCode.java.patch')
-rw-r--r--patch-remap/mache-spigotflower-stripped/net/minecraft/world/LockCode.java.patch37
1 files changed, 37 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower-stripped/net/minecraft/world/LockCode.java.patch b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/LockCode.java.patch
new file mode 100644
index 0000000000..8787dc2f00
--- /dev/null
+++ b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/LockCode.java.patch
@@ -0,0 +1,37 @@
+--- a/net/minecraft/world/LockCode.java
++++ b/net/minecraft/world/LockCode.java
+@@ -4,6 +4,11 @@
+ import net.minecraft.nbt.CompoundTag;
+ import net.minecraft.world.item.ItemStack;
+
++// CraftBukkit start
++import org.bukkit.ChatColor;
++import org.bukkit.craftbukkit.util.CraftChatMessage;
++// CraftBukkit end
++
+ @Immutable
+ public class LockCode {
+
+@@ -15,8 +20,20 @@
+ this.key = s;
+ }
+
+- public boolean unlocksWith(ItemStack itemstack) {
+- return this.key.isEmpty() || !itemstack.isEmpty() && itemstack.hasCustomHoverName() && this.key.equals(itemstack.getHoverName().getString());
++ public boolean unlocksWith(ItemStack stack) {
++ // CraftBukkit start - SPIGOT-6307: Check for color codes if the lock contains color codes
++ if (this.key.isEmpty()) return true;
++ if (!stack.isEmpty() && stack.hasCustomHoverName()) {
++ if (this.key.indexOf(ChatColor.COLOR_CHAR) == -1) {
++ // The lock key contains no color codes, so let's ignore colors in the item display name (vanilla Minecraft behavior):
++ return this.key.equals(stack.getHoverName().getString());
++ } else {
++ // The lock key contains color codes, so let's take them into account:
++ return this.key.equals(CraftChatMessage.fromComponent(stack.getHoverName()));
++ }
++ }
++ return false;
++ // CraftBukkit end
+ }
+
+ public void addToTag(CompoundTag compoundtag) {