Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
max_line_length = 80
tab_width = 2

[.gitignore]
max_line_length = unset

[*.md]
max_line_length = unset

[*.feature]
tab_width = 4

[*.gsp]
indent_size = 4
tab_width = 4

[*.haml]
tab_width = 4

[*.less]
tab_width = 4

[*.styl]
tab_width = 4

[.editorconfig]
max_line_length = unset

[{*.as,*.js2,*.es}]
indent_size = 4
tab_width = 4

[{*.cfml,*.cfm,*.cfc}]
indent_size = 4
tab_width = 4

[{*.cjs,*.js}]
max_line_length = 80

[{*.gradle,*.groovy,*.gant,*.gdsl,*.gy,*.gson}]
indent_size = 4
tab_width = 4

[{*.jspx,*.tagx}]
indent_size = 4
tab_width = 4

[{*.kts,*.kt}]
indent_size = 4
tab_width = 4

[{*.vsl,*.vm,*.ft}]
indent_size = 4
tab_width = 4

[{*.xjsp,*.tag,*.jsf,*.jsp,*.jspf,*.tagf}]
indent_size = 4
tab_width = 4

[{*.yml,*.yaml}]
tab_width = 4

25 changes: 24 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ jobs:
distribution: 'microsoft'
- name: make gradle wrapper executable
run: chmod +x ./gradlew
- name: gradle setup
uses: gradle/actions/setup-gradle@v4
- name: build
run: ./gradlew build -Pversion=${{ needs.release-dry.outputs.version }}
- name: capture build artifacts
Expand Down Expand Up @@ -93,6 +95,27 @@ jobs:
run: |
minecraft_version=$(grep "^minecraft_version=" "gradle.properties" | cut -d'=' -f2)
echo "MINECRAFT_VERSION=$minecraft_version" >> $GITHUB_ENV
last_minecraft_version=$(grep "^last_minecraft_version=" "gradle.properties" | cut -d'=' -f2)
echo "LAST_MINECRAFT_VERSION=$last_minecraft_version" >> $GITHUB_ENV
- name: Generate Minecraft versions JSON
run: |
if [[ -z "$LAST_MINECRAFT_VERSION" ]]; then
LAST_MINECRAFT_VERSION=$(curl -s https://piston-meta.mojang.com/mc/game/version_manifest_v2.json | jq -r '.latest.release')
fi

MAJOR_MINOR=$(echo "$MINECRAFT_VERSION" | cut -d. -f1,2)
START_PATCH=$(echo "$MINECRAFT_VERSION" | cut -d. -f3)
END_PATCH=$(echo "$LAST_MINECRAFT_VERSION" | cut -d. -f3)

seq $START_PATCH $END_PATCH | awk -v mm="$MAJOR_MINOR" '{print mm "." $1}' | jq -R . | jq -s -c . > versions.json

- name: Load generated versions into env var
run: |
VERSIONS=$(jq -r '.[]' versions.json | paste -sd '\n' -)
echo "MINECRAFT_VERSIONS<<EOF" >> $GITHUB_ENV
echo "$VERSIONS" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV

- name: Upload to Modrinth
if: steps.semantic-release.outputs.new_release_version != ''
uses: cloudnode-pro/modrinth-publish@2.0.0
Expand All @@ -105,5 +128,5 @@ jobs:
loaders: |-
fabric
game-versions: |-
${{ env.MINECRAFT_VERSION }}
${{ env.MINECRAFT_VERSIONS }}
files: build/libs/AltX-fabric-${{ steps.semantic-release.outputs.new_release_version }}.jar
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
build/
out/
classes/
.factorypath

# eclipse

Expand Down
100 changes: 94 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,24 @@ base {
archivesName = project.archives_base_name
}

configurations {
embed
compileOnly.extendsFrom(embed)
}

shadowJar {
configurations = [project.configurations.embed]
exclude('META-INF/services/**')
relocate "com.moandjiezana", "dcshadow.com.moandjiezana"
}

repositories {
mavenCentral()
maven {
url = uri("https://repo.opencollab.dev/main/")
}
maven { url 'https://jitpack.io' }

// Add repositories to retrieve artifacts from in here.
// You should only use this when depending on other mods because
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
Expand All @@ -23,7 +40,7 @@ loom {
splitEnvironmentSourceSets()

mods {
"modid" {
"altx" {
sourceSet sourceSets.main
sourceSet sourceSets.client
}
Expand All @@ -46,26 +63,83 @@ dependencies {
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"

// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
include(modImplementation("me.lucko:fabric-permissions-api:${project.fabric_permission_api_version}"))

include(modImplementation("me.lucko:fabric-permissions-api:${project.fabric_permission_api_version}"))
embed implementation("club.minnced:discord-webhooks:${project.minnced_discord_webhook_version}")

// config
embed implementation("de.erdbeerbaerlp:toml4j:dd60f51")

// integrations
compileOnly "org.geysermc.floodgate:api:${project.floodgate_api_version}"
compileOnly "com.github.OrdinarySMP:DiscordJustSync:${project.justsync_version}"

embed implementation("club.minnced:discord-webhooks:${project.minnced_discord_webhook_version}")
}

tasks.build.dependsOn(tasks.shadowJar)

processResources {
inputs.property "version", project.version
def minecraft_version = project.minecraft_version
if (project.last_minecraft_version != "") {
minecraft_version = minecraft_version + " <=" + project.last_minecraft_version
}

inputs.property "version", project.version
inputs.property "minecraft_version", minecraft_version
inputs.property "loader_version", project.loader_version

filesMatching("fabric.mod.json") {
expand "version": project.version
expand "version": project.version,
"loader_version": project.loader_version,
"minecraft_version": minecraft_version
}
}

tasks.withType(JavaCompile).configureEach {
it.options.release = 21
}

tasks.register("prodServer", net.fabricmc.loom.task.prod.ServerProductionRunTask) {
def version = (project.hasProperty('version') && project.property('version') != 'unspecified')
? project.property('version'): project.minecraft_version

def fabricApiMetadataUrl = 'https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api/maven-metadata.xml'

def latestFabricApiVersion = null
try {
def xmlText = new URL(fabricApiMetadataUrl).text
def parsedXml = new XmlSlurper().parseText(xmlText)
def matchingVersions = parsedXml.versioning.versions.version.findAll {
v -> v.text().endsWith("+${version}")
}

if (!matchingVersions.isEmpty()) {
latestFabricApiVersion = matchingVersions[-1].text()
}

} catch (Exception e) {
logger.warn("Failed to fetch or parse Fabric API metadata, falling back to default version: $e")
latestFabricApiVersion = project.fabric_version
version = project.minecraft_version
}

if (latestFabricApiVersion == null) {
throw new GradleException("No Fabric API version found for specified Minecraft version: ${version}")
}

configurations {
register("runtimeMods")
}

dependencies.add("runtimeMods", "net.fabricmc.fabric-api:fabric-api:${latestFabricApiVersion}")
mods.from(configurations.named("runtimeMods"))

installerVersion = "1.0.1"
loaderVersion = project.loader_version
minecraftVersion = version
}

java {
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
Expand All @@ -76,6 +150,15 @@ java {
targetCompatibility = JavaVersion.VERSION_21
}

remapJar {
// wait until the shadowJar is done
dependsOn(shadowJar)
mustRunAfter(shadowJar)
// Set the input jar for the task. Here use the shadow Jar that include the .class of the transitive dependency
inputFile = file(shadowJar.archiveFile)
}


jar {
from("LICENSE") {
rename { "${it}_${project.base.archivesName.get()}"}
Expand All @@ -90,6 +173,11 @@ remapJar {
inputFile = file(shadowJar.archiveFile)
}

artifacts {
archives tasks.shadowJar
}


// configure the maven publication
publishing {
publications {
Expand Down
12 changes: 8 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,20 @@ org.gradle.parallel=true

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.21.8
yarn_mappings=1.21.8+build.1
minecraft_version=1.21.6
last_minecraft_version=
yarn_mappings=1.21.6+build.1
loader_version=0.16.14

# Mod Properties
maven_group=com.xadale
archives_base_name=AltX-fabric

# Dependencies
fabric_version=0.129.0+1.21.8
# Mod Dependencies
fabric_version=0.127.0+1.21.6
fabric_permission_api_version=0.4.0
floodgate_api_version=2.2.4-SNAPSHOT
justsync_version=master-SNAPSHOT

# Dependencies
minnced_discord_webhook_version=0.8.4
Empty file modified gradlew
100644 → 100755
Empty file.
Loading