Skip to content

Commit

Permalink
Updated to 1.21.1 (Cobblemon 1.6)
Browse files Browse the repository at this point in the history
Removed Forge
  • Loading branch information
MrLiam2614 committed Jan 7, 2025
1 parent 42e25d9 commit 4e3b754
Show file tree
Hide file tree
Showing 16 changed files with 30 additions and 171 deletions.
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public int run(CommandContext<ServerCommandSource> 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;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -13,14 +13,14 @@
public class RemoveSpeciesWeightBoostCommand extends RemoveBoostCommand {
@Override
protected ArgumentBuilder<ServerCommandSource, ?> 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<ServerCommandSource> 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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public int run(CommandContext<ServerCommandSource> 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;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -21,20 +21,20 @@ public class SpeciesWeightBoostCommand extends BoostCommand {

@Override
protected RequiredArgumentBuilder<ServerCommandSource, Species> 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<ServerCommandSource> 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;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
],
"depends": {
"fabricloader": ">=0.15.10",
"minecraft": "~1.20.1",
"java": ">=17",
"minecraft": "1.21.1",
"java": ">=21",
"fabric-api": "*"
},
"suggests": {
Expand Down
64 changes: 0 additions & 64 deletions forge/build.gradle

This file was deleted.

1 change: 0 additions & 1 deletion forge/gradle.properties

This file was deleted.

This file was deleted.

28 changes: 0 additions & 28 deletions forge/src/main/resources/META-INF/mods.toml

This file was deleted.

Binary file not shown.
7 changes: 0 additions & 7 deletions forge/src/main/resources/pack.mcmeta

This file was deleted.

14 changes: 6 additions & 8 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
cobblemon_version=1.6.0+1.21.1
fabric_kotlin_version=1.11.0+kotlin.2.0.0
1 change: 0 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@ rootProject.name = 'yetanotherchancebooster'

include 'common'
include 'fabric'
include 'forge'

0 comments on commit 4e3b754

Please sign in to comment.