Add config option to suppress emulation warnings (#751)

This commit is contained in:
EnZaXD 2024-05-19 09:27:22 +02:00 committed by GitHub
parent f9890db702
commit 6e75026681
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 20 additions and 3 deletions

View File

@ -34,6 +34,7 @@ public class ViaBackwardsConfig extends Config implements com.viaversion.viaback
private boolean alwaysShowOriginalMobName;
private boolean fix1_13FormattedInventoryTitles;
private boolean handlePingsAsInvAcknowledgements;
private boolean suppressEmulationWarnings;
public ViaBackwardsConfig(File configFile, Logger logger) {
super(configFile, logger);
@ -52,6 +53,7 @@ public class ViaBackwardsConfig extends Config implements com.viaversion.viaback
fix1_13FormattedInventoryTitles = getBoolean("fix-formatted-inventory-titles", true);
alwaysShowOriginalMobName = getBoolean("always-show-original-mob-name", true);
handlePingsAsInvAcknowledgements = getBoolean("handle-pings-as-inv-acknowledgements", false);
suppressEmulationWarnings = getBoolean("suppress-emulation-warnings", false);
}
@Override
@ -84,6 +86,11 @@ public class ViaBackwardsConfig extends Config implements com.viaversion.viaback
return handlePingsAsInvAcknowledgements || Boolean.getBoolean("com.viaversion.handlePingsAsInvAcknowledgements");
}
@Override
public boolean suppressEmulationWarnings() {
return suppressEmulationWarnings;
}
@Override
public URL getDefaultConfigURL() {
return getClass().getClassLoader().getResource("assets/viabackwards/config.yml");

View File

@ -63,4 +63,11 @@ public interface ViaBackwardsConfig extends Config {
* @return true if enabled
*/
boolean handlePingsAsInvAcknowledgements();
/**
* Suppresses warnings of missing emulations for certain features that are not supported (e.g. world height in 1.17+).
*
* @return true if enabled
*/
boolean suppressEmulationWarnings();
}

View File

@ -83,7 +83,7 @@ public class EntityPacketRewriter1_16_2 extends EntityRewriter<ClientboundPacket
NumberTag id = biome.getNumberTag("id");
biomeStorage.addBiome(name.getValue(), id.asInt());
}
} else if (!warned) {
} else if (!warned && !ViaBackwards.getConfig().suppressEmulationWarnings()) {
warned = true;
protocol.getLogger().warning("1.16 and 1.16.1 clients are only partially supported and may have wrong biomes displayed.");
}

View File

@ -206,7 +206,7 @@ public final class EntityPacketRewriter1_17 extends EntityRewriter<ClientboundPa
NumberTag height = tag.getNumberTag("height");
NumberTag logicalHeight = tag.getNumberTag("logical_height");
if (minY.asInt() != 0 || height.asInt() > 256 || logicalHeight.asInt() > 256) {
if (warn && !warned) {
if (warn && !warned && !ViaBackwards.getConfig().suppressEmulationWarnings()) {
protocol.getLogger().warning("Increased world height is NOT SUPPORTED for 1.16 players and below. They will see a void below y 0 and above 256");
warned = true;
}

View File

@ -19,4 +19,7 @@ fix-formatted-inventory-titles: true
#
# Sends inventory acknowledgement packets to act as a replacement for ping packets for sub 1.17 clients.
# This only takes effect for ids in the short range. Useful for anticheat compatibility.
handle-pings-as-inv-acknowledgements: false
handle-pings-as-inv-acknowledgements: false
#
# Suppresses warnings of missing emulations for certain features that are not supported (e.g. world height in 1.17+).
suppress-emulation-warnings: false