Fix recording of client player's metadata after respawn (fixes #212)

1.15 removed the data tracker syncing from the spawn packet, so we now need to
send that explicitly.
This commit is contained in:
Jonas Herzig
2020-06-28 16:33:57 +02:00
parent 8e1f9f5a9c
commit 0ba651d19c
2 changed files with 10 additions and 13 deletions

View File

@@ -99,17 +99,14 @@ public class RecordingEventHandler extends EventRegistrations {
}
//#endif
public void onPlayerJoin() {
public void spawnRecordingPlayer() {
try {
packetListener.save(new PlayerSpawnS2CPacket(mc.player));
} catch(Exception e1) {
e1.printStackTrace();
}
}
public void onPlayerRespawn() {
try {
packetListener.save(new PlayerSpawnS2CPacket(mc.player));
ClientPlayerEntity player = mc.player;
assert player != null;
packetListener.save(new PlayerSpawnS2CPacket(player));
//#if MC>=11500
packetListener.save(new EntityTrackerUpdateS2CPacket(player.getEntityId(), player.getDataTracker(), true));
//#endif
lastX = lastY = lastZ = null;
} catch(Exception e) {
e.printStackTrace();

View File

@@ -81,7 +81,7 @@ public abstract class MixinNetHandlerPlayClient {
// Only add spawn packet for our own player and only if he isn't known yet
if (data.getUuid().equals(mcStatic.player.getGameProfile().getId())
&& !this.playerListEntries.containsKey(data.getUuid())) {
handler.onPlayerJoin();
handler.spawnRecordingPlayer();
}
}
} catch (IOException e) {
@@ -96,7 +96,7 @@ public abstract class MixinNetHandlerPlayClient {
//$$ public void recordOwnJoin(S01PacketJoinGame packet, CallbackInfo ci) {
//$$ RecordingEventHandler handler = getRecordingEventHandler();
//$$ if (handler != null) {
//$$ handler.onPlayerJoin();
//$$ handler.spawnRecordingPlayer();
//$$ }
//$$ }
//#endif
@@ -116,7 +116,7 @@ public abstract class MixinNetHandlerPlayClient {
public void recordOwnRespawn(PlayerRespawnS2CPacket packet, CallbackInfo ci) {
RecordingEventHandler handler = getRecordingEventHandler();
if (handler != null) {
handler.onPlayerRespawn();
handler.spawnRecordingPlayer();
}
}
}