Skip to content

Commit

Permalink
Don't send diff meta while initializing
Browse files Browse the repository at this point in the history
  • Loading branch information
MATRIX-feather committed Dec 15, 2023
1 parent f9b6922 commit fa2d796
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fa2d796

Please sign in to comment.