From fa2d79612b796b0135f13377e33a0748ab32d3b8 Mon Sep 17 00:00:00 2001 From: MATRIX-feather Date: Fri, 15 Dec 2023 15:09:26 +0800 Subject: [PATCH] Don't send diff meta while initializing --- .../network/datawatcher/watchers/SingleWatcher.java | 2 ++ .../renderer/network/listeners/MetaPacketListener.java | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/java/xiamomc/morph/backends/server/renderer/network/datawatcher/watchers/SingleWatcher.java b/src/main/java/xiamomc/morph/backends/server/renderer/network/datawatcher/watchers/SingleWatcher.java index 7bcbf5a1..e6e855bb 100644 --- a/src/main/java/xiamomc/morph/backends/server/renderer/network/datawatcher/watchers/SingleWatcher.java +++ b/src/main/java/xiamomc/morph/backends/server/renderer/network/datawatcher/watchers/SingleWatcher.java @@ -79,11 +79,13 @@ public SingleWatcher(Player bindingPlayer, EntityType entityType) this.bindingUUID = bindingPlayer.getUniqueId(); this.bindingPlayer = bindingPlayer; + syncing = true; this.entityType = entityType; initRegistry(); initValues(); sync(); + syncing = false; } //region Custom Registry diff --git a/src/main/java/xiamomc/morph/backends/server/renderer/network/listeners/MetaPacketListener.java b/src/main/java/xiamomc/morph/backends/server/renderer/network/listeners/MetaPacketListener.java index 87f27225..56ac469b 100644 --- a/src/main/java/xiamomc/morph/backends/server/renderer/network/listeners/MetaPacketListener.java +++ b/src/main/java/xiamomc/morph/backends/server/renderer/network/listeners/MetaPacketListener.java @@ -50,8 +50,14 @@ private void onMetaPacket(ClientboundSetEntityDataPacket packet, PacketEvent pac if (targetPlayer == sourcePlayer) return; - //取得来源玩家的伪装后的Meta,发送给目标玩家 - packetEvent.setPacket(getFactory().buildFullMetaPacket(sourcePlayer, watcher)); + //不要二次处理来自我们自己的包 + var packetContainer = packetEvent.getPacket(); + var meta = packetContainer.getMeta(PacketFactory.MORPH_PACKET_METAKEY); + if (meta.isEmpty()) + { + //取得来源玩家的伪装后的Meta,发送给目标玩家 + packetEvent.setPacket(getFactory().buildFullMetaPacket(sourcePlayer, watcher)); + } } @Override