3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-26 16:12:46 +01:00

Add optional workaround for >Y128 Nether building (#615)

* Add optional workaround for >Y128 Nether building

This commit adds a config option for building above the Nether by changing the Nether's dimension ID to match the End's.

* Only check for workaround application once

* Fix mappings?

* Include a bit more for the above bedrock nether building config option

Co-authored-by: Redned <redned235@gmail.com>
Dieser Commit ist enthalten in:
Camotoy 2020-05-23 17:02:51 -04:00 committet von GitHub
Ursprung 8f01221275
Commit 1664221fa9
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
9 geänderte Dateien mit 44 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -131,6 +131,11 @@ public class GeyserBukkitConfiguration implements GeyserConfiguration {
return true; // We override this as with Bukkit, we have direct access to the server implementation return true; // We override this as with Bukkit, we have direct access to the server implementation
} }
@Override
public boolean isAboveBedrockNetherBuilding() {
return config.getBoolean("above-bedrock-nether-building", false);
}
@Override @Override
public IMetricsInfo getMetrics() { public IMetricsInfo getMetrics() {
return metricsInfo; return metricsInfo;

Datei anzeigen

@ -130,6 +130,11 @@ public class GeyserBungeeConfiguration implements GeyserConfiguration {
return config.getBoolean("cache-chunks", false); return config.getBoolean("cache-chunks", false);
} }
@Override
public boolean isAboveBedrockNetherBuilding() {
return config.getBoolean("above-bedrock-nether-building", false);
}
@Override @Override
public BungeeMetricsInfo getMetrics() { public BungeeMetricsInfo getMetrics() {
return metricsInfo; return metricsInfo;

Datei anzeigen

@ -124,6 +124,11 @@ public class GeyserSpongeConfiguration implements GeyserConfiguration {
return node.getNode("cache-chunks").getBoolean(false); return node.getNode("cache-chunks").getBoolean(false);
} }
@Override
public boolean isAboveBedrockNetherBuilding() {
return node.getNode("above-bedrock-nether-building").getBoolean(false);
}
@Override @Override
public SpongeMetricsInfo getMetrics() { public SpongeMetricsInfo getMetrics() {
return metricsInfo; return metricsInfo;

Datei anzeigen

@ -71,6 +71,9 @@ public class GeyserStandaloneConfiguration implements GeyserConfiguration {
@JsonProperty("cache-chunks") @JsonProperty("cache-chunks")
private boolean cacheChunks; private boolean cacheChunks;
@JsonProperty("above-bedrock-nether-building")
private boolean isAboveBedrockNetherBuilding;
private MetricsInfo metrics; private MetricsInfo metrics;
@Override @Override

Datei anzeigen

@ -76,6 +76,9 @@ public class GeyserVelocityConfiguration implements GeyserConfiguration {
@JsonProperty("cache-chunks") @JsonProperty("cache-chunks")
private boolean cacheChunks; private boolean cacheChunks;
@JsonProperty("above-bedrock-nether-building")
private boolean aboveBedrockNetherBuilding;
private MetricsInfo metrics; private MetricsInfo metrics;
private Path floodgateKey; private Path floodgateKey;

Datei anzeigen

@ -32,7 +32,7 @@ import java.util.Map;
public interface GeyserConfiguration { public interface GeyserConfiguration {
// Modify this when you update the config // Modify this when you update the config
int CURRENT_CONFIG_VERSION = 1; int CURRENT_CONFIG_VERSION = 2;
IBedrockConfiguration getBedrock(); IBedrockConfiguration getBedrock();
@ -56,6 +56,8 @@ public interface GeyserConfiguration {
Path getFloodgateKeyFile(); Path getFloodgateKeyFile();
boolean isAboveBedrockNetherBuilding();
boolean isCacheChunks(); boolean isCacheChunks();
IMetricsInfo getMetrics(); IMetricsInfo getMetrics();

Datei anzeigen

@ -40,6 +40,7 @@ import org.geysermc.connector.network.session.GeyserSession;
import org.geysermc.connector.network.translators.Translators; import org.geysermc.connector.network.translators.Translators;
import org.geysermc.connector.network.translators.world.WorldManager; import org.geysermc.connector.network.translators.world.WorldManager;
import org.geysermc.connector.thread.PingPassthroughThread; import org.geysermc.connector.thread.PingPassthroughThread;
import org.geysermc.connector.utils.DimensionUtils;
import org.geysermc.connector.utils.DockerCheck; import org.geysermc.connector.utils.DockerCheck;
import org.geysermc.connector.utils.Toolbox; import org.geysermc.connector.utils.Toolbox;
@ -114,6 +115,9 @@ public class GeyserConnector {
if (config.isPingPassthrough()) if (config.isPingPassthrough())
generalThreadPool.scheduleAtFixedRate(passthroughThread, 1, 1, TimeUnit.SECONDS); generalThreadPool.scheduleAtFixedRate(passthroughThread, 1, 1, TimeUnit.SECONDS);
if (config.isAboveBedrockNetherBuilding())
DimensionUtils.changeBedrockNetherId(); // Apply End dimension ID workaround to Nether
bedrockServer = new BedrockServer(new InetSocketAddress(config.getBedrock().getAddress(), config.getBedrock().getPort())); bedrockServer = new BedrockServer(new InetSocketAddress(config.getBedrock().getAddress(), config.getBedrock().getPort()));
bedrockServer.setHandler(new ConnectorServerEventHandler(this)); bedrockServer.setHandler(new ConnectorServerEventHandler(this));
bedrockServer.bind().whenComplete((avoid, throwable) -> { bedrockServer.bind().whenComplete((avoid, throwable) -> {

Datei anzeigen

@ -31,6 +31,10 @@ import org.geysermc.connector.entity.Entity;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;
public class DimensionUtils { public class DimensionUtils {
// Changes if the above-bedrock Nether building workaround is applied
private static int BEDROCK_NETHER_ID = 1;
public static void switchDimension(GeyserSession session, int javaDimension) { public static void switchDimension(GeyserSession session, int javaDimension) {
int bedrockDimension = javaToBedrock(javaDimension); int bedrockDimension = javaToBedrock(javaDimension);
Entity player = session.getPlayerEntity(); Entity player = session.getPlayerEntity();
@ -71,11 +75,16 @@ public class DimensionUtils {
public static int javaToBedrock(int javaDimension) { public static int javaToBedrock(int javaDimension) {
switch (javaDimension) { switch (javaDimension) {
case -1: case -1:
return 1; return BEDROCK_NETHER_ID;
case 1: case 1:
return 2; return 2;
default: default:
return javaDimension; return javaDimension;
} }
} }
public static void changeBedrockNetherId() {
// Change dimension ID to the End to allow for building above Bedrock
BEDROCK_NETHER_ID = 2;
}
} }

Datei anzeigen

@ -73,6 +73,12 @@ default-locale: en_us
# Geyser has direct access to the server itself. # Geyser has direct access to the server itself.
cache-chunks: false cache-chunks: false
# Bedrock prevents building and displaying blocks above Y127 in the Nether -
# enabling this config option works around that by changing the Nether dimension ID
# to the End ID. The main downside to this is that the sky will resemble that of
# the end sky in the nether, but ultimately it's the only way for this feature to work.
above-bedrock-nether-building: false
# bStats is a stat tracker that is entirely anonymous and tracks only basic information # bStats is a stat tracker that is entirely anonymous and tracks only basic information
# about Geyser, such as how many people are online, how many servers are using Geyser, # about Geyser, such as how many people are online, how many servers are using Geyser,
# what OS is being used, etc. You can learn more about bStats here: https://bstats.org/. # what OS is being used, etc. You can learn more about bStats here: https://bstats.org/.