Skip to content

Commit

Permalink
Add 1.7.x equip animation behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
Mixces committed Dec 28, 2024
1 parent f2b0397 commit 10f9198
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package me.mixces.animatium.mixins.renderer.item;

import com.llamalad7.mixinextras.injector.ModifyReturnValue;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import com.llamalad7.mixinextras.sugar.Local;
Expand Down Expand Up @@ -104,6 +105,11 @@ public abstract class MixinHeldItemRenderer {
}
}

@ModifyReturnValue(method = "shouldSkipHandAnimationOnSwap", at = @At("RETURN"))
private boolean animatium$doNotSkipHandAnimationOnSwap(boolean original) {
return !AnimatiumConfig.getInstance().getDoNotSkipHandAnimationOnSwap() && original;
}

@Inject(method = "renderFirstPersonItem",
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/item/HeldItemRenderer;applyEquipOffset(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/util/Arm;F)V", shift = At.Shift.AFTER),
slice = @Slice(
Expand Down
12 changes: 12 additions & 0 deletions src/main/kotlin/me/mixces/animatium/config/AnimatiumConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,17 @@ class AnimatiumConfig {
.controller(TickBoxControllerBuilder::create)
.build()
)
otherGroup.option(
Option.createBuilder<Boolean>()
.name(Text.translatable("animatium.doNotSkipHandAnimationOnSwap"))
.description(OptionDescription.of(Text.translatable("animatium.doNotSkipHandAnimationOnSwap.description")))
.binding(
defaults.doNotSkipHandAnimationOnSwap,
{ config.doNotSkipHandAnimationOnSwap },
{ newVal -> config.doNotSkipHandAnimationOnSwap = newVal })
.controller(TickBoxControllerBuilder::create)
.build()
)
otherGroup.option(
Option.createBuilder<Boolean>()
.name(Text.translatable("animatium.disableItemUsingTextureInGui"))
Expand Down Expand Up @@ -968,6 +979,7 @@ class AnimatiumConfig {
@SerialEntry var tiltItemPositionsInThirdperson = true
@SerialEntry var applyItemSwingUsage = true
@SerialEntry var removeEquipAnimationOnItemUse = true
@SerialEntry var doNotSkipHandAnimationOnSwap = true
@SerialEntry var disableItemUsingTextureInGui = true
@SerialEntry var itemDropsFaceCamera = true
@SerialEntry var itemDrops2D = true
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/assets/animatium/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@
"animatium.applyItemSwingUsage.description": "Block hitting (apply swing offset in item usage code).",
"animatium.removeEquipAnimationOnItemUse": "Remove the equip animation when using a item",
"animatium.removeEquipAnimationOnItemUse.description": "Fixes the blocking animation which plays the equip animation on use, and others.",
"animatium.doNotSkipHandAnimationOnSwap": "Do not skip hand animation on swap",
"animatium.doNotSkipHandAnimationOnSwap.description": "Remove check enabling items of the same type to not show the hand animation while swapping like in <=1.7.x.",
"animatium.disableItemUsingTextureInGui": "Disable item usage texture in GUI",
"animatium.disableItemUsingTextureInGui.description": "Disables the item usage texture in the GUI like in <=1.8.x (mainly rod/bow/crossbow).",
"animatium.itemDropsFaceCamera": "Make item entities use camera yaw / face camera",
Expand Down

0 comments on commit 10f9198

Please sign in to comment.