Fix look packets being weird in 1.8
This commit is contained in:
parent
e65613e750
commit
4853015bd8
@ -1299,27 +1299,27 @@ public class PacketsManager {
|
|||||||
packets = new PacketContainer[0];
|
packets = new PacketContainer[0];
|
||||||
} else {
|
} else {
|
||||||
packets[0] = sentPacket.shallowClone();
|
packets[0] = sentPacket.shallowClone();
|
||||||
StructureModifier<Object> mods = packets[0].getModifier();
|
StructureModifier<Byte> bytes = packets[0].getBytes();
|
||||||
byte yawValue = (Byte) mods.read(4);
|
boolean tele = sentPacket.getType() == PacketType.Play.Server.ENTITY_TELEPORT;
|
||||||
mods.write(4, getYaw(disguise.getType(), entity.getType(), yawValue));
|
byte yawValue = (Byte) bytes.read(tele ? 0 : 3);
|
||||||
byte pitchValue = (Byte) mods.read(5);
|
bytes.write(3, getYaw(disguise.getType(), entity.getType(), yawValue));
|
||||||
mods.write(5, getPitch(disguise.getType(), DisguiseType.getType(entity.getType()), pitchValue));
|
byte pitchValue = (Byte) bytes.read(tele ? 1 : 4);
|
||||||
if (sentPacket.getType() == PacketType.Play.Server.ENTITY_TELEPORT) {
|
bytes.write(4, getPitch(disguise.getType(), DisguiseType.getType(entity.getType()), pitchValue));
|
||||||
if (disguise.getType() == DisguiseType.ITEM_FRAME) {
|
if (tele && disguise.getType() == DisguiseType.ITEM_FRAME) {
|
||||||
|
StructureModifier<Integer> ints = packets[0].getIntegers();
|
||||||
Location loc = entity.getLocation();
|
Location loc = entity.getLocation();
|
||||||
int data = ((((int) loc.getYaw() % 360) + 720 + 45) / 90) % 4;
|
int data = ((((int) loc.getYaw() % 360) + 720 + 45) / 90) % 4;
|
||||||
if (data % 2 == 0) {
|
if (data % 2 == 0) {
|
||||||
if (data % 2 == 0) {
|
if (data % 2 == 0) {
|
||||||
mods.write(3, (int) Math.floor((loc.getZ() + (data == 0 ? -1 : 1)) * 32D));
|
ints.write(3, (int) Math.floor((loc.getZ() + (data == 0 ? -1 : 1)) * 32D));
|
||||||
} else {
|
} else {
|
||||||
mods.write(1, (int) Math.floor((loc.getX() + (data == 3 ? -1 : 1)) * 32D));
|
ints.write(1, (int) Math.floor((loc.getX() + (data == 3 ? -1 : 1)) * 32D));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
double y = getYModifier(entity, disguise);
|
double y = getYModifier(entity, disguise);
|
||||||
if (y != 0) {
|
if (y != 0) {
|
||||||
y *= 32;
|
y *= 32;
|
||||||
mods.write(2, (Integer) mods.read(2) + (int) Math.floor(y));
|
ints.write(2, (Integer) ints.read(2) + (int) Math.floor(y));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user