From ab612647847b99ac7eb2a93e407e0ad352c13632 Mon Sep 17 00:00:00 2001 From: sisby-folk Date: Sat, 19 Aug 2023 14:10:07 +1000 Subject: [PATCH 1/9] demo text > biome --- gradle.properties | 2 +- .../lambdamap/gui/WorldMapWidget.java | 37 +++++++++++++------ 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/gradle.properties b/gradle.properties index b0f1f61..14a9973 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,7 +8,7 @@ fabric_api_version=7.0.6+0.85.0 qsl_version=6.0.4 # Mod properties -mod_version=1.0.0-alpha.1 +mod_version=1.0.0-bc23.1 maven_group=dev.lambdaurora archives_base_name=lambdamap diff --git a/src/main/java/dev/lambdaurora/lambdamap/gui/WorldMapWidget.java b/src/main/java/dev/lambdaurora/lambdamap/gui/WorldMapWidget.java index ea56107..f5b9efa 100644 --- a/src/main/java/dev/lambdaurora/lambdamap/gui/WorldMapWidget.java +++ b/src/main/java/dev/lambdaurora/lambdamap/gui/WorldMapWidget.java @@ -27,6 +27,7 @@ import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.render.VertexConsumerProvider; +import net.minecraft.text.Text; import net.minecraft.util.math.MathHelper; import org.lwjgl.glfw.GLFW; @@ -133,24 +134,36 @@ protected void renderWidget(GuiGraphics graphics, int mouseX, int mouseY, float if (this.renderer.scale() != 1) { scaleCompensation = this.renderer.scale(); } + + // BlanketCon Demo Disclaimer + if (mouseXOffset <= 0 || mouseYOffset < this.renderer.height() * this.scale) { + String demoText = "BlanketCon 2023"; + int width = this.client.textRenderer.getWidth(demoText); + graphics.drawShadowedText(this.client.textRenderer, demoText, this.getX() + this.getWidth() - 5 - width, this.getY() + this.getHeight() - 9, 0xffffffff); + } else { + String demoText = "Issues: #bc23-bugs"; + int width = this.client.textRenderer.getWidth(demoText); + graphics.drawShadowedText(this.client.textRenderer, demoText, this.getX() + this.getWidth() - 5 - width, this.getY() + this.getHeight() - 9, 0xffffffff); + } + if (mouseXOffset > 0 && mouseXOffset < this.renderer.width() * this.scale && mouseYOffset > 0 && mouseYOffset < this.renderer.height() * this.scale) { float x = this.renderer.cornerX() + mouseXOffset * scaleCompensation; float z = this.renderer.cornerZ() + mouseYOffset * scaleCompensation; graphics.drawCenteredShadowedText(this.client.textRenderer, String.format("X: %.1f Z: %.1f", x, z), this.getX() + this.getWidth() / 2, this.getY() + this.getHeight() - 9, 0xffffffff); - var chunk = this.renderer.worldMap().getChunk(MapChunk.blockToChunk((int) x), MapChunk.blockToChunk((int) z)); - if (chunk != null) { - var biome = chunk.getBiome((int) x, (int) z); - var registry = this.renderer.worldMap().getBiomeRegistry(); - if (biome != null && registry != null) { - var id = registry.getId(biome); - if (id != null) { - int width = this.client.textRenderer.getWidth(id.toString()); - graphics.drawShadowedText(this.client.textRenderer, id.toString(), this.getX() + this.getWidth() - 5 - width, this.getY() + this.getHeight() - 9, 0xffffffff); - } - } - } +// var chunk = this.renderer.worldMap().getChunk(MapChunk.blockToChunk((int) x), MapChunk.blockToChunk((int) z)); +// if (chunk != null) { +// var biome = chunk.getBiome((int) x, (int) z); +// var registry = this.renderer.worldMap().getBiomeRegistry(); +// if (biome != null && registry != null) { +// var id = registry.getId(biome); +// if (id != null) { +// int width = this.client.textRenderer.getWidth(id.toString()); +// graphics.drawShadowedText(this.client.textRenderer, id.toString(), this.getX() + this.getWidth() - 5 - width, this.getY() + this.getHeight() - 9, 0xffffffff); +// } +// } +// } } var scale = "1:" + this.renderer.scale(); From f04504754996d73c41943e1ea4675f750a21218e Mon Sep 17 00:00:00 2001 From: sisby-folk Date: Sat, 19 Aug 2023 14:41:35 +1000 Subject: [PATCH 2/9] hideable map markers --- .../lambdamap/LambdaMapConfig.java | 20 +++++++++++++++++++ .../lambdamap/gui/WorldMapScreen.java | 7 +++++-- .../lambdamap/gui/WorldMapWidget.java | 2 -- .../assets/lambdamap/lang/en_us.json | 1 + 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/main/java/dev/lambdaurora/lambdamap/LambdaMapConfig.java b/src/main/java/dev/lambdaurora/lambdamap/LambdaMapConfig.java index 2a1df02..d100613 100644 --- a/src/main/java/dev/lambdaurora/lambdamap/LambdaMapConfig.java +++ b/src/main/java/dev/lambdaurora/lambdamap/LambdaMapConfig.java @@ -45,6 +45,7 @@ public final class LambdaMapConfig { private static final boolean DEFAULT_RENDER_BIOME_COLORS = true; private static final boolean DEFAULT_SHOW_HUD = true; + private static final boolean DEFAULT_SHOW_MARKER_EDITOR = false; private static final int DEFAULT_HUD_SCALE = 2; private static final boolean DEFAULT_SHOW_DIRECTION_INDICATORS = true; private static final boolean DEFAULT_NORTH_LOCK = false; @@ -58,6 +59,7 @@ public final class LambdaMapConfig { private final SpruceOption renderBiomeColorsOption; private final SpruceOption showHudOption; + private final SpruceOption showMarkerEditorOption; private final SpruceOption hudScaleOption; private final SpruceOption northLockOption; private final SpruceOption directionIndicatorsOption; @@ -65,6 +67,7 @@ public final class LambdaMapConfig { private boolean renderBiomeColors; private boolean showHud; + private boolean showMarkerEditor; private int hudScale; private boolean northLock; private boolean showDirectionIndicators; @@ -82,6 +85,8 @@ public LambdaMapConfig(LambdaMap mod) { }, null, true); this.showHudOption = new SpruceCheckboxBooleanOption("lambdamap.config.hud.visible", this::isHudVisible, this::setHudVisible, null, true); + this.showMarkerEditorOption = new SpruceCheckboxBooleanOption("lambdamap.config.show_marker_editor", + this::isMarkerEditorVisible, this::setMarkerEditorVisible, null, true); this.hudScaleOption = new SpruceCyclingOption("lambdamap.config.hud.scale", amount -> this.setHudScale((this.hudScale + amount) % 4), option -> option.getDisplayText(Text.literal(String.valueOf(this.getHudScale()))), Text.translatable("lambdamap.config.hud.scale.tooltip")); @@ -113,6 +118,7 @@ public void load() { this.renderBiomeColors = this.config.getOrElse("map.render_biome_colors", DEFAULT_RENDER_BIOME_COLORS); this.showHud = this.config.getOrElse("map.hud.visible", DEFAULT_SHOW_HUD); + this.showMarkerEditor = this.config.getOrElse("map.config.show_marker_editor", DEFAULT_SHOW_MARKER_EDITOR); this.hudScale = MathHelper.clamp(this.config.getIntOrElse("map.hud.scale", DEFAULT_HUD_SCALE), 1, 3); this.northLock = this.config.getOrElse("map.hud.north_lock", DEFAULT_NORTH_LOCK); this.showDirectionIndicators = this.config.getOrElse("map.hud.direction_indicators", DEFAULT_SHOW_DIRECTION_INDICATORS); @@ -175,6 +181,20 @@ public SpruceOption getShowHudOption() { return this.showHudOption; } + + public void setMarkerEditorVisible(Boolean visible) { + this.showMarkerEditor = visible; + this.config.set("map.config.show_marker_editor", visible); + } + + public Boolean isMarkerEditorVisible() { + return this.showMarkerEditor; + } + + public SpruceOption getShowMarkerEditorOption() { + return this.showMarkerEditorOption; + } + /** * {@return the scale of the map HUD} */ diff --git a/src/main/java/dev/lambdaurora/lambdamap/gui/WorldMapScreen.java b/src/main/java/dev/lambdaurora/lambdamap/gui/WorldMapScreen.java index c1c12e5..048ac7f 100644 --- a/src/main/java/dev/lambdaurora/lambdamap/gui/WorldMapScreen.java +++ b/src/main/java/dev/lambdaurora/lambdamap/gui/WorldMapScreen.java @@ -47,8 +47,10 @@ protected void init() { tabs.getList().setBackground(RandomPrideFlagBackground.random()); tabs.addTabEntry(Text.translatable("lambdamap.tabs.world_map"), Text.translatable("lambdamap.tabs.world_map.description").formatted(Formatting.GRAY), (width, height) -> new WorldMapWidget(Position.origin(), width, height)); - tabs.addTabEntry(Text.translatable("lambdamap.tabs.markers"), Text.translatable("lambdamap.tabs.markers.description").formatted(Formatting.GRAY), - (width, height) -> new MarkerTabWidget(mod, Position.origin(), width, height)); + if (this.mod.getConfig().isMarkerEditorVisible()) { + tabs.addTabEntry(Text.translatable("lambdamap.tabs.markers"), Text.translatable("lambdamap.tabs.markers.description").formatted(Formatting.GRAY), + (width, height) -> new MarkerTabWidget(mod, Position.origin(), width, height)); + } tabs.addTabEntry(Text.translatable("lambdamap.tabs.config"), Text.translatable("lambdamap.tabs.config.description").formatted(Formatting.GRAY), this::buildConfigTab); } @@ -59,6 +61,7 @@ private SpruceOptionListWidget buildConfigTab(int width, int height) { list.addSingleOptionEntry(new SpruceSeparatorOption("lambdamap.config.category.general", true, null)); list.addSingleOptionEntry(this.mod.getConfig().getRenderBiomeColorsOption()); + list.addSingleOptionEntry(this.mod.getConfig().getShowMarkerEditorOption()); list.addSingleOptionEntry(new SpruceSeparatorOption("lambdamap.config.category.hud", true, null)); list.addSingleOptionEntry(this.mod.getConfig().getShowHudOption()); list.addOptionEntry(this.mod.getConfig().getHudScaleOption(), null); diff --git a/src/main/java/dev/lambdaurora/lambdamap/gui/WorldMapWidget.java b/src/main/java/dev/lambdaurora/lambdamap/gui/WorldMapWidget.java index f5b9efa..bc257f6 100644 --- a/src/main/java/dev/lambdaurora/lambdamap/gui/WorldMapWidget.java +++ b/src/main/java/dev/lambdaurora/lambdamap/gui/WorldMapWidget.java @@ -19,7 +19,6 @@ import com.mojang.blaze3d.vertex.Tessellator; import dev.lambdaurora.lambdamap.LambdaMap; -import dev.lambdaurora.lambdamap.map.MapChunk; import dev.lambdaurora.spruceui.Position; import dev.lambdaurora.spruceui.navigation.NavigationDirection; import dev.lambdaurora.spruceui.util.ScissorManager; @@ -27,7 +26,6 @@ import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.text.Text; import net.minecraft.util.math.MathHelper; import org.lwjgl.glfw.GLFW; diff --git a/src/main/resources/assets/lambdamap/lang/en_us.json b/src/main/resources/assets/lambdamap/lang/en_us.json index cbabeb0..8f06fcf 100644 --- a/src/main/resources/assets/lambdamap/lang/en_us.json +++ b/src/main/resources/assets/lambdamap/lang/en_us.json @@ -1,6 +1,7 @@ { "lambdamap.config.category.general": "General", "lambdamap.config.render_biome_colors": "Render Biome Colors", + "lambdamap.config.show_marker_editor": "Show Marker Editor", "lambdamap.config.category.hud": "HUD", "lambdamap.config.hud.visible": "Show HUD", "lambdamap.config.hud.scale": "Scale", From 3d4374f686f568fecd3057cc492aea1a2ba10cd4 Mon Sep 17 00:00:00 2001 From: sisby-folk Date: Sat, 19 Aug 2023 15:02:57 +1000 Subject: [PATCH 3/9] focus mode --- .../lambdamap/LambdaMapConfig.java | 20 +++++++- .../lambdamap/gui/WorldMapScreen.java | 23 +++++---- .../lambdamap/gui/WorldMapWidget.java | 51 +++++++++---------- .../assets/lambdamap/lang/en_us.json | 1 + 4 files changed, 58 insertions(+), 37 deletions(-) diff --git a/src/main/java/dev/lambdaurora/lambdamap/LambdaMapConfig.java b/src/main/java/dev/lambdaurora/lambdamap/LambdaMapConfig.java index d100613..d76215e 100644 --- a/src/main/java/dev/lambdaurora/lambdamap/LambdaMapConfig.java +++ b/src/main/java/dev/lambdaurora/lambdamap/LambdaMapConfig.java @@ -46,6 +46,7 @@ public final class LambdaMapConfig { private static final boolean DEFAULT_RENDER_BIOME_COLORS = true; private static final boolean DEFAULT_SHOW_HUD = true; private static final boolean DEFAULT_SHOW_MARKER_EDITOR = false; + private static final boolean DEFAULT_FULLSCREEN = true; private static final int DEFAULT_HUD_SCALE = 2; private static final boolean DEFAULT_SHOW_DIRECTION_INDICATORS = true; private static final boolean DEFAULT_NORTH_LOCK = false; @@ -60,6 +61,7 @@ public final class LambdaMapConfig { private final SpruceOption renderBiomeColorsOption; private final SpruceOption showHudOption; private final SpruceOption showMarkerEditorOption; + private final SpruceOption doFullscreenOption; private final SpruceOption hudScaleOption; private final SpruceOption northLockOption; private final SpruceOption directionIndicatorsOption; @@ -68,6 +70,7 @@ public final class LambdaMapConfig { private boolean renderBiomeColors; private boolean showHud; private boolean showMarkerEditor; + private boolean doFullscreen; private int hudScale; private boolean northLock; private boolean showDirectionIndicators; @@ -87,6 +90,8 @@ public LambdaMapConfig(LambdaMap mod) { this::isHudVisible, this::setHudVisible, null, true); this.showMarkerEditorOption = new SpruceCheckboxBooleanOption("lambdamap.config.show_marker_editor", this::isMarkerEditorVisible, this::setMarkerEditorVisible, null, true); + this.doFullscreenOption = new SpruceCheckboxBooleanOption("lambdamap.config.fullscreen", + this::isFullscreen, this::setDoFullscreen, null, true); this.hudScaleOption = new SpruceCyclingOption("lambdamap.config.hud.scale", amount -> this.setHudScale((this.hudScale + amount) % 4), option -> option.getDisplayText(Text.literal(String.valueOf(this.getHudScale()))), Text.translatable("lambdamap.config.hud.scale.tooltip")); @@ -119,6 +124,7 @@ public void load() { this.renderBiomeColors = this.config.getOrElse("map.render_biome_colors", DEFAULT_RENDER_BIOME_COLORS); this.showHud = this.config.getOrElse("map.hud.visible", DEFAULT_SHOW_HUD); this.showMarkerEditor = this.config.getOrElse("map.config.show_marker_editor", DEFAULT_SHOW_MARKER_EDITOR); + this.doFullscreen = this.config.getOrElse("map.config.fullscreen", DEFAULT_FULLSCREEN); this.hudScale = MathHelper.clamp(this.config.getIntOrElse("map.hud.scale", DEFAULT_HUD_SCALE), 1, 3); this.northLock = this.config.getOrElse("map.hud.north_lock", DEFAULT_NORTH_LOCK); this.showDirectionIndicators = this.config.getOrElse("map.hud.direction_indicators", DEFAULT_SHOW_DIRECTION_INDICATORS); @@ -181,7 +187,6 @@ public SpruceOption getShowHudOption() { return this.showHudOption; } - public void setMarkerEditorVisible(Boolean visible) { this.showMarkerEditor = visible; this.config.set("map.config.show_marker_editor", visible); @@ -195,6 +200,19 @@ public SpruceOption getShowMarkerEditorOption() { return this.showMarkerEditorOption; } + public void setDoFullscreen(Boolean visible) { + this.doFullscreen = visible; + this.config.set("map.config.fullscreen", visible); + } + + public Boolean isFullscreen() { + return this.doFullscreen; + } + + public SpruceOption getDoFullscreenOption() { + return this.doFullscreenOption; + } + /** * {@return the scale of the map HUD} */ diff --git a/src/main/java/dev/lambdaurora/lambdamap/gui/WorldMapScreen.java b/src/main/java/dev/lambdaurora/lambdamap/gui/WorldMapScreen.java index 048ac7f..0d20458 100644 --- a/src/main/java/dev/lambdaurora/lambdamap/gui/WorldMapScreen.java +++ b/src/main/java/dev/lambdaurora/lambdamap/gui/WorldMapScreen.java @@ -43,16 +43,20 @@ public void removed() { protected void init() { super.init(); - SpruceTabbedWidget tabs = this.addDrawableChild(new SpruceTabbedWidget(Position.origin(), this.width, this.height, Text.literal("LambdaMap"))); - tabs.getList().setBackground(RandomPrideFlagBackground.random()); - tabs.addTabEntry(Text.translatable("lambdamap.tabs.world_map"), Text.translatable("lambdamap.tabs.world_map.description").formatted(Formatting.GRAY), - (width, height) -> new WorldMapWidget(Position.origin(), width, height)); - if (this.mod.getConfig().isMarkerEditorVisible()) { - tabs.addTabEntry(Text.translatable("lambdamap.tabs.markers"), Text.translatable("lambdamap.tabs.markers.description").formatted(Formatting.GRAY), - (width, height) -> new MarkerTabWidget(mod, Position.origin(), width, height)); + if (mod.getConfig().isFullscreen()) { + this.addDrawableChild(new WorldMapWidget(Position.origin(), width, height)); + } else { + SpruceTabbedWidget tabs = this.addDrawableChild(new SpruceTabbedWidget(Position.origin(), this.width, this.height, Text.literal("LambdaMap"))); + tabs.getList().setBackground(RandomPrideFlagBackground.random()); + tabs.addTabEntry(Text.translatable("lambdamap.tabs.world_map"), Text.translatable("lambdamap.tabs.world_map.description").formatted(Formatting.GRAY), + (width, height) -> new WorldMapWidget(Position.origin(), width, height)); + if (this.mod.getConfig().isMarkerEditorVisible()) { + tabs.addTabEntry(Text.translatable("lambdamap.tabs.markers"), Text.translatable("lambdamap.tabs.markers.description").formatted(Formatting.GRAY), + (width, height) -> new MarkerTabWidget(mod, Position.origin(), width, height)); + } + tabs.addTabEntry(Text.translatable("lambdamap.tabs.config"), Text.translatable("lambdamap.tabs.config.description").formatted(Formatting.GRAY), + this::buildConfigTab); } - tabs.addTabEntry(Text.translatable("lambdamap.tabs.config"), Text.translatable("lambdamap.tabs.config.description").formatted(Formatting.GRAY), - this::buildConfigTab); } private SpruceOptionListWidget buildConfigTab(int width, int height) { @@ -62,6 +66,7 @@ private SpruceOptionListWidget buildConfigTab(int width, int height) { list.addSingleOptionEntry(new SpruceSeparatorOption("lambdamap.config.category.general", true, null)); list.addSingleOptionEntry(this.mod.getConfig().getRenderBiomeColorsOption()); list.addSingleOptionEntry(this.mod.getConfig().getShowMarkerEditorOption()); + list.addSingleOptionEntry(this.mod.getConfig().getDoFullscreenOption()); list.addSingleOptionEntry(new SpruceSeparatorOption("lambdamap.config.category.hud", true, null)); list.addSingleOptionEntry(this.mod.getConfig().getShowHudOption()); list.addOptionEntry(this.mod.getConfig().getHudScaleOption(), null); diff --git a/src/main/java/dev/lambdaurora/lambdamap/gui/WorldMapWidget.java b/src/main/java/dev/lambdaurora/lambdamap/gui/WorldMapWidget.java index bc257f6..178879d 100644 --- a/src/main/java/dev/lambdaurora/lambdamap/gui/WorldMapWidget.java +++ b/src/main/java/dev/lambdaurora/lambdamap/gui/WorldMapWidget.java @@ -88,6 +88,14 @@ public boolean onNavigation(NavigationDirection direction, boolean tab) { @Override protected boolean onMouseClick(double mouseX, double mouseY, int button) { + double mouseXOffset = mouseX - this.getX(); + double mouseYOffset = mouseY - this.getY(); + + if (mouseXOffset > 0 && mouseXOffset < this.renderer.width() * this.scale && mouseYOffset > this.renderer.height() * this.scale) { + mod.getConfig().setDoFullscreen(!mod.getConfig().isFullscreen()); + client.setScreen(new WorldMapScreen()); + } + return button == GLFW.GLFW_MOUSE_BUTTON_1; } @@ -133,41 +141,30 @@ protected void renderWidget(GuiGraphics graphics, int mouseX, int mouseY, float scaleCompensation = this.renderer.scale(); } - // BlanketCon Demo Disclaimer + if (mouseXOffset > 0 && mouseXOffset < this.renderer.width() * this.scale && mouseYOffset > 0 && mouseYOffset < this.renderer.height() * this.scale) { + float x = this.renderer.cornerX() + mouseXOffset * scaleCompensation; + float z = this.renderer.cornerZ() + mouseYOffset * scaleCompensation; + graphics.drawCenteredShadowedText(this.client.textRenderer, String.format("X: %.1f Z: %.1f", x, z), + this.getX() + this.getWidth() / 2, this.getY() + this.getHeight() - 9, 0xffffffff); + } + + // BlanketCon Info Texts Setup if (mouseXOffset <= 0 || mouseYOffset < this.renderer.height() * this.scale) { String demoText = "BlanketCon 2023"; int width = this.client.textRenderer.getWidth(demoText); graphics.drawShadowedText(this.client.textRenderer, demoText, this.getX() + this.getWidth() - 5 - width, this.getY() + this.getHeight() - 9, 0xffffffff); + + var scale = "1:" + this.renderer.scale(); + if (this.intScale < 0) { + scale = -this.intScale + ":1"; + } + graphics.drawShadowedText(this.client.textRenderer, scale, this.getX(), this.getY() + this.getHeight() - 9, 0xffffffff); } else { String demoText = "Issues: #bc23-bugs"; int width = this.client.textRenderer.getWidth(demoText); graphics.drawShadowedText(this.client.textRenderer, demoText, this.getX() + this.getWidth() - 5 - width, this.getY() + this.getHeight() - 9, 0xffffffff); + graphics.drawShadowedText(this.client.textRenderer, "LambdaMap", this.getX(), this.getY() + this.getHeight() - 9, 0xffffffff); + graphics.drawCenteredShadowedText(this.client.textRenderer, "[Toggle Fullscreen]", this.getX() + this.getWidth() / 2, this.getY() + this.getHeight() - 9, 0xffffffff); } - - if (mouseXOffset > 0 && mouseXOffset < this.renderer.width() * this.scale && mouseYOffset > 0 && mouseYOffset < this.renderer.height() * this.scale) { - float x = this.renderer.cornerX() + mouseXOffset * scaleCompensation; - float z = this.renderer.cornerZ() + mouseYOffset * scaleCompensation; - graphics.drawCenteredShadowedText(this.client.textRenderer, String.format("X: %.1f Z: %.1f", x, z), - this.getX() + this.getWidth() / 2, this.getY() + this.getHeight() - 9, 0xffffffff); - -// var chunk = this.renderer.worldMap().getChunk(MapChunk.blockToChunk((int) x), MapChunk.blockToChunk((int) z)); -// if (chunk != null) { -// var biome = chunk.getBiome((int) x, (int) z); -// var registry = this.renderer.worldMap().getBiomeRegistry(); -// if (biome != null && registry != null) { -// var id = registry.getId(biome); -// if (id != null) { -// int width = this.client.textRenderer.getWidth(id.toString()); -// graphics.drawShadowedText(this.client.textRenderer, id.toString(), this.getX() + this.getWidth() - 5 - width, this.getY() + this.getHeight() - 9, 0xffffffff); -// } -// } -// } - } - - var scale = "1:" + this.renderer.scale(); - if (this.intScale < 0) { - scale = -this.intScale + ":1"; - } - graphics.drawShadowedText(this.client.textRenderer, scale, this.getX(), this.getY() + this.getHeight() - 9, 0xffffffff); } } diff --git a/src/main/resources/assets/lambdamap/lang/en_us.json b/src/main/resources/assets/lambdamap/lang/en_us.json index 8f06fcf..988fd3c 100644 --- a/src/main/resources/assets/lambdamap/lang/en_us.json +++ b/src/main/resources/assets/lambdamap/lang/en_us.json @@ -2,6 +2,7 @@ "lambdamap.config.category.general": "General", "lambdamap.config.render_biome_colors": "Render Biome Colors", "lambdamap.config.show_marker_editor": "Show Marker Editor", + "lambdamap.config.fullscreen": "Fullscreen World Map", "lambdamap.config.category.hud": "HUD", "lambdamap.config.hud.visible": "Show HUD", "lambdamap.config.hud.scale": "Scale", From 92311b733a58561c29bce6194585a5fa5ab1ae58 Mon Sep 17 00:00:00 2001 From: sisby-folk Date: Sat, 19 Aug 2023 15:41:55 +1000 Subject: [PATCH 4/9] more sensible defaults --- src/main/java/dev/lambdaurora/lambdamap/LambdaMapConfig.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/dev/lambdaurora/lambdamap/LambdaMapConfig.java b/src/main/java/dev/lambdaurora/lambdamap/LambdaMapConfig.java index d76215e..035ca24 100644 --- a/src/main/java/dev/lambdaurora/lambdamap/LambdaMapConfig.java +++ b/src/main/java/dev/lambdaurora/lambdamap/LambdaMapConfig.java @@ -45,8 +45,8 @@ public final class LambdaMapConfig { private static final boolean DEFAULT_RENDER_BIOME_COLORS = true; private static final boolean DEFAULT_SHOW_HUD = true; - private static final boolean DEFAULT_SHOW_MARKER_EDITOR = false; - private static final boolean DEFAULT_FULLSCREEN = true; + private static final boolean DEFAULT_SHOW_MARKER_EDITOR = true; + private static final boolean DEFAULT_FULLSCREEN = false; private static final int DEFAULT_HUD_SCALE = 2; private static final boolean DEFAULT_SHOW_DIRECTION_INDICATORS = true; private static final boolean DEFAULT_NORTH_LOCK = false; From e35d82fd86b94ece89edb118fecd9656430cb4b7 Mon Sep 17 00:00:00 2001 From: sisby-folk Date: Sat, 19 Aug 2023 15:52:17 +1000 Subject: [PATCH 5/9] revert! --- .../lambdamap/LambdaMapConfig.java | 19 ------------------- .../lambdamap/gui/WorldMapScreen.java | 8 ++------ .../assets/lambdamap/lang/en_us.json | 2 -- 3 files changed, 2 insertions(+), 27 deletions(-) diff --git a/src/main/java/dev/lambdaurora/lambdamap/LambdaMapConfig.java b/src/main/java/dev/lambdaurora/lambdamap/LambdaMapConfig.java index 035ca24..f1553c9 100644 --- a/src/main/java/dev/lambdaurora/lambdamap/LambdaMapConfig.java +++ b/src/main/java/dev/lambdaurora/lambdamap/LambdaMapConfig.java @@ -45,7 +45,6 @@ public final class LambdaMapConfig { private static final boolean DEFAULT_RENDER_BIOME_COLORS = true; private static final boolean DEFAULT_SHOW_HUD = true; - private static final boolean DEFAULT_SHOW_MARKER_EDITOR = true; private static final boolean DEFAULT_FULLSCREEN = false; private static final int DEFAULT_HUD_SCALE = 2; private static final boolean DEFAULT_SHOW_DIRECTION_INDICATORS = true; @@ -60,7 +59,6 @@ public final class LambdaMapConfig { private final SpruceOption renderBiomeColorsOption; private final SpruceOption showHudOption; - private final SpruceOption showMarkerEditorOption; private final SpruceOption doFullscreenOption; private final SpruceOption hudScaleOption; private final SpruceOption northLockOption; @@ -69,7 +67,6 @@ public final class LambdaMapConfig { private boolean renderBiomeColors; private boolean showHud; - private boolean showMarkerEditor; private boolean doFullscreen; private int hudScale; private boolean northLock; @@ -88,8 +85,6 @@ public LambdaMapConfig(LambdaMap mod) { }, null, true); this.showHudOption = new SpruceCheckboxBooleanOption("lambdamap.config.hud.visible", this::isHudVisible, this::setHudVisible, null, true); - this.showMarkerEditorOption = new SpruceCheckboxBooleanOption("lambdamap.config.show_marker_editor", - this::isMarkerEditorVisible, this::setMarkerEditorVisible, null, true); this.doFullscreenOption = new SpruceCheckboxBooleanOption("lambdamap.config.fullscreen", this::isFullscreen, this::setDoFullscreen, null, true); this.hudScaleOption = new SpruceCyclingOption("lambdamap.config.hud.scale", @@ -123,7 +118,6 @@ public void load() { this.renderBiomeColors = this.config.getOrElse("map.render_biome_colors", DEFAULT_RENDER_BIOME_COLORS); this.showHud = this.config.getOrElse("map.hud.visible", DEFAULT_SHOW_HUD); - this.showMarkerEditor = this.config.getOrElse("map.config.show_marker_editor", DEFAULT_SHOW_MARKER_EDITOR); this.doFullscreen = this.config.getOrElse("map.config.fullscreen", DEFAULT_FULLSCREEN); this.hudScale = MathHelper.clamp(this.config.getIntOrElse("map.hud.scale", DEFAULT_HUD_SCALE), 1, 3); this.northLock = this.config.getOrElse("map.hud.north_lock", DEFAULT_NORTH_LOCK); @@ -187,19 +181,6 @@ public SpruceOption getShowHudOption() { return this.showHudOption; } - public void setMarkerEditorVisible(Boolean visible) { - this.showMarkerEditor = visible; - this.config.set("map.config.show_marker_editor", visible); - } - - public Boolean isMarkerEditorVisible() { - return this.showMarkerEditor; - } - - public SpruceOption getShowMarkerEditorOption() { - return this.showMarkerEditorOption; - } - public void setDoFullscreen(Boolean visible) { this.doFullscreen = visible; this.config.set("map.config.fullscreen", visible); diff --git a/src/main/java/dev/lambdaurora/lambdamap/gui/WorldMapScreen.java b/src/main/java/dev/lambdaurora/lambdamap/gui/WorldMapScreen.java index 0d20458..b15d0c7 100644 --- a/src/main/java/dev/lambdaurora/lambdamap/gui/WorldMapScreen.java +++ b/src/main/java/dev/lambdaurora/lambdamap/gui/WorldMapScreen.java @@ -50,10 +50,8 @@ protected void init() { tabs.getList().setBackground(RandomPrideFlagBackground.random()); tabs.addTabEntry(Text.translatable("lambdamap.tabs.world_map"), Text.translatable("lambdamap.tabs.world_map.description").formatted(Formatting.GRAY), (width, height) -> new WorldMapWidget(Position.origin(), width, height)); - if (this.mod.getConfig().isMarkerEditorVisible()) { - tabs.addTabEntry(Text.translatable("lambdamap.tabs.markers"), Text.translatable("lambdamap.tabs.markers.description").formatted(Formatting.GRAY), - (width, height) -> new MarkerTabWidget(mod, Position.origin(), width, height)); - } + tabs.addTabEntry(Text.translatable("lambdamap.tabs.markers"), Text.translatable("lambdamap.tabs.markers.description").formatted(Formatting.GRAY), + (width, height) -> new MarkerTabWidget(mod, Position.origin(), width, height)); tabs.addTabEntry(Text.translatable("lambdamap.tabs.config"), Text.translatable("lambdamap.tabs.config.description").formatted(Formatting.GRAY), this::buildConfigTab); } @@ -65,8 +63,6 @@ private SpruceOptionListWidget buildConfigTab(int width, int height) { list.addSingleOptionEntry(new SpruceSeparatorOption("lambdamap.config.category.general", true, null)); list.addSingleOptionEntry(this.mod.getConfig().getRenderBiomeColorsOption()); - list.addSingleOptionEntry(this.mod.getConfig().getShowMarkerEditorOption()); - list.addSingleOptionEntry(this.mod.getConfig().getDoFullscreenOption()); list.addSingleOptionEntry(new SpruceSeparatorOption("lambdamap.config.category.hud", true, null)); list.addSingleOptionEntry(this.mod.getConfig().getShowHudOption()); list.addOptionEntry(this.mod.getConfig().getHudScaleOption(), null); diff --git a/src/main/resources/assets/lambdamap/lang/en_us.json b/src/main/resources/assets/lambdamap/lang/en_us.json index 988fd3c..cbabeb0 100644 --- a/src/main/resources/assets/lambdamap/lang/en_us.json +++ b/src/main/resources/assets/lambdamap/lang/en_us.json @@ -1,8 +1,6 @@ { "lambdamap.config.category.general": "General", "lambdamap.config.render_biome_colors": "Render Biome Colors", - "lambdamap.config.show_marker_editor": "Show Marker Editor", - "lambdamap.config.fullscreen": "Fullscreen World Map", "lambdamap.config.category.hud": "HUD", "lambdamap.config.hud.visible": "Show HUD", "lambdamap.config.hud.scale": "Scale", From ec601656d4a9ce735affedcb2ae81b6e7e5c95df Mon Sep 17 00:00:00 2001 From: sisby-folk Date: Sat, 19 Aug 2023 16:07:18 +1000 Subject: [PATCH 6/9] Revert "demo text > biome" This reverts commit ab612647 --- gradle.properties | 2 +- .../lambdamap/gui/WorldMapWidget.java | 31 ++++++++++++------- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/gradle.properties b/gradle.properties index 14a9973..b0f1f61 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,7 +8,7 @@ fabric_api_version=7.0.6+0.85.0 qsl_version=6.0.4 # Mod properties -mod_version=1.0.0-bc23.1 +mod_version=1.0.0-alpha.1 maven_group=dev.lambdaurora archives_base_name=lambdamap diff --git a/src/main/java/dev/lambdaurora/lambdamap/gui/WorldMapWidget.java b/src/main/java/dev/lambdaurora/lambdamap/gui/WorldMapWidget.java index 178879d..fe9ea9c 100644 --- a/src/main/java/dev/lambdaurora/lambdamap/gui/WorldMapWidget.java +++ b/src/main/java/dev/lambdaurora/lambdamap/gui/WorldMapWidget.java @@ -19,6 +19,7 @@ import com.mojang.blaze3d.vertex.Tessellator; import dev.lambdaurora.lambdamap.LambdaMap; +import dev.lambdaurora.lambdamap.map.MapChunk; import dev.lambdaurora.spruceui.Position; import dev.lambdaurora.spruceui.navigation.NavigationDirection; import dev.lambdaurora.spruceui.util.ScissorManager; @@ -146,24 +147,32 @@ protected void renderWidget(GuiGraphics graphics, int mouseX, int mouseY, float float z = this.renderer.cornerZ() + mouseYOffset * scaleCompensation; graphics.drawCenteredShadowedText(this.client.textRenderer, String.format("X: %.1f Z: %.1f", x, z), this.getX() + this.getWidth() / 2, this.getY() + this.getHeight() - 9, 0xffffffff); - } - // BlanketCon Info Texts Setup - if (mouseXOffset <= 0 || mouseYOffset < this.renderer.height() * this.scale) { - String demoText = "BlanketCon 2023"; - int width = this.client.textRenderer.getWidth(demoText); - graphics.drawShadowedText(this.client.textRenderer, demoText, this.getX() + this.getWidth() - 5 - width, this.getY() + this.getHeight() - 9, 0xffffffff); + var chunk = this.renderer.worldMap().getChunk(MapChunk.blockToChunk((int) x), MapChunk.blockToChunk((int) z)); + if (chunk != null) { + var biome = chunk.getBiome((int) x, (int) z); + var registry = this.renderer.worldMap().getBiomeRegistry(); + if (biome != null && registry != null) { + var id = registry.getId(biome); + if (id != null) { + int width = this.client.textRenderer.getWidth(id.toString()); + graphics.drawShadowedText(this.client.textRenderer, id.toString(), this.getX() + this.getWidth() - 5 - width, this.getY() + this.getHeight() - 9, 0xffffffff); + } + } + } + } + if (!mod.getConfig().isFullscreen() || mouseXOffset <= 0 || mouseYOffset < this.renderer.height() * this.scale) + { var scale = "1:" + this.renderer.scale(); if (this.intScale < 0) { scale = -this.intScale + ":1"; } graphics.drawShadowedText(this.client.textRenderer, scale, this.getX(), this.getY() + this.getHeight() - 9, 0xffffffff); - } else { - String demoText = "Issues: #bc23-bugs"; - int width = this.client.textRenderer.getWidth(demoText); - graphics.drawShadowedText(this.client.textRenderer, demoText, this.getX() + this.getWidth() - 5 - width, this.getY() + this.getHeight() - 9, 0xffffffff); - graphics.drawShadowedText(this.client.textRenderer, "LambdaMap", this.getX(), this.getY() + this.getHeight() - 9, 0xffffffff); + } + + if (mouseXOffset > 0 && mouseYOffset >= this.renderer.height() * this.scale) { + if (mod.getConfig().isFullscreen()) graphics.drawShadowedText(this.client.textRenderer, "LambdaMap", this.getX(), this.getY() + this.getHeight() - 9, 0xffffffff); graphics.drawCenteredShadowedText(this.client.textRenderer, "[Toggle Fullscreen]", this.getX() + this.getWidth() / 2, this.getY() + this.getHeight() - 9, 0xffffffff); } } From a3e6348a8624fca9f00381dc1787889d11d0bd50 Mon Sep 17 00:00:00 2001 From: sisby-folk Date: Sat, 19 Aug 2023 16:12:34 +1000 Subject: [PATCH 7/9] drop the weird fullscreen check --- .../java/dev/lambdaurora/lambdamap/gui/WorldMapWidget.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/dev/lambdaurora/lambdamap/gui/WorldMapWidget.java b/src/main/java/dev/lambdaurora/lambdamap/gui/WorldMapWidget.java index fe9ea9c..e0fc9b3 100644 --- a/src/main/java/dev/lambdaurora/lambdamap/gui/WorldMapWidget.java +++ b/src/main/java/dev/lambdaurora/lambdamap/gui/WorldMapWidget.java @@ -162,7 +162,7 @@ protected void renderWidget(GuiGraphics graphics, int mouseX, int mouseY, float } } - if (!mod.getConfig().isFullscreen() || mouseXOffset <= 0 || mouseYOffset < this.renderer.height() * this.scale) + if (mouseXOffset <= 0 || mouseYOffset < this.renderer.height() * this.scale) { var scale = "1:" + this.renderer.scale(); if (this.intScale < 0) { @@ -172,7 +172,7 @@ protected void renderWidget(GuiGraphics graphics, int mouseX, int mouseY, float } if (mouseXOffset > 0 && mouseYOffset >= this.renderer.height() * this.scale) { - if (mod.getConfig().isFullscreen()) graphics.drawShadowedText(this.client.textRenderer, "LambdaMap", this.getX(), this.getY() + this.getHeight() - 9, 0xffffffff); + graphics.drawShadowedText(this.client.textRenderer, "LambdaMap", this.getX(), this.getY() + this.getHeight() - 9, 0xffffffff); graphics.drawCenteredShadowedText(this.client.textRenderer, "[Toggle Fullscreen]", this.getX() + this.getWidth() / 2, this.getY() + this.getHeight() - 9, 0xffffffff); } } From 8e5275bed80bacac7aa10d47b1fcf95e0a875a86 Mon Sep 17 00:00:00 2001 From: sisby-folk Date: Sat, 19 Aug 2023 16:33:02 +1000 Subject: [PATCH 8/9] Revert "drop the weird fullscreen check" This reverts commit a3e6348a8624fca9f00381dc1787889d11d0bd50. --- .../java/dev/lambdaurora/lambdamap/gui/WorldMapWidget.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/dev/lambdaurora/lambdamap/gui/WorldMapWidget.java b/src/main/java/dev/lambdaurora/lambdamap/gui/WorldMapWidget.java index e0fc9b3..fe9ea9c 100644 --- a/src/main/java/dev/lambdaurora/lambdamap/gui/WorldMapWidget.java +++ b/src/main/java/dev/lambdaurora/lambdamap/gui/WorldMapWidget.java @@ -162,7 +162,7 @@ protected void renderWidget(GuiGraphics graphics, int mouseX, int mouseY, float } } - if (mouseXOffset <= 0 || mouseYOffset < this.renderer.height() * this.scale) + if (!mod.getConfig().isFullscreen() || mouseXOffset <= 0 || mouseYOffset < this.renderer.height() * this.scale) { var scale = "1:" + this.renderer.scale(); if (this.intScale < 0) { @@ -172,7 +172,7 @@ protected void renderWidget(GuiGraphics graphics, int mouseX, int mouseY, float } if (mouseXOffset > 0 && mouseYOffset >= this.renderer.height() * this.scale) { - graphics.drawShadowedText(this.client.textRenderer, "LambdaMap", this.getX(), this.getY() + this.getHeight() - 9, 0xffffffff); + if (mod.getConfig().isFullscreen()) graphics.drawShadowedText(this.client.textRenderer, "LambdaMap", this.getX(), this.getY() + this.getHeight() - 9, 0xffffffff); graphics.drawCenteredShadowedText(this.client.textRenderer, "[Toggle Fullscreen]", this.getX() + this.getWidth() / 2, this.getY() + this.getHeight() - 9, 0xffffffff); } } From 9d28a4ccf6f222a5c910927d36440792f05c62ab Mon Sep 17 00:00:00 2001 From: LambdAurora Date: Sat, 19 Aug 2023 11:27:22 +0200 Subject: [PATCH 9/9] Quick cleanup. --- .../lambdamap/LambdaMapConfig.java | 31 ++++++++----------- .../lambdamap/gui/WorldMapScreen.java | 4 +-- .../lambdamap/gui/WorldMapWidget.java | 23 +++++++++----- 3 files changed, 31 insertions(+), 27 deletions(-) diff --git a/src/main/java/dev/lambdaurora/lambdamap/LambdaMapConfig.java b/src/main/java/dev/lambdaurora/lambdamap/LambdaMapConfig.java index f1553c9..4aca8a2 100644 --- a/src/main/java/dev/lambdaurora/lambdamap/LambdaMapConfig.java +++ b/src/main/java/dev/lambdaurora/lambdamap/LambdaMapConfig.java @@ -59,7 +59,6 @@ public final class LambdaMapConfig { private final SpruceOption renderBiomeColorsOption; private final SpruceOption showHudOption; - private final SpruceOption doFullscreenOption; private final SpruceOption hudScaleOption; private final SpruceOption northLockOption; private final SpruceOption directionIndicatorsOption; @@ -67,7 +66,7 @@ public final class LambdaMapConfig { private boolean renderBiomeColors; private boolean showHud; - private boolean doFullscreen; + private boolean worldMapFullscreen; private int hudScale; private boolean northLock; private boolean showDirectionIndicators; @@ -85,8 +84,6 @@ public LambdaMapConfig(LambdaMap mod) { }, null, true); this.showHudOption = new SpruceCheckboxBooleanOption("lambdamap.config.hud.visible", this::isHudVisible, this::setHudVisible, null, true); - this.doFullscreenOption = new SpruceCheckboxBooleanOption("lambdamap.config.fullscreen", - this::isFullscreen, this::setDoFullscreen, null, true); this.hudScaleOption = new SpruceCyclingOption("lambdamap.config.hud.scale", amount -> this.setHudScale((this.hudScale + amount) % 4), option -> option.getDisplayText(Text.literal(String.valueOf(this.getHudScale()))), Text.translatable("lambdamap.config.hud.scale.tooltip")); @@ -118,7 +115,6 @@ public void load() { this.renderBiomeColors = this.config.getOrElse("map.render_biome_colors", DEFAULT_RENDER_BIOME_COLORS); this.showHud = this.config.getOrElse("map.hud.visible", DEFAULT_SHOW_HUD); - this.doFullscreen = this.config.getOrElse("map.config.fullscreen", DEFAULT_FULLSCREEN); this.hudScale = MathHelper.clamp(this.config.getIntOrElse("map.hud.scale", DEFAULT_HUD_SCALE), 1, 3); this.northLock = this.config.getOrElse("map.hud.north_lock", DEFAULT_NORTH_LOCK); this.showDirectionIndicators = this.config.getOrElse("map.hud.direction_indicators", DEFAULT_SHOW_DIRECTION_INDICATORS); @@ -131,6 +127,7 @@ public void load() { return null; }).map(HudDecorators::get) .orElse(HudDecorators.MAP); + this.worldMapFullscreen = this.config.getOrElse("map.config.world_map.fullscreen", DEFAULT_FULLSCREEN); LOGGER.info("Configuration loaded."); } @@ -150,6 +147,8 @@ public void reset() { this.setHudVisible(DEFAULT_SHOW_HUD); this.setHudScale(DEFAULT_HUD_SCALE); this.setNorthLock(DEFAULT_NORTH_LOCK); + this.setDirectionIndicatorsVisible(DEFAULT_SHOW_DIRECTION_INDICATORS); + this.setHudDecorator(HudDecorators.MAP); } public boolean shouldRenderBiomeColors() { @@ -181,19 +180,6 @@ public SpruceOption getShowHudOption() { return this.showHudOption; } - public void setDoFullscreen(Boolean visible) { - this.doFullscreen = visible; - this.config.set("map.config.fullscreen", visible); - } - - public Boolean isFullscreen() { - return this.doFullscreen; - } - - public SpruceOption getDoFullscreenOption() { - return this.doFullscreenOption; - } - /** * {@return the scale of the map HUD} */ @@ -267,4 +253,13 @@ public void setHudDecorator(HudDecorator decorator) { public SpruceOption getHudDecoratorOption() { return this.hudDecoratorOption; } + + public void setWorldMapFullscreen(boolean visible) { + this.worldMapFullscreen = visible; + this.config.set("map.config.fullscreen", visible); + } + + public Boolean isWorldMapFullscreen() { + return this.worldMapFullscreen; + } } diff --git a/src/main/java/dev/lambdaurora/lambdamap/gui/WorldMapScreen.java b/src/main/java/dev/lambdaurora/lambdamap/gui/WorldMapScreen.java index b15d0c7..a983786 100644 --- a/src/main/java/dev/lambdaurora/lambdamap/gui/WorldMapScreen.java +++ b/src/main/java/dev/lambdaurora/lambdamap/gui/WorldMapScreen.java @@ -43,7 +43,7 @@ public void removed() { protected void init() { super.init(); - if (mod.getConfig().isFullscreen()) { + if (this.mod.getConfig().isWorldMapFullscreen()) { this.addDrawableChild(new WorldMapWidget(Position.origin(), width, height)); } else { SpruceTabbedWidget tabs = this.addDrawableChild(new SpruceTabbedWidget(Position.origin(), this.width, this.height, Text.literal("LambdaMap"))); @@ -51,7 +51,7 @@ protected void init() { tabs.addTabEntry(Text.translatable("lambdamap.tabs.world_map"), Text.translatable("lambdamap.tabs.world_map.description").formatted(Formatting.GRAY), (width, height) -> new WorldMapWidget(Position.origin(), width, height)); tabs.addTabEntry(Text.translatable("lambdamap.tabs.markers"), Text.translatable("lambdamap.tabs.markers.description").formatted(Formatting.GRAY), - (width, height) -> new MarkerTabWidget(mod, Position.origin(), width, height)); + (width, height) -> new MarkerTabWidget(this.mod, Position.origin(), width, height)); tabs.addTabEntry(Text.translatable("lambdamap.tabs.config"), Text.translatable("lambdamap.tabs.config.description").formatted(Formatting.GRAY), this::buildConfigTab); } diff --git a/src/main/java/dev/lambdaurora/lambdamap/gui/WorldMapWidget.java b/src/main/java/dev/lambdaurora/lambdamap/gui/WorldMapWidget.java index fe9ea9c..7facd09 100644 --- a/src/main/java/dev/lambdaurora/lambdamap/gui/WorldMapWidget.java +++ b/src/main/java/dev/lambdaurora/lambdamap/gui/WorldMapWidget.java @@ -93,8 +93,8 @@ protected boolean onMouseClick(double mouseX, double mouseY, int button) { double mouseYOffset = mouseY - this.getY(); if (mouseXOffset > 0 && mouseXOffset < this.renderer.width() * this.scale && mouseYOffset > this.renderer.height() * this.scale) { - mod.getConfig().setDoFullscreen(!mod.getConfig().isFullscreen()); - client.setScreen(new WorldMapScreen()); + this.mod.getConfig().setWorldMapFullscreen(!this.mod.getConfig().isWorldMapFullscreen()); + this.client.setScreen(new WorldMapScreen()); } return button == GLFW.GLFW_MOUSE_BUTTON_1; @@ -142,7 +142,8 @@ protected void renderWidget(GuiGraphics graphics, int mouseX, int mouseY, float scaleCompensation = this.renderer.scale(); } - if (mouseXOffset > 0 && mouseXOffset < this.renderer.width() * this.scale && mouseYOffset > 0 && mouseYOffset < this.renderer.height() * this.scale) { + if (mouseXOffset > 0 && mouseXOffset < this.renderer.width() * this.scale + && mouseYOffset > 0 && mouseYOffset < this.renderer.height() * this.scale) { float x = this.renderer.cornerX() + mouseXOffset * scaleCompensation; float z = this.renderer.cornerZ() + mouseYOffset * scaleCompensation; graphics.drawCenteredShadowedText(this.client.textRenderer, String.format("X: %.1f Z: %.1f", x, z), @@ -162,8 +163,8 @@ protected void renderWidget(GuiGraphics graphics, int mouseX, int mouseY, float } } - if (!mod.getConfig().isFullscreen() || mouseXOffset <= 0 || mouseYOffset < this.renderer.height() * this.scale) - { + if (!this.mod.getConfig().isWorldMapFullscreen() + || mouseXOffset <= 0 || mouseYOffset < this.renderer.height() * this.scale) { var scale = "1:" + this.renderer.scale(); if (this.intScale < 0) { scale = -this.intScale + ":1"; @@ -172,8 +173,16 @@ protected void renderWidget(GuiGraphics graphics, int mouseX, int mouseY, float } if (mouseXOffset > 0 && mouseYOffset >= this.renderer.height() * this.scale) { - if (mod.getConfig().isFullscreen()) graphics.drawShadowedText(this.client.textRenderer, "LambdaMap", this.getX(), this.getY() + this.getHeight() - 9, 0xffffffff); - graphics.drawCenteredShadowedText(this.client.textRenderer, "[Toggle Fullscreen]", this.getX() + this.getWidth() / 2, this.getY() + this.getHeight() - 9, 0xffffffff); + if (this.mod.getConfig().isWorldMapFullscreen()) + graphics.drawShadowedText(this.client.textRenderer, "LambdaMap", + this.getX(), this.getY() + this.getHeight() - 9, + 0xffffffff + ); + else + graphics.drawCenteredShadowedText(this.client.textRenderer, "[Toggle Fullscreen]", + this.getX() + this.getWidth() / 2, this.getY() + this.getHeight() - 9, + 0xffffffff + ); } } }