diff --git a/build.gradle b/build.gradle index 398b449..02d246a 100755 --- a/build.gradle +++ b/build.gradle @@ -1,15 +1,14 @@ plugins { - id 'fabric-loom' version '0.12-SNAPSHOT' + id 'fabric-loom' version '1.3-SNAPSHOT' id 'maven-publish' } -sourceCompatibility = JavaVersion.VERSION_17 -targetCompatibility = JavaVersion.VERSION_17 - -archivesBaseName = project.archives_base_name version = project.mod_version group = project.maven_group +base { + archivesName = project.archives_base_name +} repositories { maven { url "https://api.modrinth.com/maven" } } @@ -35,13 +34,6 @@ processResources { } 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" - - // Minecraft 1.17 (21w19a) upwards uses Java 16. it.options.release = 17 } @@ -50,11 +42,14 @@ java { // if it is present. // If you remove this line, sources will not be generated. withSourcesJar() + + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } jar { from("LICENSE") { - rename { "${it}_${project.archivesBaseName}"} + rename { "${it}_${project.base.archivesName.get()}"} } } @@ -62,13 +57,7 @@ jar { publishing { publications { mavenJava(MavenPublication) { - // add all the jars that should be included when publishing to maven - artifact(remapJar) { - builtBy remapJar - } - artifact(sourcesJar) { - builtBy remapSourcesJar - } + from components.java } } @@ -79,4 +68,4 @@ publishing { // The repositories here will be used for publishing your artifact, not for // retrieving dependencies. } -} +} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 14b9f9e..2a9aafa 100755 --- a/gradle.properties +++ b/gradle.properties @@ -3,9 +3,9 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these on https://fabricmc.net/use - minecraft_version=1.19 - yarn_mappings=1.19+build.4 - loader_version=0.14.8 + minecraft_version=1.20.1 + yarn_mappings=1.20.1+build.10 + loader_version=0.14.21 # Mod Properties @@ -14,6 +14,5 @@ org.gradle.jvmargs=-Xmx1G archives_base_name = puddles # Dependencies - # currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api - fabric_version=0.56.0+1.19 + fabric_version=0.86.1+1.20.1 midnightlib_version=0.5.2 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar old mode 100755 new mode 100644 index 7454180..033e24c 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 old mode 100755 new mode 100644 index ffed3a2..62f495d --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 1b6c787..fcb6fca 100755 --- a/gradlew +++ b/gradlew @@ -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/. @@ -80,13 +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##*/} - -# 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"' +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -133,22 +130,29 @@ 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. 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 @@ -193,6 +197,10 @@ if "$cygwin" || "$msys" ; then done 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 @@ -205,6 +213,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. diff --git a/gradlew.bat b/gradlew.bat index 107acd3..93e3f59 100755 --- a/gradlew.bat +++ b/gradlew.bat @@ -14,7 +14,7 @@ @rem limitations under the License. @rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +25,8 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute +if %ERRORLEVEL% equ 0 goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +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! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +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 diff --git a/settings.gradle b/settings.gradle old mode 100755 new mode 100644 index 5b60df3..56266b4 --- a/settings.gradle +++ b/settings.gradle @@ -1,10 +1,10 @@ pluginManagement { repositories { - jcenter() maven { name = 'Fabric' url = 'https://maven.fabricmc.net/' } + mavenCentral() gradlePluginPortal() } -} +} \ No newline at end of file diff --git a/src/main/java/eu/midnightdust/puddles/Puddles.java b/src/main/java/eu/midnightdust/puddles/Puddles.java index a8f7e09..2524f1f 100755 --- a/src/main/java/eu/midnightdust/puddles/Puddles.java +++ b/src/main/java/eu/midnightdust/puddles/Puddles.java @@ -3,25 +3,25 @@ package eu.midnightdust.puddles; import eu.midnightdust.puddles.block.PuddleBlock; import eu.midnightdust.puddles.config.PuddlesConfig; import net.fabricmc.api.ModInitializer; -import net.fabricmc.fabric.api.gamerule.v1.GameRuleFactory; -import net.fabricmc.fabric.api.gamerule.v1.GameRuleRegistry; import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.minecraft.block.Block; -import net.minecraft.block.Material; import net.minecraft.fluid.Fluids; import net.minecraft.item.BlockItem; import net.minecraft.item.Item; +import net.minecraft.registry.Registries; +import net.minecraft.registry.Registry; import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; -import net.minecraft.world.GameRules; public class Puddles implements ModInitializer { public static final String MOD_ID = "puddles"; - public static final Block Puddle = new PuddleBlock(Fluids.WATER, FabricBlockSettings.of(Material.WATER)); + private static final String ITEM_NAME = "puddle"; + public static final Block Puddle = new PuddleBlock(Fluids.WATER, FabricBlockSettings.create()); + + @Override public void onInitialize() { PuddlesConfig.init(MOD_ID, PuddlesConfig.class); - Registry.register(Registry.BLOCK, new Identifier(MOD_ID,"puddle"), Puddle); - Registry.register(Registry.ITEM, new Identifier(MOD_ID,"puddle"), new BlockItem(Puddle, new Item.Settings())); + Registry.register(Registries.BLOCK, new Identifier(MOD_ID, ITEM_NAME), Puddle); + Registry.register(Registries.ITEM, new Identifier(MOD_ID, ITEM_NAME), new BlockItem(Puddle, new Item.Settings())); } } diff --git a/src/main/java/eu/midnightdust/puddles/PuddlesClient.java b/src/main/java/eu/midnightdust/puddles/PuddlesClient.java index 775c2e9..0520f3f 100755 --- a/src/main/java/eu/midnightdust/puddles/PuddlesClient.java +++ b/src/main/java/eu/midnightdust/puddles/PuddlesClient.java @@ -6,7 +6,6 @@ import net.fabricmc.fabric.api.client.rendering.v1.ColorProviderRegistry; import net.fabricmc.fabric.impl.client.rendering.ColorProviderRegistryImpl; import net.minecraft.block.Blocks; import net.minecraft.world.biome.Biome; -import net.minecraft.world.biome.BuiltinBiomes; import java.util.Objects; diff --git a/src/main/java/eu/midnightdust/puddles/mixin/MixinServerWorld.java b/src/main/java/eu/midnightdust/puddles/mixin/MixinServerWorld.java index 7344e50..cca32ab 100755 --- a/src/main/java/eu/midnightdust/puddles/mixin/MixinServerWorld.java +++ b/src/main/java/eu/midnightdust/puddles/mixin/MixinServerWorld.java @@ -3,32 +3,31 @@ package eu.midnightdust.puddles.mixin; import eu.midnightdust.puddles.Puddles; import eu.midnightdust.puddles.config.PuddlesConfig; import net.minecraft.block.Blocks; +import net.minecraft.registry.DynamicRegistryManager; +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.entry.RegistryEntry; import net.minecraft.server.world.ServerWorld; import net.minecraft.state.property.Properties; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.ChunkPos; import net.minecraft.util.math.Direction; import net.minecraft.util.profiler.Profiler; -import net.minecraft.util.registry.RegistryEntry; -import net.minecraft.util.registry.RegistryKey; import net.minecraft.world.*; import net.minecraft.world.chunk.WorldChunk; import net.minecraft.world.dimension.DimensionType; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import java.util.function.Supplier; -@SuppressWarnings("deprecation") @Mixin(ServerWorld.class) public abstract class MixinServerWorld extends World { - protected MixinServerWorld(MutableWorldProperties properties, RegistryKey registryRef, RegistryEntry dimension, Supplier profiler, boolean isClient, boolean debugWorld, long seed, int maxChainedNeighborUpdates) { - super(properties, registryRef, dimension, profiler, isClient, debugWorld, seed, maxChainedNeighborUpdates); + protected MixinServerWorld(MutableWorldProperties properties, RegistryKey registryRef, DynamicRegistryManager registryManager, RegistryEntry dimensionEntry, Supplier profiler, boolean isClient, boolean debugWorld, long biomeAccess, int maxChainedNeighborUpdates) { + super(properties, registryRef, registryManager, dimensionEntry, profiler, isClient, debugWorld, biomeAccess, maxChainedNeighborUpdates); } @Inject(at = @At("TAIL"),method = "tickChunk") diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 210b1ef..ab7cc3c 100755 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -7,7 +7,8 @@ "description": "Adds puddles. Compatible with your favorite shaderpacks & mods!", "authors": [ "Motschen", - "TeamMidnightDust" + "TeamMidnightDust", + "AdamW78" ], "contact": { "homepage": "https://www.midnightdust.eu/",