diff --git a/bukkit-helper-118-2/src/main/java/org/dynmap/bukkit/helper/v118_2/BukkitVersionHelperSpigot118_2.java b/bukkit-helper-118-2/src/main/java/org/dynmap/bukkit/helper/v118_2/BukkitVersionHelperSpigot118_2.java index fed30017..054ffc70 100644 --- a/bukkit-helper-118-2/src/main/java/org/dynmap/bukkit/helper/v118_2/BukkitVersionHelperSpigot118_2.java +++ b/bukkit-helper-118-2/src/main/java/org/dynmap/bukkit/helper/v118_2/BukkitVersionHelperSpigot118_2.java @@ -111,7 +111,7 @@ public class BukkitVersionHelperSpigot118_2 extends BukkitVersionHelper { private static IRegistry reg = null; - private static IRegistry getBiomeReg() { + public static IRegistry getBiomeReg() { if (reg == null) { reg = MinecraftServer.getServer().aU().d(IRegistry.aP); } diff --git a/bukkit-helper-118-2/src/main/java/org/dynmap/bukkit/helper/v118_2/MapChunkCache118_2.java b/bukkit-helper-118-2/src/main/java/org/dynmap/bukkit/helper/v118_2/MapChunkCache118_2.java index 21b94ea3..1b939426 100644 --- a/bukkit-helper-118-2/src/main/java/org/dynmap/bukkit/helper/v118_2/MapChunkCache118_2.java +++ b/bukkit-helper-118-2/src/main/java/org/dynmap/bukkit/helper/v118_2/MapChunkCache118_2.java @@ -1,6 +1,8 @@ package org.dynmap.bukkit.helper.v118_2; +import net.minecraft.resources.MinecraftKey; import net.minecraft.server.MinecraftServer; +import net.minecraft.world.level.biome.BiomeBase; import org.bukkit.Bukkit; import org.bukkit.World; import org.bukkit.craftbukkit.v1_18_R2.CraftServer; @@ -9,6 +11,7 @@ import org.dynmap.DynmapChunk; import org.dynmap.MapManager; import org.dynmap.bukkit.helper.BukkitVersionHelper; import org.dynmap.bukkit.helper.BukkitWorld; +import org.dynmap.common.BiomeMap; import org.dynmap.common.chunk.GenericChunk; import org.dynmap.common.chunk.GenericChunkCache; import org.dynmap.common.chunk.GenericMapChunkCache; @@ -96,4 +99,18 @@ public class MapChunkCache118_2 extends GenericMapChunkCache { this.w = dw.getWorld(); super.setChunks(dw, chunks); } + + @Override + public int getFoliageColor(BiomeMap bm, int[] colormap, int x, int z) { + if (bm.getResourcelocation() == null) return colormap[bm.biomeLookup()]; + BiomeBase base = BukkitVersionHelperSpigot118_2.getBiomeReg().a(MinecraftKey.a(bm.getResourcelocation())); + return base == null ? colormap[bm.biomeLookup()] : base.j().e().orElse(colormap[bm.biomeLookup()]); + } + + @Override + public int getGrassColor(BiomeMap bm, int[] colormap, int x, int z) { + if (bm.getResourcelocation() == null) return colormap[bm.biomeLookup()]; + BiomeBase base = BukkitVersionHelperSpigot118_2.getBiomeReg().a(MinecraftKey.a(bm.getResourcelocation())); + return base == null ? colormap[bm.biomeLookup()] : base.j().g().a(x, z, base.j().f().orElse(colormap[bm.biomeLookup()])); + } } diff --git a/spigot/build.gradle b/spigot/build.gradle index b2c99fde..86778407 100644 --- a/spigot/build.gradle +++ b/spigot/build.gradle @@ -88,7 +88,7 @@ runServer { // Configure the Minecraft version for our task. // This is the only required configuration besides applying the plugin. // Your plugin's jar (or shadowJar if present) will be used automatically. - minecraftVersion("1.19.2") + minecraftVersion("1.18.2") } shadowJar { dependencies {