Fix spectator hand jittering in 1.12.2 and below
This commit is contained in:
@@ -0,0 +1 @@
|
|||||||
|
// 1.12.2 and below
|
||||||
@@ -17,6 +17,8 @@
|
|||||||
//#if MC>=11400
|
//#if MC>=11400
|
||||||
"MixinCamera",
|
"MixinCamera",
|
||||||
"MixinInGameHud",
|
"MixinInGameHud",
|
||||||
|
//#else
|
||||||
|
//$$ "Mixin_FixHandOffsetTickDelta",
|
||||||
//#endif
|
//#endif
|
||||||
"ClientWorldAccessor",
|
"ClientWorldAccessor",
|
||||||
"EntityLivingBaseAccessor",
|
"EntityLivingBaseAccessor",
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
package com.replaymod.replay.mixin;
|
||||||
|
|
||||||
|
import com.replaymod.replay.camera.CameraEntity;
|
||||||
|
import net.minecraft.client.entity.EntityPlayerSP;
|
||||||
|
import net.minecraft.client.renderer.ItemRenderer;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* In 1.12.2 and below, Vanilla does not respect the tickDelta value when getting the yaw/pitch of the player for
|
||||||
|
* computing the hand offset.
|
||||||
|
* This causes the hand movement to be jittery when spectating another player in a replay.
|
||||||
|
*/
|
||||||
|
@Mixin(ItemRenderer.class)
|
||||||
|
public abstract class Mixin_FixHandOffsetTickDelta {
|
||||||
|
@Redirect(method = "rotateArm", at = @At(value = "FIELD", target = "Lnet/minecraft/client/entity/EntityPlayerSP;rotationYaw:F"))
|
||||||
|
private float getYaw(
|
||||||
|
EntityPlayerSP instance,
|
||||||
|
//#if MC<10900
|
||||||
|
//$$ EntityPlayerSP arg,
|
||||||
|
//#endif
|
||||||
|
float tickDelta
|
||||||
|
) {
|
||||||
|
if (instance instanceof CameraEntity) {
|
||||||
|
return instance.prevRotationYaw + (instance.rotationYaw - instance.prevRotationYaw) * tickDelta;
|
||||||
|
} else {
|
||||||
|
return instance.rotationYaw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Redirect(method = "rotateArm", at = @At(value = "FIELD", target = "Lnet/minecraft/client/entity/EntityPlayerSP;rotationPitch:F"))
|
||||||
|
private float getPitch(
|
||||||
|
EntityPlayerSP instance,
|
||||||
|
//#if MC<10900
|
||||||
|
//$$ EntityPlayerSP arg,
|
||||||
|
//#endif
|
||||||
|
float tickDelta
|
||||||
|
) {
|
||||||
|
if (instance instanceof CameraEntity) {
|
||||||
|
return instance.prevRotationPitch + (instance.rotationPitch - instance.prevRotationPitch) * tickDelta;
|
||||||
|
} else {
|
||||||
|
return instance.rotationPitch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,6 +8,7 @@ net.minecraft.util.text.TextFormatting net.minecraft.util.EnumChatFormatting
|
|||||||
net.minecraft.util.text.ITextComponent net.minecraft.util.IChatComponent
|
net.minecraft.util.text.ITextComponent net.minecraft.util.IChatComponent
|
||||||
net.minecraft.network.datasync.EntityDataManager net.minecraft.entity.DataWatcher
|
net.minecraft.network.datasync.EntityDataManager net.minecraft.entity.DataWatcher
|
||||||
net.minecraft.network.datasync.EntityDataManager.DataEntry net.minecraft.entity.DataWatcher.WatchableObject
|
net.minecraft.network.datasync.EntityDataManager.DataEntry net.minecraft.entity.DataWatcher.WatchableObject
|
||||||
|
net.minecraft.client.renderer.ItemRenderer rotateArm() rotateWithPlayerRotations()
|
||||||
net.minecraft.client.renderer.VertexBuffer net.minecraft.client.renderer.WorldRenderer
|
net.minecraft.client.renderer.VertexBuffer net.minecraft.client.renderer.WorldRenderer
|
||||||
net.minecraft.client.particle.Particle net.minecraft.client.particle.EntityFX
|
net.minecraft.client.particle.Particle net.minecraft.client.particle.EntityFX
|
||||||
net.minecraft.util.math.MathHelper net.minecraft.util.MathHelper
|
net.minecraft.util.math.MathHelper net.minecraft.util.MathHelper
|
||||||
|
|||||||
Reference in New Issue
Block a user