mirror of
https://github.com/TeamMidnightDust/MidnightLib.git
synced 2025-12-15 17:05:09 +01:00
stonecutter: support MC 1.20.1 (Forge)
This commit is contained in:
@@ -59,8 +59,7 @@ loom {
|
||||
}
|
||||
if (loader == "forge") {
|
||||
forge.mixinConfigs(
|
||||
"template-common.mixins.json",
|
||||
"template-forge.mixins.json",
|
||||
"midnightlib.mixins.json",
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,25 @@ import net.neoforged.neoforge.event.RegisterCommandsEvent;
|
||||
|
||||
import java.util.ConcurrentModificationException;
|
||||
|
||||
@Mod("midnightlib")
|
||||
public class MidnightLib {
|
||||
*///?} else if forge {
|
||||
/*import java.util.ConcurrentModificationException;
|
||||
import eu.midnightdust.lib.util.PlatformFunctions;
|
||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraftforge.client.ConfigScreenHandler;
|
||||
import net.minecraftforge.event.RegisterCommandsEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.ModList;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.fml.DistExecutor;
|
||||
import net.minecraftforge.fml.IExtensionPoint;
|
||||
import net.minecraftforge.fml.ModLoadingContext;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.network.NetworkConstants;
|
||||
|
||||
@Mod("midnightlib")
|
||||
public class MidnightLib {
|
||||
*///?}
|
||||
@@ -126,4 +145,37 @@ public class MidnightLib {
|
||||
}
|
||||
}
|
||||
*///?}
|
||||
|
||||
//? if forge {
|
||||
/*public MidnightLib() {
|
||||
ModLoadingContext.get().registerExtensionPoint(IExtensionPoint.DisplayTest.class, () -> new IExtensionPoint.DisplayTest(() -> NetworkConstants.IGNORESERVERONLY, (remote, server) -> true));
|
||||
if (PlatformFunctions.isClientEnv()) this.onInitializeClient();
|
||||
}
|
||||
|
||||
public static List<LiteralArgumentBuilder<CommandSourceStack>> commands = new ArrayList<>();
|
||||
|
||||
@Mod.EventBusSubscriber(modid = "midnightlib", bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT)
|
||||
public static class MidnightLibBusEvents {
|
||||
@SubscribeEvent
|
||||
public static void onPostInit(FMLClientSetupEvent event) {
|
||||
ModList.get().forEachModContainer((modid, modContainer) -> {
|
||||
if (MidnightConfig.configInstances.containsKey(modid) && !MidnightLib.hiddenMods.contains(modid)) {
|
||||
modContainer.registerExtensionPoint(ConfigScreenHandler.ConfigScreenFactory.class, () -> new ConfigScreenHandler.ConfigScreenFactory((minecraftClient, screen) -> MidnightConfig.getScreen(screen, modid)));
|
||||
}
|
||||
});
|
||||
MidnightLib.registerAutoCommand();
|
||||
}
|
||||
}
|
||||
|
||||
@Mod.EventBusSubscriber(modid = "midnightlib")
|
||||
public static class MidnightLibEvents {
|
||||
@SubscribeEvent
|
||||
public static void registerCommands(RegisterCommandsEvent event) {
|
||||
try {
|
||||
commands.forEach(command -> event.getDispatcher().register(command));
|
||||
}
|
||||
catch (ConcurrentModificationException ignored) {}
|
||||
}
|
||||
}
|
||||
*///?}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import eu.midnightdust.lib.util.PlatformFunctions;
|
||||
import java.util.Objects;
|
||||
|
||||
public class MidnightLibConfig extends MidnightConfig {
|
||||
public static final boolean HAS_MODMENU = PlatformFunctions.isModLoaded("modmenu") || Objects.equals(PlatformFunctions.getPlatformName(), "neoforge");
|
||||
public static final boolean HAS_MODMENU = PlatformFunctions.isModLoaded("modmenu") || !Objects.equals(PlatformFunctions.getPlatformName(), "fabric");
|
||||
|
||||
@Entry public static ConfigButton config_screen_list = HAS_MODMENU ? ConfigButton.MODMENU : ConfigButton.TRUE;
|
||||
|
||||
|
||||
@@ -3,7 +3,11 @@ package eu.midnightdust.lib.util;
|
||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||
import java.nio.file.Path;
|
||||
|
||||
import eu.midnightdust.core.MidnightLib;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraftforge.fml.ModList;
|
||||
import net.minecraftforge.fml.loading.FMLEnvironment;
|
||||
import net.minecraftforge.fml.loading.FMLPaths;
|
||||
|
||||
//? if fabric {
|
||||
import net.fabricmc.api.EnvType;
|
||||
@@ -55,6 +59,20 @@ public class PlatformFunctions {
|
||||
MidnightLib.commands.add(command);
|
||||
}
|
||||
*///?} else if forge {
|
||||
//
|
||||
//?}
|
||||
/*public static String getPlatformName() {
|
||||
return "forge";
|
||||
}
|
||||
public static Path getConfigDirectory() {
|
||||
return FMLPaths.CONFIGDIR.get();
|
||||
}
|
||||
public static boolean isClientEnv() {
|
||||
return FMLEnvironment.dist.isClient();
|
||||
}
|
||||
public static boolean isModLoaded(String modid) {
|
||||
return ModList.get().isLoaded(modid);
|
||||
}
|
||||
public static void registerCommand(LiteralArgumentBuilder<CommandSourceStack> command) {
|
||||
MidnightLib.commands.add(command);
|
||||
}
|
||||
*///?}
|
||||
}
|
||||
|
||||
31
src/main/resources/META-INF/mods.toml
Normal file
31
src/main/resources/META-INF/mods.toml
Normal file
@@ -0,0 +1,31 @@
|
||||
modLoader = "javafml"
|
||||
loaderVersion = "[43,)"
|
||||
#issueTrackerURL = ""
|
||||
license = "MIT License"
|
||||
|
||||
[[mods]]
|
||||
modId = "midnightlib"
|
||||
version = "${version}"
|
||||
displayName = "${name}"
|
||||
logoFile = "midnightlib.png"
|
||||
authors = "TeamMidnightDust, Motschen"
|
||||
description = '''
|
||||
Lightweight config library with config screens and commands.
|
||||
'''
|
||||
|
||||
[[mixins]]
|
||||
config = "midnightlib.mixins.json"
|
||||
|
||||
[[dependencies.midnightlib]]
|
||||
modId = "forge"
|
||||
mandatory = true
|
||||
versionRange = "[43,)"
|
||||
ordering = "NONE"
|
||||
side = "BOTH"
|
||||
|
||||
[[dependencies.midnightlib]]
|
||||
modId = "minecraft"
|
||||
mandatory = true
|
||||
versionRange = "[1.20,)"
|
||||
ordering = "NONE"
|
||||
side = "BOTH"
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 136 B |
Binary file not shown.
|
After Width: | Height: | Size: 136 B |
Binary file not shown.
|
After Width: | Height: | Size: 114 B |
6
versions/1.20.1-forge/src/main/resources/pack.mcmeta
Normal file
6
versions/1.20.1-forge/src/main/resources/pack.mcmeta
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"pack": {
|
||||
"description": "MidnightLib",
|
||||
"pack_format": 9
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user