diff --git a/src/main/java/folk/sisby/antique_atlas/AntiqueAtlasConfig.java b/src/main/java/folk/sisby/antique_atlas/AntiqueAtlasConfig.java index 03c2e6983..8e74630cf 100644 --- a/src/main/java/folk/sisby/antique_atlas/AntiqueAtlasConfig.java +++ b/src/main/java/folk/sisby/antique_atlas/AntiqueAtlasConfig.java @@ -26,6 +26,12 @@ public enum FallbackHandling { @Comment("The background is slightly less stylish, but more tiles are shown at once") public Boolean fullscreen = true; + @Comment("Whether to keep scale after closing the map") + public Boolean keepZoom = false; + + @Comment("Whether to keep offset after closing the map") + public Boolean keepOffset = false; + @Comment("How to depict player death locations.") public GraveStyle graveStyle = GraveStyle.EUPHEMISMS; diff --git a/src/main/java/folk/sisby/antique_atlas/gui/AtlasScreen.java b/src/main/java/folk/sisby/antique_atlas/gui/AtlasScreen.java index e72ba8808..310206123 100644 --- a/src/main/java/folk/sisby/antique_atlas/gui/AtlasScreen.java +++ b/src/main/java/folk/sisby/antique_atlas/gui/AtlasScreen.java @@ -141,11 +141,11 @@ public class AtlasScreen extends Component { private boolean isDragging = false; - private double mapOffsetX; - private double mapOffsetY; + private static double mapOffsetX; + private static double mapOffsetY; - private int tilePixels = 16; - private int tileChunks = 1; + private static int tilePixels = 16; + private static int tileChunks = 1; private int mapScale; public AtlasScreen() { @@ -163,7 +163,6 @@ public AtlasScreen() { mapScale = getMapScale(); playerBookmark = new BookmarkButton(Text.translatable("gui.antique_atlas.followPlayer"), AntiqueAtlas.id("textures/gui/player.png"), DyeColor.GRAY, null, 7, 8, false); - playerBookmark.setSelected(true); addChild(playerBookmark).offsetGuiCoords(bookWidth - 10, bookHeight - MAP_BORDER_HEIGHT - BookmarkButton.HEIGHT - 10); playerBookmark.addListener(b -> { selectedButton = playerBookmark; @@ -251,7 +250,13 @@ public AtlasScreen prepareToOpen() { this.player = MinecraftClient.getInstance().player; updateAtlasData(); - setMapPosition(player.getBlockX(), player.getBlockZ()); + if (!AntiqueAtlas.CONFIG.keepOffset) { + playerBookmark.setSelected(true); + setMapPosition(player.getBlockX(), player.getBlockZ()); + } + if (!AntiqueAtlas.CONFIG.keepZoom) { + resetZoom(); + } return this; } @@ -262,6 +267,7 @@ public void init() { setGuiCoords((this.width - bookWidth) / 2, (this.height - bookHeight) / 2); + updateScaleBookmark(); updateBookmarkerList(); }