diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..d11e99a --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,31 @@ +name: build +on: + push: + # ignores tags + branches: + - "**" + pull_request: + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: checkout repository + uses: actions/checkout@v7 + - name: setup java + uses: actions/setup-java@v5 + with: + distribution: "temurin" + java-version: 25 + - name: setup gradle + uses: gradle/actions/setup-gradle@v6 + with: + cache-read-only: false + cache-provider: basic + - name: build + run: ./gradlew build + - name: upload artifacts + uses: actions/upload-artifact@v7 + with: + path: build/libs/ diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index 41b59fd..0000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,53 +0,0 @@ -name: "publish" - -on: - push: - branches: - - "main" - paths: - - src/** - - build.gradle - - gradle.properties - - settings.gradle - workflow_dispatch: - -env: - RELEASE_TITLE: "antigone - build ${{github.run_number}}" - RELEASE_NUMBER: "${{github.run_number}}" - RELEASE_FILE: "build/libs/*${{github.run_number}}.0.0.jar" - -jobs: - publish: - runs-on: "ubuntu-latest" - steps: - - name: Checkout sources - uses: actions/checkout@v2 - - name: Set up JDK 17 - uses: actions/setup-java@v3.6.0 - with: - distribution: 'adopt' - java-version: '17' - java-package: jdk - architecture: x64 - - name: Build artifacts - run: ./gradlew build - - name: Publish tagged version - uses: "marvinpinto/action-automatic-releases@latest" - with: - automatic_release_tag: "v${{ env.RELEASE_NUMBER }}" - repo_token: "${{ secrets.GITHUB_TOKEN }}" - prerelease: false - title: ${{ env.RELEASE_TITLE }} - files: | - LICENSE* - ${{ env.RELEASE_FILE }} - - name: Publish latest - uses: "marvinpinto/action-automatic-releases@latest" - with: - automatic_release_tag: "latest" - repo_token: "${{ secrets.GITHUB_TOKEN }}" - prerelease: false - title: ${{ env.RELEASE_TITLE }} - files: | - LICENSE* - ${{ env.RELEASE_FILE }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 53cbbec..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: "test" - -on: - pull_request: - branches: - - "main" - workflow_dispatch: - -jobs: - test: - runs-on: "ubuntu-latest" - steps: - - name: Checkout sources - uses: actions/checkout@v2 - - name: Set up JDK 17 - uses: actions/setup-java@v1 - with: - java-version: 17 - - name: Build artifacts - run: ./gradlew build diff --git a/build.gradle b/build.gradle index 1fef728..57c9d16 100644 --- a/build.gradle +++ b/build.gradle @@ -1,100 +1,75 @@ plugins { - id 'fabric-loom' version '1.3-SNAPSHOT' - id 'maven-publish' - id 'org.ajoberstar.grgit' version '4.1.0' + alias libs.plugins.fabric.loom + id "maven-publish" } -def getVersionMetadata() { - // CI builds version numbers - def build_id = System.getenv("RELEASE_NUMBER") - if (build_id != null) { - return build_id + ".0.0" - } - - // Development builds - if (grgit == null) { - return "dev" - } - - // Named development builds - def id = grgit.head().abbreviatedId - if (!grgit.status().clean) { - id += "-dirty" - } +version = "$mod_version+$target_version" +group = maven_group - return "rev.${id}" +base { + archivesName = archives_name } -archivesBaseName = "${project.mod_id}-${project.minecraft_version}" -version = "${getVersionMetadata()}" -group = project.maven_group - repositories { - // 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. - // See https://docs.gradle.org/current/userguide/declaring_repositories.html - // for more information about repositories. + maven { url "https://jitpack.io" } +} + +loom { + decompilers { + vineflower { + options.putAll(["mark-corresponding-synthetics": "1", "indent-string": " "]) + } + } + mixin { + useLegacyMixinAp = false + } + runs { + client { + client() + getJvmArguments().addAll( + "-Dorg.lwjgl.glfw.libname=/home/justin/download/libglfw-x86_64.so", + "-javaagent:/home/justin/.cache/gradle/caches/modules-2/files-2.1/net.fabricmc/sponge-mixin/0.17.5+mixin.0.8.7/cef8519a91129d0c21fa03bb9378f0e8ca810e5/sponge-mixin-0.17.5+mixin.0.8.7.jar" + ) + getEnvironmentVars().put("__GL_THREADED_OPTIMIZATIONS", "0") + } + } } dependencies { - // To change the versions see the gradle.properties file - minecraft "com.mojang:minecraft:${project.minecraft_version}" - mappings "net.fabricmc:yarn:${project.yarn_mappings}" - modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" + minecraft libs.minecraft + mappings variantOf(libs.yarn.mappings) { classifier "v2" } + modImplementation libs.fabric.loader } processResources { - inputs.property "mod_id", project.mod_id - inputs.property "version", project.version - inputs.property "minecraft_version", project.minecraft_version - filteringCharset "UTF-8" + def tokens = [ + version: project.version, + minecraft_version: project.target_version + ] + inputs.properties tokens filesMatching("fabric.mod.json") { - expand "mod_id": project.mod_id, - "version": project.version, - "minecraft_version": project.minecraft_version + expand tokens } } -def targetJavaVersion = 8 tasks.withType(JavaCompile).configureEach { - // ensure that the encoding is set to UTF-8, no matter what the system default is - // this fixes some edge cases with special characters not displaying correctly - // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html - // If Javadoc is generated, this must be specified in that task too. it.options.encoding = "UTF-8" - if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) { - it.options.release = targetJavaVersion - } + it.options.release.set(8) } java { - def javaVersion = JavaVersion.toVersion(targetJavaVersion) - if (JavaVersion.current() < javaVersion) { - toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion) - } + sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_8 + withSourcesJar() } jar { - from("LICENSE") { - rename { "${it}_${archivesBaseName}"} - } + from "LICENSE" } -// configure the maven publication publishing { - publications { - mavenJava(MavenPublication) { - from components.java - } - } - - // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. - repositories { - // Add repositories to publish to here. - // Notice: This block does NOT have the same function as the block in the top level. - // The repositories here will be used for publishing your artifact, not for - // retrieving dependencies. + publications.create("mavenJava", MavenPublication) { + from components.java } + repositories {} } diff --git a/gradle.properties b/gradle.properties index 1c1df79..ad31937 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,14 +1,9 @@ -# Done to increase the memory available to gradle. -org.gradle.jvmargs=-Xmx1G +org.gradle.jvmargs = -Xmx2G +org.gradle.parallel = true +org.gradle.configuration-cache=true -# Fabric Properties - # check these on https://modmuss50.me/fabric.html - minecraft_version=1.16.1 - yarn_mappings=1.16.1+build.21 - loader_version=0.14.22 - -# Mod Properties - mod_version = 1.2-SNAPSHOT - maven_group = me.char321 - mod_id = antigone +mod_version = 2.0.0 +target_version = 1.16.1 +archives_name = antigone +maven_group = me.char321 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..a23afe5 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,13 @@ +[versions] +minecraft = "1.16.1" +yarn_mappings = "1.16.1-build.28" +fabric_loader = "0.20.1" +loom = "1.19-SNAPSHOT" + +[libraries] +minecraft = { module = "com.mojang:minecraft", version.ref = "minecraft" } +yarn_mappings = { module = "dev.tildejustin:yarn", version.ref = "yarn_mappings" } +fabric_loader = { module = "net.fabricmc:fabric-loader", version.ref = "fabric_loader" } + +[plugins] +fabric_loom = { id = "fabric-loom", version.ref = "loom" } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index c1962a7..9fa7f28 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 37aef8d..988da1a 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,9 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.8.2-all.zip networkTimeout=10000 +retries=0 +retryBackOffMs=500 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index aeb74cb..249efbb 100755 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright © 2015-2021 the original authors. +# Copyright © 2015 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,10 +15,12 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # -# Gradle start up script for POSIX generated by Gradle. +# gradlew start up script for POSIX generated by Gradle. # # Important for running: # @@ -27,7 +29,7 @@ # bash, then to run this script, type that shell name before the whole # command line, like: # -# ksh Gradle +# ksh gradlew # # Busybox and similar reduced shells will NOT work, because this script # requires all of these POSIX shell features: @@ -55,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/3d91ce3b8caaf77ad09f381f43615b715b53f72c/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -83,7 +85,8 @@ done # This is normally unused # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -111,7 +114,6 @@ case "$( uname )" in #( NONSTOP* ) nonstop=true ;; esac -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar # Determine the Java command to use to start the JVM. @@ -130,10 +132,13 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. @@ -141,7 +146,7 @@ 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 + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -149,7 +154,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -166,7 +171,6 @@ fi # For Cygwin or MSYS, switch paths to Windows format before running java if "$cygwin" || "$msys" ; then APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) JAVACMD=$( cygpath --unix "$JAVACMD" ) @@ -198,16 +202,15 @@ fi # 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"' -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ "$@" # Stop when "xargs" is not available. diff --git a/gradlew.bat b/gradlew.bat index 93e3f59..3185a43 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -13,16 +13,45 @@ @rem See the License for the specific language governing permissions and @rem limitations under the License. @rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem @if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem -@rem Gradle startup script for Windows +@rem gradlew startup script for Windows @rem @rem ########################################################################## -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal +@rem Set local scope for the variables, and ensure extensions are enabled +setlocal EnableExtensions + +@rem Catch executions from older scripts and ensure they exit cleanly. +@rem This can be removed once we can be reasonably confident that few people +@rem will be migrating directly to this new wrapper. +goto afterSafetyNet +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +goto exitWithErrorLevel +:afterSafetyNet set DIRNAME=%~dp0 if "%DIRNAME%"=="" set DIRNAME=. @@ -43,13 +72,14 @@ set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +1>&2 echo. +1>&2 echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +1>&2 echo. +1>&2 echo Please set the JAVA_HOME variable in your environment to match the +1>&2 echo location of your Java installation. -goto fail +"%COMSPEC%" /c exit 1 +goto exitWithErrorLevel :findJavaFromJavaHome set JAVA_HOME=%JAVA_HOME:"=% @@ -57,36 +87,26 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +1>&2 echo. +1>&2 echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +1>&2 echo. +1>&2 echo Please set the JAVA_HOME variable in your environment to match the +1>&2 echo location of your Java installation. -goto fail +"%COMSPEC%" /c exit 1 +goto exitWithErrorLevel :execute @rem Setup the command line -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if %ERRORLEVEL% equ 0 goto mainEnd -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -set EXIT_CODE=%ERRORLEVEL% -if %EXIT_CODE% equ 0 set EXIT_CODE=1 -if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% -exit /b %EXIT_CODE% -:mainEnd -if "%OS%"=="Windows_NT" endlocal +@rem Execute gradlew +@rem endlocal doesn't take effect until after the line is parsed and variables are expanded +@rem which allows us to clear the local environment before executing the java command +endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel & goto exitWithErrorLevel -:omega +@rem This label must not be changed. We rely on old scripts being able to jump to this point. +:exitWithErrorLevel +@rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts +"%COMSPEC%" /c exit %ERRORLEVEL% diff --git a/settings.gradle b/settings.gradle index f91a4fe..f67ffc6 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,9 +1,6 @@ pluginManagement { repositories { - maven { - name = 'Fabric' - url = 'https://maven.fabricmc.net/' - } + maven { url "https://maven.fabricmc.net" } gradlePluginPortal() } -} +} \ No newline at end of file diff --git a/src/main/java/me/char321/antigone/mixin/CatEntityMixin.java b/src/main/java/me/char321/antigone/mixin/CatEntityMixin.java new file mode 100644 index 0000000..d9e4661 --- /dev/null +++ b/src/main/java/me/char321/antigone/mixin/CatEntityMixin.java @@ -0,0 +1,20 @@ +package me.char321.antigone.mixin; + +import com.llamalad7.mixinextras.injector.ModifyExpressionValue; +import com.llamalad7.mixinextras.sugar.Local; +import net.minecraft.entity.passive.CatEntity; +import net.minecraft.world.*; +import net.minecraft.world.gen.StructureAccessor; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; + +@Mixin(CatEntity.class) +public abstract class CatEntityMixin { + @ModifyExpressionValue( + method = "initialize", + at = @At(value = "INVOKE", target = "Lnet/minecraft/server/world/ServerWorld;getStructureAccessor()Lnet/minecraft/world/gen/StructureAccessor;") + ) + private StructureAccessor wrapOffThreadGetChunk(StructureAccessor original, @Local(argsOnly = true) WorldAccess world) { + return original.forRegion((ChunkRegion) world); + } +} diff --git a/src/main/resources/antigone.mixins.json b/src/main/resources/antigone.mixins.json index 0006ec8..2b64d8a 100644 --- a/src/main/resources/antigone.mixins.json +++ b/src/main/resources/antigone.mixins.json @@ -4,9 +4,14 @@ "package": "me.char321.antigone.mixin", "compatibilityLevel": "JAVA_8", "mixins": [ + "CatEntityMixin", "StriderEntityMixin" ], "injectors": { "defaultRequire": 1 + }, + "overwrites": { + "conformVisibility": true, + "requireAnnotations": true } } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index c5d91fa..9583905 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -4,9 +4,17 @@ "version": "${version}", "name": "antigone", "description": "", - "authors": [], + "authors": [ + "char321" + ], + "contributors": [ + "RedLime", + "tildejustin" + ], "contact": { - "repo": "https://github.com/qwertyuioplkjhgfd/antigone" + "homepage": "https://github.com/Minecraft-Java-Edition-Speedrunning/antigone", + "sources": "https://github.com/Minecraft-Java-Edition-Speedrunning/antigone", + "issues": "https://github.com/Minecraft-Java-Edition-Speedrunning/antigone/issues" }, "license": "MIT", "environment": "*", @@ -14,6 +22,7 @@ "antigone.mixins.json" ], "depends": { - "minecraft": "${minecraft_version}" + "minecraft": "${minecraft_version}", + "fabricloader": ">=0.15" } }