mirror of
https://github.com/TeamMidnightDust/MidnightLib.git
synced 2025-12-16 09:15:10 +01:00
MidnightLib 0.4.2 - Add opt-out from AutoModMenu
This commit is contained in:
@@ -8,7 +8,7 @@ org.gradle.jvmargs=-Xmx1G
|
|||||||
loader_version=0.11.7
|
loader_version=0.11.7
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 0.4.0
|
mod_version = 0.4.2
|
||||||
maven_group = eu.midnightdust
|
maven_group = eu.midnightdust
|
||||||
archives_base_name = midnightlib
|
archives_base_name = midnightlib
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public class MixinOptionsScreen extends Screen {
|
|||||||
|
|
||||||
@Inject(at = @At("HEAD"),method = "init")
|
@Inject(at = @At("HEAD"),method = "init")
|
||||||
private void midnightlib$init(CallbackInfo ci) {
|
private void midnightlib$init(CallbackInfo ci) {
|
||||||
if (MidnightLibConfig.config_screen_list.equals(MidnightLibConfig.ConfigButton.TRUE) || MidnightLibConfig.config_screen_list.equals(MidnightLibConfig.ConfigButton.MODMENU) && FabricLoader.getInstance().isModLoaded("modmenu"))
|
if (MidnightLibConfig.config_screen_list.equals(MidnightLibConfig.ConfigButton.TRUE) || (MidnightLibConfig.config_screen_list.equals(MidnightLibConfig.ConfigButton.MODMENU) && !FabricLoader.getInstance().isModLoaded("modmenu")))
|
||||||
this.addDrawableChild(new TexturedOverlayButtonWidget(this.width / 2 + 158, this.height / 6 - 12, 20, 20, 0, 0, 20, MIDNIGHTLIB_ICON_TEXTURE, 32, 64, (buttonWidget) -> Objects.requireNonNull(client).setScreen(new MidnightConfigOverviewScreen(this)), new TranslatableText("midnightlib.overview.title")));
|
this.addDrawableChild(new TexturedOverlayButtonWidget(this.width / 2 + 158, this.height / 6 - 12, 20, 20, 0, 0, 20, MIDNIGHTLIB_ICON_TEXTURE, 32, 64, (buttonWidget) -> Objects.requireNonNull(client).setScreen(new MidnightConfigOverviewScreen(this)), new TranslatableText("midnightlib.overview.title")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,9 +5,12 @@ import com.terraformersmc.modmenu.api.ModMenuApi;
|
|||||||
import eu.midnightdust.core.config.MidnightLibConfig;
|
import eu.midnightdust.core.config.MidnightLibConfig;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class AutoModMenu implements ModMenuApi {
|
public class AutoModMenu implements ModMenuApi {
|
||||||
|
protected static List<String> hiddenMods = List.of();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ConfigScreenFactory<?> getModConfigScreenFactory() {
|
public ConfigScreenFactory<?> getModConfigScreenFactory() {
|
||||||
return parent -> MidnightLibConfig.getScreen(parent,"midnightlib");
|
return parent -> MidnightLibConfig.getScreen(parent,"midnightlib");
|
||||||
@@ -16,7 +19,14 @@ public class AutoModMenu implements ModMenuApi {
|
|||||||
@Override
|
@Override
|
||||||
public Map<String, ConfigScreenFactory<?>> getProvidedConfigScreenFactories() {
|
public Map<String, ConfigScreenFactory<?>> getProvidedConfigScreenFactories() {
|
||||||
HashMap<String, ConfigScreenFactory<?>> map = new HashMap<>();
|
HashMap<String, ConfigScreenFactory<?>> map = new HashMap<>();
|
||||||
MidnightConfig.configClass.forEach((modid, cClass) -> map.put(modid, parent -> MidnightConfig.getScreen(parent, modid)));
|
MidnightConfig.configClass.forEach((modid, cClass) -> {
|
||||||
|
if (!hiddenMods.contains(modid))
|
||||||
|
map.put(modid, parent -> MidnightConfig.getScreen(parent, modid));
|
||||||
|
}
|
||||||
|
);
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
public static void hideFromModMenu(String hiddenMod) {
|
||||||
|
hiddenMods.add(hiddenMod);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -379,7 +379,7 @@ public abstract class MidnightConfig {
|
|||||||
public void render(MatrixStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
|
public void render(MatrixStack matrices, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) {
|
||||||
buttons.forEach(b -> { b.y = y; b.render(matrices, mouseX, mouseY, tickDelta); });
|
buttons.forEach(b -> { b.y = y; b.render(matrices, mouseX, mouseY, tickDelta); });
|
||||||
if (text != null && (!text.getString().contains("spacer") || !buttons.isEmpty()))
|
if (text != null && (!text.getString().contains("spacer") || !buttons.isEmpty()))
|
||||||
DrawableHelper.drawTextWithShadow(matrices,textRenderer, text,12,y+5,0xFFFFFF);
|
DrawableHelper.drawTextWithShadow(matrices,textRenderer, text,12,y+5,0xFFFFFF);
|
||||||
}
|
}
|
||||||
public List<? extends Element> children() {return children;}
|
public List<? extends Element> children() {return children;}
|
||||||
public List<? extends Selectable> selectableChildren() {return children;}
|
public List<? extends Selectable> selectableChildren() {return children;}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"midnightcore.mixins.json"
|
"midnightlib.mixins.json"
|
||||||
],
|
],
|
||||||
|
|
||||||
"depends": {
|
"depends": {
|
||||||
|
|||||||
Reference in New Issue
Block a user