diff options
author | Linnea Gräf <nea@nea.moe> | 2025-05-21 16:48:24 +0200 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2025-05-21 16:48:24 +0200 |
commit | 2ae915844a907ff698534cc261a3347b25f523bf (patch) | |
tree | 057c3aa73ab65e88ddf57e82ce40d44a55fb00fb /src | |
parent | 091f581bd23e52a936c3d8d672205071b0bb9d13 (diff) | |
download | Firmament-2ae915844a907ff698534cc261a3347b25f523bf.tar.gz Firmament-2ae915844a907ff698534cc261a3347b25f523bf.tar.bz2 Firmament-2ae915844a907ff698534cc261a3347b25f523bf.zip |
feat: Add option disable slot highlights in /sbmenu
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/moe/nea/firmament/mixins/feature/DisableSlotHighlights.java | 25 | ||||
-rw-r--r-- | src/main/kotlin/features/fixes/Fixes.kt | 1 |
2 files changed, 26 insertions, 0 deletions
diff --git a/src/main/java/moe/nea/firmament/mixins/feature/DisableSlotHighlights.java b/src/main/java/moe/nea/firmament/mixins/feature/DisableSlotHighlights.java new file mode 100644 index 0000000..0abed22 --- /dev/null +++ b/src/main/java/moe/nea/firmament/mixins/feature/DisableSlotHighlights.java @@ -0,0 +1,25 @@ +package moe.nea.firmament.mixins.feature; + +import moe.nea.firmament.features.fixes.Fixes; +import net.minecraft.component.DataComponentTypes; +import net.minecraft.item.ItemStack; +import net.minecraft.screen.slot.Slot; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@Mixin(Slot.class) +public abstract class DisableSlotHighlights { + @Shadow + public abstract ItemStack getStack(); + + @Inject(method = "canBeHighlighted", at = @At("HEAD"), cancellable = true) + private void dontHighlight(CallbackInfoReturnable<Boolean> cir) { + if (!Fixes.TConfig.INSTANCE.getHideSlotHighlights()) return; + var display = getStack().get(DataComponentTypes.TOOLTIP_DISPLAY); + if (display != null && display.hideTooltip()) + cir.setReturnValue(false); + } +} diff --git a/src/main/kotlin/features/fixes/Fixes.kt b/src/main/kotlin/features/fixes/Fixes.kt index 776035f..5e6350d 100644 --- a/src/main/kotlin/features/fixes/Fixes.kt +++ b/src/main/kotlin/features/fixes/Fixes.kt @@ -24,6 +24,7 @@ object Fixes : FirmamentFeature { val peekChat by keyBindingWithDefaultUnbound("peek-chat") val hidePotionEffects by toggle("hide-mob-effects") { false } val noHurtCam by toggle("disable-hurt-cam") { false } + val hideSlotHighlights by toggle("hide-slot-highlights") { false } } override val config: ManagedConfig |