Fix up packet spawn not having modified heights

This commit is contained in:
libraryaddict 2021-07-14 01:10:29 +12:00
parent 5c9b4c3245
commit 052f49aa86
1 changed files with 11 additions and 4 deletions

View File

@ -175,7 +175,8 @@ public class PacketHandlerSpawn implements IPacketHandler {
// If self disguise, or further than 50 blocks, or not in front of entity
normalPlayerDisguise = observer == disguisedEntity || disguisedEntity.getPassengers().contains(observer) || dist > (50 * 50) ||
(observer.getLocation().add(observer.getLocation().getDirection().normalize()).toVector().distanceSquared(disguisedEntity.getLocation().toVector()) - dist) < 0.3;
(observer.getLocation().add(observer.getLocation().getDirection().normalize()).toVector()
.distanceSquared(disguisedEntity.getLocation().toVector()) - dist) < 0.3;
sendArmor = normalPlayerDisguise;
skin.setSleepPackets(!normalPlayerDisguise);
@ -335,8 +336,17 @@ public class PacketHandlerSpawn implements IPacketHandler {
spawnEntity = ProtocolLibrary.getProtocolManager().createPacketConstructor(PacketType.Play.Server.SPAWN_ENTITY, nmsEntity, objectId, data)
.createPacket(nmsEntity, objectId, data);
StructureModifier<Double> doubles = spawnEntity.getDoubles();
doubles.write(0, x);
doubles.write(1, y);
doubles.write(2, z);
}
spawnEntity.getModifier().write(8, pitch);
spawnEntity.getModifier().write(9, yaw);
packets.addPacket(spawnEntity);
// If it's not the same type, then highly likely they have different velocity settings which we'd want to
@ -356,9 +366,6 @@ public class PacketHandlerSpawn implements IPacketHandler {
}
}
spawnEntity.getModifier().write(8, pitch);
spawnEntity.getModifier().write(9, yaw);
if (disguise.getType() == DisguiseType.ITEM_FRAME) {
if (data % 2 == 0) {
spawnEntity.getModifier().write(4, loc.getZ() + (data == 0 ? -1 : 1));