Initial Spigot/Paper 1.20 support

This commit is contained in:
Michael Primm 2023-06-09 02:05:17 -04:00
parent feac442492
commit 6beb62b4b7
7 changed files with 27 additions and 16 deletions

View file

@ -43,6 +43,7 @@ import net.minecraft.nbt.NBTTagString;
import net.minecraft.resources.MinecraftKey;
import net.minecraft.nbt.NBTBase;
import net.minecraft.server.MinecraftServer;
import net.minecraft.tags.TagsBlock;
import net.minecraft.world.level.BlockAccessAir;
import net.minecraft.world.level.biome.BiomeBase;
import net.minecraft.world.level.block.Block;
@ -189,13 +190,15 @@ public class BukkitVersionHelperSpigot120 extends BukkitVersionHelper {
int lightAtten = b.g(bd, BlockAccessAir.a, BlockPosition.b); // getLightBlock
//Log.info("statename=" + bname + "[" + sb + "], lightAtten=" + lightAtten);
// Fill in base attributes
bld.setBaseState(lastbs).setStateIndex(idx).setBlockName(bname).setStateName(sb).setMaterial(mat.toString()).setAttenuatesLight(lightAtten);
if (mat.b()) { bld.setSolid(); }
if (b instanceof BlockAir) { bld.setAir(); }
if (b instanceof BlockRotatable) { bld.setLog(); }
if (b instanceof BlockLeaves) { bld.setLeaves(); }
if ((!bd.r().c()) && ((bd.b() instanceof BlockFluids) == false)) { // Test if fluid type for block is not empty
bld.setBaseState(lastbs).setStateIndex(idx).setBlockName(bname).setStateName(sb).setAttenuatesLight(lightAtten);
if (bd.w() != null) { bld.setMaterial(bd.w().toString()); }
if (bd.e()) { bld.setSolid(); }
if (bd.i()) { bld.setAir(); }
if (bd.a(TagsBlock.t)) { bld.setLog(); }
if (bd.a(TagsBlock.O)) { bld.setLeaves(); }
if ((!bd.u().c()) && ((bd.b() instanceof BlockFluids) == false)) { // Test if fluid type for block is not empty
bld.setWaterlogged();
//Log.info("statename=" + bname + "[" + sb + "] = waterlogged");
}
DynmapBlockState dbs = bld.build(); // Build state
@ -338,12 +341,12 @@ public class BukkitVersionHelperSpigot120 extends BukkitVersionHelper {
@Override
public long getInhabitedTicks(Chunk c) {
return ((CraftChunk)c).getHandle(ChunkStatus.o).u();
return ((CraftChunk)c).getHandle(ChunkStatus.n).u();
}
@Override
public Map<?, ?> getTileEntitiesForChunk(Chunk c) {
return ((CraftChunk)c).getHandle(ChunkStatus.o).i;
return ((CraftChunk)c).getHandle(ChunkStatus.n).k;
}
@Override
@ -398,7 +401,7 @@ public class BukkitVersionHelperSpigot120 extends BukkitVersionHelper {
return ((NBTTagByteArray)val).d();
}
else if(val instanceof NBTTagString) {
return ((NBTTagString)val).f_();
return ((NBTTagString)val).m_();
}
else if(val instanceof NBTTagIntArray) {
return ((NBTTagIntArray)val).f();

View file

@ -3,7 +3,7 @@ package org.dynmap.bukkit.helper.v120;
import net.minecraft.world.level.biome.BiomeBase;
import net.minecraft.world.level.biome.BiomeFog;
import org.bukkit.World;
import org.bukkit.craftbukkit.v1_19_R3.CraftWorld;
import org.bukkit.craftbukkit.v1_20_R1.CraftWorld;
import org.dynmap.DynmapChunk;
import org.dynmap.bukkit.helper.BukkitVersionHelper;
import org.dynmap.bukkit.helper.BukkitWorld;
@ -53,7 +53,7 @@ public class MapChunkCache119_4 extends GenericMapChunkCache {
CraftWorld cw = (CraftWorld) w;
if (!cw.isChunkLoaded(chunk.x, chunk.z)) return null;
Chunk c = cw.getHandle().getChunkIfLoaded(chunk.x, chunk.z);
if (c == null || !c.o) return null; // c.loaded
if (c == null || !c.q) return null; // c.loaded
NBTTagCompound nbt = ChunkRegionLoader.a(cw.getHandle(), c);
return nbt != null ? parseChunkFromNBT(new NBT.NBTCompound(nbt)) : null;
}
@ -85,7 +85,7 @@ public class MapChunkCache119_4 extends GenericMapChunkCache {
ChunkCoordIntPair cc = new ChunkCoordIntPair(chunk.x, chunk.z);
GenericChunk gc = null;
try { // BUGBUG - convert this all to asyn properly, since now native async
nbt = cw.getHandle().k().a.f(cc).join().get(); // playerChunkMap
nbt = cw.getHandle().k().a.e(cc).join().get(); // playerChunkMap
} catch (CancellationException cx) {
} catch (NoSuchElementException snex) {
}

View file

@ -82,7 +82,7 @@ public class NBT {
}
@Override
public String getAsString(String s) {
return obj.c(s).f_();
return obj.c(s).m_();
}
@Override
public GenericBitStorage makeBitStorage(int bits, int count, long[] data) {