Skip to content

Commit

Permalink
MidnightLib 0.4.4 - Some more fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Motschen committed Jun 7, 2022
1 parent 23ab3ea commit c805d03
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ org.gradle.jvmargs=-Xmx1G
loader_version=0.11.7

# Mod Properties
mod_version = 0.4.3
mod_version = 0.4.4
maven_group = eu.midnightdust
archives_base_name = midnightlib

Expand Down
7 changes: 5 additions & 2 deletions src/main/java/eu/midnightdust/core/MidnightLibClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,24 @@
import eu.midnightdust.core.config.MidnightLibConfig;
import eu.midnightdust.hats.web.HatLoader;
import eu.midnightdust.hats.witch.WitchHatFeatureRenderer;
import eu.midnightdust.lib.config.AutoModMenu;
import eu.midnightdust.lib.config.MidnightConfig;
import eu.midnightdust.lib.util.MidnightColorUtil;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.fabricmc.fabric.api.client.rendering.v1.EntityModelLayerRegistry;

import java.util.ArrayList;
import java.util.List;

public class MidnightLibClient implements ClientModInitializer {
public static List<String> hiddenMods = new ArrayList<>();

public static final String MOD_ID = "midnightlib";

@Override
public void onInitializeClient() {
MidnightConfig.init("midnightlib", MidnightLibConfig.class);
AutoModMenu.hideFromModMenu("puzzle");
if (hiddenMods.contains("puzzle")) hiddenMods.add("puzzle");

EntityModelLayerRegistry.registerModelLayer(WitchHatFeatureRenderer.WITCH_HAT_MODEL_LAYER, WitchHatFeatureRenderer::getTexturedModelData);
if (MidnightLibConfig.special_hats) HatLoader.init();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package eu.midnightdust.core.screen;

import eu.midnightdust.core.MidnightLibClient;
import eu.midnightdust.lib.config.MidnightConfig;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
Expand Down Expand Up @@ -31,9 +32,12 @@ protected void init() {
this.list = new MidnightOverviewListWidget(this.client, this.width, this.height, 32, this.height - 32, 25);
if (this.client != null && this.client.world != null) this.list.setRenderBackground(false);
this.addSelectableChild(this.list);
MidnightConfig.configClass.forEach((modid, configClass) ->
MidnightConfig.configClass.forEach((modid, configClass) -> {
if (!MidnightLibClient.hiddenMods.contains(modid)) {
list.addButton(new ButtonWidget(this.width / 2 - 100, this.height - 28, 200, 20, new TranslatableText(modid +".midnightconfig.title"), (button) ->
Objects.requireNonNull(client).setScreen(MidnightConfig.getScreen(this,modid)))));
Objects.requireNonNull(client).setScreen(MidnightConfig.getScreen(this,modid))));
}
});
super.init();
}
@Override
Expand Down
9 changes: 2 additions & 7 deletions src/main/java/eu/midnightdust/lib/config/AutoModMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@

import com.terraformersmc.modmenu.api.ConfigScreenFactory;
import com.terraformersmc.modmenu.api.ModMenuApi;
import eu.midnightdust.core.MidnightLibClient;
import eu.midnightdust.core.config.MidnightLibConfig;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class AutoModMenu implements ModMenuApi {
private static List<String> hiddenMods = new ArrayList<>();

@Override
public ConfigScreenFactory<?> getModConfigScreenFactory() {
Expand All @@ -21,13 +19,10 @@ public ConfigScreenFactory<?> getModConfigScreenFactory() {
public Map<String, ConfigScreenFactory<?>> getProvidedConfigScreenFactories() {
HashMap<String, ConfigScreenFactory<?>> map = new HashMap<>();
MidnightConfig.configClass.forEach((modid, cClass) -> {
if (!hiddenMods.contains(modid))
if (!MidnightLibClient.hiddenMods.contains(modid))
map.put(modid, parent -> MidnightConfig.getScreen(parent, modid));
}
);
return map;
}
public static void hideFromModMenu(String hiddenMod) {
hiddenMods.add(hiddenMod);
}
}

0 comments on commit c805d03

Please sign in to comment.