From 5238e24cb2980e99f5bfd1d221d88b361c9ebd53 Mon Sep 17 00:00:00 2001 From: Revxrsal Date: Sun, 29 Dec 2024 23:42:18 +0300 Subject: [PATCH] minor cleanups to fabric --- examples/fabric-mod/build.gradle.kts | 22 +++++----- .../java/com/example/mod/FabricTestMod.java | 1 + fabric/build.gradle.kts | 42 ++++++++++--------- .../fabric/annotation/CommandPermission.java | 1 - 4 files changed, 35 insertions(+), 31 deletions(-) diff --git a/examples/fabric-mod/build.gradle.kts b/examples/fabric-mod/build.gradle.kts index db586d96..8c5327c7 100644 --- a/examples/fabric-mod/build.gradle.kts +++ b/examples/fabric-mod/build.gradle.kts @@ -14,20 +14,20 @@ repositories { maven("https://maven.fabricmc.net/") } -val minecraft_version = "1.21" -val yarn_mappings = "1.21+build.9" -val loader_version = "0.16.7" -val fabric_version = "0.102.0+1.21" -val permissions_version = "0.3.1" +val minecraftVersion = "1.21" +val yarnMappings = "1.21+build.9" +val loaderVersion = "0.16.7" +val fabricVersion = "0.102.0+1.21" +val permissionsVersion = "0.3.1" dependencies { implementation(project(":common")) implementation(project(":brigadier")) modImplementation(project(":fabric")) - mappings("net.fabricmc:yarn:${yarn_mappings}:v2") - minecraft("com.mojang:minecraft:${minecraft_version}") - modImplementation("net.fabricmc:fabric-loader:${loader_version}") - include("me.lucko:fabric-permissions-api:${permissions_version}")?.let { modImplementation(it) } + mappings("net.fabricmc:yarn:${yarnMappings}:v2") + minecraft("com.mojang:minecraft:${minecraftVersion}") + modImplementation("net.fabricmc:fabric-loader:${loaderVersion}") + include("me.lucko:fabric-permissions-api:${permissionsVersion}")?.let { modImplementation(it) } } java.toolchain.languageVersion.set(JavaLanguageVersion.of(21)) @@ -37,8 +37,8 @@ tasks { filesMatching("fabric.mod.json") { expand(mapOf( "version" to project.version, - "loader_version" to loader_version, - "minecraft_version" to minecraft_version + "loader_version" to loaderVersion, + "minecraft_version" to minecraftVersion )) } } diff --git a/examples/fabric-mod/src/main/java/com/example/mod/FabricTestMod.java b/examples/fabric-mod/src/main/java/com/example/mod/FabricTestMod.java index 4e0a7c91..44a39779 100644 --- a/examples/fabric-mod/src/main/java/com/example/mod/FabricTestMod.java +++ b/examples/fabric-mod/src/main/java/com/example/mod/FabricTestMod.java @@ -4,6 +4,7 @@ import revxrsal.commands.fabric.FabricLamp; public class FabricTestMod implements DedicatedServerModInitializer { + @Override public void onInitializeServer() { var lamp = FabricLamp.builder().build(); lamp.register(new GreetCommand()); diff --git a/fabric/build.gradle.kts b/fabric/build.gradle.kts index 4801ac28..b5bbcaf6 100644 --- a/fabric/build.gradle.kts +++ b/fabric/build.gradle.kts @@ -14,35 +14,39 @@ repositories { maven("https://maven.fabricmc.net/") } -val minecraft_version = "1.21" -val yarn_mappings = "1.21+build.9" -val loader_version = "0.16.7" -val fabric_version = "0.102.0+1.21" -val permissions_version = "0.3.1" -val java_version = 21 +val minecraftVersion = "1.21" +val yarnMappings = "1.21+build.9" +val loaderVersion = "0.16.7" +val fabricVersion = "0.102.0+1.21" +val permissionsVersion = "0.3.1" +val javaVersion = 21 dependencies { implementation(project(":common")) implementation(project(":brigadier")) - minecraft("com.mojang:minecraft:${minecraft_version}") - mappings("net.fabricmc:yarn:${yarn_mappings}:v2") - modImplementation("net.fabricmc:fabric-loader:${loader_version}") - modImplementation("net.fabricmc.fabric-api:fabric-api:${fabric_version}") - include("me.lucko:fabric-permissions-api:${permissions_version}")?.let { modImplementation(it) } + minecraft("com.mojang:minecraft:${minecraftVersion}") + mappings("net.fabricmc:yarn:${yarnMappings}:v2") + modImplementation("net.fabricmc:fabric-loader:${loaderVersion}") + modImplementation("net.fabricmc.fabric-api:fabric-api:${fabricVersion}") + include("me.lucko:fabric-permissions-api:${permissionsVersion}")?.let { + modImplementation(it) + } } -java.toolchain.languageVersion.set(JavaLanguageVersion.of(java_version)) +java.toolchain.languageVersion.set(JavaLanguageVersion.of(javaVersion)) tasks { processResources { filesMatching("fabric.mod.json") { - expand(mapOf( - "version" to project.version, - "java_version" to java_version, - "loader_version" to loader_version, - "fabric_version" to fabric_version, - "minecraft_version" to minecraft_version - )) + expand( + mapOf( + "version" to project.version, + "java_version" to javaVersion, + "loader_version" to loaderVersion, + "fabric_version" to fabricVersion, + "minecraft_version" to minecraftVersion + ) + ) } } } diff --git a/fabric/src/main/java/revxrsal/commands/fabric/annotation/CommandPermission.java b/fabric/src/main/java/revxrsal/commands/fabric/annotation/CommandPermission.java index d4fc942a..4cb08b68 100644 --- a/fabric/src/main/java/revxrsal/commands/fabric/annotation/CommandPermission.java +++ b/fabric/src/main/java/revxrsal/commands/fabric/annotation/CommandPermission.java @@ -2,7 +2,6 @@ import me.lucko.fabric.api.permissions.v0.Permissions; import net.minecraft.command.CommandSource; -import net.minecraft.server.command.ServerCommandSource; import revxrsal.commands.annotation.DistributeOnMethods; import revxrsal.commands.annotation.NotSender;