Skip to content

Commit

Permalink
rename command-api -> command
Browse files Browse the repository at this point in the history
  • Loading branch information
TexBlock committed Aug 4, 2024
1 parent b353bea commit f2385ba
Show file tree
Hide file tree
Showing 17 changed files with 126 additions and 14 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package band.kessoku.lib.command;

public class KessokuCommand {
public static final String MOD_ID = "kessoku_command";
}
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -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();
}
}
Original file line number Diff line number Diff line change
@@ -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);
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"schemaVersion": 1,
"id": "kessoku_command_api",
"id": "kessoku_command",
"version": "${version}",
"name": "Kessoku Command API",
"description": "About command registries.",
Expand Down
8 changes: 6 additions & 2 deletions command-api-neo/build.gradle → command-neo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -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);
}
}
Original file line number Diff line number Diff line change
@@ -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());
});
}
}
29 changes: 29 additions & 0 deletions command-neo/src/main/resources/META-INF/neoforge.mods.toml
Original file line number Diff line number Diff line change
@@ -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"
2 changes: 2 additions & 0 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ architectury {
}

dependencies {
modImplementation libs.fabric.loader

include(project(":base-fabric"))
include(project(":event-base-fabric"))
include(project(":platform-fabric"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
31 changes: 31 additions & 0 deletions lifecycle-events-fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
}
}
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit f2385ba

Please sign in to comment.