Search in sources :

Example 1 with TweakerPlusIConfigBase

use of me.ivan1f.tweakerplus.config.options.TweakerPlusIConfigBase in project tweakerplus by Ivan-1F.

the class WidgetListConfigOptionMixin method useMyBetterOptionLabelForTweakerPlus.

@ModifyArgs(method = "addConfigOption", at = @At(value = "INVOKE", target = "Lfi/dy/masa/malilib/gui/widgets/WidgetConfigOption;addLabel(IIIII[Ljava/lang/String;)V", remap = false), remap = false)
private void useMyBetterOptionLabelForTweakerPlus(Args args, int x_, int y_, float zLevel, int labelWidth, int configWidth, IConfigBase config) {
    if (isTweakerPlusConfigGui()) {
        int x = args.get(0);
        int y = args.get(1);
        int width = args.get(2);
        int height = args.get(3);
        int textColor = args.get(4);
        String[] lines = args.get(5);
        if (lines.length != 1) {
            return;
        }
        // cancel original call
        args.set(5, null);
        Function<String, String> modifier = s -> s;
        if (config instanceof TweakerPlusIConfigBase) {
            modifier = ((TweakerPlusIConfigBase) config).getGuiDisplayLineModifier();
        }
        TweakerPlusOptionLabel label = new TweakerPlusOptionLabel(x, y, width, height, textColor, lines, new String[] { config.getName() }, modifier);
        this.addWidget(label);
        this.showOriginalTextsThisTime = label.shouldShowOriginalLines();
    } else {
        this.showOriginalTextsThisTime = false;
    }
}
Also used : Inject(org.spongepowered.asm.mixin.injection.Inject) fi.dy.masa.malilib.gui.widgets(fi.dy.masa.malilib.gui.widgets) Function(java.util.function.Function) CallbackInfoReturnable(org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable) ConfigButtonKeybind(fi.dy.masa.malilib.gui.button.ConfigButtonKeybind) HotkeyedBooleanResetListener(me.ivan1f.tweakerplus.gui.HotkeyedBooleanResetListener) CallbackInfo(org.spongepowered.asm.mixin.injection.callback.CallbackInfo) ConfigButtonBoolean(fi.dy.masa.malilib.gui.button.ConfigButtonBoolean) ButtonGeneric(fi.dy.masa.malilib.gui.button.ButtonGeneric) Args(org.spongepowered.asm.mixin.injection.invoke.arg.Args) org.spongepowered.asm.mixin(org.spongepowered.asm.mixin) fi.dy.masa.malilib.hotkeys(fi.dy.masa.malilib.hotkeys) StringUtils(fi.dy.masa.malilib.util.StringUtils) At(org.spongepowered.asm.mixin.injection.At) ModifyArgs(org.spongepowered.asm.mixin.injection.ModifyArgs) TweakerPlusConfigs(me.ivan1f.tweakerplus.config.TweakerPlusConfigs) TweakerPlusConfigGui(me.ivan1f.tweakerplus.gui.TweakerPlusConfigGui) TweakerPlusOptionLabel(me.ivan1f.tweakerplus.gui.TweakerPlusOptionLabel) GuiConfigsBase(fi.dy.masa.malilib.gui.GuiConfigsBase) IKeybindConfigGui(fi.dy.masa.malilib.gui.interfaces.IKeybindConfigGui) IConfigBase(fi.dy.masa.malilib.config.IConfigBase) IHotkeyTogglable(fi.dy.masa.malilib.config.IHotkeyTogglable) Objects(java.util.Objects) ConfigBooleanHotkeyed(fi.dy.masa.malilib.config.options.ConfigBooleanHotkeyed) ConfigOptionChangeListenerButton(fi.dy.masa.malilib.config.gui.ConfigOptionChangeListenerButton) TweakerPlusIConfigBase(me.ivan1f.tweakerplus.config.options.TweakerPlusIConfigBase) ModifyArg(org.spongepowered.asm.mixin.injection.ModifyArg) TweakerPlusIConfigBase(me.ivan1f.tweakerplus.config.options.TweakerPlusIConfigBase) TweakerPlusOptionLabel(me.ivan1f.tweakerplus.gui.TweakerPlusOptionLabel) ModifyArgs(org.spongepowered.asm.mixin.injection.ModifyArgs)

Aggregations

IConfigBase (fi.dy.masa.malilib.config.IConfigBase)1 IHotkeyTogglable (fi.dy.masa.malilib.config.IHotkeyTogglable)1 ConfigOptionChangeListenerButton (fi.dy.masa.malilib.config.gui.ConfigOptionChangeListenerButton)1 ConfigBooleanHotkeyed (fi.dy.masa.malilib.config.options.ConfigBooleanHotkeyed)1 GuiConfigsBase (fi.dy.masa.malilib.gui.GuiConfigsBase)1 ButtonGeneric (fi.dy.masa.malilib.gui.button.ButtonGeneric)1 ConfigButtonBoolean (fi.dy.masa.malilib.gui.button.ConfigButtonBoolean)1 ConfigButtonKeybind (fi.dy.masa.malilib.gui.button.ConfigButtonKeybind)1 IKeybindConfigGui (fi.dy.masa.malilib.gui.interfaces.IKeybindConfigGui)1 fi.dy.masa.malilib.gui.widgets (fi.dy.masa.malilib.gui.widgets)1 fi.dy.masa.malilib.hotkeys (fi.dy.masa.malilib.hotkeys)1 StringUtils (fi.dy.masa.malilib.util.StringUtils)1 Objects (java.util.Objects)1 Function (java.util.function.Function)1 TweakerPlusConfigs (me.ivan1f.tweakerplus.config.TweakerPlusConfigs)1 TweakerPlusIConfigBase (me.ivan1f.tweakerplus.config.options.TweakerPlusIConfigBase)1 HotkeyedBooleanResetListener (me.ivan1f.tweakerplus.gui.HotkeyedBooleanResetListener)1 TweakerPlusConfigGui (me.ivan1f.tweakerplus.gui.TweakerPlusConfigGui)1 TweakerPlusOptionLabel (me.ivan1f.tweakerplus.gui.TweakerPlusOptionLabel)1 org.spongepowered.asm.mixin (org.spongepowered.asm.mixin)1