Support 1.17

This commit is contained in:
mastermc05 2022-10-14 16:06:15 +03:00
parent f34929c6cf
commit 97a82a3d1b
3 changed files with 20 additions and 3 deletions

View File

@ -85,9 +85,9 @@ public class BukkitVersionHelperSpigot117 extends BukkitVersionHelper {
return names;
}
private IRegistry<BiomeBase> reg = null;
private static IRegistry<BiomeBase> reg = null;
private IRegistry<BiomeBase> getBiomeReg() {
public static IRegistry<BiomeBase> getBiomeReg() {
if (reg == null) {
reg = MinecraftServer.getServer().getCustomRegistry().b(IRegistry.aO);
}

View File

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

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")
minecraftVersion("1.17")
}
shadowJar {
dependencies {