Support 1.18

This commit is contained in:
mastermc05 2022-10-14 15:59:20 +03:00
parent 5f29846645
commit f34929c6cf
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> getBiomeReg() {
public static IRegistry<BiomeBase> getBiomeReg() {
if (reg == null) {
reg = MinecraftServer.getServer().aV().d(IRegistry.aR);
}

View File

@ -1,5 +1,7 @@
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.World;
import org.bukkit.block.Biome;
@ -85,4 +87,19 @@ public class MapChunkCache118 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.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.
// 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.2")
minecraftVersion("1.18")
}
shadowJar {
dependencies {