Skip to content

Commit

Permalink
Some small cleanups & fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lowercasebtw committed Dec 12, 2024
1 parent 3a036e0 commit f608e57
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public abstract class MixinGameRenderer {
private MinecraftClient client;

@Inject(method = "bobView", at = @At("TAIL"))
private void animatium$bobbingTilt(MatrixStack matrices, float tickDelta, CallbackInfo ci) {
private void fixVerticalBobbingTilt(MatrixStack matrices, float tickDelta, CallbackInfo ci) {
if (AnimatiumConfig.fixVerticalBobbingTilt && this.client.getCameraEntity() instanceof PlayerEntity playerEntity) {
ViewBobbingStorage bobbingAccessor = (ViewBobbingStorage) playerEntity;
float j = MathHelper.lerp(tickDelta, bobbingAccessor.animatium$getPreviousBobbingTilt(), bobbingAccessor.animatium$getBobbingTilt());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,8 @@
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.item.HeldItemRenderer;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.component.DataComponentTypes;
import net.minecraft.component.type.ConsumableComponent;
import net.minecraft.item.BlockItem;
import net.minecraft.item.ItemStack;
import net.minecraft.item.consume.UseAction;
import net.minecraft.util.Arm;
import net.minecraft.util.Hand;
import net.minecraft.util.math.RotationAxis;
Expand All @@ -24,8 +21,6 @@
import org.spongepowered.asm.mixin.injection.Slice;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import java.util.Objects;

@Mixin(HeldItemRenderer.class)
public abstract class MixinHeldItemRenderer {
@Shadow
Expand All @@ -51,13 +46,7 @@ private void tiltItemPositions(AbstractClientPlayerEntity player, float tickDelt
private void removeBlockingEquipAnimation(Hand hand, CallbackInfo ci) {
ClientPlayerEntity player = this.client.player;
if (AnimatiumConfig.removeBlockingEquipAnimation && player != null && player.isUsingItem()) {
ItemStack activeStack = player.getActiveItem();
if (activeStack.contains(DataComponentTypes.CONSUMABLE)) {
ConsumableComponent consumableComponent = Objects.requireNonNull(activeStack.get(DataComponentTypes.CONSUMABLE));
if (consumableComponent.useAction() == UseAction.BLOCK) {
ci.cancel();
}
}
ci.cancel();
}
}

Expand Down

0 comments on commit f608e57

Please sign in to comment.