From 5264d1de7430ebc43f747eb3f7ca522f24ea224c Mon Sep 17 00:00:00 2001 From: Richard Gonlag Date: Mon, 5 Aug 2024 18:22:57 +0200 Subject: [PATCH] WIP config file --- build.gradle | 15 ++++- gradle.properties | 13 +++- .../at/ridgo8/moreoverlays/MoreOverlays.java | 6 +- .../api/lightoverlay/LightScannerBase.java | 10 +-- .../chunkbounds/ChunkBoundsRenderer.java | 14 ++-- .../at/ridgo8/moreoverlays/config/Config.java | 64 ------------------- .../config/MoreOverlaysConfigModel.java | 50 +++++++++++++++ .../moreoverlays/itemsearch/GuiRenderer.java | 11 +++- .../lightoverlay/LightOverlayHandler.java | 4 +- .../lightoverlay/LightOverlayRenderer.java | 16 ++--- .../lightoverlay/LightScannerVanilla.java | 14 ++-- .../mixin/client/MixinOverlayRenderer.java | 46 +++++-------- .../assets/moreoverlays/lang/en_us.json | 49 ++++++++++---- 13 files changed, 164 insertions(+), 148 deletions(-) delete mode 100644 src/client/java/at/ridgo8/moreoverlays/config/Config.java create mode 100644 src/client/java/at/ridgo8/moreoverlays/config/MoreOverlaysConfigModel.java diff --git a/build.gradle b/build.gradle index 8acfc23..e9ab20d 100644 --- a/build.gradle +++ b/build.gradle @@ -21,6 +21,11 @@ repositories { name = "ModMaven" url = "https://modmaven.dev" } + maven { url 'https://maven.wispforest.io/releases/' } + maven { + name = "Terraformers" + url = "https://maven.terraformersmc.com/" + } } loom { @@ -53,10 +58,14 @@ dependencies { // Fabric API. This is technically optional, but you probably want it anyway. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" - modCompileOnlyApi("mezz.jei:jei-1.20.4-common-api:17.3.0.52") - modCompileOnlyApi("mezz.jei:jei-1.20.4-fabric-api:17.3.0.52") + modCompileOnlyApi("mezz.jei:jei-${project.jei_minecraft_version}-common-api:${project.jei_version}") + modCompileOnlyApi("mezz.jei:jei-${project.jei_minecraft_version}-fabric-api:${project.jei_version}") // at runtime, use the full JEI jar for Fabric - modRuntimeOnly("mezz.jei:jei-1.20.4-fabric:17.3.0.52") + modRuntimeOnly("mezz.jei:jei-${project.jei_minecraft_version}-fabric:${project.jei_version}") + + annotationProcessor modImplementation("io.wispforest:owo-lib:${project.owo_version}") + + modImplementation("com.terraformersmc:modmenu:${project.modmenu_version}") // Uncomment the following line to enable the deprecated Fabric API modules. // These are included in the Fabric API production distribution and allow you to update your mod to the latest modules at a later more convenient time. diff --git a/gradle.properties b/gradle.properties index 5458e77..d8fe6d8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,15 +4,22 @@ org.gradle.parallel=true # Fabric Properties # check these on https://fabricmc.net/develop -minecraft_version=1.20.4 -yarn_mappings=1.20.4+build.3 +minecraft_version=1.20.1 +yarn_mappings=1.20.1+build.10 loader_version=0.15.11 # Fabric API -fabric_version=0.97.0+1.20.4 +fabric_version=0.92.2+1.20.1 # Mod Properties mod_version=1.22.4.2-fabric maven_group=at.ridgo8.moreoverlays archives_base_name=moreoverlays +# Config Properties +owo_version=0.11.2+1.20 +modmenu_version=7.2.2 + +# Dependencies Properties +jei_minecraft_version=1.20.1 +jei_version=15.10.0.29 \ No newline at end of file diff --git a/src/client/java/at/ridgo8/moreoverlays/MoreOverlays.java b/src/client/java/at/ridgo8/moreoverlays/MoreOverlays.java index 1a6ba16..d56bfff 100644 --- a/src/client/java/at/ridgo8/moreoverlays/MoreOverlays.java +++ b/src/client/java/at/ridgo8/moreoverlays/MoreOverlays.java @@ -2,8 +2,7 @@ import at.ridgo8.moreoverlays.chunkbounds.ChunkBoundsHandler; import at.ridgo8.moreoverlays.chunkbounds.ChunkBoundsHandler.RenderMode; -import at.ridgo8.moreoverlays.config.Config; -import at.ridgo8.moreoverlays.itemsearch.GuiRenderer; +import at.ridgo8.moreoverlays.config.MoreOverlaysConfig; import at.ridgo8.moreoverlays.lightoverlay.LightOverlayHandler; import org.apache.logging.log4j.LogManager; @@ -23,6 +22,8 @@ public class MoreOverlays implements ModInitializer { public static Logger logger = LogManager.getLogger(NAME); + public static MoreOverlaysConfig Config = MoreOverlaysConfig.createAndLoad(); + @Override public void onInitialize() { @@ -44,7 +45,6 @@ public void onInitialize() { }); - Config.initialize(); ClientRegistrationHandler.setupClient(); } } \ No newline at end of file diff --git a/src/client/java/at/ridgo8/moreoverlays/api/lightoverlay/LightScannerBase.java b/src/client/java/at/ridgo8/moreoverlays/api/lightoverlay/LightScannerBase.java index 3b078f9..a7282e2 100644 --- a/src/client/java/at/ridgo8/moreoverlays/api/lightoverlay/LightScannerBase.java +++ b/src/client/java/at/ridgo8/moreoverlays/api/lightoverlay/LightScannerBase.java @@ -1,6 +1,6 @@ package at.ridgo8.moreoverlays.api.lightoverlay; -import at.ridgo8.moreoverlays.config.Config; +import static at.ridgo8.moreoverlays.MoreOverlays.Config; import net.minecraft.core.Holder; import net.minecraft.world.entity.MobCategory; import net.minecraft.world.entity.player.Player; @@ -22,9 +22,9 @@ public void update(Player player) { int py = (int) Math.floor(player.getY()); int pz = (int) Math.floor(player.getZ()); - int y1 = py - Config.light_DownRange; - int y2 = py + Config.light_UpRange; - int HRange = Config.light_HRange; + int y1 = py - Config.light_DownRange(); + int y2 = py + Config.light_UpRange(); + int HRange = Config.light_HRange(); overlayCache.clear(); @@ -82,7 +82,7 @@ public boolean shouldCheck(BlockPos pos, Level world) { if(world.isClientSide){ return true; } - if (Config.light_IgnoreSpawnList) { + if (Config.light_IgnoreSpawnList()) { return true; } Holder biome = world.getBiome(pos); diff --git a/src/client/java/at/ridgo8/moreoverlays/chunkbounds/ChunkBoundsRenderer.java b/src/client/java/at/ridgo8/moreoverlays/chunkbounds/ChunkBoundsRenderer.java index cfda496..a48ab78 100644 --- a/src/client/java/at/ridgo8/moreoverlays/chunkbounds/ChunkBoundsRenderer.java +++ b/src/client/java/at/ridgo8/moreoverlays/chunkbounds/ChunkBoundsRenderer.java @@ -1,6 +1,6 @@ package at.ridgo8.moreoverlays.chunkbounds; -import at.ridgo8.moreoverlays.config.Config; +import static at.ridgo8.moreoverlays.MoreOverlays.Config; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.*; import org.joml.Matrix4d; @@ -18,7 +18,7 @@ public static void renderOverlays(PoseStack matrixstack) { RenderSystem.enableDepthTest(); RenderSystem.disableBlend(); - RenderSystem.lineWidth((float) (double) Config.render_chunkLineWidth); + RenderSystem.lineWidth((float) (double) Config.render_chunkLineWidth()); RenderSystem.setShader(GameRenderer::getPositionColorShader); @@ -67,10 +67,10 @@ public static void renderOverlays(PoseStack matrixstack) { final int regionBorderY1 = regionBorderY0 + (ChunkBoundsHandler.REGION_SIZEY_CUBIC * 16) - 128; final int regionBorderZ1 = regionBorderZ0 + (ChunkBoundsHandler.REGION_SIZEZ * 16); - final int radius = Config.chunk_EdgeRadius * 16; - final int renderColorEdge = Config.render_chunkEdgeColor; - final int renderColorMiddle = Config.render_chunkMiddleColor; - final int renderColorGrid = Config.render_chunkGridColor; + final int radius = Config.chunk_EdgeRadius() * 16; + final int renderColorEdge = Config.render_chunkEdgeColor().rgb(); + final int renderColorMiddle = Config.render_chunkMiddleColor().rgb(); + final int renderColorGrid = Config.render_chunkGridColor().rgb(); for (int xo = -16 - radius; xo <= radius; xo += 16) { @@ -79,7 +79,7 @@ public static void renderOverlays(PoseStack matrixstack) { } } - if (Config.chunk_ShowMiddle) { + if (Config.chunk_ShowMiddle()) { renderEdge(matrixstack, x2, z2, h3, h, renderColorMiddle); } diff --git a/src/client/java/at/ridgo8/moreoverlays/config/Config.java b/src/client/java/at/ridgo8/moreoverlays/config/Config.java deleted file mode 100644 index 06d38b2..0000000 --- a/src/client/java/at/ridgo8/moreoverlays/config/Config.java +++ /dev/null @@ -1,64 +0,0 @@ -package at.ridgo8.moreoverlays.config; - - -public class Config { - - public static int light_UpRange; - public static int light_DownRange; - public static int light_HRange; - public static boolean light_IgnoreLayer; - public static boolean light_IgnoreSpawnList; - public static boolean light_SimpleEntityCheck; - public static int light_SaveLevel; - public static boolean light_FinishedMigration; - - public static int chunk_EdgeRadius; - public static boolean chunk_ShowMiddle; - - public static int render_chunkEdgeColor; - public static int render_chunkGridColor; - public static int render_chunkMiddleColor; - public static double render_chunkLineWidth; - public static int render_spawnAColor; - public static int render_spawnNColor; - public static double render_spawnLineWidth; - - public static boolean search_enabled; - public static boolean search_searchCustom; - public static int search_searchBoxColor; - public static int search_filteredSlotColor; - public static double search_filteredSlotTransparancy; - - - public static void initialize() { - // Settings for the light / mobspawn overlay - light_UpRange = 4; - light_DownRange = 16; - light_HRange = 16; - light_IgnoreLayer = false; - light_IgnoreSpawnList = false; - light_SimpleEntityCheck = false; - light_SaveLevel = 1; - light_FinishedMigration = true; - - // Settings for the chunk bounds overlay - chunk_EdgeRadius = 1; - chunk_ShowMiddle = true; - - // General render settings.\nLine thickness, Colors, ... - render_chunkEdgeColor = 0xFF0000; - render_chunkGridColor = 0x00FF00; - render_chunkMiddleColor = 0xFFFF00; - render_chunkLineWidth = 1.5; - render_spawnAColor = 0xFF0000; - render_spawnNColor = 0xFFFF00; - render_spawnLineWidth = 2; - - // Settings for the search overlay - search_enabled = true; - search_searchCustom = true; - search_searchBoxColor = 0xFFFF00; - search_filteredSlotColor = 0x000000; - search_filteredSlotTransparancy = 0.5F; - } -} diff --git a/src/client/java/at/ridgo8/moreoverlays/config/MoreOverlaysConfigModel.java b/src/client/java/at/ridgo8/moreoverlays/config/MoreOverlaysConfigModel.java new file mode 100644 index 0000000..493881f --- /dev/null +++ b/src/client/java/at/ridgo8/moreoverlays/config/MoreOverlaysConfigModel.java @@ -0,0 +1,50 @@ +package at.ridgo8.moreoverlays.config; +import at.ridgo8.moreoverlays.MoreOverlays; +import io.wispforest.owo.config.annotation.Config; +import io.wispforest.owo.config.annotation.Modmenu; +import io.wispforest.owo.config.annotation.RangeConstraint; +import io.wispforest.owo.config.annotation.SectionHeader; +import io.wispforest.owo.ui.core.Color; + + +@Modmenu(modId = MoreOverlays.MOD_ID) +@Config(name = MoreOverlays.MOD_ID + "-config-fabric", wrapperName = "MoreOverlaysConfig") +public class MoreOverlaysConfigModel { + + @SectionHeader("lightoverlay") + @RangeConstraint(min = 0, max = 255) + public int light_UpRange = 4; + @RangeConstraint(min = 0, max = 255) + public int light_DownRange = 16; + @RangeConstraint(min = 0, max = 255) + public int light_HRange = 16; + public boolean light_IgnoreLayer = false; + public boolean light_IgnoreSpawnList = false; + public boolean light_SimpleEntityCheck = false; + @RangeConstraint(min = 0, max = 16) + public int light_SaveLevel = 1; + + @SectionHeader("chunkbounds") + @RangeConstraint(min = 0, max = 255) + public int chunk_EdgeRadius = 1; + public boolean chunk_ShowMiddle = true; + + @SectionHeader("rendersettings") + public Color render_chunkEdgeColor = Color.ofRgb(0xFF0000); + public Color render_chunkGridColor = Color.ofRgb(0x00FF00); + public Color render_chunkMiddleColor = Color.ofRgb(0xFFFF00); + @RangeConstraint(min = 0d, max = 16d) + public double render_chunkLineWidth = 1.5; + public Color render_spawnAColor = Color.ofRgb(0xFF0000); + public Color render_spawnNColor = Color.ofRgb(0xFFFF00); + @RangeConstraint(min = 0d, max = 16d) + public double render_spawnLineWidth = 2; + + @SectionHeader("itemsearch") + public boolean search_enabled = true; + public boolean search_searchCustom = true; + public Color search_searchBoxColor = Color.ofRgb(0xFFFF00); + public Color search_filteredSlotColor = Color.ofRgb(0x000000); + @RangeConstraint(min = 0d, max = 1d) + public double search_filteredSlotTransparancy = 0.5d; +} \ No newline at end of file diff --git a/src/client/java/at/ridgo8/moreoverlays/itemsearch/GuiRenderer.java b/src/client/java/at/ridgo8/moreoverlays/itemsearch/GuiRenderer.java index 048eac9..d73d381 100644 --- a/src/client/java/at/ridgo8/moreoverlays/itemsearch/GuiRenderer.java +++ b/src/client/java/at/ridgo8/moreoverlays/itemsearch/GuiRenderer.java @@ -18,6 +18,7 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.phys.Vec2; +import java.util.List; import java.util.Map; public class GuiRenderer { @@ -176,6 +177,10 @@ private void checkSlots(AbstractContainerScreen container) { } else { views.clear(); } + + List filteredIngredients = JeiModule.filter.getFilteredIngredients(VanillaTypes.ITEM_STACK); +// if(filteredIngredients.size() > Config.search_maxResults.get()) return; + for (Slot slot : container.getMenu().slots) { SlotViewWrapper wrapper; if (!views.containsKey(slot)) { @@ -185,14 +190,14 @@ private void checkSlots(AbstractContainerScreen container) { wrapper = views.get(slot); } - wrapper.setEnableOverlay(wrapper.getView().canSearch() && !isSearchedItem(slot.getItem())); + wrapper.setEnableOverlay(wrapper.getView().canSearch() && !isSearchedItem(slot.getItem(), filteredIngredients)); } } - private boolean isSearchedItem(ItemStack stack) { + private boolean isSearchedItem(ItemStack stack,List filteredIngredients) { if (emptyFilter) return true; else if (stack.isEmpty()) return false; - for (Object ingredient : JeiModule.filter.getFilteredIngredients(VanillaTypes.ITEM_STACK)) { + for (Object ingredient : filteredIngredients) { if (ItemUtils.ingredientMatches(ingredient, stack)) { return true; } diff --git a/src/client/java/at/ridgo8/moreoverlays/lightoverlay/LightOverlayHandler.java b/src/client/java/at/ridgo8/moreoverlays/lightoverlay/LightOverlayHandler.java index de2fb5c..6286e22 100644 --- a/src/client/java/at/ridgo8/moreoverlays/lightoverlay/LightOverlayHandler.java +++ b/src/client/java/at/ridgo8/moreoverlays/lightoverlay/LightOverlayHandler.java @@ -4,7 +4,7 @@ import at.ridgo8.moreoverlays.api.lightoverlay.ILightRenderer; import at.ridgo8.moreoverlays.api.lightoverlay.ILightScanner; import at.ridgo8.moreoverlays.api.lightoverlay.LightOverlayReloadHandlerEvent; -import at.ridgo8.moreoverlays.config.Config; +import static at.ridgo8.moreoverlays.MoreOverlays.Config; import net.minecraft.ChatFormatting; import net.minecraft.client.Minecraft; @@ -47,7 +47,7 @@ public static void reloadHandler() { } private static void reloadHandlerInternal() { - LightOverlayReloadHandlerEvent event = new LightOverlayReloadHandlerEvent(Config.light_IgnoreSpawnList, LightOverlayRenderer.class, LightScannerVanilla.class); + LightOverlayReloadHandlerEvent event = new LightOverlayReloadHandlerEvent(Config.light_IgnoreSpawnList(), LightOverlayRenderer.class, LightScannerVanilla.class); if (renderer == null || renderer.getClass() != event.getRenderer()) { try { diff --git a/src/client/java/at/ridgo8/moreoverlays/lightoverlay/LightOverlayRenderer.java b/src/client/java/at/ridgo8/moreoverlays/lightoverlay/LightOverlayRenderer.java index af2e2ca..0cbee2a 100644 --- a/src/client/java/at/ridgo8/moreoverlays/lightoverlay/LightOverlayRenderer.java +++ b/src/client/java/at/ridgo8/moreoverlays/lightoverlay/LightOverlayRenderer.java @@ -2,7 +2,7 @@ import at.ridgo8.moreoverlays.api.lightoverlay.ILightRenderer; import at.ridgo8.moreoverlays.api.lightoverlay.ILightScanner; -import at.ridgo8.moreoverlays.config.Config; +import static at.ridgo8.moreoverlays.MoreOverlays.Config; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.*; import org.joml.Matrix4d; @@ -85,7 +85,7 @@ private static void drawVertex(Matrix4d matrix, double x, double y, double z, fl public void renderOverlays(ILightScanner scanner, PoseStack matrixstack) { RenderSystem.enableDepthTest(); RenderSystem.disableBlend(); - RenderSystem.lineWidth((float) (double) Config.render_chunkLineWidth); + RenderSystem.lineWidth((float) (double) Config.render_chunkLineWidth()); RenderSystem.setShader(GameRenderer::getPositionColorShader); if (Minecraft.getInstance().options.graphicsMode().get() != GraphicsStatus.FABULOUS) { @@ -93,13 +93,13 @@ public void renderOverlays(ILightScanner scanner, PoseStack matrixstack) { RenderSystem.enableCull(); } - float ar = ((float) ((Config.render_spawnAColor >> 16) & 0xFF)) / 255F; - float ag = ((float) ((Config.render_spawnAColor >> 8) & 0xFF)) / 255F; - float ab = ((float) (Config.render_spawnAColor & 0xFF)) / 255F; + float ar = ((float) ((Config.render_spawnAColor().rgb() >> 16) & 0xFF)) / 255F; + float ag = ((float) ((Config.render_spawnAColor().rgb() >> 8) & 0xFF)) / 255F; + float ab = ((float) (Config.render_spawnAColor().rgb() & 0xFF)) / 255F; - float nr = ((float) ((Config.render_spawnNColor >> 16) & 0xFF)) / 255F; - float ng = ((float) ((Config.render_spawnNColor >> 8) & 0xFF)) / 255F; - float nb = ((float) (Config.render_spawnNColor & 0xFF)) / 255F; + float nr = ((float) ((Config.render_spawnNColor().rgb() >> 16) & 0xFF)) / 255F; + float ng = ((float) ((Config.render_spawnNColor().rgb() >> 8) & 0xFF)) / 255F; + float nb = ((float) (Config.render_spawnNColor().rgb() & 0xFF)) / 255F; renderer.begin(VertexFormat.Mode.DEBUG_LINES, DefaultVertexFormat.POSITION_COLOR); for (Pair entry : scanner.getLightModes()) { diff --git a/src/client/java/at/ridgo8/moreoverlays/lightoverlay/LightScannerVanilla.java b/src/client/java/at/ridgo8/moreoverlays/lightoverlay/LightScannerVanilla.java index 6d2d268..a10c927 100644 --- a/src/client/java/at/ridgo8/moreoverlays/lightoverlay/LightScannerVanilla.java +++ b/src/client/java/at/ridgo8/moreoverlays/lightoverlay/LightScannerVanilla.java @@ -1,7 +1,7 @@ package at.ridgo8.moreoverlays.lightoverlay; import at.ridgo8.moreoverlays.api.lightoverlay.LightScannerBase; -import at.ridgo8.moreoverlays.config.Config; +import static at.ridgo8.moreoverlays.MoreOverlays.Config; import com.google.common.collect.Lists; import net.minecraft.world.level.block.state.BlockState; @@ -34,15 +34,15 @@ public LightScannerVanilla() { private static boolean checkCollision(BlockPos pos, Level world) { BlockState block1 = world.getBlockState(pos); - if (block1.isCollisionShapeFullBlock(world, pos) || (!Config.light_IgnoreLayer && world.getBlockState(pos.above()).isCollisionShapeFullBlock(world, pos.above()))) //Don't check because a check on normal Cubes will/should return false ( 99% collide ). + if (block1.isCollisionShapeFullBlock(world, pos) || (!Config.light_IgnoreLayer() && world.getBlockState(pos.above()).isCollisionShapeFullBlock(world, pos.above()))) //Don't check because a check on normal Cubes will/should return false ( 99% collide ). return false; - else if (world.isEmptyBlock(pos) && (Config.light_IgnoreLayer || world.isEmptyBlock(pos.above()))) //Don't check because Air has no Collision Box + else if (world.isEmptyBlock(pos) && (Config.light_IgnoreLayer() || world.isEmptyBlock(pos.above()))) //Don't check because Air has no Collision Box return true; AABB bb = TEST_BB.move(pos.getX(), pos.getY(), pos.getZ()); List bbCollisions = Lists.newArrayList(world.getBlockCollisions(null, bb)); if (bbCollisions.size() == 0 && !world.containsAnyLiquid(bb)) { - if (Config.light_IgnoreLayer) + if (Config.light_IgnoreLayer()) return true; else { AABB bb2 = bb.move(0, 1, 0); @@ -65,7 +65,7 @@ private static boolean isChiselsAndBitsLoaded(){ @Override public byte getSpawnModeAt(BlockPos pos, Level world) { - if (world.getBrightness(LightLayer.BLOCK, pos) >= Config.light_SaveLevel) + if (world.getBrightness(LightLayer.BLOCK, pos) >= Config.light_SaveLevel()) return 0; final BlockPos blockPos = pos.below(); @@ -83,7 +83,7 @@ public byte getSpawnModeAt(BlockPos pos, Level world) { return 0; final BlockState state = world.getBlockState(blockPos); - if (!Config.light_SimpleEntityCheck) { + if (!Config.light_SimpleEntityCheck()) { boolean hasSpawnable = false; for (final EntityType type : this.typesToCheck) { if (state.isValidSpawn(world, blockPos, type)) { @@ -99,7 +99,7 @@ public byte getSpawnModeAt(BlockPos pos, Level world) { return 0; } - if (world.getBrightness(LightLayer.SKY, pos) >= Config.light_SaveLevel) + if (world.getBrightness(LightLayer.SKY, pos) >= Config.light_SaveLevel()) return 1; return 2; diff --git a/src/client/java/at/ridgo8/moreoverlays/mixin/client/MixinOverlayRenderer.java b/src/client/java/at/ridgo8/moreoverlays/mixin/client/MixinOverlayRenderer.java index 6b1733d..26fd7a1 100644 --- a/src/client/java/at/ridgo8/moreoverlays/mixin/client/MixinOverlayRenderer.java +++ b/src/client/java/at/ridgo8/moreoverlays/mixin/client/MixinOverlayRenderer.java @@ -22,44 +22,30 @@ public class MixinOverlayRenderer { @Inject(at = @At("TAIL"), method = "render") private void onRender(GuiGraphics guiGraphics, float f, CallbackInfo ci) { Minecraft mc = Minecraft.getInstance(); - try { - if (mc.getDebugOverlay().showDebugScreen()) { + try{ + Field renderDebugField = null; + // Use reflection to check if the renderDebug field exists in mc.options. Note: remove this for future versions + try{ + renderDebugField = mc.options.getClass().getDeclaredField("field_1866"); + renderDebugField.setAccessible(true); + } catch(Exception o){ + renderDebugField = mc.options.getClass().getField("renderDebug"); + } + + boolean renderDebug = renderDebugField.getBoolean(mc.options); + + if (renderDebug) { return; } - // Checks if the debug screen is not shown + if (!ChunkBoundsHandler.regionInfo.isEmpty()) { int y = 0; for (String text : ChunkBoundsHandler.regionInfo) { guiGraphics.drawString(mc.font, text, 10, y += 10, 0xFFFFFF); } } - } catch (NoSuchMethodError e) { - try{ - Field renderDebugField = null; - // Use reflection to check if the renderDebug field exists in mc.options. Note: remove this for future versions - try{ - renderDebugField = mc.options.getClass().getDeclaredField("field_1866"); - renderDebugField.setAccessible(true); - } catch(Exception o){ - renderDebugField = mc.options.getClass().getField("renderDebug"); - } - - boolean renderDebug = renderDebugField.getBoolean(mc.options); - - if (renderDebug) { - return; - } - - if (!ChunkBoundsHandler.regionInfo.isEmpty()) { - int y = 0; - for (String text : ChunkBoundsHandler.regionInfo) { - guiGraphics.drawString(mc.font, text, 10, y += 10, 0xFFFFFF); - } - } - } catch(Exception g){ - // Ignore - } - + } catch(Exception g){ + // Ignore } } } diff --git a/src/client/resources/assets/moreoverlays/lang/en_us.json b/src/client/resources/assets/moreoverlays/lang/en_us.json index ed3a855..821b6c7 100644 --- a/src/client/resources/assets/moreoverlays/lang/en_us.json +++ b/src/client/resources/assets/moreoverlays/lang/en_us.json @@ -1,16 +1,39 @@ { - "key.moreoverlays.category": "More Overlays Updated", - "key.moreoverlays.chunkbounds.desc": "Toggle Chunk Boundaries", - "key.moreoverlays.lightoverlay.desc": "Toggle Light Overlay", + "text.config.moreoverlays-config-fabric.category": "More Overlays Updated", - "gui.config.moreoverlays.tile": "More Overlays Updated Settings", - "gui.config.moreoverlays.reset_config": "Reset Settings", - "gui.config.moreoverlays.undo": "Undo Changes", - "gui.config.moreoverlays.save": "Save", - "config.moreoverlays.category.lightoverlay": "Light Overlay", - "config.moreoverlays.category.chunkbounds": "Chunk Boundaries", - "config.moreoverlays.category.itemsearch": "Item Search", - "config.moreoverlays.category.searchoverlay": "Item Search Overlay", - "config.moreoverlays.category.rendersettings": "Render Settings" -} + "text.config.moreoverlays-config-fabric.title": "More Overlays Updated Settings", + + "text.config.moreoverlays-config-fabric.section.lightoverlay": "Light Overlay", + "text.config.moreoverlays-config-fabric.section.chunkbounds": "Chunk Boundaries", + "text.config.moreoverlays-config-fabric.section.itemsearch": "Item Search", + "text.config.moreoverlays-config-fabric.section.rendersettings": "Render Settings", + "text.config.moreoverlays-config-fabric.section.searchoverlay": "Item Search Overlay", + + "text.config.moreoverlays-config-fabric.option.light_UpRange": "Up Range", + "text.config.moreoverlays-config-fabric.option.light_DownRange": "Down Range", + "text.config.moreoverlays-config-fabric.option.light_HRange": "Horizontal Range", + "text.config.moreoverlays-config-fabric.option.light_IgnoreLayer": "Ignore Layer", + "text.config.moreoverlays-config-fabric.option.light_IgnoreSpawnList": "Ignore Spawnlist", + "text.config.moreoverlays-config-fabric.option.light_SimpleEntityCheck": "Simple Check", + "text.config.moreoverlays-config-fabric.option.light_SaveLevel": "Safe Light Level", + + "text.config.moreoverlays-config-fabric.option.chunk_EdgeRadius": "Edge Radius", + "text.config.moreoverlays-config-fabric.option.chunk_ShowMiddle": "Show Mid Point", + + "text.config.moreoverlays-config-fabric.option.render_chunkEdgeColor": "Chunk: Edge Color", + "text.config.moreoverlays-config-fabric.option.render_chunkGridColor": "Chunk: Grid Color", + "text.config.moreoverlays-config-fabric.option.render_chunkMiddleColor": "Chunk: Middle Color", + "text.config.moreoverlays-config-fabric.option.render_chunkLineWidth": "Chunk: Line Width", + "text.config.moreoverlays-config-fabric.option.render_spawnAColor": "Spawn: Color", + "text.config.moreoverlays-config-fabric.option.render_spawnNColor": "Spawn: Night Color", + "text.config.moreoverlays-config-fabric.option.render_spawnLineWidth": "Spawn: Line Width", + + "text.config.moreoverlays-config-fabric.option.search_enabled": "Enable Search", + "text.config.moreoverlays-config-fabric.option.search_searchCustom": "Search Custom", + "text.config.moreoverlays-config-fabric.option.search_searchTooltip": "Search Tooltip", + "text.config.moreoverlays-config-fabric.option.search_searchMaxResults": "Max Search Results", + "text.config.moreoverlays-config-fabric.option.search_searchBoxColor": "Search Box Color", + "text.config.moreoverlays-config-fabric.option.search_filteredSlotColor": "Slot Color", + "text.config.moreoverlays-config-fabric.option.search_filteredSlotTransparancy": "Slot Transparency" +} \ No newline at end of file