Yatopia/patches/server/0059-Custom-Locale-Support.patch
Ivan Pekov adb131f051
Updated Upstream and Sidestream(s) (Tuinity/EMC/Purpur/AirplaneLite)
Upstream/An Sidestream has released updates that appears to apply and compile correctly
This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing.

Tuinity Changes:
2325c36 Updated Upstream (Paper)

EMC Changes:
a841b5a5 Fix more lore/item name issues (fixes witch gem issue)
1abb3fae Ensure server conversions on ExactChoice ingredients
f2f9d2b0 Forgot to commit paper ref
388620d5 Updated Paper
7a0ae67b Add a null check for UUID to prevent npe later
9de409e0 Updated Paper
0d09eb9a Add new Empire Server API for managing fake players for the tablist

Purpur Changes:
da95725 Updated Upstream (Tuinity)
7194a16 Updated Upstream (Paper)
77373ea Updated Upstream (Tuinity)
0bae78d Drop async advancements patch for now

AirplaneLite Changes:
7b4acbe h != k
a07e80c Whoops, missed paperclip change
845c191 Add license to patch files
fa671b7 Allow gradle wrapper in gitignore
04fc820 Rework strip raytracing patch
f48f6b2 Updated Upstream (Tuinity)
ec7c6df Fix encoding
9326301 Update upstream, fix utf8
20b8c79 Allow gradle wrapper in gitignore
6cd80e9 Updated Upstream (Tuinity)
2021-01-03 13:41:36 +02:00

45 lines
2.4 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Bud Gidiere <sgidiere@gmail.com>
Date: Sun, 25 Oct 2020 11:45:38 -0500
Subject: [PATCH] Custom Locale Support
All Server Jars Come with a pre-baked, usually English, locale file. This patch allows you to change the locale file by creating a locale.json file in the root directory of your server. Note that while custom locale files are supported by the server no support will be given for non-official Mojang locale files.
diff --git a/src/main/java/net/minecraft/server/LocaleLanguage.java b/src/main/java/net/minecraft/server/LocaleLanguage.java
index 29d55483510d3644a1edd3a01d7314232c358ac6..9909dd07d47ec86b71b74f66ab0e252de3441e23 100644
--- a/src/main/java/net/minecraft/server/LocaleLanguage.java
+++ b/src/main/java/net/minecraft/server/LocaleLanguage.java
@@ -30,9 +30,19 @@ public abstract class LocaleLanguage {
private static LocaleLanguage c() {
Builder<String, String> builder = ImmutableMap.builder();
BiConsumer<String, String> biconsumer = builder::put; // Paper - decompile fix
+ boolean usingCustomLocale = false; // Yatopia
try {
- InputStream inputstream = LocaleLanguage.class.getResourceAsStream("/assets/minecraft/lang/en_us.json");
+ // Yatopia Start - Custom Locale
+ InputStream inputstream;
+ java.io.File file = new java.io.File("./locale.json");
+ if (file.isFile() && file.canRead()) {
+ usingCustomLocale = true;
+ inputstream = new java.io.FileInputStream(file);
+ } else {
+ inputstream = LocaleLanguage.class.getResourceAsStream("/assets/minecraft/lang/en_us.json");
+ }
+ // Yatopia End
Throwable throwable = null;
try {
@@ -55,7 +65,11 @@ public abstract class LocaleLanguage {
}
} catch (JsonParseException | IOException ioexception) {
+ if (!usingCustomLocale) { // Yatopia
LocaleLanguage.LOGGER.error("Couldn't read strings from /assets/minecraft/lang/en_us.json", ioexception);
+ } else { // Yatopia start
+ LocaleLanguage.LOGGER.error("Couldn't read strings from custom locale file. Please check that your custom Locale File is formatted correctly", ioexception);
+ } // Yatopia end
}
final Map<String, String> map = builder.build();