Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
TropheusJ committed Apr 1, 2024
0 parents commit a03fff7
Show file tree
Hide file tree
Showing 21 changed files with 895 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# http://editorconfig.org
root = true

[*]
indent_style = space
indent_size = 4
continuation_indent_size = 8
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.json]
indent_size = 2

[*.yml]
indent_size = 2

[*.gradle]
indent_style = tab

[*.java]
indent_style = tab
ij_continuation_indent_size = 8
ij_java_class_count_to_use_import_on_demand = 99
ij_java_names_count_to_use_import_on_demand = 99
ij_java_imports_layout = $*, |, java.**, |, javax.**, |, org.**, |, com.**, |, *
33 changes: 33 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: build
on: [ pull_request, push ]

jobs:
build:
strategy:
matrix:
java: [ 17 ]
runs-on: ubuntu-latest
env:
PUBLISH_SUFFIX: snapshots
MAVEN_USER: ${{ secrets.MAVEN_USER }}
MAVEN_PASS: ${{ secrets.MAVEN_PASS }}
steps:
- name: checkout repository
uses: actions/checkout@v2

- name: setup jdk ${{ matrix.java }}
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}

- name: make gradle wrapper executable
run: chmod +x ./gradlew

- name: build
run: ./gradlew buildOrPublish

- name: capture build artifacts
uses: actions/upload-artifact@v2
with:
name: Artifacts
path: build/libs/
33 changes: 33 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# gradle

.gradle/
build/
out/
classes/

# eclipse

*.launch

# idea

.idea/
*.iml
*.ipr
*.iws

# vscode

.settings/
.vscode/
bin/
.classpath
.project

# macos

*.DS_Store

# fabric

run/
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 Tropheus Jay

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Fabric Example Mod

# Stuff
This template mod, in addition to the features of the standard template mod,
also has an example test mod as well as an example gametest setup. It uses Mojang
mappings primarily, but also uses Quilt Mappings for Javadocs and parameter names.

## Setup
For setup instructions please see the [fabric wiki page](https://fabricmc.net/wiki/tutorial:setup) that relates to the
IDE that you are using.

## License
This template is available under the MIT license. Feel free to learn from it and incorporate it in your own projects.
139 changes: 139 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
//file:noinspection GroovyAssignabilityCheck
//file:noinspection GroovyAccessibility
//file:noinspection GradlePackageVersionRange
plugins {
id "fabric-loom" version "1.4.+"
id "maven-publish"
}

sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17

archivesBaseName = archives_base_name
group = maven_group

String buildNumber = System.getenv("GITHUB_RUN_NUMBER")
String patch = buildNumber != null ? buildNumber : "99999"
version = mod_version.replace("<build>", patch)

repositories {
maven { url = "https://maven.quiltmc.org/repository/release" }
maven { url = "https://api.modrinth.com/maven" }
maven { url = "https://maven.bai.lol" }
maven { url = "https://maven.terraformersmc.com/releases/" }
maven { url = "https://maven.shedaniel.me/" }
}

dependencies {
// dev environment
minecraft("com.mojang:minecraft:$minecraft_version")
mappings(loom.layered {
it.mappings("org.quiltmc:quilt-mappings:$minecraft_version+build.$qm_version:intermediary-v2")
if (parchment_version != "none")
it.parchment("org.parchmentmc.data:parchment-$minecraft_version:$parchment_version@zip")
it.officialMojangMappings { nameSyntheticMembers = false }
})
modImplementation("net.fabricmc:fabric-loader:$loader_version")

// dev env
modLocalRuntime("maven.modrinth:suggestion-tweaker:$suggestion_tweaker_version")
modLocalRuntime("maven.modrinth:cloth-config:$cloth_config_version") { exclude(group: "net.fabricmc.fabric-api") }
modLocalRuntime("maven.modrinth:jade:$jade_version")
modLocalRuntime("com.terraformersmc:modmenu:$modmenu_version") { exclude(group: "net.fabricmc"); exclude(group: "net.fabricmc.fabric-api") }

// dependencies
modImplementation("net.fabricmc.fabric-api:fabric-api:$fabric_version")
}

tasks.register("buildOrPublish") {
group = "build"
String mavenUser = System.getenv("MAVEN_USER")
if (mavenUser != null && !mavenUser.isEmpty()) {
dependsOn(tasks.named("publish"))
println("prepared for publish")
} else {
dependsOn(tasks.named("build"))
println("prepared for build")
}
}

processResources {
Map<String, String> properties = new HashMap<>()
properties.put("version", version)
properties.put("loader_version", loader_version)
properties.put("fabric_version", fabric_version)
properties.put("minecraft_version", minecraft_version)

properties.forEach((k, v) -> inputs.property(k, v))

filesMatching("fabric.mod.json") {
expand properties
}
}

sourceSets {
testmod {
compileClasspath += main.compileClasspath
compileClasspath += main.output
runtimeClasspath += main.runtimeClasspath
runtimeClasspath += main.output
}
}

loom {
runs {
testmodClient {
client()
name "Testmod Client"
source sourceSets.testmod
runDir "run/test"
}
testmodServer {
server()
name "Testmod Server"
source sourceSets.testmod
runDir "run/test_server"
}
gametest {
server()
name "Test"
source sourceSets.testmod
vmArg "-Dfabric-api.gametest"
vmArg "-Dfabric-api.gametest.report-file=${project.buildDir}/junit.xml"
runDir "run/gametest_server"
}
}
}

tasks.withType(JavaCompile).configureEach {
it.options.release = Integer.parseInt(sourceCompatibility)
}

java {
withSourcesJar()
}

jar {
from("LICENSE") {
rename { "${it}_${archivesBaseName}" }
}
}

publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}

repositories {
maven {
url = "https://mvn.devos.one/${System.getenv("PUBLISH_SUFFIX")}/"
credentials {
username = System.getenv("MAVEN_USER")
password = System.getenv("MAVEN_PASS")
}
authentication { basic(BasicAuthentication) }
}
}
}
26 changes: 26 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
org.gradle.jvmargs=-Xmx2G

maven_group = io.github.tropheusj
archives_base_name = modid
# <build> is replaced at compile time with either GitHub Actions build number, or 99999 if not available.
mod_version = 0.0.<build>

# https://fabricmc.net/develop
minecraft_version = 1.20.4
loader_version = 0.15.2
fabric_version = 0.91.3+1.20.4
# https://lambdaurora.dev/tools/import_quilt.html
qm_version = 2
# https://parchmentmc.org/docs/getting-started
parchment_version = none

# dev env mods

# https://modrinth.com/mod/jade/versions?l=fabric
jade_version = XoEjMfV6
# https://modrinth.com/mod/modmenu/versions
modmenu_version = 9.0.0-pre.1
# https://modrinth.com/mod/suggestion-tweaker/versions?l=fabric
suggestion_tweaker_version = 1.20-1.5.1+fabric
# https://modrinth.com/mod/cloth-config/versions?l=fabric
cloth_config_version = 13.0.114+fabric
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 5 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit a03fff7

Please sign in to comment.