diff --git a/build.gradle b/build.gradle index 1f2ca0a8..59aad78b 100644 --- a/build.gradle +++ b/build.gradle @@ -22,15 +22,22 @@ allprojects { apply plugin: "java" apply plugin: "idea" - java.toolchain.languageVersion = JavaLanguageVersion.of(21) - tasks.withType(JavaCompile).configureEach { options.encoding = "UTF-8" options.compilerArgs = ["-Xlint:deprecation"] + options.deprecation = true + options.release.set(25) + + sourceCompatibility = JavaVersion.VERSION_25 + targetCompatibility = JavaVersion.VERSION_25 + + javaToolchains { + version = JavaLanguageVersion.of(25) + } } dependencies { - implementation("org.jspecify:jspecify:1.0.0") //TODO Use version catalog + implementation(libs.jspecify) compileOnly(libs.lombok) annotationProcessor(libs.lombok) } @@ -106,7 +113,7 @@ def isAlpha = false if (version.contains("b")) { relType = "beta" } -if (version.contains("a") || version.contains("dev")) { +if (version.contains("a") || version.contains("dev") || version.contains("snapshot")) { relType = "alpha" isAlpha = true } @@ -182,7 +189,7 @@ curseforge { addGameVersion(minecraftVersion) } - addGameVersion("Java 21") + addGameVersion("Java 25") if (project.includeFabric.toBoolean()) { addGameVersion("Fabric") } diff --git a/fabric/build.gradle.kts b/fabric/build.gradle.kts index 3fee2222..9fa85580 100644 --- a/fabric/build.gradle.kts +++ b/fabric/build.gradle.kts @@ -4,22 +4,21 @@ plugins { dependencies { minecraft(libs.minecraft) - mappings(loom.officialMojangMappings()) - modImplementation(libs.bundles.fabric) { + implementation(libs.bundles.fabric) { exclude(module = "fabric-api-deprecated") } implementation(project(":common")) - modImplementation(libs.modmenu) { + api(libs.modmenu) { exclude(group = "net.fabricmc.fabric-api") } - modImplementation(libs.clothConfigFabric) { - exclude(group = "net.fabricmc.fabric-api") - exclude(module = "modmenu") - } +// modImplementation(libs.clothConfigFabric) { +// exclude(group = "net.fabricmc.fabric-api") +// exclude(module = "modmenu") +// } } tasks { @@ -32,12 +31,6 @@ tasks { expand(project.properties) } } - - compileJava { - options.encoding = "UTF-8" - options.isDeprecation = true - options.release.set(21) - } } loom { @@ -46,7 +39,7 @@ loom { splitEnvironmentSourceSets() mods { - create("fallingtree") { + register("fallingtree") { sourceSet(sourceSets["main"]) sourceSet(sourceSets["client"]) } @@ -56,8 +49,6 @@ loom { defaultRefmapName.set("fabric.${modId}.refmap.json") } - accessWidenerPath.set(file("src/main/resources/fallingtree.accesswidener")) - runs { create("FTFabricClient") { client() diff --git a/fabric/src/client/java/fr/rakambda/fallingtree/fabric/client/ModMenuImpl.java b/fabric/src/client/java/fr/rakambda/fallingtree/fabric/client/ModMenuImpl.java index 2e32b1e8..5a8e0ce8 100644 --- a/fabric/src/client/java/fr/rakambda/fallingtree/fabric/client/ModMenuImpl.java +++ b/fabric/src/client/java/fr/rakambda/fallingtree/fabric/client/ModMenuImpl.java @@ -2,35 +2,30 @@ import com.terraformersmc.modmenu.api.ConfigScreenFactory; import com.terraformersmc.modmenu.api.ModMenuApi; -import fr.rakambda.fallingtree.common.FallingTreeCommon; -import fr.rakambda.fallingtree.fabric.FallingTree; -import fr.rakambda.fallingtree.fabric.client.cloth.ClothConfigHook; -import net.fabricmc.loader.api.FabricLoader; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import java.lang.reflect.InvocationTargetException; public class ModMenuImpl implements ModMenuApi{ private static final Logger log = LogManager.getLogger(ModMenuImpl.class); @Override public ConfigScreenFactory getModConfigScreenFactory(){ - if(FabricLoader.getInstance().isModLoaded("cloth-config")){ - return (screen) -> { - try{ - return Class.forName("fr.rakambda.fallingtree.fabric.client.cloth.ClothConfigHook") - .asSubclass(ClothConfigHook.class) - .getConstructor(FallingTreeCommon.class) - .newInstance(FallingTree.getMod()) - .load() - .apply(screen); - } - catch(ClassNotFoundException | IllegalAccessException | InstantiationException | NoSuchMethodException | InvocationTargetException e){ - log.error("Failed to hook into ClothConfig", e); - } - return null; - }; - } + // if(FabricLoader.getInstance().isModLoaded("cloth-config")){ + // return (screen) -> { + // try{ + // return Class.forName("fr.rakambda.fallingtree.fabric.client.cloth.ClothConfigHook") + // .asSubclass(ClothConfigHook.class) + // .getConstructor(FallingTreeCommon.class) + // .newInstance(FallingTree.getMod()) + // .load() + // .apply(screen); + // } + // catch(ClassNotFoundException | IllegalAccessException | InstantiationException | NoSuchMethodException | InvocationTargetException e){ + // log.error("Failed to hook into ClothConfig", e); + // } + // return null; + // }; + // } return screen -> null; } } diff --git a/fabric/src/client/java/fr/rakambda/fallingtree/fabric/client/cloth/ClothConfigHook.java b/fabric/src/client/java/fr/rakambda/fallingtree/fabric/client/cloth/ClothConfigHook.java.disabled similarity index 100% rename from fabric/src/client/java/fr/rakambda/fallingtree/fabric/client/cloth/ClothConfigHook.java rename to fabric/src/client/java/fr/rakambda/fallingtree/fabric/client/cloth/ClothConfigHook.java.disabled diff --git a/fabric/src/main/java/fr/rakambda/fallingtree/fabric/common/FallingTreeCommonsImpl.java b/fabric/src/main/java/fr/rakambda/fallingtree/fabric/common/FallingTreeCommonsImpl.java index febe2957..8645da5c 100644 --- a/fabric/src/main/java/fr/rakambda/fallingtree/fabric/common/FallingTreeCommonsImpl.java +++ b/fabric/src/main/java/fr/rakambda/fallingtree/fabric/common/FallingTreeCommonsImpl.java @@ -26,8 +26,8 @@ import fr.rakambda.fallingtree.fabric.network.FabricServerPacketHandler; import lombok.Getter; import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback; +import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLevelEvents; import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents; -import net.fabricmc.fabric.api.event.lifecycle.v1.ServerWorldEvents; import net.fabricmc.fabric.api.event.player.PlayerBlockBreakEvents; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -263,7 +263,7 @@ public void register(){ getServerPacketHandler().registerServer(); ServerTickEvents.END_SERVER_TICK.register(new LeafBreakingListener(this)); - ServerWorldEvents.UNLOAD.register(new LeafBreakingListener(this)); + ServerLevelEvents.UNLOAD.register(new LeafBreakingListener(this)); PlayerBlockBreakEvents.BEFORE.register(new BlockBreakListener(this)); PlayerBlockBreakEvents.AFTER.register(new BlockBreakListener(this)); diff --git a/fabric/src/main/java/fr/rakambda/fallingtree/fabric/common/wrapper/ChunkPosWrapper.java b/fabric/src/main/java/fr/rakambda/fallingtree/fabric/common/wrapper/ChunkPosWrapper.java index f536671a..ce05f641 100644 --- a/fabric/src/main/java/fr/rakambda/fallingtree/fabric/common/wrapper/ChunkPosWrapper.java +++ b/fabric/src/main/java/fr/rakambda/fallingtree/fabric/common/wrapper/ChunkPosWrapper.java @@ -16,11 +16,11 @@ public class ChunkPosWrapper implements IChunkPos{ @Override public int getX(){ - return raw.x; + return raw.x(); } @Override public int getZ(){ - return raw.z; + return raw.z(); } } diff --git a/fabric/src/main/java/fr/rakambda/fallingtree/fabric/common/wrapper/PlayerWrapper.java b/fabric/src/main/java/fr/rakambda/fallingtree/fabric/common/wrapper/PlayerWrapper.java index ce8868c7..7c320cf9 100644 --- a/fabric/src/main/java/fr/rakambda/fallingtree/fabric/common/wrapper/PlayerWrapper.java +++ b/fabric/src/main/java/fr/rakambda/fallingtree/fabric/common/wrapper/PlayerWrapper.java @@ -36,7 +36,7 @@ public void sendMessage(@NonNull IComponent component, @NonNull NotificationMode } } else{ - raw.displayClientMessage(text, true); + raw.sendOverlayMessage(text); } } @@ -76,7 +76,7 @@ public ILevel getLevel(){ @Override @NonNull public Set getTags(){ - return raw.getTags(); + return raw.entityTags(); } @Override diff --git a/fabric/src/main/java/fr/rakambda/fallingtree/fabric/event/LeafBreakingListener.java b/fabric/src/main/java/fr/rakambda/fallingtree/fabric/event/LeafBreakingListener.java index 8378ffd0..ccc65bd3 100644 --- a/fabric/src/main/java/fr/rakambda/fallingtree/fabric/event/LeafBreakingListener.java +++ b/fabric/src/main/java/fr/rakambda/fallingtree/fabric/event/LeafBreakingListener.java @@ -3,24 +3,24 @@ import fr.rakambda.fallingtree.common.FallingTreeCommon; import fr.rakambda.fallingtree.fabric.common.wrapper.ServerLevelWrapper; import lombok.RequiredArgsConstructor; +import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLevelEvents; import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents; -import net.fabricmc.fabric.api.event.lifecycle.v1.ServerWorldEvents; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerLevel; import org.jspecify.annotations.NonNull; @RequiredArgsConstructor -public class LeafBreakingListener implements ServerTickEvents.EndTick, ServerWorldEvents.Unload{ +public class LeafBreakingListener implements ServerTickEvents.EndTick, ServerLevelEvents.Unload{ @NonNull private final FallingTreeCommon mod; @Override - public void onEndTick(MinecraftServer minecraftServer){ + public void onEndTick(@NonNull MinecraftServer minecraftServer){ mod.getLeafBreakingHandler().onServerTick(); } @Override - public void onWorldUnload(MinecraftServer server, ServerLevel world){ + public void onLevelUnload(@NonNull MinecraftServer server, @NonNull ServerLevel world){ mod.getLeafBreakingHandler().onWorldUnload(new ServerLevelWrapper(world)); } } diff --git a/fabric/src/main/java/fr/rakambda/fallingtree/fabric/network/FabricServerPacketHandler.java b/fabric/src/main/java/fr/rakambda/fallingtree/fabric/network/FabricServerPacketHandler.java index 44a7880b..d9206be3 100644 --- a/fabric/src/main/java/fr/rakambda/fallingtree/fabric/network/FabricServerPacketHandler.java +++ b/fabric/src/main/java/fr/rakambda/fallingtree/fabric/network/FabricServerPacketHandler.java @@ -14,7 +14,7 @@ public class FabricServerPacketHandler implements ServerPacketHandler{ @Override public void registerServer(){ - PayloadTypeRegistry.configurationS2C().register(FallingTreeConfigPacket.TYPE, FallingTreeConfigPacket.CODEC); + PayloadTypeRegistry.clientboundConfiguration().register(FallingTreeConfigPacket.TYPE, FallingTreeConfigPacket.CODEC); ServerConfigurationConnectionEvents.CONFIGURE.register(((handler, server) -> { var packet = ConfigurationPacket.get(server.isDedicatedServer(), mod.getConfiguration()); ServerConfigurationNetworking.send(handler, new FallingTreeConfigPacket(packet)); diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json index d78c2c6d..7cbc7d94 100644 --- a/fabric/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -30,12 +30,11 @@ "mixins": [ "fallingtree.mixins.json" ], - "accessWidener" : "fallingtree.accesswidener", "depends": { - "fabricloader": ">=0.18.2", + "fabricloader": ">=0.18.4", "fabric-lifecycle-events-v1": "*", - "fabric-api": ">=0.91", - "java": ">=21" + "fabric-api": ">=0.144", + "java": ">=25" }, "suggests": { "modmenu": "*", diff --git a/fabric/src/main/resources/fallingtree.accesswidener b/fabric/src/main/resources/fallingtree.accesswidener deleted file mode 100644 index 3ea98fb1..00000000 --- a/fabric/src/main/resources/fallingtree.accesswidener +++ /dev/null @@ -1,2 +0,0 @@ -accessWidener v1 named -accessible field net/minecraft/world/entity/item/FallingBlockEntity blockState Lnet/minecraft/world/level/block/state/BlockState; \ No newline at end of file diff --git a/fabric/src/main/resources/fallingtree.mixins.json b/fabric/src/main/resources/fallingtree.mixins.json index 6c3db008..9c3af798 100644 --- a/fabric/src/main/resources/fallingtree.mixins.json +++ b/fabric/src/main/resources/fallingtree.mixins.json @@ -1,15 +1,17 @@ { - "required": true, - "minVersion": "0.8", - "package": "fr.rakambda.fallingtree.fabric.mixin", - "compatibilityLevel": "JAVA_21", - "mixins": [ + "required" : true, + "package" : "fr.rakambda.fallingtree.fabric.mixin", + "compatibilityLevel" : "JAVA_25", + "mixins" : [ "AbstractBlockMixin", "LevelMixin" ], - "client": [], - "server": [], - "injectors": { - "defaultRequire": 1 + "client" : [], + "server" : [], + "injectors" : { + "defaultRequire" : 1 + }, + "overwrites" : { + "requireAnnotations" : true } } diff --git a/gradle.properties b/gradle.properties index b1068606..bcef7537 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,8 +5,8 @@ org.gradle.daemon=false modId=fallingtree modName=FallingTree includeFabric=true -includeForge=true -includeNeoForge=true +includeForge=false +includeNeoForge=false # Repository repoUser=Rakambda repoName=FallingTree diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 6ddac84f..534f1aff 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,34 +1,34 @@ # Fabric https://modmuss50.me/fabric.html [versions] -lombok-version = "1.18.42" +lombok-version = "1.18.44" jspecify-version = "1.0.0" gson-version = "2.13.2" log4j2-version = "2.25.3" # Minecraft / Loaders -minecraftVersion = "1.21.11" +minecraftVersion = "26.1" fabric-loader-version = "0.18.4" -fabric-api-version = "0.139.5+" +fabric-api-version = "0.144.0+26.1" forge-version = "1.21.11-61.0.7" forgeEventbusValidator-version = "7.0-beta.12" neoforgeVersion = "21.11.0-beta" # Mod dependencies -modmenu-version = "17.0.0-beta.2" +modmenu-version = "18.0.0-alpha.6" clothConfigVersion = "20.0.149" -fabric-loom-version = "1.13-SNAPSHOT" +fabric-loom-version = "1.15-SNAPSHOT" forge-plugin-version = "[6.0.46,6.2)" neoforge-plugin-version = "2.0.140" curse-version = "1.4.0" -modrinth-version = "2.8.10" +modrinth-version = "2.9.0" names-version = "0.53.0" -git-version-plugin-version = "4.2.0" +git-version-plugin-version = "5.0.0" [libraries] lombok = { group = "org.projectlombok", name = "lombok", version.ref = "lombok-version" } -jSpecify = { group = "org.jspecify", name = "jspecify", version.ref = "jspecify-version" } +jspecify = { group = "org.jspecify", name = "jspecify", version.ref = "jspecify-version" } gson = { group = "com.google.code.gson", name = "gson", version.ref = "gson-version" } log4j2 = { group = "org.apache.logging.log4j", name = "log4j-api", version.ref = "log4j2-version" } minecraft = { group = "com.mojang", name = "minecraft", version.ref = "minecraftVersion" } @@ -48,7 +48,7 @@ fabric = ["fabric-loader", "fabric-api"] curse = { id = "com.matthewprenger.cursegradle", version.ref = "curse-version"} modrinth = { id = "com.modrinth.minotaur", version.ref = "modrinth-version"} names = { id = "com.github.ben-manes.versions", version.ref = "names-version" } -loom = { id = "fabric-loom", version.ref = "fabric-loom-version" } +loom = { id = "net.fabricmc.fabric-loom", version.ref = "fabric-loom-version" } forge = { id = "net.minecraftforge.gradle", version.ref = "forge-plugin-version" } neoforge = { id = "net.neoforged.moddev", version.ref = "neoforge-plugin-version" } gitVersion = { id = "com.palantir.git-version", version.ref = "git-version-plugin-version" } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 1b33c55b..61285a65 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 d4081da4..c61a118f 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index 23d15a93..adff685a 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. @@ -114,7 +114,6 @@ case "$( uname )" in #( NONSTOP* ) nonstop=true ;; esac -CLASSPATH="\\\"\\\"" # Determine the Java command to use to start the JVM. @@ -172,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" ) @@ -212,7 +210,6 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ "$@" diff --git a/gradlew.bat b/gradlew.bat index 5eed7ee8..e509b2dd 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -70,11 +70,10 @@ goto fail :execute @rem Setup the command line -set CLASSPATH= @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* :end @rem End local scope for the variables with windows NT shell