Compare commits

..
Author SHA1 Message Date
Waldleufer fde8a03c5f more cleanup [skip-ci] 2024-06-18 19:31:29 +02:00
Waldleufer df273a0075 cleanup [skip-ci] 2024-06-18 19:25:39 +02:00
Hiroku f6124d7474 Merge branch 'initiate_battle_while_recalling_bugfix' into 'main'
Fixes issue #872

Closes #872

See merge request cable-mc/cobblemon!1072
2024-06-16 08:07:16 +00:00
Notepadccino a0300ccd18 Update CHANGELOG.md 2024-06-16 08:05:22 +00:00
notepadccino 486056d7f0 Fixes issue #872 2024-06-14 16:52:12 +02:00
6 changed files with 12 additions and 143 deletions

No files matched your search

+1
View File
@@ -11,6 +11,7 @@
- Fixed Pokémon losing their Hidden Ability through evolution if the middle stage did not have a Hidden Ability.
- Fixed Crumbling Arch not blending in with the world.
- Fixed Energy Root applying being usable on a fainted Pokemon.
- Fixed Pokémon entity not spawning when starting a battle while recalling said Pokémon
### Additions
- Added extra visuals to early berry growth stages
@@ -123,14 +123,8 @@ import net.minecraft.command.argument.serialize.ConstantArgumentSerializer
import net.minecraft.entity.data.TrackedDataHandlerRegistry
import net.minecraft.item.Items
import net.minecraft.item.NameTagItem
import net.minecraft.loot.LootDataType
import net.minecraft.loot.context.LootContextParameterSet
import net.minecraft.loot.context.LootContextParameters
import net.minecraft.registry.RegistryKey
import net.minecraft.server.world.ServerWorld
import net.minecraft.util.Identifier
import net.minecraft.util.WorldSavePath
import net.minecraft.util.math.Vec3d
import net.minecraft.world.World
import org.apache.logging.log4j.LogManager
import org.apache.logging.log4j.Logger
@@ -270,52 +264,6 @@ object Cobblemon {
event.newFriendship = event.pokemon.friendship + increment.roundToInt()
}
CobblemonEvents.BATTLE_VICTORY.subscribe(Priority.NORMAL) { evt ->
val world = evt.winners.flatMap { it.pokemonList }.firstNotNullOfOrNull { it.entity?.world }
if (world?.server == null) return@subscribe
for (winner in evt.winners) {
val position = winner.pokemonList.firstNotNullOf { it.entity }.blockPos
val vecPos = Vec3d(position.x.toDouble(), position.y.toDouble(), position.z.toDouble())
for (battlePokemon in winner.pokemonList) {
val pokemon = battlePokemon.effectedPokemon
// println("Rolling for ${pokemon.ability.name} on ${pokemon.getDisplayName().string}")
if (!pokemon.heldItem().isEmpty) {
// println("${pokemon.getDisplayName().string} is already holding an item")
continue
}
val identifier = Identifier("cobblemon", "gameplay/abilities/postbattle/${pokemon.ability.name}")
val lootManager = world.server!!.lootManager
if (!lootManager.getIds(LootDataType.LOOT_TABLES).contains(identifier)) {
// println("${pokemon.ability.name} doesn't have a postbattle loot table")
continue
}
val lootTable = lootManager.getLootTable(identifier)
val list = lootTable.generateLoot(
LootContextParameterSet(
world as ServerWorld,
mapOf(
LootContextParameters.ORIGIN to vecPos
),
mapOf(),
0F
)
)
if (list.isEmpty) {
// println("Attempted to roll for ability ${pokemon.ability.name} but nothing dropped.")
continue
}
pokemon.swapHeldItem(list.first())
}
}
}
HeldItemProvider.register(CobblemonHeldItemManager, Priority.LOWEST)
}
@@ -47,7 +47,16 @@ class SwitchInstruction(val instructionSet: InstructionSet, val battleActor: Bat
if (!battle.started) {
activePokemon.battlePokemon = pokemon
activePokemon.illusion = illusion
val pokemonEntity = pokemon.entity
val pokemonEntity = pokemon.entity?.let {
// If a Pokémon entity is being recalled with an animation,
// wrap up the animation and recall the Pokémon immediately.
if (it.beamMode == 3) {
pokemon.effectedPokemon.recall()
return@let null
}
pokemon.entity
}
if (pokemonEntity == null && entity != null) {
val targetPos = battleActor.getSide().getOppositeSide().actors.filterIsInstance<EntityBackedBattleActor<*>>().firstOrNull()?.entity?.pos?.let { pos ->
val offset = pos.subtract(entity.pos)
@@ -1,20 +0,0 @@
{
"type": "minecraft:generic",
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "minecraft:air",
"weight": 9
},
{
"type": "minecraft:item",
"weight": 1,
"name": "minecraft:honey_bottle"
}
]
}
]
}
@@ -1,65 +0,0 @@
{
"type": "minecraft:generic",
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "minecraft:air",
"weight": 900
},
{
"type": "minecraft:item",
"weight": 30,
"name": "cobblemon:super_potion"
},
{
"type": "minecraft:item",
"weight": 10,
"name": "cobblemon:ultra_ball"
},
{
"type": "minecraft:item",
"weight": 10,
"name": "cobblemon:full_restore"
},
{
"type": "minecraft:item",
"weight": 10,
"name": "cobblemon:full_heal"
},
{
"type": "minecraft:item",
"weight": 10,
"name": "minecraft:gold_nugget"
},
{
"type": "minecraft:item",
"weight": 10,
"name": "cobblemon:revive"
},
{
"type": "minecraft:item",
"weight": 10,
"name": "cobblemon:rare_candy"
},
{
"type": "minecraft:item",
"weight": 5,
"name": "cobblemon:protein"
},
{
"type": "minecraft:item",
"weight": 4,
"name": "cobblemon:pp_up"
},
{
"type": "minecraft:item",
"weight": 1,
"name": "cobblemon:kings_rock"
}
]
}
]
}
+1 -5
View File
@@ -9,8 +9,6 @@ from scriptutils import printCobblemonHeader, print_list_filtered, print_cobblem
print_cobblemon_script_footer, print_problems_and_paths, print_warning, sanitize_pokemon, print_separator
DEFAULT_POKEMON_MODELS_PATH = "../common/src/main/kotlin/com/cobblemon/mod/common/client/render/models/blockbench/pokemon/"
# Download the CSV file
ASSETS_CSV_URL = "https://docs.google.com/spreadsheets/d/e/2PACX-1vSTisDTkJvV0GzKV1zKjAPdMAQAO7znWxjEWXrM1gZPUVmsTU91oy54aJGMpbbvOqAOg03ER1wl7eeA/pub?gid=0&single=true&output=csv"
@@ -63,6 +61,7 @@ def main(print_missing_models=True, print_missing_animations=True):
cries_in_game,
pokemon_in_game,
cries_on_repo):
# Skip pokemon that are not in the game yet
if this_pokemon_in_game == "❌":
continue
cry_in_game = str(cry_in_game).strip() # remove whitespace
@@ -88,9 +87,6 @@ def main(print_missing_models=True, print_missing_animations=True):
'sound_effects_and_keyframes': False,
}
# Construct the path to the model file
if pokemon_name == "Rattata [Alolan]":
print(pokemon_name)
# Try to convert gen_number to an integer and handle ValueError
try:
if pokemon_form:
# Check if the form is a regional form or F or M, if not, use the default model file