Support 1.18

This commit is contained in:
mastermc05 2022-10-14 15:59:20 +03:00
parent 9d8e95d9b2
commit 065585e418
3 changed files with 19 additions and 2 deletions

View file

@ -104,7 +104,7 @@ public class BukkitVersionHelperSpigot118 extends BukkitVersionHelper {
private static IRegistry<BiomeBase> reg = null; private static IRegistry<BiomeBase> reg = null;
private static IRegistry<BiomeBase> getBiomeReg() { public static IRegistry<BiomeBase> getBiomeReg() {
if (reg == null) { if (reg == null) {
reg = MinecraftServer.getServer().aV().d(IRegistry.aR); reg = MinecraftServer.getServer().aV().d(IRegistry.aR);
} }

View file

@ -1,5 +1,7 @@
package org.dynmap.bukkit.helper.v118; package org.dynmap.bukkit.helper.v118;
import net.minecraft.resources.MinecraftKey;
import net.minecraft.world.level.biome.BiomeBase;
import org.bukkit.ChunkSnapshot; import org.bukkit.ChunkSnapshot;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.block.Biome; import org.bukkit.block.Biome;
@ -85,4 +87,19 @@ public class MapChunkCache118 extends GenericMapChunkCache {
this.w = dw.getWorld(); this.w = dw.getWorld();
super.setChunks(dw, chunks); 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.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.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. // Configure the Minecraft version for our task.
// This is the only required configuration besides applying the plugin. // This is the only required configuration besides applying the plugin.
// Your plugin's jar (or shadowJar if present) will be used automatically. // Your plugin's jar (or shadowJar if present) will be used automatically.
minecraftVersion("1.18.2") minecraftVersion("1.18")
} }
shadowJar { shadowJar {
dependencies { dependencies {