Release 2.6.3

This commit is contained in:
Jonas Herzig
2021-12-11 11:19:41 +01:00
3 changed files with 17 additions and 10 deletions

View File

@@ -3,25 +3,32 @@ package com.replaymod.replay.mixin.entity_tracking;
import com.replaymod.replay.ext.EntityExt;
import net.minecraft.entity.Entity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
@Mixin(Entity.class)
public abstract class Mixin_EntityExt implements EntityExt {
@Unique
private float trackedYaw;
@Shadow
public float yaw;
@Shadow
public float pitch;
@Unique
private float trackedPitch;
private float trackedYaw = Float.NaN;
@Unique
private float trackedPitch = Float.NaN;
@Override
public float replaymod$getTrackedYaw() {
return this.trackedYaw;
return !Float.isNaN(this.trackedYaw) ? this.trackedYaw : this.yaw;
}
@Override
public float replaymod$getTrackedPitch() {
return this.trackedPitch;
return !Float.isNaN(this.trackedPitch) ? this.trackedPitch : this.pitch;
}
@Override

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;

View File

@@ -1 +1 @@
2.6.2
2.6.3