Skip to content

Commit

Permalink
Updated fabric impl to minecraft 1.21
Browse files Browse the repository at this point in the history
  • Loading branch information
Radu-Voinea committed Nov 19, 2024
1 parent 3c007aa commit 00b4e47
Show file tree
Hide file tree
Showing 21 changed files with 400 additions and 24 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

## How to add to your project

## Fabric versioning

| Minecraft version | Fabric version | command-manager-fabric vebric |
|-------------------|----------------|-------------------------------|
| 1.20.1 | 0.15.10 | [1.0.0 - 1.0.6] |
| 1.21.1 | 0.16.9 | [1.1.0 - ] |

```kotlin
repositories {
maven("https://repository.voinearadu.com/repository/maven-releases/")
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ fun DependencyHandlerScope.applyDependencies() {
if(project.properties["com.voinearadu.utils.local"] != null){
api(project(project.properties["com.voinearadu.utils.local"] as String))
}else{
api("com.voinearadu:utils:1.1.17")
api(libs.voinearadu.utils)
}

// Annotations
Expand Down
23 changes: 14 additions & 9 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,31 +1,36 @@
[versions]

version = "1.0.6"
version = "1.1.-1"
group = "com.voinearadu"

[plugins]

loom = { id = "fabric-loom", version = "1.5.5" }
loom_v20 = { id = "fabric-loom", version = "1.5.5" }
loom_v21 = { id = "fabric-loom", version = "1.7.3" }

[libraries]

# Minecraft

# Fabric 1.20
minecraft_v20 = { module = "com.mojang:minecraft", version = "1.20.1" }
fabric_api_v20 = { module = "net.fabricmc.fabric-api:fabric-api", version = "0.90.7+1.20.3" }
fabric_loader_v20 = { module = "net.fabricmc:fabric-loader", version = "0.15.10" }
parchment_mappings_v20 = { module = "org.parchmentmc.data:parchment-1.20.1", version = "2023.09.03" }

# Fabric
fabric_api = { module = "net.fabricmc.fabric-api:fabric-api", version = "0.90.7+1.20.3" }
fabric_loader = { module = "net.fabricmc:fabric-loader", version = "0.15.10" }
parchment_mappings = { module = "org.parchmentmc.data:parchment-1.20.1", version = "2023.09.03" }
# Fabric 1.21
minecraft_v21 = { module = "com.mojang:minecraft", version = "1.21.1" }
fabric_api_v21 = { module = "net.fabricmc.fabric-api:fabric-api", version = "0.109.0+1.21.1" }
fabric_loader_v21 = { module = "net.fabricmc:fabric-loader", version = "0.16.9" }
parchment_mappings_v21 = { module = "org.parchmentmc.data:parchment-1.21", version = "2024.11.10" }

# Velocioty
velocity = { module = "com.velocitypowered:velocity-api", version = "3.1.2-SNAPSHOT" }

# Dependencies
lombok = { module = "org.projectlombok:lombok", version = "1.18.34" }
jetbrains_annotations = { module = "org.jetbrains:annotations", version = "24.1.0" }
gson = { module = "com.google.code.gson:gson", version = "2.11.0" }
reflections = { module = "org.reflections:reflections", version = "0.10.2" }
luckperms = { module = "net.luckperms:api", version = "5.4" }
kyori_minimessage = { module = "net.kyori:adventure-text-minimessage", version = "4.17.0" }
kyori_adventure_fabric = { module = "net.kyori:adventure-platform-fabric", version = "5.9.0" }
voinearadu_utils = { module = "com.voinearadu:utils", version = "1.1.6" }
voinearadu_utils = { module = "com.voinearadu:utils", version = "1.1.19" }
3 changes: 2 additions & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ fun defineProject(module: String, path: String) {
}

defineProject(":command-manager-common", "src/common")
defineProject(":command-manager-fabric-20", "src/fabric_20")
//defineProject(":command-manager-fabric-20", "src/fabric-20") // Only for archival purposes
defineProject(":command-manager-fabric-21", "src/fabric-21")
defineProject(":command-manager-velocity", "src/velocity")
// TODO: Spigot (Bukkit) Support
// TODO: Force Support
2 changes: 1 addition & 1 deletion src/common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ dependencies {
if (project.properties["com.voinearadu.utils.local"] != null) {
api(project(project.properties["com.voinearadu.utils.local"] as String))
} else {
api("com.voinearadu:utils:1.1.6")
api(libs.voinearadu.utils)
}
api(libs.luckperms)
api(libs.kyori.minimessage)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import java.util.Set;
import java.util.stream.Collectors;

@SuppressWarnings("unused")
public abstract class CommonCommand {

// Provided
Expand All @@ -29,7 +30,7 @@ public CommonCommand(CommonCommandManager commandManager) throws CommandNotAnnot

this.annotation = this.getClass().getAnnotation(Command.class);

subCommands.addAll(commandManager.getReflections().getOfType(CommonCommand.class)
subCommands.addAll(commandManager.getReflectionsCrawler().getOfType(CommonCommand.class)
.stream()
.filter(commandClass -> commandClass.isAnnotationPresent(Command.class))
.filter(commandClass -> commandClass.getAnnotation(Command.class).parent().equals(this.getClass()))
Expand Down Expand Up @@ -96,7 +97,7 @@ public void execute(@NotNull Object executor, @NotNull List<String> arguments) {
}

if (!arguments.isEmpty()) {
String subCommandName = arguments.get(0);
String subCommandName = arguments.getFirst();
CommonCommand subCommand = subCommands.stream()
.filter(command -> command.getAliases().contains(subCommandName))
.findFirst()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,20 @@
import java.util.ArrayList;
import java.util.List;

@SuppressWarnings("unused")
public abstract class CommonCommandManager {

private final @Getter Reflections reflections;
private final @Getter Reflections.Crawler reflectionsCrawler;
private final List<CommonCommand> commands = new ArrayList<>();
private final @Getter Class<?> playerClass;
private final @Getter Class<?> consoleClass;
private final @Getter Class<?> senderClass;
private final @Getter String basePermission;

public CommonCommandManager(@NotNull Reflections reflections, @NotNull Class<?> playerClass,
public CommonCommandManager(@NotNull Reflections.Crawler reflectionsCrawler, @NotNull Class<?> playerClass,
@NotNull Class<?> consoleClass, @NotNull Class<?> senderClass,
@NotNull String basePermission) {
this.reflections = reflections;
this.reflectionsCrawler = reflectionsCrawler;
this.playerClass = playerClass;
this.consoleClass = consoleClass;
this.senderClass = senderClass;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
@file:Suppress("UnstableApiUsage")

plugins {
id(libs.plugins.loom.get().pluginId) version libs.plugins.loom.get().version.toString()
id(libs.plugins.loom.v20.get().pluginId) version libs.plugins.loom.v20.get().version.toString()
}

dependencies {
// Minecraft
minecraft(libs.minecraft.v20)
mappings(loom.layered {
officialMojangMappings()
parchment(libs.parchment.mappings)
parchment(libs.parchment.mappings.v20)
})

modCompileOnly(libs.fabric.loader)
modCompileOnly(libs.fabric.api)
modCompileOnly(libs.fabric.loader.v20)
modCompileOnly(libs.fabric.api.v20)

// Project
api(project(":command-manager-common"))
Expand Down
58 changes: 58 additions & 0 deletions src/fabric-21/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
@file:Suppress("UnstableApiUsage")

plugins {
id(libs.plugins.loom.v21.get().pluginId) version libs.plugins.loom.v21.get().version.toString()
}

dependencies {
// Minecraft
minecraft(libs.minecraft.v21)
mappings(loom.layered {
officialMojangMappings()
parchment(libs.parchment.mappings.v21)
})

modCompileOnly(libs.fabric.loader.v21)
modCompileOnly(libs.fabric.api.v21)

// Project
api(project(":command-manager-common"))

// Dependencies
if (project.properties["com.voinearadu.utils.local"] != null) {
api(project(project.properties["com.voinearadu.utils.local"] as String))
} else {
api("com.voinearadu:utils:1.1.6")
}
api(libs.luckperms)
modApi(libs.kyori.adventure.fabric)

// Annotations
compileOnly(libs.lombok)
annotationProcessor(libs.lombok)
testCompileOnly(libs.lombok)
testAnnotationProcessor(libs.lombok)

compileOnly(libs.jetbrains.annotations)
annotationProcessor(libs.jetbrains.annotations)
testCompileOnly(libs.jetbrains.annotations)
testAnnotationProcessor(libs.jetbrains.annotations)
}

tasks {
jar {
archiveFileName = "FabricCommandManager-$version.jar"
}

processResources {
inputs.property("version", version)

filesMatching("fabric.mod.json") {
expand("version" to version)
}
}

remapJar {
archiveFileName = "FabricCommandManager-$version.jar"
}
}
Loading

0 comments on commit 00b4e47

Please sign in to comment.