-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from MiniPlaceholders/feat/fabric
Fabric implementation
- Loading branch information
Showing
8 changed files
with
117 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
plugins { | ||
id("fabric-loom") | ||
alias(libs.plugins.shadow) | ||
} | ||
|
||
val shade: Configuration by configurations.creating | ||
|
||
dependencies { | ||
compileOnly(libs.miniplaceholders) | ||
shadeModule(projects.exampleExpansionCommon) | ||
minecraft(libs.minecraft) | ||
mappings(loom.officialMojangMappings()) | ||
modImplementation(libs.fabric.loader) | ||
modImplementation(libs.fabric.api) | ||
modImplementation(libs.adventure.platform.fabric) | ||
} | ||
|
||
fun DependencyHandlerScope.shadeModule(dependency: Any) { | ||
shade(dependency) | ||
implementation(dependency) | ||
} | ||
|
||
tasks { | ||
processResources { | ||
filteringCharset = Charsets.UTF_8.name() | ||
filesMatching("fabric.mod.json") { | ||
expand("version" to project.version) | ||
} | ||
} | ||
remapJar { | ||
inputFile.set(shadowJar.get().archiveFile) | ||
archiveFileName.set("MiniPlaceholders-Example-Expansion-Fabric-${project.version}.jar") | ||
destinationDirectory.set(file("${project.rootDir}/build")) | ||
} | ||
shadowJar { | ||
configurations = listOf(shade) | ||
} | ||
} | ||
|
||
java { | ||
withSourcesJar() | ||
} |
15 changes: 15 additions & 0 deletions
15
fabric/src/main/java/io/github/miniplaceholders/expansion/expressions/fabric/FabricMod.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package io.github.miniplaceholders.expansion.expressions.fabric; | ||
|
||
import io.github.miniplaceholders.expansion.example.common.CommonExpansion; | ||
import net.fabricmc.api.DedicatedServerModInitializer; | ||
import net.minecraft.server.level.ServerPlayer; | ||
|
||
public class FabricMod implements DedicatedServerModInitializer { | ||
@Override | ||
public void onInitializeServer() { | ||
CommonExpansion.builder() | ||
.filter(ServerPlayer.class) | ||
.build() | ||
.register(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"schemaVersion": 1, | ||
"id": "miniplaceholders-example-expansion", | ||
"version": "${version}", | ||
"name": "MiniPlaceholders Example Expansion", | ||
"description": "MiniPlaceholders Example Expansion for Fabric", | ||
"authors": [ | ||
"4drian3d" | ||
], | ||
"contact": { | ||
"homepage": "https://github.com/MiniPlaceholders/Example-Expansion", | ||
"sources": "https://github.com/MiniPlaceholders/Example-Expansion" | ||
}, | ||
"license": "MIT", | ||
"environment": "*", | ||
"entrypoints": { | ||
"server": [ | ||
"io.github.miniplaceholders.expansion.expressions.fabric.FabricMod" | ||
] | ||
}, | ||
"depends": { | ||
"fabricloader": ">=0.14.23", | ||
"minecraft": ">=1.20.2", | ||
"java": ">=17", | ||
"fabric-api": "*", | ||
"miniplaceholders": "*" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
group = io.github.miniplaceholders | ||
version = 1.0.0 | ||
description = MiniPlaceholders Example Expansion | ||
description = MiniPlaceholders Example Expansion | ||
org.gradle.jvmargs=-Xmx2G |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters