Skip to content

Commit

Permalink
initial update to 1.20.4
Browse files Browse the repository at this point in the history
  • Loading branch information
UpcraftLP committed Mar 20, 2024
1 parent ee5e8eb commit 9a06161
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@
import dev.upcraft.sparkweave.logging.SparkweaveLogging;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.core.registries.Registries;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.common.Mod;
import net.neoforged.fml.javafmlmod.FMLJavaModLoadingContext;
import net.neoforged.fml.loading.FMLEnvironment;
import net.neoforged.neoforge.registries.RegisterEvent;

@CalledByReflection
@Mod(SparkweaveMod.MODID)
public class Main {

public Main() {
FMLJavaModLoadingContext.get().getModEventBus().register(this);
public Main(IEventBus bus) {
bus.register(this);

EntrypointHelper.fireEntrypoints(MainEntryPoint.class, MainEntryPoint::onInitialize);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
package dev.upcraft.sparkweave.neoforge.service;

import dev.upcraft.sparkweave.SparkweaveMod;
import dev.upcraft.sparkweave.api.annotation.CalledByReflection;
import dev.upcraft.sparkweave.api.platform.services.RegistryService;
import dev.upcraft.sparkweave.api.registry.RegistryHandler;
import dev.upcraft.sparkweave.api.registry.RegistryVisitor;
import net.minecraft.core.Registry;
import net.minecraft.resources.ResourceKey;
import net.neoforged.fml.javafmlmod.FMLJavaModLoadingContext;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.fml.ModList;
import net.neoforged.neoforge.registries.DeferredRegister;
import org.apache.commons.lang3.NotImplementedException;

public class NeoRegistryService implements RegistryService {

private final IEventBus modBus;

@CalledByReflection
public NeoRegistryService() {
// need an explicit default constructor for the service loader to work

modBus = ModList.get().getModContainerById(SparkweaveMod.MODID).orElseThrow().getEventBus();
}

@SuppressWarnings("unchecked")
Expand All @@ -31,7 +37,7 @@ public <T> void visitRegistry(Registry<T> registry, RegistryVisitor<T> callback)
@Override
public <T> void handleRegister(RegistryHandler<T> handler) {
if (handler instanceof DeferredRegister<?> deferredRegister) {
deferredRegister.register(FMLJavaModLoadingContext.get().getModEventBus());
deferredRegister.register(modBus);
}
}
}
6 changes: 3 additions & 3 deletions NeoForge/src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ config = "${mod_id}.neoforge.mixins.json"
# https://docs.neoforged.net/docs/gettingstarted/modfiles#dependency-configurations
[dependencies]
"${mod_id}" = [
{ modId = "neoforge", mandatory = true, versionRange = "*", ordering = "NONE", side = "BOTH", mc-publish = { ignore = true } },
{ modId = "minecraft", mandatory = true, versionRange = "[${minecraft_version}]", ordering = "NONE", side = "BOTH" },
{ modId = "resourcefulconfig", mandatory = true, versionRange = "*", ordering = "NONE", side = "BOTH", mc-publish = { curseforge = "714059", modrinth = "M1953qlQ" } },
{ modId = "neoforge", type = "required", versionRange = "*", ordering = "NONE", side = "BOTH", mc-publish = { ignore = true } },
{ modId = "minecraft", type = "required", versionRange = "[${minecraft_version}]", ordering = "NONE", side = "BOTH" },
{ modId = "resourcefulconfig", type = "required", versionRange = "*", ordering = "NONE", side = "BOTH", mc-publish = { curseforge = "714059", modrinth = "M1953qlQ" } },
]

# Features are specific properties of the game environment, that you may want to declare you require. This example declares
Expand Down
8 changes: 4 additions & 4 deletions NeoForge/src/testmod/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ description = '''Testmod for ${mod_display_name}''' #mandatory (Supports multili
# https://docs.neoforged.net/docs/gettingstarted/modfiles#dependency-configurations
[dependencies]
"${mod_id}_testmod" = [
{ modId = "neoforge", mandatory = true, versionRange = "*", ordering = "NONE", side = "BOTH", mc-publish = { ignore = true } },
{ modId = "minecraft", mandatory = true, versionRange = "[${minecraft_version}]", ordering = "NONE", side = "BOTH" },
{ modId = "${mod_id}", mandatory = true, versionRange = "[${version}]" },
{ modId = "resourcefulconfig", mandatory = true, versionRange = "*", ordering = "NONE", side = "BOTH", mc-publish = { curseforge = "714059", modrinth = "M1953qlQ" } },
{ modId = "neoforge", type = "required", versionRange = "*", ordering = "NONE", side = "BOTH", mc-publish = { ignore = true } },
{ modId = "minecraft", type = "required", versionRange = "[${minecraft_version}]", ordering = "NONE", side = "BOTH" },
{ modId = "${mod_id}", type = "required", versionRange = "[${version}]", ordering = "NONE", side = "BOTH" },
{ modId = "resourcefulconfig", type = "required", versionRange = "*", ordering = "NONE", side = "BOTH", mc-publish = { curseforge = "714059", modrinth = "M1953qlQ" } },
]

# Features are specific properties of the game environment, that you may want to declare you require. This example declares
Expand Down
6 changes: 6 additions & 0 deletions Quilt/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ project.configurations.configureEach {
exclude(group: "net.fabricmc.fabric-api")
}

repositories {
maven {
url = "https://maven.oroarmor.com"
}
}

dependencies {
minecraft libs.minecraft
mappings(loom.layered {
Expand Down

0 comments on commit 9a06161

Please sign in to comment.