Skip to content

Commit

Permalink
Fix spawn packets not sending the modified pitch/yaw from the start
Browse files Browse the repository at this point in the history
  • Loading branch information
libraryaddict committed Dec 31, 2024
1 parent 3753a81 commit 428c963
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -396,15 +396,16 @@ private PacketWrapper constructLivingPacket(Player observer, LibsPackets packets
com.github.retrooper.packetevents.protocol.entity.type.EntityType entityType = getEntityType(disguise);
PacketWrapper spawnEntity;
int entityId = observer == disguisedEntity ? DisguiseAPI.getSelfDisguiseId() : disguisedEntity.getEntityId();
com.github.retrooper.packetevents.protocol.world.Location location =
new com.github.retrooper.packetevents.protocol.world.Location(loc.getX(), loc.getY(), loc.getZ(), pitch, yaw);

if (NmsVersion.v1_19_R1.isSupported()) {
spawnEntity =
new WrapperPlayServerSpawnEntity(entityId, disguise.getUUID(), entityType, SpigotConversionUtil.fromBukkitLocation(loc),
loc.getYaw(), 0, new Vector3d(vec.getX(), vec.getY(), vec.getZ()));
yaw, 0, new Vector3d(vec.getX(), vec.getY(), vec.getZ()));
} else {
spawnEntity = new WrapperPlayServerSpawnLivingEntity(entityId, disguise.getUUID(), entityType,
SpigotConversionUtil.fromBukkitLocation(loc), loc.getPitch(), new Vector3d(vec.getX(), vec.getY(), vec.getZ()),
new ArrayList<>());
SpigotConversionUtil.fromBukkitLocation(loc), pitch, new Vector3d(vec.getX(), vec.getY(), vec.getZ()), new ArrayList<>());
}

packets.addPacket(spawnEntity);
Expand Down

0 comments on commit 428c963

Please sign in to comment.