Fix i18n String API

In 1.13 the method previously used now returns translatable keys.
`block.minecraft.cobblestone` instead of `Cobblestone`

We just need to make sure we're translating those keys.
This commit is contained in:
Zach Brown 2018-07-30 16:07:36 -05:00
parent 76e1e4d79f
commit 12f9b10e44
No known key found for this signature in database
GPG key ID: CC9DA35FC5450B76
2 changed files with 40 additions and 10 deletions

View file

@ -1,11 +1,11 @@
From 6460da5f11f9c0a62d52da096c1e70e2d8b0fbd4 Mon Sep 17 00:00:00 2001
From a18199d7ee98c2917e6ae150a6d19ad8173416f2 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 30 Mar 2016 19:36:20 -0400
Subject: [PATCH] MC Dev fixes
diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java
index 002da2a191..9f3aa24590 100644
index 002da2a19..9f3aa2459 100644
--- a/src/main/java/net/minecraft/server/BlockPosition.java
+++ b/src/main/java/net/minecraft/server/BlockPosition.java
@@ -150,7 +150,7 @@ public class BlockPosition extends BaseBlockPosition {
@ -59,7 +59,7 @@ index 002da2a191..9f3aa24590 100644
}
diff --git a/src/main/java/net/minecraft/server/DefinedStructure.java b/src/main/java/net/minecraft/server/DefinedStructure.java
index a661789c1e..785a1a2184 100644
index a661789c1..785a1a218 100644
--- a/src/main/java/net/minecraft/server/DefinedStructure.java
+++ b/src/main/java/net/minecraft/server/DefinedStructure.java
@@ -88,7 +88,7 @@ public class DefinedStructure {
@ -113,8 +113,21 @@ index a661789c1e..785a1a2184 100644
}
public Iterator<IBlockData> iterator() {
diff --git a/src/main/java/net/minecraft/server/LocaleLanguage.java b/src/main/java/net/minecraft/server/LocaleLanguage.java
index 8f06c5848..4361b2cee 100644
--- a/src/main/java/net/minecraft/server/LocaleLanguage.java
+++ b/src/main/java/net/minecraft/server/LocaleLanguage.java
@@ -34,7 +34,7 @@ public class LocaleLanguage {
Entry entry = (Entry) iterator.next();
String s = LocaleLanguage.b.matcher(ChatDeserializer.a((JsonElement) entry.getValue(), (String) entry.getKey())).replaceAll("%$1s");
- this.d.put(entry.getKey(), s);
+ this.d.put((String) entry.getKey(), s); // Paper - Decompile fix
}
this.e = SystemUtils.b();
diff --git a/src/main/java/net/minecraft/server/RegistryID.java b/src/main/java/net/minecraft/server/RegistryID.java
index 3b8f6ec167..bde5714dd6 100644
index 3b8f6ec16..bde5714dd 100644
--- a/src/main/java/net/minecraft/server/RegistryID.java
+++ b/src/main/java/net/minecraft/server/RegistryID.java
@@ -6,7 +6,7 @@ import java.util.Arrays;
@ -155,7 +168,7 @@ index 3b8f6ec167..bde5714dd6 100644
this.f = 0;
diff --git a/src/main/java/net/minecraft/server/VoxelShape.java b/src/main/java/net/minecraft/server/VoxelShape.java
index 4b5463cca2..53c9f21887 100644
index 4b5463cca..53c9f2188 100644
--- a/src/main/java/net/minecraft/server/VoxelShape.java
+++ b/src/main/java/net/minecraft/server/VoxelShape.java
@@ -67,7 +67,7 @@ public abstract class VoxelShape {
@ -168,5 +181,5 @@ index 4b5463cca2..53c9f21887 100644
return arraylist;
}
--
2.18.0
2.17.1

View file

@ -1,4 +1,4 @@
From 570da01a74b273d367daa8ffbd4e4c38ed323aee Mon Sep 17 00:00:00 2001
From fb596b3a8df6a1332aff27d428bb4de583b6bef8 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
@ -7,8 +7,25 @@ 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 4361b2cee..f81887c66 100644
--- a/src/main/java/net/minecraft/server/LocaleLanguage.java
+++ b/src/main/java/net/minecraft/server/LocaleLanguage.java
@@ -44,10 +44,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 e98e1ed72..1df2b463a 100644
index e98e1ed72..35eb3181d 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
@@ -292,5 +292,18 @@ public final class CraftItemFactory implements ItemFactory {
@ -26,10 +43,10 @@ index e98e1ed72..1df2b463a 100644
+ nms = CraftItemStack.asNMSCopy(item);
+ }
+
+ return nms != null ? nms.getItem().getName() : null;
+ return nms != null ? net.minecraft.server.LocaleLanguage.getInstance().translateKey(nms.getItem().getName()) : null;
+ }
// Paper end
}
--
2.18.0
2.17.1