Skip to content

Commit

Permalink
Cancel Component Update Animation (#1116)
Browse files Browse the repository at this point in the history
  • Loading branch information
AzureAaron authored Jan 2, 2025
1 parent a09c6ee commit 18ec59c
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,14 @@ public static ConfigCategory create(SkyblockerConfig defaults, SkyblockerConfig
newValue -> config.uiAndVisuals.showEquipmentInInventory = newValue)
.controller(ConfigUtils::createBooleanController)
.build())
.option(Option.<Boolean>createBuilder()
.name(Text.translatable("skyblocker.config.uiAndVisuals.cancelComponentUpdateAnimation"))
.description(OptionDescription.of(Text.translatable("skyblocker.config.uiAndVisuals.cancelComponentUpdateAnimation.@Tooltip")))
.binding(defaults.uiAndVisuals.cancelComponentUpdateAnimation,
() -> config.uiAndVisuals.cancelComponentUpdateAnimation,
newValue -> config.uiAndVisuals.cancelComponentUpdateAnimation = newValue)
.controller(ConfigUtils::createBooleanController)
.build())

//Chest Value FIXME change dropdown to color controller
.group(OptionGroup.createBuilder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ public class UIAndVisualsConfig {
@SerialEntry
public boolean showEquipmentInInventory = true;

@SerialEntry
public boolean cancelComponentUpdateAnimation = true;

@SerialEntry
public ChestValue chestValue = new ChestValue();

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package de.hysky.skyblocker.mixins;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;

import com.llamalad7.mixinextras.injector.ModifyReturnValue;

import de.hysky.skyblocker.config.SkyblockerConfigManager;
import de.hysky.skyblocker.utils.Utils;
import net.minecraft.client.render.item.HeldItemRenderer;
import net.minecraft.item.ItemStack;

@Mixin(HeldItemRenderer.class)
public class HeldItemRendererMixin {

@ModifyReturnValue(method = "shouldSkipHandAnimationOnSwap", at = @At("RETURN"))
private boolean skyblocker$cancelComponentUpdateAnimation(boolean original, ItemStack from, ItemStack to) {
return Utils.isOnSkyblock() && from.getItem() == to.getItem() ? original || SkyblockerConfigManager.get().uiAndVisuals.cancelComponentUpdateAnimation : original;
}
}
3 changes: 3 additions & 0 deletions src/main/resources/assets/skyblocker/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,9 @@
"skyblocker.config.uiAndVisuals.bars": "Health, Mana, Defence, Speed & XP Bars",
"skyblocker.config.uiAndVisuals.bars.enableBars": "Enable Bars",

"skyblocker.config.uiAndVisuals.cancelComponentUpdateAnimation": "Cancel Component Update Animation",
"skyblocker.config.uiAndVisuals.cancelComponentUpdateAnimation.@Tooltip": "Cancels the down-and-up animation in your hand that plays when an item's components are updated.",

"skyblocker.config.uiAndVisuals.chestValue": "Chest Value",
"skyblocker.config.uiAndVisuals.chestValue.color": "Chest Value Color",
"skyblocker.config.uiAndVisuals.chestValue.enableChestValue": "Enable Chest Value",
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/skyblocker.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"GenericContainerScreenHandlerMixin",
"HandledScreenMixin",
"HandledScreenProviderMixin",
"HeldItemRendererMixin",
"InGameHudMixin",
"InGameOverlayRendererMixin",
"InventoryScreenMixin",
Expand Down

0 comments on commit 18ec59c

Please sign in to comment.