Running with Redirects
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
package io.github.skippyall.ruler.fabric;
|
||||
|
||||
import io.github.skippyall.ruler.command.CommandHelper;
|
||||
import net.kyori.adventure.audience.Audience;
|
||||
import net.minecraft.server.command.ServerCommandSource;
|
||||
|
||||
public class FabricCommandHelper implements CommandHelper<ServerCommandSource> {
|
||||
@Override
|
||||
public Audience toAudience(ServerCommandSource source) {
|
||||
return source.audience();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package io.github.skippyall.ruler.fabric;
|
||||
|
||||
import io.github.skippyall.ruler.Platform;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.minecraft.util.Util;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class FabricPlatform implements Platform {
|
||||
private static final Path CONFIG_DIR = FabricLoader.getInstance().getConfigDir().resolve(RulerFabric.MOD_ID).toAbsolutePath();
|
||||
|
||||
public FabricPlatform() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Path getConfigDirectory() {
|
||||
return CONFIG_DIR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Logger getLogger() {
|
||||
return RulerFabric.LOGGER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> CompletableFuture<T> runAsync(Supplier<T> supplier) {
|
||||
return CompletableFuture.supplyAsync(supplier, Util.getMainWorkerExecutor());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package io.github.skippyall.ruler.fabric;
|
||||
|
||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||
import io.github.skippyall.ruler.Ruler;
|
||||
import io.github.skippyall.ruler.command.Commands;
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
|
||||
import net.minecraft.server.command.ServerCommandSource;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class RulerFabric implements ModInitializer {
|
||||
public static final String MOD_ID = "ruler";
|
||||
public static final Commands<ServerCommandSource> COMMANDS = new Commands<>(new FabricCommandHelper());
|
||||
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
|
||||
|
||||
@Override
|
||||
public void onInitialize() {
|
||||
Ruler.init(new FabricPlatform());
|
||||
CommandRegistrationCallback.EVENT.register((dispatcher, access,environment) -> {
|
||||
for(LiteralArgumentBuilder<ServerCommandSource> node : COMMANDS.getCommands()) {
|
||||
dispatcher.register(node);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"id": "ruler",
|
||||
"version": "${version}",
|
||||
|
||||
"name": "Ruler",
|
||||
"description": "",
|
||||
"authors": [
|
||||
"skippyall"
|
||||
],
|
||||
"contact": {},
|
||||
|
||||
"license": "MIT",
|
||||
|
||||
"environment": "*",
|
||||
"entrypoints": {
|
||||
"main": [
|
||||
"io.github.skippyall.ruler.fabric.RulerFabric"
|
||||
]
|
||||
},
|
||||
"depends": {
|
||||
"fabricloader": ">=${loader_version}",
|
||||
"fabric": "*",
|
||||
"minecraft": "${minecraft_version}"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user