I'm trying to port my 1.21 plugin to 1.21.3 and trying to port NPC spawning. Before, I used to spawn them with NMS like this:
But now I'm trying to do it with
and getting this error:
it points at that line.
Code:
connection.send(ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER, npc))
connection.send(ClientboundAddPlayerPacket(npc))
But now I'm trying to do it with
Code:
connection.send(ClientboundPlayerInfoUpdatePacket.createSinglePlayerInitializing(npc, false))
and getting this error:
Code:
Caused by: java.lang.NullPointerException: Cannot invoke "net.minecraft.server.network.ServerGamePacketListenerImpl.latency()" because "player.connection" is null
it points at that line.
connection
's type is ServerGamePacketListenerImpl
and npc
's type is CraftPlayer