diff --git a/build.gradle b/build.gradle index 1f2ca0a8..8a5d68ac 100644 --- a/build.gradle +++ b/build.gradle @@ -22,7 +22,7 @@ allprojects { apply plugin: "java" apply plugin: "idea" - java.toolchain.languageVersion = JavaLanguageVersion.of(21) + java.toolchain.languageVersion = JavaLanguageVersion.of(25) tasks.withType(JavaCompile).configureEach { options.encoding = "UTF-8" @@ -30,7 +30,7 @@ allprojects { } dependencies { - implementation("org.jspecify:jspecify:1.0.0") //TODO Use version catalog + implementation(libs.jspecify) compileOnly(libs.lombok) annotationProcessor(libs.lombok) } @@ -106,7 +106,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 +182,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..be8abc40 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 { @@ -36,7 +35,7 @@ tasks { compileJava { options.encoding = "UTF-8" options.isDeprecation = true - options.release.set(21) + options.release.set(25) } } @@ -56,8 +55,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..79d07b66 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 @@ -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..3ea291ef 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", "fabric-lifecycle-events-v1": "*", "fabric-api": ">=0.91", - "java": ">=21" + "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/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..3444d027 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -7,18 +7,18 @@ gson-version = "2.13.2" log4j2-version = "2.25.3" # Minecraft / Loaders -minecraftVersion = "1.21.11" +minecraftVersion = "26.1-snapshot-6" fabric-loader-version = "0.18.4" -fabric-api-version = "0.139.5+" +fabric-api-version = "0.143.2+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.5" 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" @@ -28,7 +28,7 @@ git-version-plugin-version = "4.2.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.properties b/gradle/wrapper/gradle-wrapper.properties index d4081da4..ec2cf4d7 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.0-rc-1-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME