diff --git a/src/main/java/me/mixces/animatium/mixins/renderer/item/MixinHeldItemRenderer.java b/src/main/java/me/mixces/animatium/mixins/renderer/item/MixinHeldItemRenderer.java index 1ae4742..b5d80c3 100644 --- a/src/main/java/me/mixces/animatium/mixins/renderer/item/MixinHeldItemRenderer.java +++ b/src/main/java/me/mixces/animatium/mixins/renderer/item/MixinHeldItemRenderer.java @@ -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; @@ -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( diff --git a/src/main/kotlin/me/mixces/animatium/config/AnimatiumConfig.kt b/src/main/kotlin/me/mixces/animatium/config/AnimatiumConfig.kt index 470f3ac..7dbb1fa 100644 --- a/src/main/kotlin/me/mixces/animatium/config/AnimatiumConfig.kt +++ b/src/main/kotlin/me/mixces/animatium/config/AnimatiumConfig.kt @@ -681,6 +681,17 @@ class AnimatiumConfig { .controller(TickBoxControllerBuilder::create) .build() ) + otherGroup.option( + Option.createBuilder() + .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() .name(Text.translatable("animatium.disableItemUsingTextureInGui")) @@ -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 diff --git a/src/main/resources/assets/animatium/lang/en_us.json b/src/main/resources/assets/animatium/lang/en_us.json index 02f5bc4..29f277a 100644 --- a/src/main/resources/assets/animatium/lang/en_us.json +++ b/src/main/resources/assets/animatium/lang/en_us.json @@ -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",