diff --git a/build.gradle b/build.gradle index 7b3fbf6..d7555cb 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,7 @@ plugins { - id 'fabric-loom' version '1.3-SNAPSHOT' + id 'fabric-loom' version '1.9-SNAPSHOT' id 'maven-publish' + id "org.jetbrains.kotlin.jvm" version "2.1.0" } version = project.mod_version @@ -48,6 +49,8 @@ dependencies { include(modImplementation('me.lucko:fabric-permissions-api:0.2-SNAPSHOT')) modImplementation("curse.maven:cobblemon-687131:${property("cobblemon_curse_file_id")}") + + modImplementation("net.fabricmc:fabric-language-kotlin:${property("fabric_kotlin")}") } processResources { @@ -59,7 +62,7 @@ processResources { } tasks.withType(JavaCompile).configureEach { - it.options.release = 17 + it.options.release = 21 } java { @@ -68,8 +71,8 @@ java { // If you remove this line, sources will not be generated. withSourcesJar() - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 + sourceCompatibility = JavaVersion.VERSION_21 + targetCompatibility = JavaVersion.VERSION_21 } jar { diff --git a/gradle.properties b/gradle.properties index decbf2e..775a140 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,9 +4,9 @@ org.gradle.parallel=true # Fabric Properties # check these on https://fabricmc.net/develop -minecraft_version=1.19.2 -yarn_mappings=1.19.2+build.28 -loader_version=0.14.21 +minecraft_version=1.21.1 +yarn_mappings=1.21.1+build.3 +loader_version=0.16.9 # Mod Properties mod_version=1.0.0 @@ -14,6 +14,8 @@ maven_group=unsafedodo.cobblemonexplock archives_base_name=cobblemon-explock # Dependencies -fabric_version=0.76.0+1.19.2 +fabric_version=0.114.0+1.21.1 -cobblemon_curse_file_id=4468330 \ No newline at end of file +cobblemon_curse_file_id=6021010 + +fabric_kotlin=1.13.0+kotlin.2.1.0 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 9f4197d..e2847c8 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.2.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/src/main/java/unsafedodo/cobblemonexplock/command/ExpLockToggleCommand.java b/src/main/java/unsafedodo/cobblemonexplock/command/ExpLockToggleCommand.java index 98a977c..8f01e0d 100644 --- a/src/main/java/unsafedodo/cobblemonexplock/command/ExpLockToggleCommand.java +++ b/src/main/java/unsafedodo/cobblemonexplock/command/ExpLockToggleCommand.java @@ -1,7 +1,6 @@ package unsafedodo.cobblemonexplock.command; import com.cobblemon.mod.common.Cobblemon; -import com.cobblemon.mod.common.api.storage.NoPokemonStoreException; import com.cobblemon.mod.common.api.storage.party.PlayerPartyStore; import com.cobblemon.mod.common.pokemon.Pokemon; import com.mojang.brigadier.CommandDispatcher; @@ -25,20 +24,16 @@ public static void register(CommandDispatcher dispatcher, C } private static int run(CommandContext context) { - try{ - PlayerPartyStore partyStore = Cobblemon.INSTANCE.getStorage().getParty(context.getSource().getPlayer().getUuid()); + PlayerPartyStore partyStore = Cobblemon.INSTANCE.getStorage().getParty(context.getSource().getPlayer()); int slot = (IntegerArgumentType.getInteger(context, "slotNumber")-1); Pokemon pokemon = partyStore.get(slot); if(pokemon != null){ boolean state = ExpData.setExpState((IPokemonDataSaver) pokemon); - context.getSource().sendFeedback(Text.literal("Exp gain state for "+pokemon.getDisplayName().getString()+" changed to "+state).formatted(Formatting.GREEN), false); + context.getSource().sendFeedback(() -> Text.literal("Exp gain state for "+pokemon.getDisplayName().getString()+" changed to "+state).formatted(Formatting.GREEN), false); } else { - context.getSource().sendFeedback(Text.literal("Invalid slot").formatted(Formatting.RED), false); + context.getSource().sendFeedback(() -> Text.literal("Invalid slot").formatted(Formatting.RED), false); return -1; } - } catch (NoPokemonStoreException e){ - e.printStackTrace(); - } return 0; } diff --git a/src/main/java/unsafedodo/cobblemonexplock/mixin/SaveNbtMixin.java b/src/main/java/unsafedodo/cobblemonexplock/mixin/SaveNbtMixin.java index edc598b..c2f8424 100644 --- a/src/main/java/unsafedodo/cobblemonexplock/mixin/SaveNbtMixin.java +++ b/src/main/java/unsafedodo/cobblemonexplock/mixin/SaveNbtMixin.java @@ -2,6 +2,7 @@ import com.cobblemon.mod.common.pokemon.Pokemon; import net.minecraft.nbt.NbtCompound; +import net.minecraft.registry.DynamicRegistryManager; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; @@ -21,7 +22,7 @@ public NbtCompound getPersistentData(){ } @Inject(method = "loadFromNBT", at = @At("TAIL")) - protected void loadFromNbt(NbtCompound nbt, CallbackInfoReturnable cir){ + protected void loadFromNbt(DynamicRegistryManager drm, NbtCompound nbt, CallbackInfoReturnable cir){ if(nbt.contains("explock")){ persistentData = nbt.getCompound("explock"); } @@ -29,7 +30,7 @@ protected void loadFromNbt(NbtCompound nbt, CallbackInfoReturnable cir) @Inject(method = "saveToNBT", at = @At("TAIL")) - protected void saveToNbt(NbtCompound nbt, CallbackInfoReturnable cir){ + protected void saveToNbt(DynamicRegistryManager drm, NbtCompound nbt, CallbackInfoReturnable cir){ if(persistentData != null){ nbt.put("explock", persistentData); } diff --git a/src/main/resources/cobblemon-explock.mixins.json b/src/main/resources/cobblemon-explock.mixins.json index 7b81e1e..13702be 100644 --- a/src/main/resources/cobblemon-explock.mixins.json +++ b/src/main/resources/cobblemon-explock.mixins.json @@ -1,7 +1,7 @@ { "required": true, "package": "unsafedodo.cobblemonexplock.mixin", - "compatibilityLevel": "JAVA_17", + "compatibilityLevel": "JAVA_21", "mixins": [ "ExpGainMixin", "SaveNbtMixin" diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 71d9de6..72ed50b 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -23,9 +23,9 @@ "cobblemon-explock.mixins.json" ], "depends": { - "fabricloader": ">=0.14.18", - "minecraft": "~1.19.2", - "java": ">=17", + "fabricloader": ">=0.16.9", + "minecraft": "~1.21.1", + "java": ">=21", "fabric-api": "*" }, "suggests": {