This commit is contained in:
s809
2023-08-19 23:45:16 +05:00
5 changed files with 18 additions and 13 deletions
@@ -19,11 +19,9 @@
package com.seibel.distanthorizons.common.wrappers.chunk;
import com.seibel.distanthorizons.api.enums.config.ELightGenerationMode;
import com.seibel.distanthorizons.common.wrappers.block.BiomeWrapper;
import com.seibel.distanthorizons.common.wrappers.block.BlockStateWrapper;
import com.seibel.distanthorizons.common.wrappers.worldGeneration.mimicObject.DhLitWorldGenRegion;
import com.seibel.distanthorizons.core.config.Config;
import com.seibel.distanthorizons.core.pos.DhBlockPos;
import com.seibel.distanthorizons.core.pos.DhChunkPos;
import com.seibel.distanthorizons.core.util.LodUtil;
@@ -60,6 +58,10 @@ import net.minecraft.core.SectionPos;
public class ChunkWrapper implements IChunkWrapper
{
/** useful for debugging, but can slow down chunk operations quite a bit due to being called every time. */
private static final boolean RUN_RELATIVE_POS_INDEX_VALIDATION = false;
private final ChunkAccess chunk;
private final DhChunkPos chunkPos;
private final LevelReader lightSource;
@@ -440,6 +442,9 @@ public class ChunkWrapper implements IChunkWrapper
/** used to prevent accidentally attempting to get/set values outside this chunk's boundaries */
private void throwIndexOutOfBoundsIfRelativePosOutsideChunkBounds(int x, int y, int z) throws IndexOutOfBoundsException
{
if (RUN_RELATIVE_POS_INDEX_VALIDATION)
return;
// FIXME +1 is to handle the fact that LodDataBuilder adds +1 to all block lighting calculations, also done in the constructor
int minHeight = this.getMinBuildHeight();
int maxHeight = this.getMaxBuildHeight() + 1;
@@ -161,15 +161,15 @@ public class ClassicConfigGUI
if (((ConfigEntry) info).isValid(value) == 0 && info.getType() != List.class)
{
if (!cast)
((ConfigEntry) info).setWithoutSaving(value);
((ConfigEntry) info).uiSetWithoutSaving(value);
else
((ConfigEntry) info).setWithoutSaving(value.intValue());
((ConfigEntry) info).uiSetWithoutSaving(value.intValue());
}
// else if (((ConfigEntry) info).isValidMemoryAddress() == 0)
// {
// if (((List<String>) info.get()).size() == ((EntryInfo) info.guiValue).index)
// info.set(((List<String>) info.get()).add(""));
// info.set(((List<String>) info.get()).set(((EntryInfo) info.guiValue).index, Arrays.stream(((EntryInfo) info.guiValue).tempValue.replace("[", "").replace("]", "").split(", ")).collect(Collectors.toList()).get(0)));
// info.uiSet(((List<String>) info.get()).add(""));
// info.uiSet(((List<String>) info.get()).set(((EntryInfo) info.guiValue).index, Arrays.stream(((EntryInfo) info.guiValue).tempValue.replace("[", "").replace("]", "").split(", ")).collect(Collectors.toList()).get(0)));
// }
return true;
@@ -309,7 +309,7 @@ public class ClassicConfigGUI
if (ConfigEntry.class.isAssignableFrom(info.getClass()))
{
Button.OnPress btnAction = button -> {
((ConfigEntry) info).setWithoutSaving(((ConfigEntry) info).getDefaultValue());
((ConfigEntry) info).uiSetWithoutSaving(((ConfigEntry) info).getDefaultValue());
((EntryInfo) info.guiValue).index = 0;
this.reload = true;
Objects.requireNonNull(minecraft).setScreen(this);
@@ -463,7 +463,7 @@ public class ClassicConfigGUI
Function<Object, Component> func = value -> TextOrTranslatable((Boolean) value ? "True" : "False").withStyle((Boolean) value ? ChatFormatting.GREEN : ChatFormatting.RED);
((EntryInfo) info.guiValue).widget = new AbstractMap.SimpleEntry<Button.OnPress, Function<Object, Component>>(button -> {
((ConfigEntry) info).setWithoutSaving(!(Boolean) info.get());
((ConfigEntry) info).uiSetWithoutSaving(!(Boolean) info.get());
button.setMessage(func.apply(info.get()));
}, func);
}
@@ -503,7 +503,7 @@ public class ClassicConfigGUI
}
info.set(enumValue);
((ConfigEntry<Enum<?>>) info).uiSetWithoutSaving(enumValue);
button.setMessage(func.apply(info.get()));
}, func);
}
+2 -2
View File
@@ -1,5 +1,5 @@
{
"git_main_branch": "${git_main_branch}",
"git_main_commit": "${git_main_commit}",
"git_core_commit": "${git_core_commit}",
"git_main_branch": "${git_main_branch}"
"git_core_commit": "${git_core_commit}"
}
+1 -1
View File
@@ -18,7 +18,7 @@ mod_issues=https://gitlab.com/jeseibel/minecraft-lod-mod/-/issues
mod_discord=https://discord.gg/xAB8G4cENx
# Global Plugin Versions
manifold_version=2023.1.11
manifold_version=2023.1.15
toml_version=3.6.4
lz4_version=1.8.0
nightconfig_version=3.6.6