Support 1.18.2

This commit is contained in:
mastermc05 2022-10-14 15:51:08 +03:00
parent 8a8e2ecfcf
commit 5f29846645
3 changed files with 19 additions and 2 deletions

View File

@ -111,7 +111,7 @@ public class BukkitVersionHelperSpigot118_2 extends BukkitVersionHelper {
private static IRegistry<BiomeBase> reg = null;
private static IRegistry<BiomeBase> getBiomeReg() {
public static IRegistry<BiomeBase> getBiomeReg() {
if (reg == null) {
reg = MinecraftServer.getServer().aU().d(IRegistry.aP);
}

View File

@ -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()]));
}
}

View File

@ -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 {