diff --git a/build.gradle b/build.gradle index 6a45dd4..4565b16 100644 --- a/build.gradle +++ b/build.gradle @@ -1,8 +1,8 @@ plugins { - id 'dev.architectury.loom' version '1.6-SNAPSHOT' apply false + id 'dev.architectury.loom' version '1.7-SNAPSHOT' apply false id 'architectury-plugin' version '3.4-SNAPSHOT' id 'com.github.johnrengelman.shadow' version '8.1.1' apply false - id 'org.jetbrains.kotlin.jvm' version '1.8.20' + id 'org.jetbrains.kotlin.jvm' version '2.0.0' } architectury { @@ -47,12 +47,12 @@ subprojects { // 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 } tasks.withType(JavaCompile).configureEach { - it.options.release = 17 + it.options.release = 21 } // Configure Maven publishing. diff --git a/common/src/main/java/com/metacontent/yetanotherchancebooster/command/boost/LabelWeightBoostCommand.java b/common/src/main/java/com/metacontent/yetanotherchancebooster/command/boost/LabelWeightBoostCommand.java index e9bd159..67c6a99 100644 --- a/common/src/main/java/com/metacontent/yetanotherchancebooster/command/boost/LabelWeightBoostCommand.java +++ b/common/src/main/java/com/metacontent/yetanotherchancebooster/command/boost/LabelWeightBoostCommand.java @@ -40,7 +40,7 @@ public int run(CommandContext context) throws CommandSyntax LabelWeightBoost boost = new LabelWeightBoost(amplifier, duration, labels); BoostManagerData.getOrCreate(player).getManager().addBoost(boost); - Events.BOOST_STARTED.emit(new BoostStartedEvent(player, boost, source.getEntityName())); + Events.BOOST_STARTED.emit(new BoostStartedEvent(player, boost, source.getName().getString())); return 1; } diff --git a/common/src/main/java/com/metacontent/yetanotherchancebooster/command/boost/RemoveSpeciesWeightBoostCommand.java b/common/src/main/java/com/metacontent/yetanotherchancebooster/command/boost/RemoveSpeciesWeightBoostCommand.java index 70b9cf3..fc1ea26 100644 --- a/common/src/main/java/com/metacontent/yetanotherchancebooster/command/boost/RemoveSpeciesWeightBoostCommand.java +++ b/common/src/main/java/com/metacontent/yetanotherchancebooster/command/boost/RemoveSpeciesWeightBoostCommand.java @@ -1,6 +1,6 @@ package com.metacontent.yetanotherchancebooster.command.boost; -import com.cobblemon.mod.common.command.argument.PokemonArgumentType; +import com.cobblemon.mod.common.command.argument.SpeciesArgumentType; import com.metacontent.yetanotherchancebooster.store.BoostManagerData; import com.mojang.brigadier.builder.ArgumentBuilder; import com.mojang.brigadier.context.CommandContext; @@ -13,14 +13,14 @@ public class RemoveSpeciesWeightBoostCommand extends RemoveBoostCommand { @Override protected ArgumentBuilder remove() { - return CommandManager.argument(SpeciesWeightBoostCommand.SPECIES, PokemonArgumentType.Companion.pokemon()) + return CommandManager.argument(SpeciesWeightBoostCommand.SPECIES, SpeciesArgumentType.Companion.species()) .executes(this::run); } @Override public int run(CommandContext context) throws CommandSyntaxException { ServerPlayerEntity player = EntityArgumentType.getPlayer(context, PLAYER); - String species = PokemonArgumentType.Companion.getPokemon(context, SpeciesWeightBoostCommand.SPECIES).showdownId(); + String species = SpeciesArgumentType.Companion.getPokemon(context, SpeciesWeightBoostCommand.SPECIES).showdownId(); BoostManagerData.getOrCreate(player).getManager().endWeightBoost(species); return 1; } diff --git a/common/src/main/java/com/metacontent/yetanotherchancebooster/command/boost/ShinyBoostCommand.java b/common/src/main/java/com/metacontent/yetanotherchancebooster/command/boost/ShinyBoostCommand.java index 8847af7..e114eb5 100644 --- a/common/src/main/java/com/metacontent/yetanotherchancebooster/command/boost/ShinyBoostCommand.java +++ b/common/src/main/java/com/metacontent/yetanotherchancebooster/command/boost/ShinyBoostCommand.java @@ -32,7 +32,7 @@ public int run(CommandContext context) throws CommandSyntax BoostManager manager = BoostManagerData.getOrCreate(player).getManager(); manager.addShinyBoost(amplifier, duration); - Events.BOOST_STARTED.emit(new BoostStartedEvent(player, manager.getShinyBoost(), source.getEntityName())); + Events.BOOST_STARTED.emit(new BoostStartedEvent(player, manager.getShinyBoost(), source.getName().getString())); return 1; } diff --git a/common/src/main/java/com/metacontent/yetanotherchancebooster/command/boost/SpeciesWeightBoostCommand.java b/common/src/main/java/com/metacontent/yetanotherchancebooster/command/boost/SpeciesWeightBoostCommand.java index 15b78b8..449baea 100644 --- a/common/src/main/java/com/metacontent/yetanotherchancebooster/command/boost/SpeciesWeightBoostCommand.java +++ b/common/src/main/java/com/metacontent/yetanotherchancebooster/command/boost/SpeciesWeightBoostCommand.java @@ -1,6 +1,6 @@ package com.metacontent.yetanotherchancebooster.command.boost; -import com.cobblemon.mod.common.command.argument.PokemonArgumentType; +import com.cobblemon.mod.common.command.argument.SpeciesArgumentType; import com.cobblemon.mod.common.pokemon.Species; import com.metacontent.yetanotherchancebooster.boost.SpeciesWeightBoost; import com.metacontent.yetanotherchancebooster.event.BoostStartedEvent; @@ -21,20 +21,20 @@ public class SpeciesWeightBoostCommand extends BoostCommand { @Override protected RequiredArgumentBuilder boost() { - return CommandManager.argument(SPECIES, PokemonArgumentType.Companion.pokemon()).executes(this::run); + return CommandManager.argument(SPECIES, SpeciesArgumentType.Companion.species()).executes(this::run); } @Override public int run(CommandContext context) throws CommandSyntaxException { ServerPlayerEntity source = context.getSource().getPlayerOrThrow(); ServerPlayerEntity player = EntityArgumentType.getPlayer(context, PLAYER); - Species species = PokemonArgumentType.Companion.getPokemon(context, SPECIES); + Species species = SpeciesArgumentType.Companion.getPokemon(context, SPECIES); float amplifier = FloatArgumentType.getFloat(context, AMPLIFIER); long duration = LongArgumentType.getLong(context, DURATION); SpeciesWeightBoost boost = new SpeciesWeightBoost(amplifier, duration, species.showdownId()); BoostManagerData.getOrCreate(player).getManager().addBoost(boost); - Events.BOOST_STARTED.emit(new BoostStartedEvent(player, boost, source.getEntityName())); + Events.BOOST_STARTED.emit(new BoostStartedEvent(player, boost, source.getName().getString())); return 1; } diff --git a/common/src/main/java/com/metacontent/yetanotherchancebooster/store/BoostManagerData.java b/common/src/main/java/com/metacontent/yetanotherchancebooster/store/BoostManagerData.java index 7222ab6..b6c7fa5 100644 --- a/common/src/main/java/com/metacontent/yetanotherchancebooster/store/BoostManagerData.java +++ b/common/src/main/java/com/metacontent/yetanotherchancebooster/store/BoostManagerData.java @@ -1,8 +1,9 @@ package com.metacontent.yetanotherchancebooster.store; import com.cobblemon.mod.common.Cobblemon; -import com.cobblemon.mod.common.api.storage.player.PlayerData; +import com.cobblemon.mod.common.api.storage.player.GeneralPlayerData; import com.cobblemon.mod.common.api.storage.player.PlayerDataExtension; +import com.cobblemon.mod.common.api.storage.player.PlayerInstancedDataStoreTypes; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonObject; @@ -18,12 +19,12 @@ public class BoostManagerData implements PlayerDataExtension { private BoostManager manager = new BoostManager(); public static BoostManagerData getOrCreate(ServerPlayerEntity player) { - PlayerData data = Cobblemon.playerData.get(player); + GeneralPlayerData data = Cobblemon.playerDataManager.getGenericData(player); BoostManagerData boostManagerData = (BoostManagerData) data.getExtraData().get(NAME); if (boostManagerData == null) { boostManagerData = new BoostManagerData(); data.getExtraData().put(NAME, boostManagerData); - Cobblemon.playerData.saveSingle(data); + Cobblemon.playerDataManager.saveSingle(data, PlayerInstancedDataStoreTypes.INSTANCE.getGENERAL()); } return boostManagerData; } diff --git a/common/src/main/java/com/metacontent/yetanotherchancebooster/store/PlayerDataUtil.java b/common/src/main/java/com/metacontent/yetanotherchancebooster/store/PlayerDataUtil.java index 1f62b94..0ad4bd9 100644 --- a/common/src/main/java/com/metacontent/yetanotherchancebooster/store/PlayerDataUtil.java +++ b/common/src/main/java/com/metacontent/yetanotherchancebooster/store/PlayerDataUtil.java @@ -1,14 +1,15 @@ package com.metacontent.yetanotherchancebooster.store; import com.cobblemon.mod.common.Cobblemon; -import com.cobblemon.mod.common.api.storage.player.PlayerData; +import com.cobblemon.mod.common.api.storage.player.GeneralPlayerData; +import com.cobblemon.mod.common.api.storage.player.PlayerInstancedDataStoreTypes; import com.metacontent.yetanotherchancebooster.YetAnotherChanceBooster; import net.minecraft.server.network.ServerPlayerEntity; public class PlayerDataUtil { public static void save(ServerPlayerEntity player) { - PlayerData data = Cobblemon.playerData.get(player); - Cobblemon.playerData.saveSingle(data); + GeneralPlayerData data = Cobblemon.playerDataManager.getGenericData(player); + Cobblemon.playerDataManager.saveSingle(data, PlayerInstancedDataStoreTypes.INSTANCE.getGENERAL()); } public static void onDisconnect(ServerPlayerEntity player) { diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json index 0531819..5538b46 100644 --- a/fabric/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -27,8 +27,8 @@ ], "depends": { "fabricloader": ">=0.15.10", - "minecraft": "~1.20.1", - "java": ">=17", + "minecraft": "1.21.1", + "java": ">=21", "fabric-api": "*" }, "suggests": { diff --git a/forge/build.gradle b/forge/build.gradle deleted file mode 100644 index 99a3430..0000000 --- a/forge/build.gradle +++ /dev/null @@ -1,64 +0,0 @@ -plugins { - id 'com.github.johnrengelman.shadow' -} - -loom { - forge { - mixinConfig "yetanotherchancebooster.mixins.json" - } -} - -architectury { - platformSetupLoomIde() - forge() -} - -configurations { - common { - canBeResolved = true - canBeConsumed = false - } - compileClasspath.extendsFrom common - runtimeClasspath.extendsFrom common - developmentForge.extendsFrom common - - // Files in this configuration will be bundled into your mod using the Shadow plugin. - // Don't use the `shadow` configuration from the plugin itself as it's meant for excluding files. - shadowBundle { - canBeResolved = true - canBeConsumed = false - } -} - -repositories { - maven { - url "https://thedarkcolour.github.io/KotlinForForge/" - } -} - -dependencies { - forge "net.minecraftforge:forge:$rootProject.forge_version" - implementation "thedarkcolour:kotlinforforge:${rootProject.property("kotlinforforge_version")}" - - common(project(path: ':common', configuration: 'namedElements')) { transitive false } - shadowBundle project(path: ':common', configuration: 'transformProductionForge') - - modImplementation "com.cobblemon:forge:${rootProject.property("cobblemon_version")}" -} - -processResources { - inputs.property 'version', project.version - - filesMatching('META-INF/mods.toml') { - expand version: project.version - } -} - -shadowJar { - configurations = [project.configurations.shadowBundle] - archiveClassifier = 'dev-shadow' -} - -remapJar { - input.set shadowJar.archiveFile -} diff --git a/forge/gradle.properties b/forge/gradle.properties deleted file mode 100644 index a58ba14..0000000 --- a/forge/gradle.properties +++ /dev/null @@ -1 +0,0 @@ -loom.platform = forge diff --git a/forge/src/main/java/com/metacontent/yetanotherchancebooster/forge/YetAnotherChangeBoosterForge.java b/forge/src/main/java/com/metacontent/yetanotherchancebooster/forge/YetAnotherChangeBoosterForge.java deleted file mode 100644 index f2be709..0000000 --- a/forge/src/main/java/com/metacontent/yetanotherchancebooster/forge/YetAnotherChangeBoosterForge.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.metacontent.yetanotherchancebooster.forge; - -import com.metacontent.yetanotherchancebooster.command.CommandRegistryProvider; -import com.metacontent.yetanotherchancebooster.command.argument.BoostListArgumentType; -import com.metacontent.yetanotherchancebooster.command.argument.LabelsArgumentType; -import com.mojang.brigadier.arguments.ArgumentType; -import net.minecraft.command.argument.ArgumentTypes; -import net.minecraft.command.argument.serialize.ArgumentSerializer; -import net.minecraft.command.argument.serialize.ConstantArgumentSerializer; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.util.Identifier; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.RegisterCommandsEvent; -import net.minecraftforge.fml.common.Mod; - -import com.metacontent.yetanotherchancebooster.YetAnotherChanceBooster; -import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; -import net.minecraftforge.registries.DeferredRegister; - -@Mod(YetAnotherChanceBooster.MOD_ID) -public final class YetAnotherChangeBoosterForge { -// private final DeferredRegister> argumentTypes = DeferredRegister.create(RegistryKeys.COMMAND_ARGUMENT_TYPE, -// YetAnotherChanceBooster.MOD_ID); - - public YetAnotherChangeBoosterForge() { -// registerArgument(new Identifier(YetAnotherChanceBooster.MOD_ID, "boost_list"), BoostListArgumentType.class, ConstantArgumentSerializer.of(BoostListArgumentType::boostList)); -// registerArgument(new Identifier(YetAnotherChanceBooster.MOD_ID, "labels"), LabelsArgumentType.class, ConstantArgumentSerializer.of(LabelsArgumentType::labels)); -// argumentTypes.register(FMLJavaModLoadingContext.get().getModEventBus()); - YetAnotherChanceBooster.init(); - MinecraftForge.EVENT_BUS.addListener(this::registerCommands); - } - - public void registerCommands(RegisterCommandsEvent event) { - CommandRegistryProvider.registerCommands(command -> command.register(event.getDispatcher())); - } - -// public , T extends ArgumentSerializer.ArgumentTypeProperties> void registerArgument(Identifier id, Class aClass, ArgumentSerializer serializer) { -// argumentTypes.register(id.getPath(), () -> ArgumentTypes.registerByClass(aClass, serializer)); -// } -} diff --git a/forge/src/main/resources/META-INF/mods.toml b/forge/src/main/resources/META-INF/mods.toml deleted file mode 100644 index a177d68..0000000 --- a/forge/src/main/resources/META-INF/mods.toml +++ /dev/null @@ -1,28 +0,0 @@ -modLoader = "javafml" -loaderVersion = "[47,)" -#issueTrackerURL = "" -license = "MPL-2.0" - -[[mods]] -modId = "yetanotherchancebooster" -version = "${version}" -displayName = "YetAnotherChanceBooster" -authors = "gatekeep06" -description = ''' -Server-side side-mod for Cobblemon, that allows you to boost spawn chances -''' -logoFile = "/assets/yetanotherchancebooster/icon.png" - -[[dependencies.yetanotherchancebooster]] -modId = "forge" -mandatory = true -versionRange = "[47,)" -ordering = "NONE" -side = "BOTH" - -[[dependencies.yetanotherchancebooster]] -modId = "minecraft" -mandatory = true -versionRange = "[1.20.1,)" -ordering = "NONE" -side = "BOTH" diff --git a/forge/src/main/resources/assets/yetanotherchancebooster/icon.png b/forge/src/main/resources/assets/yetanotherchancebooster/icon.png deleted file mode 100644 index 809a5d9..0000000 Binary files a/forge/src/main/resources/assets/yetanotherchancebooster/icon.png and /dev/null differ diff --git a/forge/src/main/resources/pack.mcmeta b/forge/src/main/resources/pack.mcmeta deleted file mode 100644 index 6853e23..0000000 --- a/forge/src/main/resources/pack.mcmeta +++ /dev/null @@ -1,7 +0,0 @@ -{ - "pack": { - "description": "YetAnotherChanceBooster", - "forge:server_data_pack_format": 15, - "pack_format": 15 - } -} diff --git a/gradle.properties b/gradle.properties index fc0d6fb..e81d181 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,20 +3,18 @@ org.gradle.jvmargs=-Xmx4G org.gradle.parallel=true # Mod properties -mod_version = 1.0.1 +mod_version=1.1.0 maven_group = com.metacontent.yetanotherchancebooster archives_name = yetanotherchancebooster enabled_platforms = fabric,forge # Minecraft properties -minecraft_version = 1.20.1 -yarn_mappings = 1.20.1+build.1 +minecraft_version=1.21.1 +yarn_mappings=1.21.1+build.3 # Dependencies -fabric_loader_version = 0.15.10 +fabric_loader_version=0.16.9 fabric_api_version = 0.92.2+1.20.1 forge_version = 1.20.1-47.3.3 - -cobblemon_version=1.5.2+1.20.1 -kotlinforforge_version=4.11.0 -fabric_kotlin_version=1.10.9+kotlin.1.9.0 \ No newline at end of file +cobblemon_version=1.6.0+1.21.1 +fabric_kotlin_version=1.11.0+kotlin.2.0.0 \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index dab4252..926234b 100644 --- a/settings.gradle +++ b/settings.gradle @@ -11,4 +11,3 @@ rootProject.name = 'yetanotherchancebooster' include 'common' include 'fabric' -include 'forge'