Finalize some things

This commit is contained in:
FlorianMichael 2024-12-04 01:44:51 +01:00
parent ee1df66f35
commit a77937670e
No known key found for this signature in database
GPG Key ID: C2FB87E71C425126
3 changed files with 14 additions and 15 deletions

View File

@ -87,19 +87,8 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity
super(world, profile);
}
@Redirect(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;shouldSlowDown()Z"))
private boolean moveSlowDownAbove(ClientPlayerEntity instance) {
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_13_2)) {
return instance.input.playerInput.sneak();
} else if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_14_4)) {
return !MinecraftClient.getInstance().player.isSpectator() && (instance.input.playerInput.sneak() || instance.shouldSlowDown());
} else {
return instance.shouldSlowDown();
}
}
@Redirect(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;shouldStopSprinting()Z"))
private boolean keepSprintingStateOff(ClientPlayerEntity instance) {
private boolean dontUnsprint(ClientPlayerEntity instance) {
return shouldStopSprinting() && ProtocolTranslator.getTargetVersion().newerThanOrEqualTo(ProtocolVersion.v1_21_4);
}
@ -178,6 +167,17 @@ public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity
return ProtocolTranslator.getTargetVersion().newerThan(ProtocolVersion.v1_15_1) && original;
}
@Redirect(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;shouldSlowDown()Z"))
private boolean changeSneakSlowdownCondition(ClientPlayerEntity instance) {
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_13_2)) {
return instance.input.playerInput.sneak();
} else if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_14_4)) {
return !MinecraftClient.getInstance().player.isSpectator() && (instance.input.playerInput.sneak() || instance.shouldSlowDown());
} else {
return instance.shouldSlowDown();
}
}
@Inject(method = "tickMovement()V",
slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;isCamera()Z")),
at = @At(value = "INVOKE", target = "Lnet/minecraft/util/PlayerInput;sneak()Z", ordinal = 0))

View File

@ -62,8 +62,7 @@ public abstract class MixinHeldItemRenderer {
@Inject(method = "renderFirstPersonItem",
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/item/HeldItemRenderer;renderItem(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/item/ItemStack;Lnet/minecraft/item/ModelTransformationMode;ZLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V", ordinal = 1))
private void transformItemPosition1_7(AbstractClientPlayerEntity player, float tickDelta, float pitch, Hand hand, float swingProgress, ItemStack stack, float equipProgress, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, CallbackInfo ci) {
// Modifies the handheld position to be slightly tilted like in 1.7 and prior
private void slightlyTiltItemPosition(AbstractClientPlayerEntity player, float tickDelta, float pitch, Hand hand, float swingProgress, ItemStack stack, float equipProgress, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, CallbackInfo ci) {
if (VisualSettings.global().tiltItemPositions.isEnabled() && !(stack.getItem() instanceof BlockItem)) {
final Arm arm = hand == Hand.MAIN_HAND ? player.getMainArm() : player.getMainArm().getOpposite();
final int direction = arm == Arm.RIGHT ? 1 : -1;

View File

@ -96,7 +96,7 @@ public abstract class VFPListEntry extends AlwaysSelectedEntryListWidget.Entry<V
final double interpolatedValue = Math.sin((Math.PI / 2) * Math.cos(Math.PI * 2 * time / Math.max(interpolateEnd * 0.5, 3.0))) / 2.0 + 0.5;
context.enableScissor(x, y, x + entryWidth - offset - SCISSORS_OFFSET, y + entryHeight);
context.enableScissor(0, 0, entryWidth - offset - SCISSORS_OFFSET, entryHeight);
context.drawTextWithShadow(font, name, SLOT_MARGIN - (int) MathHelper.lerp(interpolatedValue, 0.0, interpolateEnd), textY, -1);
context.disableScissor();
} else {