Move max generation distance check functionality to render distance config

This commit is contained in:
s809
2025-06-10 00:29:02 +05:00
parent 91743bf742
commit 9cb627eaac
3 changed files with 6 additions and 13 deletions
@@ -171,9 +171,11 @@ public class Config
public static class Quality public static class Quality
{ {
public static ConfigEntry<Integer> lodChunkRenderDistanceRadius = new ConfigEntry.Builder<Integer>() public static ConfigEntry<Integer> lodChunkRenderDistanceRadius = new ConfigEntry.Builder<Integer>()
.setChatCommandName("generation.maxRequestDistance")
.setMinDefaultMax(32, 256, 4096) .setMinDefaultMax(32, 256, 4096)
.comment("" + .comment("" +
"The radius of the mod's render distance. (measured in chunks)\n" + "The radius of the mod's render distance. (measured in chunks)\n" +
"On server defines the distance allowed to generate around the player; note that real-time updates and synd on load limits are defined separately. \n" +
"") "")
.setPerformance(EConfigEntryPerformance.HIGH) .setPerformance(EConfigEntryPerformance.HIGH)
.build(); .build();
@@ -1620,15 +1622,6 @@ public class Config
+ "") + "")
.build(); .build();
public static ConfigEntry<Integer> maxGenerationRequestDistance = new ConfigEntry.Builder<Integer>()
.setChatCommandName("generation.maxRequestDistance")
.setMinDefaultMax(256, 4096, 4096)
.comment("" +
"Defines the distance allowed to generate around the player." +
"")
.setPerformance(EConfigEntryPerformance.HIGH)
.build();
public static ConfigEntry<Integer> generationBoundsX = new ConfigEntry.Builder<Integer>() public static ConfigEntry<Integer> generationBoundsX = new ConfigEntry.Builder<Integer>()
.setChatCommandName("generation.bounds.x") .setChatCommandName("generation.bounds.x")
.setAppearance(EConfigEntryAppearance.ONLY_IN_FILE) .setAppearance(EConfigEntryAppearance.ONLY_IN_FILE)
@@ -143,9 +143,9 @@ public abstract class AbstractDhServerLevel extends AbstractDhLevel implements I
if (message.clientTimestamp == null) if (message.clientTimestamp == null)
{ {
if (distanceFromPlayer > Config.Server.maxGenerationRequestDistance.get()) if (distanceFromPlayer > Config.Client.Advanced.Graphics.Quality.lodChunkRenderDistanceRadius.get())
{ {
message.sendResponse(new RequestOutOfRangeException("Distance too large: " + distanceFromPlayer + " > " + Config.Server.maxGenerationRequestDistance.get())); message.sendResponse(new RequestOutOfRangeException("Distance too large: " + distanceFromPlayer + " > " + Config.Client.Advanced.Graphics.Quality.lodChunkRenderDistanceRadius.get()));
return; return;
} }
@@ -32,7 +32,7 @@ public class SessionConfig implements INetworkObject
// Note: config values are transmitted in the insertion order // Note: config values are transmitted in the insertion order
registerConfigEntry(Config.Common.WorldGenerator.enableDistantGeneration, Boolean::logicalAnd); registerConfigEntry(Config.Common.WorldGenerator.enableDistantGeneration, Boolean::logicalAnd);
registerConfigEntry(Config.Server.maxGenerationRequestDistance, Math::min); registerConfigEntry(Config.Client.Advanced.Graphics.Quality.lodChunkRenderDistanceRadius, Math::min);
registerConfigEntry(Config.Server.generationBoundsX, (x, y) -> y); registerConfigEntry(Config.Server.generationBoundsX, (x, y) -> y);
registerConfigEntry(Config.Server.generationBoundsZ, (x, y) -> y); registerConfigEntry(Config.Server.generationBoundsZ, (x, y) -> y);
registerConfigEntry(Config.Server.generationBoundsRadius, (x, y) -> y); registerConfigEntry(Config.Server.generationBoundsRadius, (x, y) -> y);
@@ -67,7 +67,7 @@ public class SessionConfig implements INetworkObject
//===============// //===============//
public boolean isDistantGenerationEnabled() { return this.getValue(Config.Common.WorldGenerator.enableDistantGeneration); } public boolean isDistantGenerationEnabled() { return this.getValue(Config.Common.WorldGenerator.enableDistantGeneration); }
public int getMaxGenerationRequestDistance() { return this.getValue(Config.Server.maxGenerationRequestDistance); } public int getMaxGenerationRequestDistance() { return this.getValue(Config.Client.Advanced.Graphics.Quality.lodChunkRenderDistanceRadius); }
public Integer getGenerationBoundsX() { return this.getValue(Config.Server.generationBoundsX); } public Integer getGenerationBoundsX() { return this.getValue(Config.Server.generationBoundsX); }
public Integer getGenerationBoundsZ() { return this.getValue(Config.Server.generationBoundsZ); } public Integer getGenerationBoundsZ() { return this.getValue(Config.Server.generationBoundsZ); }
public Integer getGenerationBoundsRadius() { return this.getValue(Config.Server.generationBoundsRadius); } public Integer getGenerationBoundsRadius() { return this.getValue(Config.Server.generationBoundsRadius); }