Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-26 00:00:41 +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:
Ursprung
8f01221275
Commit
1664221fa9
@ -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
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAboveBedrockNetherBuilding() {
|
||||
return config.getBoolean("above-bedrock-nether-building", false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMetricsInfo getMetrics() {
|
||||
return metricsInfo;
|
||||
|
@ -130,6 +130,11 @@ public class GeyserBungeeConfiguration implements GeyserConfiguration {
|
||||
return config.getBoolean("cache-chunks", false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAboveBedrockNetherBuilding() {
|
||||
return config.getBoolean("above-bedrock-nether-building", false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BungeeMetricsInfo getMetrics() {
|
||||
return metricsInfo;
|
||||
|
@ -124,6 +124,11 @@ public class GeyserSpongeConfiguration implements GeyserConfiguration {
|
||||
return node.getNode("cache-chunks").getBoolean(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAboveBedrockNetherBuilding() {
|
||||
return node.getNode("above-bedrock-nether-building").getBoolean(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SpongeMetricsInfo getMetrics() {
|
||||
return metricsInfo;
|
||||
|
@ -71,6 +71,9 @@ public class GeyserStandaloneConfiguration implements GeyserConfiguration {
|
||||
@JsonProperty("cache-chunks")
|
||||
private boolean cacheChunks;
|
||||
|
||||
@JsonProperty("above-bedrock-nether-building")
|
||||
private boolean isAboveBedrockNetherBuilding;
|
||||
|
||||
private MetricsInfo metrics;
|
||||
|
||||
@Override
|
||||
|
@ -76,6 +76,9 @@ public class GeyserVelocityConfiguration implements GeyserConfiguration {
|
||||
@JsonProperty("cache-chunks")
|
||||
private boolean cacheChunks;
|
||||
|
||||
@JsonProperty("above-bedrock-nether-building")
|
||||
private boolean aboveBedrockNetherBuilding;
|
||||
|
||||
private MetricsInfo metrics;
|
||||
|
||||
private Path floodgateKey;
|
||||
|
@ -32,7 +32,7 @@ import java.util.Map;
|
||||
public interface GeyserConfiguration {
|
||||
|
||||
// Modify this when you update the config
|
||||
int CURRENT_CONFIG_VERSION = 1;
|
||||
int CURRENT_CONFIG_VERSION = 2;
|
||||
|
||||
IBedrockConfiguration getBedrock();
|
||||
|
||||
@ -56,6 +56,8 @@ public interface GeyserConfiguration {
|
||||
|
||||
Path getFloodgateKeyFile();
|
||||
|
||||
boolean isAboveBedrockNetherBuilding();
|
||||
|
||||
boolean isCacheChunks();
|
||||
|
||||
IMetricsInfo getMetrics();
|
||||
|
@ -40,6 +40,7 @@ import org.geysermc.connector.network.session.GeyserSession;
|
||||
import org.geysermc.connector.network.translators.Translators;
|
||||
import org.geysermc.connector.network.translators.world.WorldManager;
|
||||
import org.geysermc.connector.thread.PingPassthroughThread;
|
||||
import org.geysermc.connector.utils.DimensionUtils;
|
||||
import org.geysermc.connector.utils.DockerCheck;
|
||||
import org.geysermc.connector.utils.Toolbox;
|
||||
|
||||
@ -114,6 +115,9 @@ public class GeyserConnector {
|
||||
if (config.isPingPassthrough())
|
||||
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.setHandler(new ConnectorServerEventHandler(this));
|
||||
bedrockServer.bind().whenComplete((avoid, throwable) -> {
|
||||
|
@ -31,6 +31,10 @@ import org.geysermc.connector.entity.Entity;
|
||||
import org.geysermc.connector.network.session.GeyserSession;
|
||||
|
||||
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) {
|
||||
int bedrockDimension = javaToBedrock(javaDimension);
|
||||
Entity player = session.getPlayerEntity();
|
||||
@ -71,11 +75,16 @@ public class DimensionUtils {
|
||||
public static int javaToBedrock(int javaDimension) {
|
||||
switch (javaDimension) {
|
||||
case -1:
|
||||
return 1;
|
||||
return BEDROCK_NETHER_ID;
|
||||
case 1:
|
||||
return 2;
|
||||
default:
|
||||
return javaDimension;
|
||||
}
|
||||
}
|
||||
|
||||
public static void changeBedrockNetherId() {
|
||||
// Change dimension ID to the End to allow for building above Bedrock
|
||||
BEDROCK_NETHER_ID = 2;
|
||||
}
|
||||
}
|
||||
|
@ -73,6 +73,12 @@ default-locale: en_us
|
||||
# Geyser has direct access to the server itself.
|
||||
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
|
||||
# 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/.
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren