feat: Add option disable slot highlights in /sbmenu

This commit is contained in:
Linnea Gräf
2025-05-21 16:48:24 +02:00
parent 091f581bd2
commit 2ae915844a
3 changed files with 28 additions and 0 deletions

View File

@@ -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);
}
}

View File

@@ -24,6 +24,7 @@ object Fixes : FirmamentFeature {
val peekChat by keyBindingWithDefaultUnbound("peek-chat") val peekChat by keyBindingWithDefaultUnbound("peek-chat")
val hidePotionEffects by toggle("hide-mob-effects") { false } val hidePotionEffects by toggle("hide-mob-effects") { false }
val noHurtCam by toggle("disable-hurt-cam") { false } val noHurtCam by toggle("disable-hurt-cam") { false }
val hideSlotHighlights by toggle("hide-slot-highlights") { false }
} }
override val config: ManagedConfig override val config: ManagedConfig

View File

@@ -122,6 +122,8 @@
"firmament.config.fixes.disable-hurt-cam.description": "Disable the damage screen shake animation.", "firmament.config.fixes.disable-hurt-cam.description": "Disable the damage screen shake animation.",
"firmament.config.fixes.hide-mob-effects": "Hide Potion Effects", "firmament.config.fixes.hide-mob-effects": "Hide Potion Effects",
"firmament.config.fixes.hide-mob-effects.description": "Hide Potion effects on the right side of your player inventory.", "firmament.config.fixes.hide-mob-effects.description": "Hide Potion effects on the right side of your player inventory.",
"firmament.config.fixes.hide-slot-highlights": "Hide Slot Highlights",
"firmament.config.fixes.hide-slot-highlights.description": "Hide slot highlights for items with disabled tooltip. This makes /sbmenu look nicer with smooth texture packs.",
"firmament.config.fixes.peek-chat": "Peek Chat", "firmament.config.fixes.peek-chat": "Peek Chat",
"firmament.config.fixes.peek-chat.description": "Hold this keybinding to view the chat as if you have it opened, but while still being able to control your character.", "firmament.config.fixes.peek-chat.description": "Hold this keybinding to view the chat as if you have it opened, but while still being able to control your character.",
"firmament.config.fixes.player-skins": "Fix unsigned Player Skins", "firmament.config.fixes.player-skins": "Fix unsigned Player Skins",