|
7 | 7 | import com.mojang.brigadier.LiteralMessage; |
8 | 8 | import com.mojang.datafixers.util.Pair; |
9 | 9 | import net.minecraft.Optionull; |
| 10 | +import net.minecraft.core.BlockPos; |
10 | 11 | import net.minecraft.network.chat.ComponentUtils; |
11 | 12 | import net.minecraft.network.chat.RemoteChatSession; |
12 | 13 | import net.minecraft.network.protocol.game.*; |
|
20 | 21 | import net.minecraft.server.level.ServerPlayer; |
21 | 22 | import net.minecraft.server.network.ServerGamePacketListenerImpl; |
22 | 23 | import net.minecraft.world.entity.EquipmentSlot; |
| 24 | +import net.minecraft.world.phys.Vec3; |
23 | 25 | import net.minecraft.world.scores.PlayerTeam; |
24 | 26 | import net.minecraft.world.scores.Scoreboard; |
25 | 27 | import net.pascalpex.npc.Config; |
@@ -231,7 +233,8 @@ public static void addNPCPacket(ServerPlayer npc, String suffix) { |
231 | 233 | if (player.getWorld().equals(worldMap.get(npc.getId()))) { |
232 | 234 | ServerGamePacketListenerImpl connection = ((CraftPlayer) player).getHandle().connection; |
233 | 235 | connection.send(createInitPacket(npc)); |
234 | | - connection.send(new ClientboundAddEntityPacket(npc, 0, npc.blockPosition())); |
| 236 | + Vec3 pos = npc.position(); |
| 237 | + connection.send(new ClientboundAddEntityPacket(npc.getId(), npc.getUUID(), pos.x(), pos.y(), pos.z(), npc.getXRot(), npc.getYRot(), npc.getType(), 0, npc.getDeltaMovement(), npc.getYHeadRot())); |
235 | 238 | connection.send(new ClientboundRotateHeadPacket(npc, (byte) (NpcData.getLocation(getID(npc)).getYaw() * 256f / 360f))); |
236 | 239 | Scoreboard scoreboard = new Scoreboard(); |
237 | 240 | PlayerTeam team = new PlayerTeam(scoreboard, npc.getUUID().toString()); |
@@ -266,7 +269,8 @@ public static void addJoinPacket(Player player) { |
266 | 269 | ServerGamePacketListenerImpl connection = ((CraftPlayer) player).getHandle().connection; |
267 | 270 | connection.send(createInitPacket(npc)); |
268 | 271 | connection.send(new ClientboundEntityEventPacket(npc, (byte) 1)); |
269 | | - connection.send(new ClientboundAddEntityPacket(npc, 0, npc.blockPosition())); |
| 272 | + Vec3 pos = npc.position(); |
| 273 | + connection.send(new ClientboundAddEntityPacket(npc.getId(), npc.getUUID(), pos.x(), pos.y(), pos.z(), npc.getXRot(), npc.getYRot(), npc.getType(), 0, npc.getDeltaMovement(), npc.getYHeadRot())); |
270 | 274 | connection.send(new ClientboundRotateHeadPacket(npc, (byte) (NpcData.getLocation(getID(npc)).getYaw() * 256f / 360f))); |
271 | 275 | Scoreboard scoreboard = new Scoreboard(); |
272 | 276 | PlayerTeam team = new PlayerTeam(scoreboard, npc.getUUID().toString()); |
|
0 commit comments