From a527eca3ee333ceeaa9433572de7022ffc2367b2 Mon Sep 17 00:00:00 2001 From: Neil Date: Thu, 22 Dec 2022 19:50:15 +0100 Subject: [PATCH] Fix screenshot --- .../minemap/ui/map/fragment/Fragment.java | 19 +++++++++++-------- src/test/java/Test.java | 4 +++- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/seedfinding/minemap/ui/map/fragment/Fragment.java b/src/main/java/com/seedfinding/minemap/ui/map/fragment/Fragment.java index 02a661e..aee83c1 100644 --- a/src/main/java/com/seedfinding/minemap/ui/map/fragment/Fragment.java +++ b/src/main/java/com/seedfinding/minemap/ui/map/fragment/Fragment.java @@ -271,15 +271,18 @@ private void refreshHeightImageCache() { } private void refreshBiomeCache() { - MapPanel panel = MineMap.INSTANCE.worldTabs.getSelectedMapPanel(); - int cheating; - if (panel != null && panel.manager != null) { - cheating = Math.max(1, (int) (panel.manager.blocksPerFragment / 16 / panel.manager.pixelsPerFragment)); - if (this.biomeCache != null && this.layerIdCache == this.context.getLayerId() && lastCheatingBiome <= cheating) return; - } else { - cheating = 1; + int cheating=1; + if (MineMap.INSTANCE ==null){ + if(this.biomeCache != null && this.layerIdCache == this.context.getLayerId())return; + }else{ + MapPanel panel = MineMap.INSTANCE.worldTabs.getSelectedMapPanel(); + if (panel != null && panel.manager != null) { + cheating = Math.max(1, (int) (panel.manager.blocksPerFragment / 16 / panel.manager.pixelsPerFragment)); + if (this.biomeCache != null && this.layerIdCache == this.context.getLayerId() && lastCheatingBiome <= cheating) return; + } + lastCheatingBiome = cheating; } - lastCheatingBiome = cheating; + this.layerIdCache = this.context.getLayerId(); BiomeLayer layer = this.context.getBiomeLayer(); int effectiveRegion = Math.max(Math.max(this.regionSize / layer.getScale(), 1) / cheating, 1); diff --git a/src/test/java/Test.java b/src/test/java/Test.java index 2913e34..cec9f7b 100644 --- a/src/test/java/Test.java +++ b/src/test/java/Test.java @@ -1,5 +1,6 @@ import com.seedfinding.mcfeature.misc.SlimeChunk; import com.seedfinding.mcfeature.structure.Mineshaft; +import com.seedfinding.minemap.feature.chests.Chests; import com.seedfinding.minemap.init.Configs; import com.seedfinding.minemap.init.Features; import com.seedfinding.minemap.init.Icons; @@ -20,8 +21,9 @@ public class Test { public static void main(String[] args) throws IOException { //Initializes the icons, features and biome colors. Features.registerFeatures(); + Chests.registerChests(); Configs.registerConfigs(); - Icons.registerIcons(); + Icons.registerIcons(); // this depends on config MapSettings settings = new MapSettings(MCVersion.v1_12, Dimension.OVERWORLD).refresh(); MapContext context = new MapContext(1234L, settings);