From 733485f0fdd1f39899509be4f170ce917af5f6b0 Mon Sep 17 00:00:00 2001 From: sisby-folk Date: Mon, 12 Jun 2023 13:35:13 +1000 Subject: [PATCH 1/2] don't unnecessarily re-retrieve biome tag --- .../mc/impl/atlas/core/scanning/TileDetectorBase.java | 6 ++---- .../mc/impl/atlas/core/scanning/TileDetectorNether.java | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/common/src/main/java/hunternif/mc/impl/atlas/core/scanning/TileDetectorBase.java b/common/src/main/java/hunternif/mc/impl/atlas/core/scanning/TileDetectorBase.java index e54c012f4..41c662279 100644 --- a/common/src/main/java/hunternif/mc/impl/atlas/core/scanning/TileDetectorBase.java +++ b/common/src/main/java/hunternif/mc/impl/atlas/core/scanning/TileDetectorBase.java @@ -52,9 +52,7 @@ static private boolean hasSwampWater(RegistryEntry biomeTag) { throw new AssertionError("Not implemented"); } - static int priorityForBiome(World world, Biome biome) { - Registry biomeRegistry = world.getRegistryManager().get(Registry.BIOME_KEY); - RegistryEntry biomeTag = biomeRegistry.entryOf(biomeRegistry.getKey(biome).orElse(null)); + static int priorityForBiome(RegistryEntry biomeTag) { if (biomeTag.isIn(BiomeTags.IS_OCEAN) || biomeTag.isIn(BiomeTags.IS_RIVER) || biomeTag.isIn(BiomeTags.IS_DEEP_OCEAN)) { return 4; } else if (biomeTag.isIn(BiomeTags.IS_BEACH)) { @@ -175,7 +173,7 @@ public Identifier getBiomeID(World world, Chunk chunk) { } // updateOccurrencesMap(biomeOccurrences, world, biome, getHeightType(weirdness), priorityForBiome(getBiomeIdentifier(world, biome))); - updateOccurrencesMap(biomeOccurrences, world, biome, getHeightTypeFromY(y, world.getSeaLevel()), priorityForBiome(world, biome)); + updateOccurrencesMap(biomeOccurrences, world, biome, getHeightTypeFromY(y, world.getSeaLevel()), priorityForBiome(biomeTag)); } } diff --git a/common/src/main/java/hunternif/mc/impl/atlas/core/scanning/TileDetectorNether.java b/common/src/main/java/hunternif/mc/impl/atlas/core/scanning/TileDetectorNether.java index 8cec02876..4d3970ab6 100644 --- a/common/src/main/java/hunternif/mc/impl/atlas/core/scanning/TileDetectorNether.java +++ b/common/src/main/java/hunternif/mc/impl/atlas/core/scanning/TileDetectorNether.java @@ -65,7 +65,7 @@ public Identifier getBiomeID(World world, Chunk chunk) { } } else { // In case there are custom biomes "modded in": - updateOccurrencesMap(biomeOccurrences, getBiomeIdentifier(world,biome), priorityForBiome(world,biome)); + updateOccurrencesMap(biomeOccurrences, getBiomeIdentifier(world,biome), priorityForBiome(biomeTag)); } } } From d8b8ffc59d496114bcb04484567589e1989b2689 Mon Sep 17 00:00:00 2001 From: sisby-folk Date: Fri, 7 Jul 2023 12:28:27 +1000 Subject: [PATCH 2/2] fix biomeIsPlateau visibility --- .../java/hunternif/mc/impl/atlas/client/TileTextureMap.java | 2 +- .../mc/impl/atlas/client/fabric/TileTextureMapImpl.java | 2 +- .../mc/impl/atlas/client/forge/TileTextureMapImpl.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/common/src/main/java/hunternif/mc/impl/atlas/client/TileTextureMap.java b/common/src/main/java/hunternif/mc/impl/atlas/client/TileTextureMap.java index 1ed418606..2e8e08f50 100644 --- a/common/src/main/java/hunternif/mc/impl/atlas/client/TileTextureMap.java +++ b/common/src/main/java/hunternif/mc/impl/atlas/client/TileTextureMap.java @@ -286,7 +286,7 @@ public static boolean biomeIsSavanna(RegistryEntry biomeTag) { } @ExpectPlatform - private static boolean biomeIsPlateau(RegistryEntry biomeTag) { + public static boolean biomeIsPlateau(RegistryEntry biomeTag) { return false; } diff --git a/fabric/src/main/java/hunternif/mc/impl/atlas/client/fabric/TileTextureMapImpl.java b/fabric/src/main/java/hunternif/mc/impl/atlas/client/fabric/TileTextureMapImpl.java index f52bf54d2..fe0ffe7fc 100644 --- a/fabric/src/main/java/hunternif/mc/impl/atlas/client/fabric/TileTextureMapImpl.java +++ b/fabric/src/main/java/hunternif/mc/impl/atlas/client/fabric/TileTextureMapImpl.java @@ -53,7 +53,7 @@ public static boolean biomeIsBadlands(RegistryEntry biomeTag) { return biomeTag.isIn((ConventionalBiomeTags.BADLANDS)) || biomeTag.isIn((ConventionalBiomeTags.MESA)); } - private static boolean biomeIsPlateau(RegistryEntry biomeTag) { + public static boolean biomeIsPlateau(RegistryEntry biomeTag) { return false; // None } diff --git a/forge/src/main/java/hunternif/mc/impl/atlas/client/forge/TileTextureMapImpl.java b/forge/src/main/java/hunternif/mc/impl/atlas/client/forge/TileTextureMapImpl.java index 48e22251b..1d718d389 100644 --- a/forge/src/main/java/hunternif/mc/impl/atlas/client/forge/TileTextureMapImpl.java +++ b/forge/src/main/java/hunternif/mc/impl/atlas/client/forge/TileTextureMapImpl.java @@ -53,7 +53,7 @@ public static boolean biomeIsBadlands(RegistryEntry biomeTag) { return false; // None } - private static boolean biomeIsPlateau(RegistryEntry biomeTag) { + public static boolean biomeIsPlateau(RegistryEntry biomeTag) { return biomeTag.isIn((Tags.Biomes.IS_PLATEAU)); }