Skip to content

Commit

Permalink
Update to Minecraft 1.19.3.
Browse files Browse the repository at this point in the history
  • Loading branch information
LambdAurora committed Feb 6, 2023
1 parent 03f9273 commit f9a3a53
Show file tree
Hide file tree
Showing 19 changed files with 235 additions and 156 deletions.
24 changes: 18 additions & 6 deletions .github/workflows/gradle_build.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,32 @@
name: Gradle Build

on: [ push, pull_request ]
on:
push:
branches:
- '*'
pull_request:
branches:
- '*'

jobs:
build:
strategy:
matrix:
java: [ 17, 19 ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 17
uses: actions/setup-java@v2
- uses: actions/checkout@v3
with:
java-version: 17
fetch-depth: 0
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'
cache: 'gradle'

- name: Build with Gradle
run: ./gradlew build
run: ./gradlew build --parallel --stacktrace

- uses: actions/upload-artifact@v2
with:
Expand Down
26 changes: 0 additions & 26 deletions .github/workflows/modrinth_update.yml

This file was deleted.

30 changes: 30 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Release

on:
release:
types:
- published

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'

- name: Build with Gradle
run: ./gradlew build modrinth curseforge --parallel --stacktrace
env:
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }}

- uses: actions/upload-artifact@v2
with:
name: Artifacts
path: ./build/libs/
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# LambdAurora's ignore file
#
# v0.20
# v0.21

# JetBrains
.idea/
Expand Down Expand Up @@ -37,6 +37,8 @@ CMakeFiles/
.gradle/
## Node.JS
node_modules/
## PHP composer
vendor/

# Editors
## VSCode
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,8 @@
- Added Canadian French translations.
- Moved the Snail Spawn Egg to be in the same place as Vanilla would put Spawn Eggs in the creative inventory.
- Stopped rendering chests if the snail is a baby. Not naturally possible, but it happened.

### 1.1.1

- Updated to 1.19.3.
- Improved a little the spawn logic code.
112 changes: 89 additions & 23 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
plugins {
id 'fabric-loom' version '0.12.+'
id 'io.github.juuxel.loom-quiltflower' version '1.7.+'
id 'org.quiltmc.quilt-mappings-on-loom' version '4.0.0'
id 'fabric-loom' version '1.+'
id 'io.github.juuxel.loom-quiltflower' version '1.8.+'
id 'org.quiltmc.gradle.licenser' version '1.1.+'
id 'java-library'
id 'maven-publish'
id 'com.modrinth.minotaur' version '2.+'
id 'com.matthewprenger.cursegradle' version '1.4.+'
}

import com.modrinth.minotaur.dependencies.ModDependency

group = project.maven_group
version = "${project.mod_version}+${getMCVersionString()}"
version = "${project.mod_version}+${project.minecraft_version}"
archivesBaseName = project.archives_base_name

// This field defines the Java version your mod target.
Expand All @@ -30,28 +30,63 @@ String getMCVersionString() {
return version[0] + '.' + version[1]
}

String getVersionType() {
if (isMCVersionNonRelease() || version.contains("-alpha.")) {
return "alpha"
} else if (version.contains("-beta.")) {
return "beta"
} else {
return "release"
}
}

String parseReadme() {
def linkRegex = /!\[([A-z_ ]+)]\((images\/[A-z.\/_]+)\)/

def readme = (String) file('README.md').text
readme = readme.replaceAll(linkRegex, '![$1](https://raw.githubusercontent.com/LambdAurora/lovely_snails/1.17/$2)')
readme = readme.replaceAll(linkRegex, '![$1](https://raw.githubusercontent.com/LambdAurora/lovely_snails/1.19.3/$2)')
return readme
}

String fetchChangelog() {
def changelogText = file('CHANGELOG.md').text
def regexVersion = ((String) project.mod_version).replaceAll('\\.', /\\./).replaceAll('\\+', '\\+')
def changelogRegex = ~"###? ${regexVersion}\\n\\n(( *- .+\\n)+)"
def matcher = changelogText =~ changelogRegex

if (matcher.find()) {
def changelogContent = matcher.group(1)

def changelogLines = changelogText.split('\n')
def linkRefRegex = ~'^\\[([A-z\\d _\\-/+.]+)]: '
for (int i = changelogLines.length - 1; i > 0; i--) {
def line = changelogLines[i]
if ((line =~ linkRefRegex).find())
changelogContent += '\n' + line
else break
}
return changelogContent
} else {
return null;
}
}

loom {
// Enable runtime only log4j, forces mods to use SLF4J for logging.
runtimeOnlyLog4j = true
}

repositories {
maven {
name 'Quilt'
url 'https://maven.quiltmc.org/repository/release'
}
}

dependencies {
//to change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings(loom.layered {
addLayer(quiltMappings.mappings("org.quiltmc:quilt-mappings:${minecraft_version}+build.${project.quilt_mappings}:v2"))
})
mappings "org.quiltmc:quilt-mappings:${minecraft_version}+build.${project.quilt_mappings}:intermediary-v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"

modImplementation("net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version}") {
Expand Down Expand Up @@ -104,22 +139,10 @@ modrinth {
syncBodyFrom = parseReadme()

// Changelog fetching
def changelogText = file('CHANGELOG.md').text.replaceAll('\\r\\n', '\n')
def regexVersion = ((String) project.mod_version).replaceAll('\\.', /\\./).replaceAll('\\+', '\\+')
def changelogRegex = ~"###? ${regexVersion}\\n\\n(( *- .+\\n)+)"
def matcher = changelogText =~ changelogRegex

if (matcher.find()) {
changelog = matcher.group(1)
def changelogContent = fetchChangelog()

def changelogLines = changelogText.split('\n')
def linkRefRegex = ~'^\\[([A-z0-9 _\\-/+.]+)]: '
for (int i = changelogLines.length - 1; i > 0; i--) {
def line = changelogLines[i]
if ((line =~ linkRefRegex).find())
changelog += '\n' + line
else break
}
if (changelogContent) {
changelog = changelogContent
} else {
afterEvaluate {
tasks.modrinth.setEnabled(false)
Expand All @@ -128,6 +151,49 @@ modrinth {
}
tasks.modrinth.dependsOn(tasks.modrinthSyncBody)

curseforge {
if (System.getenv("CURSEFORGE_TOKEN")) {
apiKey = System.getenv("CURSEFORGE_TOKEN")
}

project {
id = project.curseforge_id
releaseType = this.getVersionType()
addGameVersion project.minecraft_version
addGameVersion "Fabric"
addGameVersion "Quilt"
addGameVersion "Java 17"
addGameVersion "Java 18"

// Changelog fetching
def changelogContent = fetchChangelog()

if (changelogContent) {
changelogType = "markdown"
changelog = "Changelog:\n\n${changelogContent}"
} else {
afterEvaluate {
uploadTask.setEnabled(false)
}
}

mainArtifact(remapJar) {
displayName = "Lovely Snails ${project.mod_version} (${project.minecraft_version})"

relations {
requiredDependency "fabric-api"
optionalDependency "modmenu"
}
}

afterEvaluate {
uploadTask.setGroup("publishing")
uploadTask.dependsOn("remapJar")
}
}
}
tasks.curseforge.setGroup("publishing")

// configure the maven publication
publishing {
publications {
Expand Down
11 changes: 6 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
org.gradle.jvmargs=-Xmx1G

# Quilt properties
minecraft_version=1.19
quilt_mappings=1
loader_version=0.14.7
fabric_api_version=0.55.3+1.19
minecraft_version=1.19.3
quilt_mappings=23
loader_version=0.14.10
fabric_api_version=0.73.2+1.19.3

# Mod properties
mod_version=1.1.0
mod_version=1.1.1
maven_group=dev.lambdaurora
archives_base_name=lovely_snails
modrinth_id=hBVVhStr
curseforge_id=499425

# Dependencies
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
18 changes: 14 additions & 4 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand All @@ -80,10 +80,10 @@ do
esac
done

APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
Expand Down Expand Up @@ -143,12 +143,16 @@ fi
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -205,6 +209,12 @@ set -- \
org.gradle.wrapper.GradleWrapperMain \
"$@"

# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi

# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
Expand Down
Loading

0 comments on commit f9a3a53

Please sign in to comment.