diff --git a/bukkit-helper-117/src/main/java/org/dynmap/bukkit/helper/v117/BukkitVersionHelperSpigot117.java b/bukkit-helper-117/src/main/java/org/dynmap/bukkit/helper/v117/BukkitVersionHelperSpigot117.java index f5a9b076..9a7a5fb1 100644 --- a/bukkit-helper-117/src/main/java/org/dynmap/bukkit/helper/v117/BukkitVersionHelperSpigot117.java +++ b/bukkit-helper-117/src/main/java/org/dynmap/bukkit/helper/v117/BukkitVersionHelperSpigot117.java @@ -85,9 +85,9 @@ public class BukkitVersionHelperSpigot117 extends BukkitVersionHelper { return names; } - private IRegistry reg = null; + private static IRegistry reg = null; - private IRegistry getBiomeReg() { + public static IRegistry getBiomeReg() { if (reg == null) { reg = MinecraftServer.getServer().getCustomRegistry().b(IRegistry.aO); } diff --git a/bukkit-helper-117/src/main/java/org/dynmap/bukkit/helper/v117/MapChunkCache117.java b/bukkit-helper-117/src/main/java/org/dynmap/bukkit/helper/v117/MapChunkCache117.java index b92d76a0..0148f2d0 100644 --- a/bukkit-helper-117/src/main/java/org/dynmap/bukkit/helper/v117/MapChunkCache117.java +++ b/bukkit-helper-117/src/main/java/org/dynmap/bukkit/helper/v117/MapChunkCache117.java @@ -1,9 +1,12 @@ package org.dynmap.bukkit.helper.v117; +import net.minecraft.resources.MinecraftKey; +import net.minecraft.world.level.biome.BiomeBase; import org.bukkit.World; import org.bukkit.craftbukkit.v1_17_R1.CraftWorld; import org.dynmap.DynmapChunk; 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; @@ -66,4 +69,18 @@ public class MapChunkCache117 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 = BukkitVersionHelperSpigot117.getBiomeReg().get(MinecraftKey.a(bm.getResourcelocation())); + return base == null ? colormap[bm.biomeLookup()] : base.l().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 = BukkitVersionHelperSpigot117.getBiomeReg().get(MinecraftKey.a(bm.getResourcelocation())); + return base == null ? colormap[bm.biomeLookup()] : base.l().g().a(x, z, base.l().f().orElse(colormap[bm.biomeLookup()])); + } } diff --git a/spigot/build.gradle b/spigot/build.gradle index 25918f99..5b54daeb 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.18") + minecraftVersion("1.17") } shadowJar { dependencies {