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.
This commit is contained in:
Jonas Herzig
2021-12-11 10:51:07 +01:00
parent 1d76427a4d
commit e472713d1c

View File

@@ -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;