diff --git a/command-api-common/build.gradle b/command-common/build.gradle similarity index 100% rename from command-api-common/build.gradle rename to command-common/build.gradle diff --git a/command-common/src/main/java/band/kessoku/lib/command/KessokuCommand.java b/command-common/src/main/java/band/kessoku/lib/command/KessokuCommand.java new file mode 100644 index 00000000..33197740 --- /dev/null +++ b/command-common/src/main/java/band/kessoku/lib/command/KessokuCommand.java @@ -0,0 +1,5 @@ +package band.kessoku.lib.command; + +public class KessokuCommand { + public static final String MOD_ID = "kessoku_command"; +} diff --git a/command-api-common/src/main/java/band/kessoku/lib/command/events/CommandRegistryEvent.java b/command-common/src/main/java/band/kessoku/lib/command/api/events/CommandRegistryEvent.java similarity index 96% rename from command-api-common/src/main/java/band/kessoku/lib/command/events/CommandRegistryEvent.java rename to command-common/src/main/java/band/kessoku/lib/command/api/events/CommandRegistryEvent.java index 81486343..5e2636dc 100644 --- a/command-api-common/src/main/java/band/kessoku/lib/command/events/CommandRegistryEvent.java +++ b/command-common/src/main/java/band/kessoku/lib/command/api/events/CommandRegistryEvent.java @@ -1,4 +1,4 @@ -package band.kessoku.lib.command.events; +package band.kessoku.lib.command.api.events; import band.kessoku.lib.event.api.Event; import com.mojang.brigadier.CommandDispatcher; diff --git a/command-api-fabric/build.gradle b/command-fabric/build.gradle similarity index 80% rename from command-api-fabric/build.gradle rename to command-fabric/build.gradle index 2ab13308..adfafa17 100644 --- a/command-api-fabric/build.gradle +++ b/command-fabric/build.gradle @@ -31,8 +31,11 @@ configurations { dependencies { modImplementation libs.fabric.loader modImplementation libs.fabric.api - common(project(path: ':command-api-common', configuration: 'namedElements')) { transitive false } - shadowBundle project(path: ':command-api-common', configuration: 'transformProductionFabric') + + implementation(project(":event-base-common")) + + common(project(path: ':command-common', configuration: 'namedElements')) { transitive false } + shadowBundle project(path: ':command-common', configuration: 'transformProductionFabric') } processResources { diff --git a/command-fabric/src/main/java/band/kessoku/lib/command/KessokuCommandEntrypoint.java b/command-fabric/src/main/java/band/kessoku/lib/command/KessokuCommandEntrypoint.java new file mode 100644 index 00000000..74a939b0 --- /dev/null +++ b/command-fabric/src/main/java/band/kessoku/lib/command/KessokuCommandEntrypoint.java @@ -0,0 +1,11 @@ +package band.kessoku.lib.command; + +import band.kessoku.lib.command.impl.KessokuCommandImpl; +import net.fabricmc.api.ModInitializer; + +public class KessokuCommandEntrypoint implements ModInitializer { + @Override + public void onInitialize() { + KessokuCommandImpl.registerCommonEvents(); + } +} diff --git a/command-api-fabric/src/main/java/band/kessoku/lib/command/KessokuCommandApiEntrypoint.java b/command-fabric/src/main/java/band/kessoku/lib/command/impl/KessokuCommandImpl.java similarity index 53% rename from command-api-fabric/src/main/java/band/kessoku/lib/command/KessokuCommandApiEntrypoint.java rename to command-fabric/src/main/java/band/kessoku/lib/command/impl/KessokuCommandImpl.java index 8cf94d28..4f621ffe 100644 --- a/command-api-fabric/src/main/java/band/kessoku/lib/command/KessokuCommandApiEntrypoint.java +++ b/command-fabric/src/main/java/band/kessoku/lib/command/impl/KessokuCommandImpl.java @@ -1,12 +1,10 @@ -package band.kessoku.lib.command; +package band.kessoku.lib.command.impl; -import band.kessoku.lib.command.events.CommandRegistryEvent; -import net.fabricmc.api.ModInitializer; +import band.kessoku.lib.command.api.events.CommandRegistryEvent; import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback; -public class KessokuCommandApiEntrypoint implements ModInitializer { - @Override - public void onInitialize() { +public class KessokuCommandImpl { + public static void registerCommonEvents() { CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> { CommandRegistryEvent.EVENT.invoker().register(dispatcher, registryAccess, environment); }); diff --git a/command-api-fabric/src/main/resources/fabric.mod.json b/command-fabric/src/main/resources/fabric.mod.json similarity index 95% rename from command-api-fabric/src/main/resources/fabric.mod.json rename to command-fabric/src/main/resources/fabric.mod.json index 325d2cdf..04fadd51 100644 --- a/command-api-fabric/src/main/resources/fabric.mod.json +++ b/command-fabric/src/main/resources/fabric.mod.json @@ -1,6 +1,6 @@ { "schemaVersion": 1, - "id": "kessoku_command_api", + "id": "kessoku_command", "version": "${version}", "name": "Kessoku Command API", "description": "About command registries.", diff --git a/command-api-fabric/src/main/resources/kessoku_command_api.mixins.json b/command-fabric/src/main/resources/kessoku_command.mixins.json similarity index 100% rename from command-api-fabric/src/main/resources/kessoku_command_api.mixins.json rename to command-fabric/src/main/resources/kessoku_command.mixins.json diff --git a/command-api-neo/build.gradle b/command-neo/build.gradle similarity index 78% rename from command-api-neo/build.gradle rename to command-neo/build.gradle index dc4d97f8..84906794 100644 --- a/command-api-neo/build.gradle +++ b/command-neo/build.gradle @@ -34,8 +34,12 @@ configurations { dependencies { neoForge libs.neo - common(project(path: ':command-api-common', configuration: 'namedElements')) { transitive false } - shadowBundle project(path: ':command-api-common', configuration: 'transformProductionNeoForge') + + implementation(project(":event-base-common")) + implementation(project(":event-base-neo")) + + common(project(path: ':command-common', configuration: 'namedElements')) { transitive false } + shadowBundle project(path: ':command-common', configuration: 'transformProductionNeoForge') } processResources { diff --git a/command-api-neo/gradle.properties b/command-neo/gradle.properties similarity index 100% rename from command-api-neo/gradle.properties rename to command-neo/gradle.properties diff --git a/command-neo/src/main/java/band/kessoku/lib/command/KessokuCommandEntrypoint.java b/command-neo/src/main/java/band/kessoku/lib/command/KessokuCommandEntrypoint.java new file mode 100644 index 00000000..6deb7ea9 --- /dev/null +++ b/command-neo/src/main/java/band/kessoku/lib/command/KessokuCommandEntrypoint.java @@ -0,0 +1,15 @@ +package band.kessoku.lib.command; + +import band.kessoku.lib.command.impl.KessokuCommandImpl; +import net.neoforged.bus.api.IEventBus; +import net.neoforged.fml.common.Mod; +import net.neoforged.neoforge.common.NeoForge; + +@Mod(KessokuCommand.MOD_ID) +public class KessokuCommandEntrypoint { + public KessokuCommandEntrypoint(IEventBus modEventBus) { + var forgeEventBus = NeoForge.EVENT_BUS; + + KessokuCommandImpl.registerCommonEvents(forgeEventBus); + } +} diff --git a/command-neo/src/main/java/band/kessoku/lib/command/impl/KessokuCommandImpl.java b/command-neo/src/main/java/band/kessoku/lib/command/impl/KessokuCommandImpl.java new file mode 100644 index 00000000..152c6ad3 --- /dev/null +++ b/command-neo/src/main/java/band/kessoku/lib/command/impl/KessokuCommandImpl.java @@ -0,0 +1,14 @@ +package band.kessoku.lib.command.impl; + +import band.kessoku.lib.command.api.events.CommandRegistryEvent; +import band.kessoku.lib.event.util.NeoEventUtils; +import net.neoforged.bus.api.IEventBus; +import net.neoforged.neoforge.event.RegisterCommandsEvent; + +public class KessokuCommandImpl { + public static void registerCommonEvents(IEventBus forgeEventBus) { + NeoEventUtils.registerEvent(forgeEventBus, RegisterCommandsEvent.class, event -> { + CommandRegistryEvent.EVENT.invoker().register(event.getDispatcher(), event.getBuildContext(), event.getCommandSelection()); + }); + } +} diff --git a/command-neo/src/main/resources/META-INF/neoforge.mods.toml b/command-neo/src/main/resources/META-INF/neoforge.mods.toml new file mode 100644 index 00000000..6b937418 --- /dev/null +++ b/command-neo/src/main/resources/META-INF/neoforge.mods.toml @@ -0,0 +1,29 @@ +modLoader = "javafml" +loaderVersion = "[4,)" +license = "LGPL-3.0-only" +issueTrackerURL = "https://github.com/KessokuTeaTime/KessokuLib/issues" + +[[mods]] +modId = "kessoku_command" +version = "${version}" +displayName = "Kessoku Command API" +description = ''' +About command registries. +''' +logoFile = "icon.png" +authors = "Kessoku Tea Time" +displayURL = "https://modrinth.com/mod/kessoku-lib" + +[[dependencies.kessoku-event-base]] +modId = "neoforge" +type = "required" +versionRange = "[21.0,)" +ordering = "NONE" +side = "BOTH" + +[[dependencies.kessoku-event-base]] +modId = "minecraft" +type = "required" +versionRange = "[1.21,)" +ordering = "NONE" +side = "BOTH" \ No newline at end of file diff --git a/fabric/build.gradle b/fabric/build.gradle index f7817af4..dc1fd8c0 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -11,6 +11,8 @@ architectury { } dependencies { + modImplementation libs.fabric.loader + include(project(":base-fabric")) include(project(":event-base-fabric")) include(project(":platform-fabric")) diff --git a/lifecycle-events-fabric/src/main/java/band/kessoku/lib/events/lifecycle/KessokuLifecycleEventsEntrypoints.java b/lifecycle-events-fabric/src/main/java/band/kessoku/lib/events/lifecycle/KessokuLifecycleEventsEntrypoint.java similarity index 78% rename from lifecycle-events-fabric/src/main/java/band/kessoku/lib/events/lifecycle/KessokuLifecycleEventsEntrypoints.java rename to lifecycle-events-fabric/src/main/java/band/kessoku/lib/events/lifecycle/KessokuLifecycleEventsEntrypoint.java index 5348c0de..ff12e016 100644 --- a/lifecycle-events-fabric/src/main/java/band/kessoku/lib/events/lifecycle/KessokuLifecycleEventsEntrypoints.java +++ b/lifecycle-events-fabric/src/main/java/band/kessoku/lib/events/lifecycle/KessokuLifecycleEventsEntrypoint.java @@ -3,7 +3,7 @@ import band.kessoku.lib.events.lifecycle.impl.KessokuLifecycleEventsImpl; import net.fabricmc.api.ModInitializer; -public class KessokuLifecycleEventsEntrypoints implements ModInitializer { +public class KessokuLifecycleEventsEntrypoint implements ModInitializer { @Override public void onInitialize() { KessokuLifecycleEventsImpl.registerCommonEvents(); diff --git a/lifecycle-events-fabric/src/main/resources/fabric.mod.json b/lifecycle-events-fabric/src/main/resources/fabric.mod.json new file mode 100644 index 00000000..3f4d4280 --- /dev/null +++ b/lifecycle-events-fabric/src/main/resources/fabric.mod.json @@ -0,0 +1,31 @@ +{ + "schemaVersion": 1, + "id": "kessoku_lifecycle_events", + "version": "${version}", + "name": "Kessoku Command API", + "description": "About command registries.", + "authors": [ + "Kessoku Tea Time" + ], + "contact": { + "homepage": "https://modrinth.com/mod/kessoku-lib", + "sources": "https://github.com/KessokuTeaTime/KessokuLib", + "issues": "https://github.com/KessokuTeaTime/KessokuLib/issues" + }, + "license": "LGPL-3.0-only", + "icon": "icon.png", + "environment": "*", + "depends": { + "fabricloader": ">=0.16.0", + "minecraft": "1.21", + "java": ">=21", + "fabric-api": "*" + }, + "custom": { + "modmenu": { + "badges": [ + "library" + ] + } + } +} \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index f92acb38..7709ff4b 100644 --- a/settings.gradle +++ b/settings.gradle @@ -14,4 +14,4 @@ include("base-common", "base-fabric", "base-neo") // Base include("event-base-common", "event-base-fabric", "event-base-neo") // Event Base include("platform-common", "platform-fabric", "platform-neo") // Platform include("lifecycle-events-common", "lifecycle-events-fabric", "lifecycle-events-neo") // Lifecycle Events -include("command-api-common", "command-api-fabric", "command-api-neo") // Command API +include("command-common", "command-fabric", "command-neo") // Command API