Clean up more TODOs

This commit is contained in:
James Seibel
2026-01-29 07:48:10 -06:00
parent c30e410132
commit a9bfc3fbe1
8 changed files with 114 additions and 44 deletions
@@ -73,8 +73,6 @@ public class ClientApi
{
private static final DhLogger LOGGER = new DhLoggerBuilder().build();
public static boolean prefLoggerEnabled = false;
public static final ClientApi INSTANCE = new ClientApi();
public static final TestRenderer TEST_RENDERER = new TestRenderer();
@@ -185,13 +183,12 @@ public class ClientApi
MC_CLIENT.sendChatMessage("DH may behave strangely or have missing functionality.");
MC_CLIENT.sendChatMessage("In order to use pre-generated LODs, put your DH database(s) in:");
MC_CLIENT.sendChatMessage(MinecraftTextFormat.GRAY +".Minecraft" + File.separator + ClientOnlySaveStructure.SERVER_DATA_FOLDER_NAME + File.separator + ClientOnlySaveStructure.REPLAY_SERVER_FOLDER_NAME + File.separator + "DIMENSION_NAME"+ MinecraftTextFormat.CLEAR_FORMATTING);
MC_CLIENT.sendChatMessage("This can be disabled in DH's config under Advanced -> Logging.");
MC_CLIENT.sendChatMessage("This message can be disabled in DH's config under Advanced -> Logging.");
MC_CLIENT.sendChatMessage("");
}
}
// firing after clientLevelLoadEvent
// TODO if level has prepped to load it should fire level load event
DhClientWorld world = new DhClientWorld();
SharedApi.setDhWorld(world);
@@ -693,20 +690,20 @@ public class ClientApi
}
if (glfwKey == GLFW.GLFW_KEY_F8)
{
Config.Client.Advanced.Debugging.debugRendering.set(EDhApiDebugRendering.next(Config.Client.Advanced.Debugging.debugRendering.get()));
MC_CLIENT.sendChatMessage("F8: Set debug mode to " + Config.Client.Advanced.Debugging.debugRendering.get());
}
else if (glfwKey == GLFW.GLFW_KEY_F6)
if (glfwKey == GLFW.GLFW_KEY_F6)
{
Config.Client.Advanced.Debugging.rendererMode.set(EDhApiRendererMode.next(Config.Client.Advanced.Debugging.rendererMode.get()));
MC_CLIENT.sendChatMessage("F6: Set rendering to " + Config.Client.Advanced.Debugging.rendererMode.get());
}
else if (glfwKey == GLFW.GLFW_KEY_P)
else if (glfwKey == GLFW.GLFW_KEY_F7)
{
prefLoggerEnabled = !prefLoggerEnabled;
MC_CLIENT.sendChatMessage("P: Debug Pref Logger is " + (prefLoggerEnabled ? "enabled" : "disabled"));
Config.Client.Advanced.Debugging.lodOnlyMode.set(!Config.Client.Advanced.Debugging.lodOnlyMode.get());
MC_CLIENT.sendChatMessage("F7: Set LOD only mode to " + Config.Client.Advanced.Debugging.lodOnlyMode.get());
}
else if (glfwKey == GLFW.GLFW_KEY_F8)
{
Config.Client.Advanced.Debugging.debugRendering.set(EDhApiDebugRendering.next(Config.Client.Advanced.Debugging.debugRendering.get()));
MC_CLIENT.sendChatMessage("F8: Set debug mode to " + Config.Client.Advanced.Debugging.debugRendering.get());
}
}
@@ -699,7 +699,7 @@ public class Config
+ "How intense should the noise should be?")
.build();
public static ConfigEntry<Integer> noiseDropoff = new ConfigEntry.Builder<Integer>() // TODO: Make this a float (the ClassicConfigGUI doesn't support floats)
public static ConfigEntry<Integer> noiseDropoff = new ConfigEntry.Builder<Integer>()
.setMinDefaultMax(0, 1024, null)
.comment(""
+ "Defines how far should the noise texture render before it fades away. (in blocks) \n"
@@ -979,13 +979,15 @@ public class Config
+ "")
.build();
// TODO add LOD-only mode to this
public static ConfigEntry<Boolean> enableDebugKeybindings = new ConfigEntry.Builder<Boolean>()
.set(false)
.comment(""
+ "If true the F8 key can be used to cycle through the different debug modes. \n"
+ "and the F6 key can be used to enable and disable LOD rendering.")
.build();
.set(false)
.comment(""
+ "If true several keys can be used to toggle debug states. \n"
+ "F6 - enable/disable LOD rendering \n"
+ "F7 - enable/disable LOD only rendering \n"
+ "F8 - cycle through the different debug rendering modes \n"
+ "")
.build();
public static ConfigEntry<Boolean> enableWhiteWorld = new ConfigEntry.Builder<Boolean>()
.set(false)
@@ -241,8 +241,8 @@ public class ConfigFileHandler
}
else if (entry.getTrueValue() == null)
{
// TODO when can this happen?
throw new IllegalArgumentException("BlockBiomeWrapperPair [" + entry.getNameAndCategory() + "] is null, this may be a problem with [" + ModInfo.NAME + "]. Please contact the authors.");
// shouldn't happen, but just in case
throw new IllegalArgumentException("ConfigEntry [" + entry.getNameAndCategory() + "] is null, how did this happen?");
}
workConfig.set(entry.getNameAndCategory(), ConfigTypeConverters.attemptToConvertToString(entry.getType(), entry.getTrueValue()));
@@ -60,6 +60,7 @@ public class ConfigEntry<T> extends AbstractConfigBase<T>
//=============//
// constructor //
//=============//
//region
private ConfigEntry(
EConfigEntryAppearance appearance,
@@ -78,11 +79,14 @@ public class ConfigEntry<T> extends AbstractConfigBase<T>
this.listenerList = listenerList;
}
//endregion
//==========================//
// property getters/setters //
//==========================//
//region
/** the string used when entering the config into the command line or chat */
public String getChatCommandName() { return this.chatCommandName; }
@@ -100,16 +104,22 @@ public class ConfigEntry<T> extends AbstractConfigBase<T>
public T getMax() { return this.max; }
public void setMax(T newMax) { this.max = newMax; }
//endregion
//===============//
// value setters //
//===============//
//region
public void setApiValue(T newApiValue)
{
this.apiValue = newApiValue;
this.listenerList.forEach(IConfigListener::onConfigValueSet);
synchronized (this.listenerList)
{
this.listenerList.forEach(IConfigListener::onConfigValueSet);
}
}
public boolean apiIsOverriding()
@@ -129,7 +139,11 @@ public class ConfigEntry<T> extends AbstractConfigBase<T>
public void setWithoutSaving(T newValue)
{
super.set(newValue);
this.listenerList.forEach(IConfigListener::onConfigValueSet);
synchronized (this.listenerList)
{
this.listenerList.forEach(IConfigListener::onConfigValueSet);
}
}
@Override
public void set(T newValue)
@@ -141,19 +155,30 @@ public class ConfigEntry<T> extends AbstractConfigBase<T>
public void uiSetWithoutSaving(T newValue)
{
this.setWithoutSaving(newValue);
this.listenerList.forEach(IConfigListener::onUiModify);
synchronized (this.listenerList)
{
this.listenerList.forEach(IConfigListener::onUiModify);
}
}
public void uiSet(T newValue)
{
this.set(newValue);
this.listenerList.forEach(IConfigListener::onUiModify);
synchronized (this.listenerList)
{
this.listenerList.forEach(IConfigListener::onUiModify);
}
}
//endregion
//===============//
// value getters //
//===============//
//region
@Override
public T get()
@@ -174,11 +199,14 @@ public class ConfigEntry<T> extends AbstractConfigBase<T>
@Nullable
public T getApiValue() { return this.apiValue; }
//endregion
//===========//
// listeners //
//===========//
//region
/** Fired whenever the config value changes to a new value. */
public void addValueChangeListener(Consumer<T> onValueChangeFunc)
@@ -187,26 +215,38 @@ public class ConfigEntry<T> extends AbstractConfigBase<T>
this.addListener(changeListener);
}
/** Fired whenever the config value is updated, including when the value doesn't change (IE when the UI changes state or the config is reloaded). */
public void addListener(IConfigListener newListener) { this.listenerList.add(newListener); }
//public void removeValueChangeListener(Consumer<T> onValueChangeFunc) { } // not currently implemented
public void removeListener(IConfigListener oldListener) { this.listenerList.remove(oldListener); }
public void clearListeners() { this.listenerList.clear(); }
public ArrayList<IConfigListener> getListeners() { return this.listenerList; }
/** Replaces the listener list */
public void setListeners(ArrayList<IConfigListener> newListeners)
public void addListener(IConfigListener newListener)
{
this.listenerList.clear();
this.listenerList.addAll(newListeners);
synchronized (this.listenerList)
{
this.listenerList.add(newListener);
}
}
public void setListeners(IConfigListener... newListeners) { this.listenerList.addAll(Arrays.asList(newListeners)); }
public void removeListener(IConfigListener oldListener)
{
synchronized (this.listenerList)
{
this.listenerList.remove(oldListener);
}
}
public void clearListeners()
{
synchronized (this.listenerList)
{
this.listenerList.clear();
}
}
//endregion
//====================//
// min/max validation //
//====================//
//region
/** Checks if this config's current value is valid */
public EConfigValidity getValidity() { return this.getValidity(this.value, this.min, this.max); }
@@ -257,22 +297,28 @@ public class ConfigEntry<T> extends AbstractConfigBase<T>
}
}
//endregion
//===============//
// file handling //
//===============//
//region
/** This should normally not be called since set() automatically calls this */
public void save() { ConfigHandler.INSTANCE.configFileHandler.saveEntry(this); }
/** This should normally not be called except for special circumstances */
public void load() { ConfigHandler.INSTANCE.configFileHandler.loadEntry(this); }
//endregion
//================//
// base overrides //
//================//
//region
public boolean equals(AbstractConfigBase<?> obj)
{
@@ -294,11 +340,14 @@ public class ConfigEntry<T> extends AbstractConfigBase<T>
}
}
//endregion
//=========//
// builder //
//=========//
//region
public static class Builder<T> extends AbstractConfigBase.Builder<T, Builder<T>>
{
@@ -397,4 +446,8 @@ public class ConfigEntry<T> extends AbstractConfigBase<T>
}
//endregion
}
@@ -289,7 +289,7 @@ public abstract class AbstractDhLevel implements IDhLevel
int minBlockX, int maxBlockX,
int minBlockZ, int maxBlockZ,
List<BeaconBeamDTO> activeBeamList
) // TODO min/max block pos instead
)
{
if (this.beaconBeamRepo == null)
{
@@ -87,6 +87,7 @@ public class CloudRenderHandler
//=============//
// constructor //
//=============//
//region
public CloudRenderHandler(IDhClientLevel level, GenericObjectRenderer renderer)
{
@@ -269,6 +270,15 @@ public class CloudRenderHandler
}
}
//endregion
//===========//
// rendering //
//===========//
//region
private void preRender(DhApiRenderParam renderParam, CloudParams cloudParams)
{
IDhApiRenderableBoxGroup boxGroup = this.boxGroupByOffset[cloudParams.instanceOffsetX+CLOUD_INSTANCE_RADIUS_COUNT][cloudParams.instanceOffsetZ+CLOUD_INSTANCE_RADIUS_COUNT];
@@ -399,8 +409,7 @@ public class CloudRenderHandler
boxGroup.setOriginBlockPos(new DhApiVec3d(newMinPosX, newMinPosY, newMinPosZ));
}
private synchronized boolean shouldCloudBeCulled(
private boolean shouldCloudBeCulled(
float minPosX, float minPosY, float minPosZ,
CloudParams cloudParams)
{
@@ -484,12 +493,14 @@ public class CloudRenderHandler
return allOutsideRenderDistance || allBehindCamera;
}
//endregion
//==================//
// texture handling //
//==================//
//region
private static boolean[][] getCloudsFromTexture() throws FileNotFoundException, IOException
{
@@ -523,11 +534,14 @@ public class CloudRenderHandler
return whitePixels;
}
//endregion
//================//
// helper classes //
//================//
//region
private static class CloudParams
{
@@ -565,4 +579,8 @@ public class CloudRenderHandler
}
//endregion
}
@@ -42,7 +42,7 @@ public interface IWrapperFactory extends IDhApiWrapperFactory, IBindable
IBatchGeneratorEnvironmentWrapper createBatchGenerator(IDhLevel targetLevel);
IBiomeWrapper deserializeBiomeWrapper(String str, ILevelWrapper levelWrapper) throws IOException;
IBiomeWrapper getPlainsBiomeWrapper(ILevelWrapper levelWrapper); // TODO it would be nice to remove the level wrapper if possible to put this in line with getAirBlockStateWrapper() but it isn't necessary
IBiomeWrapper getPlainsBiomeWrapper(ILevelWrapper levelWrapper);
default IBiomeWrapper deserializeBiomeWrapperOrGetDefault(String str, ILevelWrapper levelWrapper)
{
IBiomeWrapper biome;
@@ -463,7 +463,7 @@
"distanthorizons.config.client.advanced.debugging.enableDebugKeybindings":
"Enable debug keybindings",
"distanthorizons.config.client.advanced.debugging.enableDebugKeybindings.@tooltip":
"§6True:§r debug keybindings can be used to change the Debug mode in game.",
"If true several keys can be used to toggle debug states. \nF6 - enable/disable LOD rendering \nF7 - enable/disable LOD only rendering \nF8 - cycle through the different debug rendering modes",
"distanthorizons.config.client.advanced.debugging.enableWhiteWorld":
"Enable white world",
"distanthorizons.config.client.advanced.debugging.enableWhiteWorld.@tooltip":