Fixed invalid methods when using Spigot

This commit is contained in:
OmerBenGera 2022-01-29 12:34:10 +02:00
parent 98020c02f2
commit 0a2fbde412

View File

@ -64,8 +64,7 @@ public final class ChunkLoaderNPC_v1_16_R3 extends EntityPlayer implements Chunk
dieCall = true; dieCall = true;
removePlayer(getWorldServer(), this); removePlayer(getWorldServer(), this);
dieCall = false; dieCall = false;
} } else {
else {
super.die(); super.die();
} }
} }
@ -76,13 +75,17 @@ public final class ChunkLoaderNPC_v1_16_R3 extends EntityPlayer implements Chunk
} }
private static void removePlayer(WorldServer worldServer, EntityPlayer entityPlayer) { private static void removePlayer(WorldServer worldServer, EntityPlayer entityPlayer) {
Chunk currentChunk = entityPlayer.getCurrentChunk(); Chunk currentChunk = worldServer.getChunkIfLoaded((int) entityPlayer.locX() >> 4,
(int) entityPlayer.locZ() >> 4);
if (currentChunk != null) if (currentChunk != null)
currentChunk.b(entityPlayer); currentChunk.b(entityPlayer);
worldServer.entitiesById.remove(entityPlayer.getId()); worldServer.entitiesById.remove(entityPlayer.getId());
worldServer.unregisterEntity(entityPlayer); worldServer.unregisterEntity(entityPlayer);
try {
entityPlayer.shouldBeRemoved = true; entityPlayer.shouldBeRemoved = true;
} catch (Throwable ignored) {
}
} }
public static class DummyNetworkManager extends NetworkManager { public static class DummyNetworkManager extends NetworkManager {