Search in sources :

Example 1 with ConfigBooleanHotkeyed

use of fi.dy.masa.malilib.config.options.ConfigBooleanHotkeyed in project Tweak-My-Client by Hendrix-Shen.

the class MixinDisconnectedScreen method onPressAutoReconnect.

private void onPressAutoReconnect() {
    ConfigBooleanHotkeyed featureAutoReconnect = Configs.Feature.FEATURE_AUTO_RECONNECT;
    featureAutoReconnect.setBooleanValue(!featureAutoReconnect.getBooleanValue());
    if (featureAutoReconnect.getBooleanValue()) {
        AutoReconnectUtils.ReconnectTimer = Configs.Generic.AUTO_RECONNECT_TIMER.getIntegerValue() * 20;
    }
}
Also used : ConfigBooleanHotkeyed(fi.dy.masa.malilib.config.options.ConfigBooleanHotkeyed)

Example 2 with ConfigBooleanHotkeyed

use of fi.dy.masa.malilib.config.options.ConfigBooleanHotkeyed in project tweakermore by Fallen-Breath.

the class WidgetListConfigOptionMixin method specialJudgeCustomConfigBooleanHotkeyed.

/**
 * Stolen from malilib 1.18 v0.11.4
 * to make compact ConfigBooleanHotkeyed option panel works
 */
@Inject(method = "wasConfigModified", at = @At(value = "INVOKE", target = "Lfi/dy/masa/malilib/gui/GuiConfigsBase$ConfigOptionWrapper;getConfig()Lfi/dy/masa/malilib/config/IConfigBase;", ordinal = 0, remap = false), cancellable = true, remap = false)
private void specialJudgeCustomConfigBooleanHotkeyed(CallbackInfoReturnable<Boolean> cir) {
    IConfigBase config = this.wrapper.getConfig();
    if (config instanceof ConfigBooleanHotkeyed && TweakerMoreConfigs.hasConfig(config)) {
        ConfigBooleanHotkeyed booleanHotkey = (ConfigBooleanHotkeyed) config;
        IKeybind keybind = booleanHotkey.getKeybind();
        cir.setReturnValue(this.initialBoolean != booleanHotkey.getBooleanValue() || !Objects.equals(this.initialStringValue, keybind.getStringValue()) || !Objects.equals(this.initialKeybindSettings, keybind.getSettings()));
    }
}
Also used : IConfigBase(fi.dy.masa.malilib.config.IConfigBase) TweakerMoreIConfigBase(me.fallenbreath.tweakermore.config.options.TweakerMoreIConfigBase) ConfigBooleanHotkeyed(fi.dy.masa.malilib.config.options.ConfigBooleanHotkeyed)

Example 3 with ConfigBooleanHotkeyed

use of fi.dy.masa.malilib.config.options.ConfigBooleanHotkeyed in project tweakermore by Fallen-Breath.

the class WidgetListConfigOptionMixin method initInitialState.

// #if MC < 11800
/**
 * Stolen from malilib 1.18 v0.11.4
 * to make compact ConfigBooleanHotkeyed option panel works
 */
@Inject(method = "<init>", at = @At("TAIL"), remap = false)
private void initInitialState(CallbackInfo ci) {
    if (isTweakerMoreConfigGui() && this.wrapper.getType() == GuiConfigsBase.ConfigOptionWrapper.Type.CONFIG) {
        IConfigBase config = wrapper.getConfig();
        if (config instanceof ConfigBooleanHotkeyed) {
            this.initialBoolean = ((ConfigBooleanHotkeyed) config).getBooleanValue();
            this.initialStringValue = ((ConfigBooleanHotkeyed) config).getKeybind().getStringValue();
            this.initialKeybindSettings = ((ConfigBooleanHotkeyed) config).getKeybind().getSettings();
        }
    }
}
Also used : IConfigBase(fi.dy.masa.malilib.config.IConfigBase) TweakerMoreIConfigBase(me.fallenbreath.tweakermore.config.options.TweakerMoreIConfigBase) ConfigBooleanHotkeyed(fi.dy.masa.malilib.config.options.ConfigBooleanHotkeyed)

Example 4 with ConfigBooleanHotkeyed

use of fi.dy.masa.malilib.config.options.ConfigBooleanHotkeyed in project tweakerplus by Ivan-1F.

the class WidgetListConfigOptionMixin method initInitialState$tweakerplus.

/**
 * Stolen from malilib 1.18 v0.11.4
 * to make compact ConfigBooleanHotkeyed option panel works
 */
@Inject(method = "<init>", at = @At("TAIL"), remap = false)
private void initInitialState$tweakerplus(CallbackInfo ci) {
    if (isTweakerPlusConfigGui() && this.wrapper.getType() == GuiConfigsBase.ConfigOptionWrapper.Type.CONFIG) {
        IConfigBase config = wrapper.getConfig();
        if (config instanceof ConfigBooleanHotkeyed) {
            this.initialBoolean = ((ConfigBooleanHotkeyed) config).getBooleanValue();
            this.initialStringValue = ((ConfigBooleanHotkeyed) config).getKeybind().getStringValue();
            this.initialKeybindSettings = ((ConfigBooleanHotkeyed) config).getKeybind().getSettings();
        }
    }
}
Also used : IConfigBase(fi.dy.masa.malilib.config.IConfigBase) TweakerPlusIConfigBase(me.ivan1f.tweakerplus.config.options.TweakerPlusIConfigBase) ConfigBooleanHotkeyed(fi.dy.masa.malilib.config.options.ConfigBooleanHotkeyed) Inject(org.spongepowered.asm.mixin.injection.Inject)

Example 5 with ConfigBooleanHotkeyed

use of fi.dy.masa.malilib.config.options.ConfigBooleanHotkeyed in project tweakerplus by Ivan-1F.

the class WidgetListConfigOptionMixin method specialJudgeCustomConfigBooleanHotkeyed$tweakerplus.

/**
 * Stolen from malilib 1.18 v0.11.4
 * to make compact ConfigBooleanHotkeyed option panel works
 */
@Inject(method = "wasConfigModified", at = @At(value = "INVOKE", target = "Lfi/dy/masa/malilib/gui/GuiConfigsBase$ConfigOptionWrapper;getConfig()Lfi/dy/masa/malilib/config/IConfigBase;", ordinal = 0, remap = false), cancellable = true, remap = false)
private void specialJudgeCustomConfigBooleanHotkeyed$tweakerplus(CallbackInfoReturnable<Boolean> cir) {
    IConfigBase config = this.wrapper.getConfig();
    if (config instanceof ConfigBooleanHotkeyed && TweakerPlusConfigs.hasConfig(config)) {
        ConfigBooleanHotkeyed booleanHotkey = (ConfigBooleanHotkeyed) config;
        IKeybind keybind = booleanHotkey.getKeybind();
        cir.setReturnValue(this.initialBoolean != booleanHotkey.getBooleanValue() || !Objects.equals(this.initialStringValue, keybind.getStringValue()) || !Objects.equals(this.initialKeybindSettings, keybind.getSettings()));
    }
}
Also used : IConfigBase(fi.dy.masa.malilib.config.IConfigBase) TweakerPlusIConfigBase(me.ivan1f.tweakerplus.config.options.TweakerPlusIConfigBase) ConfigBooleanHotkeyed(fi.dy.masa.malilib.config.options.ConfigBooleanHotkeyed) Inject(org.spongepowered.asm.mixin.injection.Inject)

Aggregations

ConfigBooleanHotkeyed (fi.dy.masa.malilib.config.options.ConfigBooleanHotkeyed)5 IConfigBase (fi.dy.masa.malilib.config.IConfigBase)4 TweakerMoreIConfigBase (me.fallenbreath.tweakermore.config.options.TweakerMoreIConfigBase)2 TweakerPlusIConfigBase (me.ivan1f.tweakerplus.config.options.TweakerPlusIConfigBase)2 Inject (org.spongepowered.asm.mixin.injection.Inject)2