Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cancel Component Update Animation #1116

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -769,6 +769,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
Loading