From 3415db58a6a7168161ee92e04fd7d84c16a609f7 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 29 Jul 2023 10:01:22 -0500 Subject: [PATCH] Fix multiplayer networking configs and add missing localizations --- .../core/api/internal/ClientApi.java | 8 ++++++++ .../seibel/distanthorizons/core/config/Config.java | 13 +++++++++++-- .../distanthorizons/core/world/DhClientWorld.java | 2 +- .../assets/distanthorizons/lang/en_us.json | 8 ++++++++ 4 files changed, 28 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/com/seibel/distanthorizons/core/api/internal/ClientApi.java b/core/src/main/java/com/seibel/distanthorizons/core/api/internal/ClientApi.java index 9b4116ba5..84122c405 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/api/internal/ClientApi.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/api/internal/ClientApi.java @@ -332,6 +332,14 @@ public class ClientApi /** @param byteBuf is Netty's {@link ByteBuffer} wrapper. */ public void serverMessageReceived(ByteBuf byteBuf) { + if (!Config.Client.Advanced.Multiplayer.enableMultiverseNetworking.get()) + { + // multiverse networking disabled, ignore anything sent from the server + return; + } + + + // either value can be set to true to debug the received byte stream boolean stopAndDisplayInputAsByteArray = false; boolean stopAndDisplayInputAsString = false; diff --git a/core/src/main/java/com/seibel/distanthorizons/core/config/Config.java b/core/src/main/java/com/seibel/distanthorizons/core/config/Config.java index ee36c6e8f..d27282404 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/config/Config.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/config/Config.java @@ -741,9 +741,18 @@ public class Config .comment("" + "If true Distant Horizons will attempt to communicate with the connected \n" + "server in order to improve multiverse support. \n" - + "If you experience network issues when attempting to join a server, disable this option. \n" + + "") + .build(); + + public static ConfigEntry enableServerNetworking = new ConfigEntry.Builder() + .set(false) + .comment("" + + "Attention: this is only for developers and hasn't been implemented.\n" + "\n" - + "Note: this requires setup on the server in order to function. \n" + + "If true Distant Horizons will attempt to communicate with the connected \n" + + "server in order to load LODs outside your vanilla render distance. \n" + + "\n" + + "Note: This requires DH to be installed on the server in order to function. \n" + "") .build(); diff --git a/core/src/main/java/com/seibel/distanthorizons/core/world/DhClientWorld.java b/core/src/main/java/com/seibel/distanthorizons/core/world/DhClientWorld.java index 601da7877..bed9ea75c 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/world/DhClientWorld.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/world/DhClientWorld.java @@ -47,7 +47,7 @@ public class DhClientWorld extends AbstractDhWorld implements IDhClientWorld this.saveStructure = new ClientOnlySaveStructure(); this.levels = new ConcurrentHashMap<>(); - if (Config.Client.Advanced.Multiplayer.enableMultiverseNetworking.get()) + if (Config.Client.Advanced.Multiplayer.enableServerNetworking.get()) { // TODO server specific configs this.networkClient = new NetworkClient(MC_CLIENT.getCurrentServerIp(), 25049); diff --git a/core/src/main/resources/assets/distanthorizons/lang/en_us.json b/core/src/main/resources/assets/distanthorizons/lang/en_us.json index 1f814acfc..d502c1fe9 100644 --- a/core/src/main/resources/assets/distanthorizons/lang/en_us.json +++ b/core/src/main/resources/assets/distanthorizons/lang/en_us.json @@ -300,6 +300,14 @@ "Multiverse Required Similarity %", "distanthorizons.config.client.advanced.multiplayer.multiverseSimilarityRequiredPercent.@tooltip": "When matching worlds of the same dimension type the\ntested chunk(s) must be at least this percent the same\nin order to be considered the same world.\n\nNote: If you use portals to enter a dimension at two\ndifferent locations this system may think it is two different worlds.\n\n§61.0:§r the chunks must be identical.\n§60.5:§r the chunks must be half the same.\n§60.0:§r disables multi-dimension support\n only one world will be used per dimension.", + "distanthorizons.config.client.advanced.multiplayer.enableMultiverseNetworking": + "Networked Multiverse Support", + "distanthorizons.config.client.advanced.multiplayer.enableMultiverseNetworking.@tooltip": + "If true Distant Horizons will attempt to communicate with the connected \nserver in order to improve multiverse support.", + "distanthorizons.config.client.advanced.multiplayer.enableServerNetworking": + "§4Unimplemented, Dev Use Only§r - Server Support", + "distanthorizons.config.client.advanced.multiplayer.enableServerNetworking.@tooltip": + "§6Attention:§r this is only for developers and hasn't been implemented. \n\nIf true Distant Horizons will attempt to communicate with the connected \nserver in order to load LODs outside your vanilla render distance. \n\nNote: This requires DH to be installed on the server in order to function.",