While Recording, only insert S19PacketEntityHeadLook for recording player if value actually changed | https://trello.com/c/9MZeTBgj/
This commit is contained in:
@@ -38,6 +38,7 @@ public class RecordingHandler {
|
|||||||
private int ticksSinceLastCorrection = 0;
|
private int ticksSinceLastCorrection = 0;
|
||||||
private boolean wasSleeping = false;
|
private boolean wasSleeping = false;
|
||||||
private int lastRiding = -1;
|
private int lastRiding = -1;
|
||||||
|
private Integer rotationYawHeadBefore = 0;
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onPlayerJoin(EntityJoinWorldEvent e) {
|
public void onPlayerJoin(EntityJoinWorldEvent e) {
|
||||||
@@ -104,6 +105,7 @@ public class RecordingHandler {
|
|||||||
|
|
||||||
public void resetVars() {
|
public void resetVars() {
|
||||||
lastX = lastY = lastZ = null;
|
lastX = lastY = lastZ = null;
|
||||||
|
rotationYawHeadBefore = null;
|
||||||
lastEffects = new ArrayList<Integer>();
|
lastEffects = new ArrayList<Integer>();
|
||||||
playerItems = new ItemStack[5];
|
playerItems = new ItemStack[5];
|
||||||
}
|
}
|
||||||
@@ -162,17 +164,23 @@ public class RecordingHandler {
|
|||||||
ConnectionEventHandler.insertPacket(packet);
|
ConnectionEventHandler.insertPacket(packet);
|
||||||
|
|
||||||
//HEAD POS
|
//HEAD POS
|
||||||
|
int rotationYawHead = ((int)(e.player.rotationYawHead * 256.0F / 360.0F));
|
||||||
|
|
||||||
|
if(rotationYawHead != rotationYawHeadBefore) {
|
||||||
S19PacketEntityHeadLook head = new S19PacketEntityHeadLook();
|
S19PacketEntityHeadLook head = new S19PacketEntityHeadLook();
|
||||||
ByteBuf bb1 = Unpooled.buffer();
|
ByteBuf bb1 = Unpooled.buffer();
|
||||||
PacketBuffer pb1 = new PacketBuffer(bb1);
|
PacketBuffer pb1 = new PacketBuffer(bb1);
|
||||||
|
|
||||||
pb1.writeVarIntToBuffer(entityID);
|
pb1.writeVarIntToBuffer(entityID);
|
||||||
pb1.writeByte(((int) (e.player.rotationYawHead * 256.0F / 360.0F)));
|
pb1.writeByte(rotationYawHead);
|
||||||
|
|
||||||
head.readPacketData(pb1);
|
head.readPacketData(pb1);
|
||||||
|
|
||||||
ConnectionEventHandler.insertPacket(head);
|
ConnectionEventHandler.insertPacket(head);
|
||||||
|
|
||||||
|
rotationYawHeadBefore = rotationYawHead;
|
||||||
|
}
|
||||||
|
|
||||||
S12PacketEntityVelocity vel = new S12PacketEntityVelocity(entityID, e.player.motionX, e.player.motionY, e.player.motionZ);
|
S12PacketEntityVelocity vel = new S12PacketEntityVelocity(entityID, e.player.motionX, e.player.motionY, e.player.motionZ);
|
||||||
ConnectionEventHandler.insertPacket(vel);
|
ConnectionEventHandler.insertPacket(vel);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user