From e472713d1ccf6af4ecedfe1bf20bf5ecb9fec125 Mon Sep 17 00:00:00 2001 From: Jonas Herzig Date: Sat, 11 Dec 2021 10:51:07 +0100 Subject: [PATCH] Fix rotation from entity teleport getting lost (related to #619) This fixes the rotation of newly placed entities (cause they seem to get spawned with 0/0 and then get teleported to their correct rotation, which we didn't capture). This does not fix the rotation of already existing entities that just got sent to the client, those already get spawned with their rotation, which we don't yet capture. The following commit fixes that. --- .../mixin/entity_tracking/Mixin_FixPartialUpdates.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/replaymod/replay/mixin/entity_tracking/Mixin_FixPartialUpdates.java b/src/main/java/com/replaymod/replay/mixin/entity_tracking/Mixin_FixPartialUpdates.java index 255102ae..2ffd980a 100644 --- a/src/main/java/com/replaymod/replay/mixin/entity_tracking/Mixin_FixPartialUpdates.java +++ b/src/main/java/com/replaymod/replay/mixin/entity_tracking/Mixin_FixPartialUpdates.java @@ -85,23 +85,23 @@ public class Mixin_FixPartialUpdates { @Unique private Entity entity; - @ModifyVariable(method = "onEntityUpdate", at = @At(value = "INVOKE", target = ENTITY_UPDATE), ordinal = 0) + @ModifyVariable(method = { "onEntityUpdate", "onEntityPosition" }, at = @At(value = "INVOKE", target = ENTITY_UPDATE), ordinal = 0) private Entity captureEntity(Entity entity) { return this.entity = entity; } - @Inject(method = "onEntityUpdate", at = @At("RETURN")) + @Inject(method = { "onEntityUpdate", "onEntityPosition" }, at = @At("RETURN")) private void resetEntityField(CallbackInfo ci) { this.entity = null; } - @ModifyArg(method = "onEntityUpdate", at = @At(value = "INVOKE", target = ENTITY_UPDATE), index = 3) + @ModifyArg(method = { "onEntityUpdate", "onEntityPosition" }, at = @At(value = "INVOKE", target = ENTITY_UPDATE), index = 3) private float captureTrackedYaw(float value) { ((EntityExt) this.entity).replaymod$setTrackedYaw(value); return value; } - @ModifyArg(method = "onEntityUpdate", at = @At(value = "INVOKE", target = ENTITY_UPDATE), index = 4) + @ModifyArg(method = { "onEntityUpdate", "onEntityPosition" }, at = @At(value = "INVOKE", target = ENTITY_UPDATE), index = 4) private float captureTrackedPitch(float value) { ((EntityExt) this.entity).replaymod$setTrackedPitch(value); return value;