Fixed all but one remaining API changes in 1.16.1

No testing has been performed yet.
This commit is contained in:
MattBDev 2020-06-25 20:57:06 -04:00
parent 9cb24bc37d
commit aab10adb79
2 changed files with 5 additions and 12 deletions

View File

@ -47,8 +47,6 @@ public final class BukkitAdapter_1_16_1 extends NMSAdapter {
private final static MethodHandle methodGetVisibleChunk;
public final static MethodHandle methodSetLightNibbleArray;
private static final int CHUNKSECTION_BASE;
private static final int CHUNKSECTION_SHIFT;
@ -79,10 +77,6 @@ public final class BukkitAdapter_1_16_1 extends NMSAdapter {
declaredGetVisibleChunk.setAccessible(true);
methodGetVisibleChunk = MethodHandles.lookup().unreflect(declaredGetVisibleChunk);
Method declaredSetLightNibbleArray = LightEngineStorage.class.getDeclaredMethod("a", long.class, NibbleArray.class);
declaredSetLightNibbleArray.setAccessible(true);
methodSetLightNibbleArray = MethodHandles.lookup().unreflect(declaredSetLightNibbleArray);
Field tmp = DataPaletteBlock.class.getDeclaredField("j");
ReflectionUtils.setAccessibleNonFinal(tmp);
fieldLock = tmp;
@ -130,7 +124,7 @@ public final class BukkitAdapter_1_16_1 extends NMSAdapter {
}
public static Chunk ensureLoaded(World nmsWorld, int X, int Z) {
Chunk nmsChunk = nmsWorld.getChunkIfLoaded(X, Z);
Chunk nmsChunk = nmsWorld.getChunkProvider().getChunkAt(X, Z, false);
if (nmsChunk != null) {
return nmsChunk;
}
@ -183,7 +177,8 @@ public final class BukkitAdapter_1_16_1 extends NMSAdapter {
if (lighting) {
ChunkCoordIntPair chunkCoordIntPair = new ChunkCoordIntPair(X, Z);
PacketPlayOutLightUpdate packet = new PacketPlayOutLightUpdate(chunkCoordIntPair, nmsWorld.getChunkProvider().getLightEngine());
boolean trustEdges = false; //Added in 1.16.1 Not sure what it does.
PacketPlayOutLightUpdate packet = new PacketPlayOutLightUpdate(chunkCoordIntPair, nmsWorld.getChunkProvider().getLightEngine(), trustEdges);
playerChunk.players.a(chunkCoordIntPair, false).forEach(p -> {
p.playerConnection.sendPacket(packet);
});
@ -194,9 +189,7 @@ public final class BukkitAdapter_1_16_1 extends NMSAdapter {
}
return null;
});
return;
}
return;
}
/*

View File

@ -229,7 +229,7 @@ public class BukkitGetBlocks_1_16_1 extends CharGetBlocks {
entity.valid = false;
}
public Chunk ensureLoaded(net.minecraft.server.v1_15_R1.World nmsWorld, int X, int Z) {
public Chunk ensureLoaded(net.minecraft.server.v1_16_R1.World nmsWorld, int X, int Z) {
return BukkitAdapter_1_16_1.ensureLoaded(nmsWorld, X, Z);
}
@ -428,7 +428,7 @@ public class BukkitGetBlocks_1_16_1 extends CharGetBlocks {
for (final String name : Constants.NO_COPY_ENTITY_NBT_FIELDS) {
tag.remove(name);
}
entity.f(tag);
entity.save(tag);
}
entity.setLocation(x, y, z, yaw, pitch);
nmsWorld.addEntity(entity, CreatureSpawnEvent.SpawnReason.CUSTOM);