Skip to content

Commit

Permalink
added mixin toggle for LanguageReload/LanguageScreen (passive feature)
Browse files Browse the repository at this point in the history
  • Loading branch information
SrRapero720 committed Jan 5, 2024
1 parent 2b811eb commit 7aa1308
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ public class EmbyMixinConfig {
public static final ForgeConfigSpec SPECS;

public static final ForgeConfigSpec.BooleanValue mixin$Borderless$F11;
public static final ForgeConfigSpec.BooleanValue mixin$LanguageScreen$fastreload;

static {
var BUILDER = new ForgeConfigSpec.Builder();

mixin$Borderless$F11 = BUILDER.define("mixin.borderless.f11", true);
mixin$LanguageScreen$fastreload = BUILDER.define("mixin.languageScreen.fastreload", true);

SPECS = BUILDER.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,20 @@ private static ImmutableList<OptionGroup> create() {
.setBinding((options, value) -> EmbyMixinConfig.mixin$Borderless$F11.set(value),
(options) -> EmbyMixinConfig.mixin$Borderless$F11.get())
.setFlags(OptionFlag.REQUIRES_GAME_RESTART)
.build())
.add(OptionImpl.createBuilder(boolean.class, mixinsOptionsStorage)
.setName(Component.translatable("embeddium.plus.mixins.languagescreen.fastreload.title"))
.setTooltip(Component.translatable("embeddium.plus.mixins.languagescreen.fastreload.desc"))
.setControl(TickBoxControl::new)
.setBinding((options, value) -> EmbyMixinConfig.mixin$LanguageScreen$fastreload.set(value),
(options) -> EmbyMixinConfig.mixin$LanguageScreen$fastreload.get())
.setFlags(OptionFlag.REQUIRES_GAME_RESTART)
.build()
).build())
;
)


.build()
);

return ImmutableList.copyOf(groups);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,35 @@ public boolean shouldApplyMixin(String target, String mixin) {
final var mixinName = EmbyTools.getLastValue(mixin.split("\\."));

if (mixin.endsWith("fastchests.BERenderDispatcherMixin") || mixin.endsWith("fastchests.ChestBlockMixin") || mixin.endsWith("fastchests.EnderChestBlockMixin")) {
return EmbyTools.isModInstalled("enhancedblockentities");
if (EmbyTools.isModInstalled("enhancedblockentities")) {
LOGGER.warn(IT, "Disabled FastChest feature mixin '{}' because EBE is installed", mixinName);
return false;
} else {
return true;
}
}

if (mixin.endsWith("language.LanguageScreenMixin")) {
if (!EmbyMixinConfig.mixin$LanguageScreen$fastreload.get()) {
LOGGER.warn(IT, "Disabled LanguageReload feature mixins by user config");
return false;
} else {
return true;
}
}

if (mixin.endsWith("borderless.KeyboardHandlerMixin")) {
if (!EmbyMixinConfig.mixin$Borderless$F11.get()) {
LOGGER.warn("Mixin {}.{} disabled by user config", "borderless", mixinName);
LOGGER.warn(IT,"Disable F11 mixin for Borderless feature by user config");
return false;
} else {
return true;
}
}

if (mixin.endsWith("JeiOverlayMixin")) {
if (!EmbyTools.isModInstalled("jei")) {
LOGGER.warn(IT, "Disabling JeiOverlayMixin due to JEI being NOT installed");
LOGGER.warn(IT, "Disabling JeiOverlayMixin because JEI is not installed");
return false;
} else {
LOGGER.warn(IT, "Enabling JeiOverlayMixin...");
Expand Down
4 changes: 3 additions & 1 deletion src/main/resources/assets/embeddiumplus/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,5 +102,7 @@
"embeddium.plus.options.screen.windowed": "Windowed",

"embeddium.plus.mixins.borderless.f11.title": "Add borderless to F11",
"embeddium.plus.mixins.borderless.f11.desc": "If enabled, F11 will now had borderless state into it.\n\nRequires game restart"
"embeddium.plus.mixins.borderless.f11.desc": "If enabled, F11 will now had borderless state into it.\n\nRequires game restart",
"embeddium.plus.mixins.languagescreen.fastreload.title": "Enable Fast Language Reload",
"embeddium.plus.mixins.languagescreen.fastreload.desc": "If enabled, Language updates only reload language instead of all resources, a 99.9% extra of speed\n\nRequires game restart"
}

0 comments on commit 7aa1308

Please sign in to comment.