From aab10adb7977dc485b91b3f1e3c2335b2d8ca2be Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Thu, 25 Jun 2020 20:57:06 -0400 Subject: [PATCH] Fixed all but one remaining API changes in 1.16.1 No testing has been performed yet. --- .../adapter/mc1_16_1/BukkitAdapter_1_16_1.java | 13 +++---------- .../adapter/mc1_16_1/BukkitGetBlocks_1_16_1.java | 4 ++-- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_16_1/BukkitAdapter_1_16_1.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_16_1/BukkitAdapter_1_16_1.java index adab97743..74ae46eb2 100644 --- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_16_1/BukkitAdapter_1_16_1.java +++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_16_1/BukkitAdapter_1_16_1.java @@ -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; } /* diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_16_1/BukkitGetBlocks_1_16_1.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_16_1/BukkitGetBlocks_1_16_1.java index 61940e1fc..110a47298 100644 --- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_16_1/BukkitGetBlocks_1_16_1.java +++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_16_1/BukkitGetBlocks_1_16_1.java @@ -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);