Paper/Spigot-Server-Patches/0166-Implement-getI18NDisplayName.patch
Shane Freeder 14513c3ce1
Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
92f24ff2 SPIGOT-5158: Add SuspiciousStewMeta
b9bf4dae SPIGOT-5310: Add Chunk.contains
b2adbb45 Add API to get/set inhabited time of a Chunk
e3c812dd SPIGOT-5250: Add ChunkSnapshot.contains
71973d85 SPIGOT-5255: Raid / patrol spawn reasons

CraftBukkit Changes:
03b145b3 SPIGOT-5158: Add SuspiciousStewMeta
9aa74304 SPIGOT-5310: Add Chunk.contains
7ef2b20d SPIGOT-3308: RecipeIterator cannot longer remove recipes
023f438c Add API to get/set inhabited time of a Chunk
b79a86ed SPIGOT-5250: Add ChunkSnapshot.contains
aa492e55 SPIGOT-5255: Raid / patrol spawn reasons
2019-09-10 19:51:02 +01:00

53 lines
2.1 KiB
Diff

From 1a37b18ef694433c929d94f2e4e5d197ac6c917b Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 4 May 2016 23:59:38 -0400
Subject: [PATCH] Implement getI18NDisplayName
Gets the Display name as seen in the Client.
Currently the server only supports the English language. To override this,
You must replace the language file embedded in the server jar.
diff --git a/src/main/java/net/minecraft/server/LocaleLanguage.java b/src/main/java/net/minecraft/server/LocaleLanguage.java
index c0c13798f..601273933 100644
--- a/src/main/java/net/minecraft/server/LocaleLanguage.java
+++ b/src/main/java/net/minecraft/server/LocaleLanguage.java
@@ -65,10 +65,12 @@ public class LocaleLanguage {
}
+ public static LocaleLanguage getInstance() { return a(); } // Paper - OBFHELPER
public static LocaleLanguage a() {
return LocaleLanguage.c;
}
+ public synchronized String translateKey(String key) { return a(key); } // Paper - OBFHELPER
public synchronized String a(String s) {
return this.c(s);
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
index bd04174c3..3cddf254a 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
@@ -337,5 +337,18 @@ public final class CraftItemFactory implements ItemFactory {
public ItemStack ensureServerConversions(ItemStack item) {
return CraftItemStack.asCraftMirror(CraftItemStack.asNMSCopy(item));
}
+
+ @Override
+ public String getI18NDisplayName(ItemStack item) {
+ net.minecraft.server.ItemStack nms = null;
+ if (item instanceof CraftItemStack) {
+ nms = ((CraftItemStack) item).handle;
+ }
+ if (nms == null) {
+ nms = CraftItemStack.asNMSCopy(item);
+ }
+
+ return nms != null ? net.minecraft.server.LocaleLanguage.getInstance().translateKey(nms.getItem().getName()) : null;
+ }
// Paper end
}
--
2.23.0