Compare commits

...
Author SHA1 Message Date
Ronak Chavva 166cc32a24 help button wip 2026-10-29 02:04:05 -05:00
Ronak Chavva 4980ffc151 feat(*): gear bg change, info icon, scrolling implementation 2026-10-28 16:39:38 -05:00
Ronak Chavva fb7d2a96b3 fix(*): cancel movement, edge movement fix 2026-10-28 14:46:53 -05:00
Ronak Chavva f6d3071a44 fix(*): pathing + range bugs 2026-10-28 14:34:07 -05:00
Ronak Chavva 73f27ec732 ui done 2026-10-28 04:18:27 -05:00
Hiroku f4140a097d Put the snap back on 2026-10-27 20:16:12 +10:00
Hiroku b79dbcca80 no scope. I mean no snap 2026-10-27 19:42:59 +10:00
Hiroku 5ac12a897a Merge remote-tracking branch 'origin/lang-updates' 2026-10-27 19:28:28 +10:00
Polymeta ae5f7c83f2 Merge branch 'implement_pokemon' into 'main'
implement_pokemon

See merge request cable-mc/cobblemon!2507
2026-10-26 23:10:50 +00:00
ewwww f14de9ab58 updated water shuriken 2026-10-26 16:35:00 -04:00
ewwww 8a1c846c2c Merge branch 'main' into implement_pokemon 2026-10-26 16:06:28 -04:00
Polymeta 459e7d3490 this doesnt make any sense
Signed-off-by: Polymeta <4726322-polymeta@users.noreply.gitlab.com>
2026-10-26 09:16:39 +00:00
Polymeta 5a9be8944f Merge branch 'hotbox-hitfix' into 'main'
Orb Ceiling Hitbox Correction

See merge request cable-mc/cobblemon!2512
2026-10-26 07:09:59 +00:00
Polymeta 3bb941b087 Merge branch 'dusclops-cry-fix' into 'main'
fixed dusclops using squirtle's cry

See merge request cable-mc/cobblemon!2511
2026-10-26 07:07:40 +00:00
dhi_holo 384b496d76 T H E O R B 2026-10-26 13:37:09 +10:00
geumu 4caa736e0b Translated using Weblate (Korean)
Currently translated at 99.6% (9549 of 9587 strings)

Translation: Cobblemon/Mod
Translate-URL: https://lang.cobblemon.com/projects/cobblemon/mod/ko/
2026-10-26 02:38:47 +00:00
geumu c3e9051918 Translated using Weblate (Korean)
Currently translated at 98.5% (9445 of 9587 strings)

Translation: Cobblemon/Mod
Translate-URL: https://lang.cobblemon.com/projects/cobblemon/mod/ko/
2026-10-26 02:26:52 +00:00
ewwww fe940caafc fixed dusclops using squirtle's cry 2026-10-25 21:33:38 -04:00
Polymeta c9d148ec9c bump showdown build and changelog
Signed-off-by: Polymeta <4726322-polymeta@users.noreply.gitlab.com>
2026-10-26 00:41:23 +00:00
Polymeta e611bf4a77 Merge branch 'fix-missing-recipe-book-data' into 'main'
Fixed Cooking Pot recipe book tabs and entries on Fabric

See merge request cable-mc/cobblemon!2510
2026-10-26 00:37:47 +00:00
Polymeta 8093822140 Merge branch 'battle-selection-fix' into 'main'
Fixed a bug with battle selection.

See merge request cable-mc/cobblemon!2509
2026-10-26 00:27:00 +00:00
Fyre520 f695ec15f9 Fixed Cooking Pot recipe book tabs and entries on Fabric 2026-10-26 02:01:15 +05:30
Deltric 1f6c791ce6 Fixed a bug with battle selection. 2026-10-25 14:24:44 -04:00
Polymeta 570805fdf1 Merge branch 'structure-tags-for-spawning' into 'main'
Structure Spawn Tags

See merge request cable-mc/cobblemon!2508
2026-10-25 16:53:38 +00:00
dhi_holo ddecb08bc7 Edit is_illager_structure.json 2026-10-26 00:21:36 +10:00
Kenji_64 a1b930a21f More Frogadier fixes (ty Mitchoo) 2026-10-25 14:14:44 +01:00
Kenji_64 7728ff3892 Fixed Fearow missing blink crashing during gliding 2026-10-25 14:11:22 +01:00
阿鱼 0b38e063d2 Translated using Weblate (Chinese (Simplified Han script))
Currently translated at 98.7% (9464 of 9587 strings)

Translation: Cobblemon/Mod
Translate-URL: https://lang.cobblemon.com/projects/cobblemon/mod/zh_Hans/
2026-10-25 10:52:25 +00:00
Hiroku 4d7cfcdf61 Added q.target_fainted to MoveInstruction 2026-10-25 11:11:52 +10:00
Hiroku e56dd6ef64 snap it back on 2026-10-25 10:43:01 +10:00
Kenji_64 236b98fa78 I forgot the changelog :( 2026-10-25 02:21:08 +02:00
Kenji_64 ac61e0d4d0 Had to fix Froakie again. Heck 2026-10-25 02:20:20 +02:00
Kenji_64 d8956fd66f Froakie line eye lid and animation fixes 2026-10-25 02:14:01 +02:00
ewwww 50a5a78dd4 Merge remote-tracking branch 'origin/implement_pokemon' into implement_pokemon 2026-10-24 19:16:59 -04:00
ewwww 76c2654399 it appears my lang tweaks were reverted somehow 2026-10-24 19:16:20 -04:00
dhi_holo b5ac54cd16 Tweaks to prepare for Scrapes 2026-10-21 14:22:17 +10:00
dhi_holo dc703e67f7 Merge branch 'main' into structure-tags-for-spawning 2026-10-21 14:01:10 +10:00
dhi_holo 8e1fcc6f14 Structure Spawn Tags
Feel free to rename, delete, or rework any of these, it's moreso just setting the groundwork

`spawns/is_aquatic_monument` - Ocean Monuments and related structures
`spawns/is_aquatic_ruins` - Ocean Ruins and similar structures
`spawns/is_civilization` - Village and Towns tag, for anything that should spawn at any kind of village/town
`spawns/is_desert_monument` - Desert Pyramids and Temples
`spawns/is_dungeon` - Modded tag, the idea is things of the Stronghold *vibe*, but not being literal strongholds
`spawns/is_end_structure` - End Cities and related structures
`spawns/is_graveyard` - Modded tag, graveyards and crypts
`spawns/is_igloo` - just the vanilla igloo, it's me just wanting stuff in tags where it isn't yet so if some addon wants to give igloos another place they can
`spawns/is_illager_outpost` - small settlements for illagers, such as campsites and other small watchtower-like things
`spawns/is_illager_structure` - Bigger illager structures, the mansion, manors, stuff that has a sense of "infrastructure" I suppose
`spawns/is_jungle_monument` - Jungle Temples and Pyramids
`spawns/is_nether_structure` - is a structure of the Nether
`spawns/is_piglin_structure` - is a structure specifically inhabited by Piglins. Can be used to either add stuff specifically around Piglins, or to prevent things around them
`spawns/is_ruins` - Taking what we have as ruins and just applying that logic to other mods
`spawns/is_shipwreck` - not sure if we use this for spawns, but if we do this can be hooked into, if not then this could be deleted, no hassle, just felt like a logical thing to include. Is related to "surface" shipwrecks, not things like the coves
`spawns/is_witch_structure` - witch structures, like huts, villages, etc. Also added any structures that force black cat spawning, as that's used to reference to witches in the vanilla tags

Mods used within the tags so far:
https://modrinth.com/mod/dungeons-and-taverns (`nova_structures`)
A lot of https://modrinth.com/organization/nuVP8uUG mods (the Yung structure ones, usually starts as `better` and then the structure name)
https://modrinth.com/mod/enderscape
https://modrinth.com/mod/aquamirae
https://modrinth.com/mod/terralith
Will continue to investigate mods to add to these
2026-10-14 17:54:34 +10:00
94 changed files with 5122 additions and 1695 deletions

No files matched your search

+4 -96
View File
@@ -1,107 +1,15 @@
# Changelog
## [1.8.3 (October 25th, 2026)](#1-8-3)
## [1.8.x (MONTH xth, 2026)](#1-8-x)
### Additions
- Added compatability with AppleSkin.
### New Rideable Pokémon
- Vikavolt
- Fearow
### Particles
## New Move Animations
- Water Shuriken
### Cries added/updated for the following Pokémon
- Hoppip
- Skiploom
- Jumpluff
- Houndour
- Houndoom
- Wurmple
- Silcoon
- Beautifly
- Cascoon
- Dustox
- Surskit
- Masquerain
- Torkoal
- Starly
- Staravia
- Staraptor
- Combee
- Vespiquen
- Dusknoir
- Helioptile
- Heliolisk
- Grubbin
- Charjabug
- Vikavolt
- Applin (updated)
- Flapple (updated)
- Appletun
- Runerigus
- Dipplin
### Animation updates for the following Pokémon
- Vikavolt
- Magby
- Magmar
- Ninetales (+ Alolan)
- Spearow
- Fearow
- Squawkabilly
- Mudkip
- Marshtomp
- Swampert
### Changes
- Changed the Misc icon in the Campfire Pot Recipe Book to Health Candy.
- Moved EXP Candies from the Medicine recipe book category to the Misc category.
- Removed Dynamic Lights data from the Magmarizer item for consistency with the block.
- Added `doPokemonPredation` game rule, which controls aggressiveness of Pokémon with the `hate_entity` brain task defined.
- Added `predation_chance` server config value, which controls the possibility of attacking the hated entity found in `hate_entity` brain tasks.
- Prehistoric Eroded Pillar generates slightly more frequently.
- Togekiss was changed from a jet-style mount to bird-style.
### Fixes
- Fixed datapacks with item interaction evolutions that don't specify an item crashing the world on load.
- Fixed the Pokédex evolution tree crashing when a datapack's dex entry is missing an evolution's form.
- Fixed the Pokédex evolution tree crashing with a stack overflow on evolutions that loop back on themselves.
- Fixed the Pokédex evolution tree crashing when looking at a dex that is not part of the "National Dex" aggregate.
- Fixed some display names in the Pokédex evolution tree having unintended font colours.
- Fixed evolution trees not building properly when a Pokémon has several Pokédex entries for different regions.
- Fixed form-changing evolutions sometimes resolving to the source form in the Pokédex evolution tree.
- Broken datapack evolutions are now logged and skipped in the Pokédex evolution tree instead of crashing.
- Fixed the `alpha` property having no tab completion in commands such as `/pokespawn`, `/pokegive` and `/pokeedit`, and added the missing `dmax_level`, `gmax_factor` and `tradable` aliases to tab completion.
- Fixed friendship booster items not being recognised as such.
- Fixed conflicts with other mods that would make use of recipe books in certain ways (Farmer's Delight Cooking Pot).
- Fixed Pokémon battles stalling when a sidemod cancels the `THROWN_POKEBALL_HIT` hit event.
- Fixed choice feature tab completion in `spawnpokemon/pokegive/pokeedit` commands.
- Fixed MoLang that's targeting players intermittedly failing when they have died, requiring them to relog.
- Fixed a NeoForge bug where none of the Cobblemon plants/berries could be placed into pots.
- Fixed party overlay not hiding when the player opens the Pokédex scanner.
- Fixed `hate_entity` task focusing on its own entity, therefore enabling deadly warfare between Zangoose and Seviper.
- Prehistoric Frozen Pond, Prehistoric Frozen Spike, and Prehistoric Lush Den now actually generate (oops).
- Fixed Frogadier floating in its `battle_idle` animation.
- Fixed absence or incorrect mergers in spawning conditions, causing the max height/depth of conditions to use the min value instead.
- Added stricter riding checks on server side to prevent possible packet forgery when a player tries to ride Pokémon.
- Fixed Pokémon cries and animation sounds played from GUIs, such as the starter selection screen and the Pokédex, being tied to the Master volume slider instead of Friendly Creatures.
- Fixed Archeops T-posing during its `air_cry` animation.
### Developer
- Bumped NeoForge to `21.1.195` to get access to MixinExtras `0.5` and the expressions annotation.
- New Platform Event `PLAYER_RESPAWN` which is fired when a player respawns (either through death or returning from the end).
- Platform Events `SERVER_PLAYER_TICK_PRE` and `SERVER_PLAYER_TICK_POST` no longer fire when the player is dead.
- It is now tied much closer to the actual entity rather than the player or their connection.
### Molang & Datapacks
- Fixed `q.pokemon.nature` returning class instance instead of proper string value (`cobblemon:adamant`).
- Fixed `q.entity.is_looking_at` result being always `1` for whatever entity passed as the target parameter.
- Added hate chance optional parameter to `hate_entity` task. `1.0` will make an entity always attack the target.
### Particles
### Localization
- Updated translations for:
- Russian
- Japanese
- Brazilian Portuguese
- Updated translations for:
+107
View File
@@ -0,0 +1,107 @@
# Changelog
## [1.8.3 (October 25th, 2026)](#1-8-3)
### Additions
- Added compatability with AppleSkin.
### New Rideable Pokémon
- Vikavolt
- Fearow
### Particles
## New Move Animations
- Water Shuriken
### Cries added/updated for the following Pokémon
- Hoppip
- Skiploom
- Jumpluff
- Houndour
- Houndoom
- Wurmple
- Silcoon
- Beautifly
- Cascoon
- Dustox
- Surskit
- Masquerain
- Torkoal
- Starly
- Staravia
- Staraptor
- Combee
- Vespiquen
- Dusknoir
- Helioptile
- Heliolisk
- Grubbin
- Charjabug
- Vikavolt
- Applin (updated)
- Flapple (updated)
- Appletun
- Runerigus
- Dipplin
### Animation updates for the following Pokémon
- Vikavolt
- Magby
- Magmar
- Ninetales (+ Alolan)
- Spearow
- Fearow
- Squawkabilly
- Mudkip
- Marshtomp
- Swampert
### Changes
- Changed the Misc icon in the Campfire Pot Recipe Book to Health Candy.
- Moved EXP Candies from the Medicine recipe book category to the Misc category.
- Removed Dynamic Lights data from the Magmarizer item for consistency with the block.
- Added `doPokemonPredation` game rule, which controls aggressiveness of Pokémon with the `hate_entity` brain task defined.
- Added `predation_chance` server config value, which controls the possibility of attacking the hated entity found in `hate_entity` brain tasks.
- Prehistoric Eroded Pillar generates slightly more frequently.
- Togekiss was changed from a jet-style mount to bird-style.
### Fixes
- Fixed datapacks with item interaction evolutions that don't specify an item crashing the world on load.
- Fixed the Pokédex evolution tree crashing when a datapack's dex entry is missing an evolution's form.
- Fixed the Pokédex evolution tree crashing with a stack overflow on evolutions that loop back on themselves.
- Fixed the Pokédex evolution tree crashing when looking at a dex that is not part of the "National Dex" aggregate.
- Fixed some display names in the Pokédex evolution tree having unintended font colours.
- Fixed evolution trees not building properly when a Pokémon has several Pokédex entries for different regions.
- Fixed form-changing evolutions sometimes resolving to the source form in the Pokédex evolution tree.
- Broken datapack evolutions are now logged and skipped in the Pokédex evolution tree instead of crashing.
- Fixed the `alpha` property having no tab completion in commands such as `/pokespawn`, `/pokegive` and `/pokeedit`, and added the missing `dmax_level`, `gmax_factor` and `tradable` aliases to tab completion.
- Fixed friendship booster items not being recognised as such.
- Fixed conflicts with other mods that would make use of recipe books in certain ways (Farmer's Delight Cooking Pot).
- Fixed Pokémon battles stalling when a sidemod cancels the `THROWN_POKEBALL_HIT` hit event.
- Fixed choice feature tab completion in `spawnpokemon/pokegive/pokeedit` commands.
- Fixed MoLang that's targeting players intermittedly failing when they have died, requiring them to relog.
- Fixed a NeoForge bug where none of the Cobblemon plants/berries could be placed into pots.
- Fixed party overlay not hiding when the player opens the Pokédex scanner.
- Fixed `hate_entity` task focusing on its own entity, therefore enabling deadly warfare between Zangoose and Seviper.
- Prehistoric Frozen Pond, Prehistoric Frozen Spike, and Prehistoric Lush Den now actually generate (oops).
- Fixed Frogadier floating in its `battle_idle` animation.
- Fixed absence or incorrect mergers in spawning conditions, causing the max height/depth of conditions to use the min value instead.
- Added stricter riding checks on server side to prevent possible packet forgery when a player tries to ride Pokémon.
- Fixed Pokémon cries and animation sounds played from GUIs, such as the starter selection screen and the Pokédex, being tied to the Master volume slider instead of Friendly Creatures.
- Fixed Archeops T-posing during its `air_cry` animation.
### Developer
- Bumped NeoForge to `21.1.195` to get access to MixinExtras `0.5` and the expressions annotation.
- New Platform Event `PLAYER_RESPAWN` which is fired when a player respawns (either through death or returning from the end).
- Platform Events `SERVER_PLAYER_TICK_PRE` and `SERVER_PLAYER_TICK_POST` no longer fire when the player is dead.
- It is now tied much closer to the actual entity rather than the player or their connection.
### Molang & Datapacks
- Fixed `q.pokemon.nature` returning class instance instead of proper string value (`cobblemon:adamant`).
- Fixed `q.entity.is_looking_at` result being always `1` for whatever entity passed as the target parameter.
- Added hate chance optional parameter to `hate_entity` task. `1.0` will make an entity always attack the target.
### Localization
- Updated translations for:
- Russian
- Japanese
- Brazilian Portuguese
+25
View File
@@ -0,0 +1,25 @@
# Changelog
## [1.8.4 (October 27th, 2026)](#1-8-4)
### Changes
- The Froakie line now blinks. The world will never be the same.
### Fixes
- Fixed heaps of spawns not working. This was caused by us missing something before release. RIP.
- Fixed a crash caused by Fearow blinking while you're riding one. Makes sense to me.
- Fixed Minior's "Shields Down" ability being very broken.
- Fixed Dusclops using Squirtle's cry sound (lol).
- Fixed blank Cooking Pot recipe book entries and missing tabs on Fabric.
- Fixed a hitbox issue with placeable Orb held items attached to a ceiling.
- Fixed something sneaky. I'll tell you about it later.
### Molang & Datapacks
- Added `q.target_fainted` function to move action effects that checks if any opponents fainted from the move.
### Particles
- Updated Water Shuriken effect to be timed better when the opponent faints.
### Localization
- Updated translations for:
- Korean
- Simplified Chinese
@@ -69,7 +69,7 @@ public abstract class ClientRecipeBookMixin {
value = "INVOKE",
target = "Lcom/google/common/collect/ImmutableMap;copyOf(Ljava/util/Map;)Lcom/google/common/collect/ImmutableMap;"
))
private void addCustomAggregateCategories(Iterable<RecipeHolder<?>> recipes, RegistryAccess registryAccess, CallbackInfo ci, @Local(name = "map2") Map<RecipeBookCategories, List<RecipeCollection>> map2) {
private void addCustomAggregateCategories(Iterable<RecipeHolder<?>> recipes, RegistryAccess registryAccess, CallbackInfo ci, @Local(ordinal = 1) Map<RecipeBookCategories, List<RecipeCollection>> map2) {
CobblemonRecipeCategories.Companion.getCustomAggregateCategories().forEach((recipeBookCategories, list) -> map2.put(recipeBookCategories, (List) list.stream().flatMap((recipeBookCategoriesx) -> ((List) map2.getOrDefault(recipeBookCategoriesx, ImmutableList.of())).stream()).collect(ImmutableList.toImmutableList())));
}
}
@@ -20,14 +20,14 @@ import org.spongepowered.asm.mixin.injection.At;
@Mixin(RecipeBookComponent.class)
public class RecipeBookComponentMixin {
@Definition(id = "recipeBookCategories", local = @Local(name = "recipeBookCategories"))
@Definition(id = "recipeBookCategories", local = @Local(type = RecipeBookCategories.class))
@Definition(id = "FURNACE_SEARCH", field = "Lnet/minecraft/client/RecipeBookCategories;FURNACE_SEARCH:Lnet/minecraft/client/RecipeBookCategories;")
@Expression("recipeBookCategories != FURNACE_SEARCH")
@ModifyExpressionValue(
method = "updateTabs",
at = @At(value = "MIXINEXTRAS:EXPRESSION")
)
private boolean notCookingPotSearch(boolean original, @Local(name = "recipeBookCategories") RecipeBookCategories recipeBookCategories) {
private boolean notCookingPotSearch(boolean original, @Local RecipeBookCategories recipeBookCategories) {
return original && recipeBookCategories != CobblemonRecipeCategories.COOKING_POT_SEARCH.toVanillaCategory();
}
}
@@ -42,9 +42,14 @@ import com.cobblemon.mod.common.client.net.npc.OpenNPCEditorHandler
import com.cobblemon.mod.common.client.net.orientation.ClientboundUpdateOrientationHandler
import com.cobblemon.mod.common.client.net.pasture.ClosePastureHandler
import com.cobblemon.mod.common.client.net.pasture.OpenPastureHandler
import com.cobblemon.mod.common.client.net.pasture.UpdatePastureRangeHandler
import com.cobblemon.mod.common.net.messages.client.pasture.UpdatePastureRangePacket
import com.cobblemon.mod.common.net.messages.server.pasture.AdjustPastureRangePacket
import com.cobblemon.mod.common.net.serverhandling.pasture.AdjustPastureRangeHandler
import com.cobblemon.mod.common.client.net.pasture.PokemonPasturedHandler
import com.cobblemon.mod.common.client.net.pasture.PokemonUnpasturedHandler
import com.cobblemon.mod.common.client.net.pasture.UpdatePastureConflictFlagHandler
import com.cobblemon.mod.common.client.net.pasture.UpdatePastureRecoveryHandler
import com.cobblemon.mod.common.client.net.pokedex.ServerConfirmedRegisterHandler
import com.cobblemon.mod.common.client.net.pokemon.update.ClientboundSeatAssignmentPacketHandler
import com.cobblemon.mod.common.client.net.pokemon.update.ClientboundUpdateRidingStateHandler
@@ -101,6 +106,7 @@ import com.cobblemon.mod.common.net.messages.client.pasture.OpenPasturePacket
import com.cobblemon.mod.common.net.messages.client.pasture.PokemonPasturedPacket
import com.cobblemon.mod.common.net.messages.client.pasture.PokemonUnpasturedPacket
import com.cobblemon.mod.common.net.messages.client.pasture.UpdatePastureConflictFlagPacket
import com.cobblemon.mod.common.net.messages.client.pasture.UpdatePastureRecoveryPacket
import com.cobblemon.mod.common.net.messages.client.pokedex.ServerConfirmedRegisterPacket
import com.cobblemon.mod.common.net.messages.client.pokemon.update.*
import com.cobblemon.mod.common.net.messages.client.pokemon.update.evolution.AddEvolutionPacket
@@ -473,10 +479,12 @@ object CobblemonNetwork {
// Pasture
list.add(PacketRegisterInfo(OpenPasturePacket.ID, OpenPasturePacket::decode, OpenPastureHandler))
list.add(PacketRegisterInfo(UpdatePastureRangePacket.ID, UpdatePastureRangePacket::decode, UpdatePastureRangeHandler))
list.add(PacketRegisterInfo(ClosePasturePacket.ID, ClosePasturePacket::decode, ClosePastureHandler))
list.add(PacketRegisterInfo(PokemonPasturedPacket.ID, PokemonPasturedPacket::decode, PokemonPasturedHandler))
list.add(PacketRegisterInfo(PokemonUnpasturedPacket.ID, PokemonUnpasturedPacket::decode, PokemonUnpasturedHandler))
list.add(PacketRegisterInfo(UpdatePastureConflictFlagPacket.ID, UpdatePastureConflictFlagPacket::decode, UpdatePastureConflictFlagHandler))
list.add(PacketRegisterInfo(UpdatePastureRecoveryPacket.ID, UpdatePastureRecoveryPacket::decode, UpdatePastureRecoveryHandler))
// Orientation
list.add(PacketRegisterInfo(ClientboundUpdateOrientationPacket.ID, ClientboundUpdateOrientationPacket::decode, ClientboundUpdateOrientationHandler))
@@ -591,6 +599,7 @@ object CobblemonNetwork {
// Pasture
list.add(PacketRegisterInfo(PasturePokemonPacket.ID, PasturePokemonPacket::decode, PasturePokemonHandler))
list.add(PacketRegisterInfo(AdjustPastureRangePacket.ID, AdjustPastureRangePacket::decode, AdjustPastureRangeHandler))
list.add(PacketRegisterInfo(UnpasturePokemonPacket.ID, UnpasturePokemonPacket::decode, UnpasturePokemonHandler))
list.add(PacketRegisterInfo(UnpastureAllPokemonPacket.ID, UnpastureAllPokemonPacket::decode, UnpastureAllPokemonHandler))
list.add(PacketRegisterInfo(SetPastureConflictPacket.ID, SetPastureConflictPacket::decode, SetPastureConflictHandler))
@@ -657,4 +666,4 @@ object CobblemonNetwork {
fun sendPacketToPlayer(player: ServerPlayer, packet: NetworkPacket<*>) {
Cobblemon.implementation.networkManager.sendPacketToPlayer(player, packet)
}
}
}
@@ -15,11 +15,13 @@ import com.cobblemon.mod.common.api.ai.asVariables
import com.cobblemon.mod.common.api.ai.config.task.WanderTaskConfig.Companion.WANDER
import com.cobblemon.mod.common.api.molang.MoLangFunctions.asMostSpecificMoLangValue
import com.cobblemon.mod.common.api.npc.configuration.MoLangConfigVariable
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
import com.cobblemon.mod.common.util.asExpression
import com.cobblemon.mod.common.util.mainThreadRuntime
import com.cobblemon.mod.common.util.resolveFloat
import com.cobblemon.mod.common.util.withQueryValue
import com.mojang.datafixers.util.Either
import net.minecraft.core.BlockPos
import net.minecraft.world.entity.LivingEntity
import net.minecraft.world.entity.PathfinderMob
import net.minecraft.world.entity.ai.behavior.BehaviorControl
@@ -69,7 +71,14 @@ class AirWanderTaskConfig : SingleTaskConfig {
val rotVec = entity.getViewVector(0F)
pathCooldown.setWithExpiry(true, 60L)
val target = HoverRandomPos.getPos(entity, horizontalRange.resolveInt(runtime), verticalRange.resolveInt(runtime), rotVec.x, rotVec.y, 1.5707964f, minUpwardsMovement.resolveInt(runtime), minDownwardsMovement.resolveInt(runtime))
val tethering = (entity as? PokemonEntity)?.tethering
val horizontal = horizontalRange.resolveInt(runtime)
val vertical = verticalRange.resolveInt(runtime)
val minUpwards = minUpwardsMovement.resolveInt(runtime)
val minDownwards = minDownwardsMovement.resolveInt(runtime)
val target = (0 until 10).asSequence()
.mapNotNull { HoverRandomPos.getPos(entity, horizontal, vertical, rotVec.x, rotVec.y, 1.5707964f, minUpwards, minDownwards) }
.firstOrNull { tethering?.canRoamTo(BlockPos.containing(it)) != false }
?: return@Trigger false
walkTarget.set(WalkTarget(target, speedMultiplier.resolveFloat(runtime), 3))
lookTarget.set(BlockPosTracker(target))
@@ -78,4 +87,4 @@ class AirWanderTaskConfig : SingleTaskConfig {
}
}
}
}
}
@@ -17,6 +17,7 @@ import com.cobblemon.mod.common.api.ai.config.task.WanderTaskConfig.Companion.WA
import com.cobblemon.mod.common.api.molang.MoLangFunctions.asMostSpecificMoLangValue
import com.cobblemon.mod.common.api.npc.configuration.MoLangConfigVariable
import com.cobblemon.mod.common.entity.ai.CobblemonWalkTarget
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
import com.cobblemon.mod.common.util.asExpression
import com.cobblemon.mod.common.util.mainThreadRuntime
import com.cobblemon.mod.common.util.resolveFloat
@@ -95,6 +96,7 @@ class WaterWanderTaskConfig : SingleTaskConfig {
attempts++
target = BehaviorUtils.getRandomSwimmablePos(entity, horizontalRange.resolveInt(mainThreadRuntime), verticalRange.resolveInt(mainThreadRuntime))
?: continue
if ((entity as? PokemonEntity)?.tethering?.canRoamTo(BlockPos.containing(target)) == false) continue
pos = BlockPos.containing(target).takeIf(wanderControl::isSuitable)
}
@@ -143,4 +145,4 @@ class WaterWanderTaskConfig : SingleTaskConfig {
}
}
}
}
}
@@ -239,6 +239,10 @@ open class PokemonBattle(
}
fun writeShowdownAction(vararg messages: String) {
if (messages.any { it.contains("\n") || it.contains("\r") }) {
LOGGER.warn("Refusing to forward Showdown action with an embedded line break for battle {}: {}", battleId, messages.joinToString(" | "))
return
}
log(messages.joinToString("\n"))
ShowdownService.service.send(battleId, messages.toList().toTypedArray())
}
@@ -34,7 +34,7 @@ object PastureLinkManager {
fun getLinkByPlayer(player: ServerPlayer): PastureLink? {
val link = getLinkByPlayerId(player.uuid)
if (link != null) {
if (!player.level().dimensionTypeRegistration().`is`(link.dimension) || !link.pos.closerToCenterThan(player.position(), 10.0)) {
if (player.level().dimension().location() != link.dimension || !link.pos.closerToCenterThan(player.position(), 10.0)) {
links.remove(player.uuid)
return null
}
@@ -46,8 +46,8 @@ object PastureLinkManager {
@JvmStatic
fun removeAt(world: ServerLevel, pos: BlockPos) {
links.removeIf { (uuid, pastureLink) ->
val shouldRemove = world.dimensionTypeRegistration().`is`(pastureLink.dimension) && pastureLink.pos == pos
uuid.getPlayer()?.sendPacket(ClosePasturePacket())
val shouldRemove = world.dimension().location() == pastureLink.dimension && pastureLink.pos == pos
if (shouldRemove) uuid.getPlayer()?.sendPacket(ClosePasturePacket())
return@removeIf shouldRemove
}
}
@@ -0,0 +1,82 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.pasture
import net.minecraft.core.BlockPos
import net.minecraft.core.Direction
import net.minecraft.network.RegistryFriendlyByteBuf
import kotlin.math.abs
import kotlin.math.ceil
import kotlin.math.floor
data class PastureRange(val north: Int, val east: Int, val south: Int, val west: Int) {
fun isValid(maximum: Int): Boolean =
listOf(north, east, south, west).all { it in 0..maximum } &&
north.toLong() + south >= 8 && east.toLong() + west >= 8
operator fun get(direction: Direction): Int = when (direction) {
Direction.NORTH -> north
Direction.EAST -> east
Direction.SOUTH -> south
Direction.WEST -> west
else -> error("Pasture range directions must be horizontal")
}
fun adjusted(direction: Direction, amount: Int): PastureRange = when (direction) {
Direction.NORTH -> copy(north = north + amount)
Direction.EAST -> copy(east = east + amount)
Direction.SOUTH -> copy(south = south + amount)
Direction.WEST -> copy(west = west + amount)
else -> this
}
fun minPos(origin: BlockPos) = origin.offset(-west, 0, -north)
fun maxPos(origin: BlockPos) = origin.offset(east, 0, south)
fun nearbyBlocks(origin: BlockPos, preferred: BlockPos, width: Double): Sequence<BlockPos> = sequence {
val halfWidth = width / 2.0
val minX = ceil(origin.x - west + halfWidth - 0.5).toInt()
val maxX = floor(origin.x + east - halfWidth - 0.5).toInt()
val minZ = ceil(origin.z - north + halfWidth - 0.5).toInt()
val maxZ = floor(origin.z + south - halfWidth - 0.5).toInt()
if (minX > maxX || minZ > maxZ) return@sequence
val centerX = preferred.x.coerceIn(minX, maxX)
val centerZ = preferred.z.coerceIn(minZ, maxZ)
for (distance in 0..16) {
for (dx in -distance..distance) {
val x = centerX + dx
if (x !in minX..maxX) continue
val dz = distance - abs(dx)
val z = centerZ + dz
if (z in minZ..maxZ) yield(BlockPos(x, origin.y, z))
if (dz != 0 && centerZ - dz in minZ..maxZ) yield(BlockPos(x, origin.y, centerZ - dz))
}
}
}
fun encode(buffer: RegistryFriendlyByteBuf) {
buffer.writeVarInt(north)
buffer.writeVarInt(east)
buffer.writeVarInt(south)
buffer.writeVarInt(west)
}
companion object {
const val MAX_DISTANCE = 64
fun fromBounds(origin: BlockPos, min: BlockPos, max: BlockPos) = PastureRange(
origin.z - min.z, max.x - origin.x, max.z - origin.z, origin.x - min.x
)
fun decode(buffer: RegistryFriendlyByteBuf) = PastureRange(
buffer.readVarInt(), buffer.readVarInt(), buffer.readVarInt(), buffer.readVarInt()
)
}
}
@@ -198,7 +198,17 @@ interface Spawner {
val mid = chunk.getBlockState(startPos)
val above = chunk.getBlockState(abovePos)
return above.isPathfindable(PathComputationType.AIR) && mid.isAir
// Above must be non-solid
if (!above.isPathfindable(PathComputationType.AIR)) {
return false
}
// Position must be non-air
if (mid.isAir) {
return false
}
return true
}
fun constrainArea(area: SpawningZoneInput): SpawningZoneInput? {
@@ -117,6 +117,9 @@ abstract class ShowdownActionResponse(val type: ShowdownActionResponseType) {
data class MoveActionResponse(var moveName: String, var targetPnx: String? = null, var gimmickID: String? = null): ShowdownActionResponse(ShowdownActionResponseType.MOVE) {
override fun isValid(activeBattlePokemon: ActiveBattlePokemon, showdownMoveSet: ShowdownMoveset?, forceSwitch: Boolean): Boolean {
// Ensure that the gimmick ID the player is sending is valid
gimmickID?.let { if (it !in VALID_GIMMICK_IDS) return false }
if (forceSwitch || showdownMoveSet == null) {
return false
}
@@ -168,6 +171,10 @@ data class MoveActionResponse(var moveName: String, var targetPnx: String? = nul
gimmickID = buffer.readNullable { buffer.readString() }
return this
}
companion object {
private val VALID_GIMMICK_IDS = ShowdownMoveset.Gimmick.entries.map { it.id }.toSet()
}
}
data class HealItemActionResponse(var item: String) : ShowdownActionResponse(ShowdownActionResponseType.FORCE_PASS) {
@@ -183,7 +190,8 @@ data class HealItemActionResponse(var item: String) : ShowdownActionResponse(Sho
}
override fun isValid(activeBattlePokemon: ActiveBattlePokemon, showdownMoveSet: ShowdownMoveset?, forceSwitch: Boolean): Boolean {
return !forceSwitch
// Previously checked for !forceSwitch, excepts in the case of a forceSwitch, this couldn't legally be sent anyway.
return false
}
override fun toShowdownString(activeBattlePokemon: ActiveBattlePokemon, showdownMoveSet: ShowdownMoveset?): String {
@@ -37,7 +37,6 @@ import com.cobblemon.mod.common.util.asIdentifierDefaultingNamespace
import com.cobblemon.mod.common.util.battleLang
import com.cobblemon.mod.common.util.cobblemonResource
import java.util.concurrent.CompletableFuture
import net.minecraft.world.entity.LivingEntity
/**
* Format: |move|POKEMON|MOVE|TARGET
@@ -77,7 +76,7 @@ class MoveInstruction(
val pokemonName = userPokemon.getName()
ShowdownInterpreter.lastCauser[battle.battleId] = message
// For Spread targets the message data only gives the pnx strings. So we can't know what pokemon are actually targeted until the previous messages have been interpreted
val spreadTargetPokemon = spreadTargets.map { battle.activePokemon.firstOrNull() { poke -> poke.getPNX() == it }?.battlePokemon }
val spreadTargetPokemon = spreadTargets.map { battle.activePokemon.firstOrNull { poke -> poke.getPNX() == it }?.battlePokemon }
val targetPokemonEntity = targetPokemon?.entity
if (targetPokemonEntity != null) {
@@ -137,10 +136,20 @@ class MoveInstruction(
val subsequentInstructions = instructionSet.findInstructionsCausedBy(this)
val missedTargets = subsequentInstructions.filterIsInstance<MissInstruction>().mapNotNull { it.target }
val faintedTargets = subsequentInstructions.filterIsInstance<FaintInstruction>().map { it.faintingPokemon }
val failed = subsequentInstructions.any { it is FailInstruction }
val failedTargets = subsequentInstructions.filterIsInstance<FailInstruction>().mapNotNull { it.target }
val hitCountInstruction = subsequentInstructions.filterIsInstance<HitCountInstruction>().firstOrNull()
runtime.environment.query.addFunction("target_fainted") { params ->
if (params.params.size == 0) {
return@addFunction DoubleValue(faintedTargets.isNotEmpty())
} else {
val entityUUID = params.getString(0)
return@addFunction DoubleValue(faintedTargets.any { it.entity?.stringUUID == entityUUID })
}
}
runtime.environment.query.addFunction("missed") { params ->
if (params.params.size == 0) {
return@addFunction DoubleValue(missedTargets.isNotEmpty())
@@ -30,7 +30,7 @@ class OrbBlock(properties: Properties) : SixFaceRotationalBlock(properties) {
val FLOOR_NORTH = Shapes.box(0.3125, 0.0, 0.3125, 0.6875, 0.375, 0.6875)
val WALL_NORTH = Shapes.box(0.3125, 0.3125, 0.625, 0.6875, 0.6875, 1.0)
val CEILING_NORTH = Shapes.box(0.3125, 0.625, 0.375, 0.6875, 1.0, 0.6875)
val CEILING_NORTH = Shapes.box(0.3125, 0.625, 0.3125, 0.6875, 1.0, 0.6875)
}
init {
@@ -25,7 +25,6 @@ import com.cobblemon.mod.common.util.rotateShape
import com.mojang.serialization.MapCodec
import net.minecraft.core.BlockPos
import net.minecraft.core.Direction
import net.minecraft.resources.ResourceLocation
import net.minecraft.server.level.ServerLevel
import net.minecraft.server.level.ServerPlayer
import net.minecraft.util.StringRepresentable
@@ -283,11 +282,13 @@ class PastureBlock(settings: Properties): BaseEntityBlock(settings), SimpleWater
pastureId = linkId,
permissions = perms,
limit = baseEntity.getMaxTethered(),
tetheredPokemon = baseEntity.tetheredPokemon.mapNotNull { it.toDTO(player) }
tetheredPokemon = baseEntity.tetheredPokemon.mapNotNull { it.toDTO(player) },
range = baseEntity.getRange(),
facing = state.getValue(HorizontalDirectionalBlock.FACING)
)
)
PastureLinkManager.createLink(player.uuid, PastureLink(linkId, pcId, ResourceLocation.tryParse(world.dimensionTypeRegistration().registeredName)!!, getBasePosition(state, pos), perms))
PastureLinkManager.createLink(player.uuid, PastureLink(linkId, pcId, world.dimension().location(), getBasePosition(state, pos), perms))
world.playSoundServer(
position = pos.bottomCenter,
@@ -366,4 +367,4 @@ class PastureBlock(settings: Properties): BaseEntityBlock(settings), SimpleWater
return state
}
}
}
@@ -14,15 +14,19 @@ import com.cobblemon.mod.common.CobblemonBlocks
import com.cobblemon.mod.common.CobblemonNetwork.sendPacket
import com.cobblemon.mod.common.advancement.CobblemonCriteria
import com.cobblemon.mod.common.api.pasture.PastureLinkManager
import com.cobblemon.mod.common.api.pasture.PastureRange
import com.cobblemon.mod.common.api.scheduling.afterOnServer
import com.cobblemon.mod.common.api.text.italicise
import com.cobblemon.mod.common.api.text.red
import com.cobblemon.mod.common.block.PastureBlock
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
import com.cobblemon.mod.common.entity.pokemon.PokemonBehaviourFlag
import com.cobblemon.mod.common.net.messages.client.effect.SpawnSnowstormEntityParticlePacket
import com.cobblemon.mod.common.net.messages.client.pasture.ClosePasturePacket
import com.cobblemon.mod.common.net.messages.client.pasture.OpenPasturePacket
import com.cobblemon.mod.common.net.messages.client.pasture.PokemonPasturedPacket
import com.cobblemon.mod.common.net.messages.client.pasture.UpdatePastureRecoveryPacket
import com.cobblemon.mod.common.net.messages.client.pasture.UpdatePastureConflictFlagPacket
import com.cobblemon.mod.common.net.serverhandling.storage.SendOutPokemonHandler
import com.cobblemon.mod.common.pokemon.Pokemon
import com.cobblemon.mod.common.util.DataKeys
@@ -39,7 +43,6 @@ import net.minecraft.core.Vec3i
import net.minecraft.nbt.CompoundTag
import net.minecraft.nbt.ListTag
import net.minecraft.nbt.NbtUtils
import net.minecraft.resources.ResourceLocation
import net.minecraft.server.level.ServerLevel
import net.minecraft.server.level.ServerPlayer
import net.minecraft.tags.FluidTags
@@ -48,38 +51,61 @@ import net.minecraft.world.entity.item.ItemEntity
import net.minecraft.world.item.ItemStack
import net.minecraft.world.level.Level
import net.minecraft.world.level.block.Blocks
import net.minecraft.world.level.block.HorizontalDirectionalBlock
import net.minecraft.world.entity.ai.memory.MemoryModuleType
import net.minecraft.world.level.block.entity.BlockEntity
import net.minecraft.world.level.block.entity.BlockEntityTicker
import net.minecraft.world.level.block.state.BlockState
import net.minecraft.world.level.entity.EntityTypeTest
import net.minecraft.world.phys.AABB
import net.minecraft.world.phys.Vec3
class PokemonPastureBlockEntity(pos: BlockPos, state: BlockState) :
BlockEntity(CobblemonBlockEntities.PASTURE, pos, state) {
open class Tethering(
val minRoamPos: BlockPos,
val maxRoamPos: BlockPos,
var minRoamPos: BlockPos,
var maxRoamPos: BlockPos,
val playerId: UUID,
val playerName: String,
val tetheringId: UUID,
val pokemonId: UUID,
val pcId: UUID,
val entityId: Int,
val pasturePos: BlockPos
var entityId: Int,
val pasturePos: BlockPos,
var entityUuid: UUID? = null,
var lastEntityPos: BlockPos? = null,
var respawnAt: Long = 0L,
var healingAfterFaint: Boolean = false,
var conflictEnabled: Boolean? = null
) {
fun getPokemon(): Pokemon? {
val srv = server() ?: return null
val pc = Cobblemon.storage.getPC(pcId, srv.registryAccess())
return pc[pokemonId]
}
val box = AABB(minRoamPos.toVec3d(), maxRoamPos.toVec3d())
open fun canRoamTo(pos: BlockPos) = box.contains(pos.center)
val box get() = AABB(minRoamPos.toVec3d(), maxRoamPos.toVec3d())
fun canRoamTo(x: Double, z: Double) = x >= minRoamPos.x && x < maxRoamPos.x && z >= minRoamPos.z && z < maxRoamPos.z
open fun canRoamTo(pos: BlockPos) = canRoamTo(pos.x + 0.5, pos.z + 0.5)
internal fun beginRecovery(now: Long, fainted: Boolean) {
if (fainted && !healingAfterFaint) {
healingAfterFaint = true
respawnAt = now + FAINT_COOLDOWN
} else if (respawnAt == 0L) {
respawnAt = now + MISSING_ENTITY_COOLDOWN
}
}
fun toDTO(player: ServerPlayer): OpenPasturePacket.PasturePokemonDataDTO? {
val pokemon = getPokemon() ?: return null
val entity = pokemon.entity
val behaviourFlags = entity?.getActiveBehaviourFlags() ?: emptySet()
val behaviourFlags = (entity?.getActiveBehaviourFlags() ?: emptySet()).toMutableSet()
when (conflictEnabled) {
true -> behaviourFlags.add(PokemonBehaviourFlag.PASTURE_CONFLICT)
false -> behaviourFlags.remove(PokemonBehaviourFlag.PASTURE_CONFLICT)
null -> Unit
}
return OpenPasturePacket.PasturePokemonDataDTO(
pokemonId = pokemonId,
@@ -91,12 +117,16 @@ class PokemonPastureBlockEntity(pos: BlockPos, state: BlockState) :
heldItem = pokemon.heldItem(),
level = pokemon.level,
entityKnown = (entity?.tethering?.tetheringId == tetheringId),
behaviourFlags = behaviourFlags
behaviourFlags = behaviourFlags,
healingAfterFaint = healingAfterFaint,
respawnAt = respawnAt
)
}
}
companion object {
private const val FAINT_COOLDOWN = 24000L
private const val MISSING_ENTITY_COOLDOWN = 200L
internal val TICKER = BlockEntityTicker<PokemonPastureBlockEntity> { world, _, _, blockEntity ->
if (world.isClientSide) return@BlockEntityTicker
blockEntity.ticksUntilCheck--
@@ -134,6 +164,26 @@ class PokemonPastureBlockEntity(pos: BlockPos, state: BlockState) :
fun getMaxTethered() = Cobblemon.config.defaultPasturedPokemonLimit
fun getRange() = PastureRange.fromBounds(blockPos, minRoamPos, maxRoamPos)
fun setRange(range: PastureRange) {
minRoamPos = range.minPos(blockPos).atY(minRoamPos.y)
maxRoamPos = range.maxPos(blockPos).atY(maxRoamPos.y)
tetheredPokemon.forEach { tethering ->
tethering.minRoamPos = minRoamPos
tethering.maxRoamPos = maxRoamPos
tethering.getPokemon()?.entity?.let { entity ->
if (entity.tethering?.tetheringId == tethering.tetheringId) {
entity.tethering = tethering
entity.navigation.stop()
entity.brain.eraseMemory(MemoryModuleType.WALK_TARGET)
entity.checkPastureTether()
}
}
}
setChanged()
}
fun canAddPokemon(player: ServerPlayer, pokemon: Pokemon, maxPerPlayer: Int): Boolean {
val forThisPlayer = tetheredPokemon.count { it.playerId == player.uuid }
// Shouldn't be possible, client should've prevented it
@@ -158,57 +208,64 @@ class PokemonPastureBlockEntity(pos: BlockPos, state: BlockState) :
fun tether(player: ServerPlayer, pokemon: Pokemon, directionToBehind: Direction): Boolean {
val tethering = Tethering(
minRoamPos, maxRoamPos, player.uuid, player.gameProfile.name, UUID.randomUUID(),
pokemon.uuid, Cobblemon.storage.getPC(player).uuid, -1, blockPos
)
if (!spawnPokemon(pokemon, tethering, directionToBehind)) return false
pokemon.tetheringId = tethering.tetheringId
pokemon.onChange()
tetheredPokemon.add(tethering)
tethering.toDTO(player)?.let { player.sendPacket(PokemonPasturedPacket(it)) }
setChanged()
CobblemonCriteria.PASTURE_USE.trigger(player, pokemon)
return true
}
private fun spawnPokemon(pokemon: Pokemon, tethering: Tethering, directionToBehind: Direction): Boolean {
val world = level ?: return false
val entity = PokemonEntity(world, pokemon = pokemon)
entity.refreshDimensions()
val width = entity.boundingBox.xsize
val idealPlace = blockPos.offset(directionToBehind.normal.multiply(ceil(width).toInt() + 1))
var box = entity.getDimensions(Pose.STANDING).makeBoundingBox(idealPlace.center.subtract(0.0, 0.5, 0.0))
for (i in 0..5) {
box = box.move(directionToBehind.normal.x.toDouble(), 0.0, directionToBehind.normal.z.toDouble())
val fixedPosition = makeSuitableY(world, idealPlace.offset(directionToBehind.normal.multiply(i + 1)), entity, box)
if (fixedPosition != null) {
entity.setPos(fixedPosition.center.subtract(0.0, 0.5, 0.0))
val pc = Cobblemon.storage.getPC(player)
entity.beamMode = 2
afterOnServer(seconds = 0.5F) {
if(entity.pokemon.shiny) {
SpawnSnowstormEntityParticlePacket(cobblemonResource("shiny_ring"), entity.id, listOf("shiny_particles", "middle"))
.sendToPlayersAround(entity.x, entity.y, entity.z, 64.0, entity.level().dimension())
}
entity.after(seconds = SendOutPokemonHandler.SEND_OUT_DURATION) {
entity.beamMode = 0
}
}
if (world.addFreshEntity(entity)) {
val tethering = Tethering(
minRoamPos = minRoamPos,
maxRoamPos = maxRoamPos,
playerId = player.uuid,
playerName = player.gameProfile.name,
tetheringId = UUID.randomUUID(),
pokemonId = pokemon.uuid,
pcId = pc.uuid,
entityId = entity.id,
pasturePos = blockPos
)
pokemon.tetheringId = tethering.tetheringId
tetheredPokemon.add(tethering)
entity.tethering = tethering
tethering.toDTO(player)?.let { player.sendPacket(PokemonPasturedPacket(it)) }
setChanged()
CobblemonCriteria.PASTURE_USE.trigger(player, pokemon)
return true
} else {
Cobblemon.LOGGER.warn("Couldn't spawn pastured Pokémon for some reason")
}
break
val position = findSpawnPosition(entity, tethering.lastEntityPos, directionToBehind) ?: return false
entity.setPos(position)
entity.beamMode = 2
entity.tethering = tethering
entity.setBehaviourFlag(PokemonBehaviourFlag.PASTURE_CONFLICT, tethering.conflictEnabled == true)
if (!world.addFreshEntity(entity)) return false
if (tethering.conflictEnabled == true) entity.remakeBrain()
tethering.entityId = entity.id
tethering.entityUuid = entity.uuid
tethering.lastEntityPos = entity.blockPosition()
tethering.respawnAt = 0L
syncRecovery(tethering)
afterOnServer(seconds = 0.5F) {
if (!entity.isRemoved && entity.pokemon.shiny) {
SpawnSnowstormEntityParticlePacket(cobblemonResource("shiny_ring"), entity.id, listOf("shiny_particles", "middle"))
.sendToPlayersAround(entity.x, entity.y, entity.z, 64.0, entity.level().dimension())
}
entity.after(seconds = SendOutPokemonHandler.SEND_OUT_DURATION) {
entity.beamMode = 0
}
}
return true
}
return false
fun findSpawnPosition(entity: PokemonEntity, preferred: BlockPos? = null, direction: Direction = blockState.getValue(HorizontalDirectionalBlock.FACING)): Vec3? {
val world = level ?: return null
val dimensions = entity.getDimensions(Pose.STANDING)
val idealPlace = preferred ?: blockPos.offset(direction.normal.multiply(ceil(dimensions.width / 2.0).toInt() + 1))
for (candidate in getRange().nearbyBlocks(blockPos, idealPlace, dimensions.width.toDouble())) {
if (!world.hasChunkAt(candidate)) continue
val box = dimensions.makeBoundingBox(candidate.center.subtract(0.0, 0.5, 0.0))
val fixedPosition = makeSuitableY(world, candidate, entity, box) ?: continue
val position = fixedPosition.center.subtract(0.0, 0.5, 0.0)
val spawnBox = dimensions.makeBoundingBox(position)
if (world.noCollision(entity, spawnBox) &&
world.getEntitiesOfClass(PokemonEntity::class.java, spawnBox) { it != entity }.isEmpty()) {
return position
}
}
return null
}
private fun togglePastureOn(on: Boolean) {
@@ -289,6 +346,7 @@ class PokemonPastureBlockEntity(pos: BlockPos, state: BlockState) :
}
fun checkPokemon() {
val world = level as? ServerLevel ?: return
val deadLinks = mutableListOf<UUID>()
tetheredPokemon.forEach {
val pokemon = it.getPokemon()
@@ -296,6 +354,8 @@ class PokemonPastureBlockEntity(pos: BlockPos, state: BlockState) :
deadLinks.add(it.pokemonId)
} else if (pokemon.tetheringId == null || pokemon.tetheringId != it.tetheringId) {
deadLinks.add(it.pokemonId)
} else {
checkDeployment(world, it, pokemon)
}
}
deadLinks.forEach(::releasePokemon)
@@ -303,6 +363,85 @@ class PokemonPastureBlockEntity(pos: BlockPos, state: BlockState) :
setChanged()
}
private fun checkDeployment(world: ServerLevel, tethering: Tethering, pokemon: Pokemon) {
val now = world.gameTime
if (pokemon.isFainted() && !tethering.healingAfterFaint) {
tethering.beginRecovery(now, fainted = true)
syncRecovery(tethering)
}
val entity = (pokemon.entity ?: tethering.entityUuid?.let(world::getEntity) as? PokemonEntity)
?.takeIf { !it.isRemoved && it.tethering?.tetheringId == tethering.tetheringId }
if (tethering.conflictEnabled == null && entity != null) {
tethering.conflictEnabled = entity.getBehaviourFlag(PokemonBehaviourFlag.PASTURE_CONFLICT)
}
if (entity != null && pokemon.isFainted()) entity.discard()
if (entity != null && !entity.isRemoved) {
if (tethering.conflictEnabled != null && entity.getBehaviourFlag(PokemonBehaviourFlag.PASTURE_CONFLICT) != tethering.conflictEnabled) {
entity.setBehaviourFlag(PokemonBehaviourFlag.PASTURE_CONFLICT, tethering.conflictEnabled == true)
entity.remakeBrain()
}
tethering.entityUuid = entity.uuid
tethering.lastEntityPos = entity.blockPosition()
entity.tethering = tethering
if (tethering.respawnAt != 0L || tethering.healingAfterFaint) {
tethering.respawnAt = 0L
tethering.healingAfterFaint = false
syncRecovery(tethering)
}
return
}
// A Pokémon in an unloaded chunk is still deployed. Never create its replacement.
val lastPosition = tethering.lastEntityPos
if (lastPosition != null) {
if (!world.hasChunkAt(lastPosition)) return
}
// The last saved position may predate a chunk crossing. Require the entire range
// to be entity-ticking before deciding that its missing Pokémon has disappeared.
for (chunkX in (minRoamPos.x shr 4)..(maxRoamPos.x shr 4)) {
for (chunkZ in (minRoamPos.z shr 4)..(maxRoamPos.z shr 4)) {
if (!world.isPositionEntityTicking(BlockPos(chunkX shl 4, blockPos.y, chunkZ shl 4))) return
}
}
if (tethering.respawnAt == 0L) {
tethering.beginRecovery(now, fainted = false)
syncRecovery(tethering)
return
}
if (now < tethering.respawnAt) return
if (tethering.healingAfterFaint) {
pokemon.heal()
if (pokemon.isFainted()) return
tethering.healingAfterFaint = false
syncRecovery(tethering)
}
val radius = Cobblemon.config.pastureMaxWanderDistance.toDouble()
val nearby = world.getEntitiesOfClass(PokemonEntity::class.java, AABB.ofSize(blockPos.toVec3d(), radius * 2, world.height.toDouble(), radius * 2)).size
val chunkDiameter = (radius / 16) * 2
if (nearby >= Cobblemon.config.pastureMaxPerChunk * chunkDiameter * chunkDiameter ||
!spawnPokemon(pokemon, tethering, blockState.getValue(HorizontalDirectionalBlock.FACING))) {
tethering.respawnAt = now + MISSING_ENTITY_COOLDOWN
syncRecovery(tethering)
}
}
private fun syncRecovery(tethering: Tethering) {
val world = level as? ServerLevel ?: return
val packet = UpdatePastureRecoveryPacket(tethering.pokemonId, tethering.healingAfterFaint, tethering.respawnAt)
world.server.playerList.players.filter(::isPlayerViewing).forEach { it.sendPacket(packet) }
}
fun setConflict(tethering: Tethering, enabled: Boolean) {
tethering.conflictEnabled = enabled
tethering.getPokemon()?.entity?.takeIf { it.tethering?.tetheringId == tethering.tetheringId }?.let {
it.setBehaviourFlag(PokemonBehaviourFlag.PASTURE_CONFLICT, enabled)
it.remakeBrain()
}
setChanged()
val world = level as? ServerLevel ?: return
val packet = UpdatePastureConflictFlagPacket(tethering.pokemonId, enabled)
world.server.playerList.players.filter(::isPlayerViewing).forEach { it.sendPacket(packet) }
}
fun onBroken() {
if (level is ServerLevel) {
tetheredPokemon.toList().forEach { releasePokemon(it.pokemonId) }
@@ -312,7 +451,10 @@ class PokemonPastureBlockEntity(pos: BlockPos, state: BlockState) :
fun releasePokemon(pokemonId: UUID) {
val tethering = tetheredPokemon.find { it.pokemonId == pokemonId } ?: return
tethering.getPokemon()?.tetheringId = null
tethering.getPokemon()?.let { pokemon ->
pokemon.tetheringId = null
pokemon.onChange()
}
tetheredPokemon.remove(tethering)
setChanged()
}
@@ -320,7 +462,10 @@ class PokemonPastureBlockEntity(pos: BlockPos, state: BlockState) :
fun releaseAllPokemon(playerId: UUID): List<UUID> {
val unpastured = mutableListOf<UUID>()
tetheredPokemon.filter { it.playerId == playerId }.forEach {
it.getPokemon()?.tetheringId = null
it.getPokemon()?.let { pokemon ->
pokemon.tetheringId = null
pokemon.onChange()
}
tetheredPokemon.remove(it)
unpastured.add(it.pokemonId)
}
@@ -343,9 +488,7 @@ class PokemonPastureBlockEntity(pos: BlockPos, state: BlockState) :
private fun isPlayerViewing(player: ServerPlayer): Boolean {
val pastureLink = PastureLinkManager.getLinkByPlayer(player)
return pastureLink != null && pastureLink.pos == blockPos && pastureLink.dimension == ResourceLocation.tryParse(
player.level().dimensionTypeRegistration().registeredName // todo (techdaan): confirm this is good
)
return pastureLink != null && pastureLink.pos == blockPos && pastureLink.dimension == player.level().dimension().location()
}
override fun loadAdditional(nbt: CompoundTag, registryLookup: HolderLookup.Provider) {
@@ -353,6 +496,9 @@ class PokemonPastureBlockEntity(pos: BlockPos, state: BlockState) :
val list = nbt.getList(DataKeys.TETHER_POKEMON, CompoundTag.TAG_COMPOUND.toInt())
this.ownerId = if (nbt.hasUUID(DataKeys.TETHER_OWNER_ID)) nbt.getUUID(DataKeys.TETHER_OWNER_ID) else null
this.ownerName = nbt.getString(DataKeys.TETHER_OWNER_NAME).takeIf { it.isNotEmpty() } ?: ""
this.minRoamPos = NbtUtils.readBlockPos(nbt, DataKeys.TETHER_MIN_ROAM_POS).orElse(minRoamPos)
this.maxRoamPos = NbtUtils.readBlockPos(nbt, DataKeys.TETHER_MAX_ROAM_POS).orElse(maxRoamPos)
tetheredPokemon.clear()
for (tetheringNBT in list) {
tetheringNBT as CompoundTag
val tetheringId = tetheringNBT.getUUID(DataKeys.TETHERING_ID)
@@ -365,17 +511,20 @@ class PokemonPastureBlockEntity(pos: BlockPos, state: BlockState) :
minRoamPos = minRoamPos,
maxRoamPos = maxRoamPos,
playerId = playerId,
playerName = ownerName,
playerName = tetheringNBT.getString("PlayerName").ifEmpty { ownerName },
tetheringId = tetheringId,
pokemonId = pokemonId,
pcId = pcId,
entityId = entityId,
pasturePos = blockPos
pasturePos = blockPos,
entityUuid = if (tetheringNBT.hasUUID("EntityUUID")) tetheringNBT.getUUID("EntityUUID") else null,
lastEntityPos = NbtUtils.readBlockPos(tetheringNBT, "LastEntityPos").orElse(null),
respawnAt = tetheringNBT.getLong("RespawnAt"),
healingAfterFaint = tetheringNBT.getBoolean("HealingAfterFaint"),
conflictEnabled = if (tetheringNBT.contains("PastureConflict")) tetheringNBT.getBoolean("PastureConflict") else null
)
)
}
this.minRoamPos = NbtUtils.readBlockPos(nbt, DataKeys.TETHER_MIN_ROAM_POS).get()
this.maxRoamPos = NbtUtils.readBlockPos(nbt, DataKeys.TETHER_MAX_ROAM_POS).get()
}
override fun saveAdditional(nbt: CompoundTag, registryLookup: HolderLookup.Provider) {
@@ -388,6 +537,12 @@ class PokemonPastureBlockEntity(pos: BlockPos, state: BlockState) :
tetheringNBT.putUUID(DataKeys.POKEMON_UUID, tethering.pokemonId)
tetheringNBT.putUUID(DataKeys.PC_ID, tethering.pcId)
tetheringNBT.putInt(DataKeys.TETHERING_ENTITY_ID, tethering.entityId)
tetheringNBT.putString("PlayerName", tethering.playerName)
tethering.entityUuid?.let { tetheringNBT.putUUID("EntityUUID", it) }
tethering.lastEntityPos?.let { tetheringNBT.put("LastEntityPos", NbtUtils.writeBlockPos(it)) }
tetheringNBT.putLong("RespawnAt", tethering.respawnAt)
tetheringNBT.putBoolean("HealingAfterFaint", tethering.healingAfterFaint)
tethering.conflictEnabled?.let { tetheringNBT.putBoolean("PastureConflict", it) }
list.add(tetheringNBT)
}
nbt.put(DataKeys.TETHER_POKEMON, list)
@@ -396,4 +551,4 @@ class PokemonPastureBlockEntity(pos: BlockPos, state: BlockState) :
ownerId?.let { nbt.putUUID(DataKeys.TETHER_OWNER_ID, it) }
nbt.putString(DataKeys.TETHER_OWNER_NAME, this.ownerName)
}
}
}
@@ -11,6 +11,8 @@ package com.cobblemon.mod.common.client.gui.pasture
import com.cobblemon.mod.common.CobblemonNetwork
import com.cobblemon.mod.common.CobblemonSounds
import com.cobblemon.mod.common.api.pasture.PasturePermissions
import com.cobblemon.mod.common.api.pasture.PastureRange
import net.minecraft.core.Direction
import com.cobblemon.mod.common.api.reactive.SettableObservable
import com.cobblemon.mod.common.client.gui.pc.PCGUIConfiguration
import com.cobblemon.mod.common.net.messages.client.pasture.OpenPasturePacket
@@ -21,7 +23,9 @@ class PasturePCGUIConfiguration(
val pastureId: UUID,
val limit: Int,
val pasturedPokemon: SettableObservable<List<OpenPasturePacket.PasturePokemonDataDTO>>,
var permissions: PasturePermissions
var permissions: PasturePermissions,
var range: PastureRange,
val facing: Direction
) : PCGUIConfiguration(
exitFunction = { it.closeNormally(unlink = true) },
showParty = false,
@@ -32,4 +36,6 @@ class PasturePCGUIConfiguration(
}
},
canSelect = { pokemon -> !pokemon.isFainted() && pokemon.tetheringId == null }
)
) {
var editingRange = false
}
@@ -58,6 +58,7 @@ class PasturePokemonScrollList(
private val scrollOverlayResource = cobblemonResource("textures/gui/pasture/pasture_scroll_overlay.png")
private val slotResource = cobblemonResource("textures/gui/pasture/pasture_slot.png")
private val slotOwnerResource = cobblemonResource("textures/gui/pasture/pasture_slot_owner.png")
private val slotFaintedResource = cobblemonResource("textures/gui/pasture/pasture_slot_fainted.png")
}
private var scrolling = false
@@ -194,7 +195,7 @@ class PasturePokemonScrollList(
}
)
override fun getNarration() = pokemon.displayName
override fun getNarration() = if (pokemon.healingAfterFaint) lang("ui.pasture.fainted").append(" ").append(pokemon.displayName) else pokemon.displayName
override fun render(
context: GuiGraphics,
@@ -214,7 +215,7 @@ class PasturePokemonScrollList(
val matrixStack = context.pose()
blitk(
matrixStack = matrixStack,
texture = if (isOwned()) slotOwnerResource else slotResource,
texture = if (pokemon.healingAfterFaint) slotFaintedResource else if (isOwned()) slotOwnerResource else slotResource,
x = x,
y = y,
height = SLOT_HEIGHT,
@@ -234,7 +235,8 @@ class PasturePokemonScrollList(
rotation = Quaternionf().fromEulerXYZDegrees(Vector3f(13F, 35F, 0F)),
state = state,
partialTicks = partialTicks,
scale = 4.5F
scale = 4.5F,
a = if (pokemon.healingAfterFaint) 0.7F else 1F
)
matrixStack.popPose()
@@ -249,14 +251,21 @@ class PasturePokemonScrollList(
)
}
drawScaledTextJustifiedRight(
context = context,
text = lang("ui.lv.number", pokemon.level),
x = x + 59,
y = y + 17,
shadow = true,
scale = SCALE
)
val recovering = pokemon.healingAfterFaint || pokemon.respawnAt > 0L
if (recovering) {
if (!pokemon.healingAfterFaint) {
drawScaledText(context, text = lang("ui.pasture.returning"),
x = x + 18, y = y + 7, scale = SCALE, colour = 0xFFFF8585.toInt(), shadow = true)
}
val remainingTicks = (pokemon.respawnAt - (client.level?.gameTime ?: 0L)).coerceAtLeast(0L)
val seconds = (remainingTicks + 19L) / 20L
val timer = if (remainingTicks == 0L) lang("ui.pasture.ready") else "%d:%02d".format(seconds / 60L, seconds % 60L).text()
drawScaledTextJustifiedRight(context = context, text = timer, x = x + 59, y = y + 17,
shadow = true, scale = SCALE)
} else {
drawScaledTextJustifiedRight(context = context, text = lang("ui.lv.number", pokemon.level),
x = x + 59, y = y + 17, shadow = true, scale = SCALE)
}
drawScaledText(
context = context,
@@ -279,7 +288,7 @@ class PasturePokemonScrollList(
}
if (canUnpasture()) {
if (canDefend() == true) {
if (isOwned() && canDefend() == true) {
conflictButton.setPos(x + 44, y + 3)
conflictButton.render(context, mouseX, mouseY, partialTicks)
}
@@ -291,7 +300,7 @@ class PasturePokemonScrollList(
override fun mouseClicked(mouseX: Double, mouseY: Double, delta: Int): Boolean {
if (canUnpasture()) {
if (canDefend() == true && conflictButton.isHovered(mouseX, mouseY)) {
if (isOwned() && canDefend() == true && conflictButton.isHovered(mouseX, mouseY)) {
conflictButton.onPress()
return true
}
@@ -303,4 +312,4 @@ class PasturePokemonScrollList(
return false
}
}
}
}
@@ -0,0 +1,225 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.client.gui.pasture
import com.cobblemon.mod.common.CobblemonSounds
import com.cobblemon.mod.common.api.gui.blitk
import com.cobblemon.mod.common.api.text.bold
import com.cobblemon.mod.common.api.text.font
import com.cobblemon.mod.common.client.CobblemonResources
import com.cobblemon.mod.common.client.gui.pc.StorageWidget
import com.cobblemon.mod.common.client.gui.summary.widgets.SoundlessWidget
import com.cobblemon.mod.common.client.render.drawScaledText
import com.cobblemon.mod.common.client.render.gui.PCBoxWallpaperRepository
import com.cobblemon.mod.common.net.messages.server.pasture.AdjustPastureRangePacket
import com.cobblemon.mod.common.util.cobblemonResource
import com.cobblemon.mod.common.util.lang
import net.minecraft.client.Minecraft
import net.minecraft.client.gui.GuiGraphics
import net.minecraft.client.resources.sounds.SimpleSoundInstance
import net.minecraft.core.Direction
import net.minecraft.network.chat.Component
class PastureRangeWidget(x: Int, y: Int, private val configuration: PasturePCGUIConfiguration) :
SoundlessWidget(x, y, StorageWidget.SCREEN_WIDTH, StorageWidget.SCREEN_HEIGHT, lang("ui.pasture.range")) {
private val rangeResource = cobblemonResource("textures/gui/pasture/pasture_range.png")
private val glowResource = cobblemonResource("textures/gui/pc/wallpaper/basic/glow/wallpaper_basic_05.png")
private val overlayResource = cobblemonResource("textures/gui/pc/pc_screen_overlay.png")
private val infoResource = cobblemonResource("textures/gui/pasture/pasture_range_help.png")
private val infoButtonResource = cobblemonResource("textures/gui/pasture/pasture_button.png")
private val infoButtonSize = 17
private val directions = listOf(configuration.facing, configuration.facing.clockWise, configuration.facing.opposite, configuration.facing.counterClockWise)
private val arrowBounds = listOf(
intArrayOf(75, 17, 103, 46), intArrayOf(116, 64, 152, 96),
intArrayOf(75, 109, 103, 143), intArrayOf(26, 64, 62, 96)
)
// Centers of the numeral shadows in pasture_range.png, relative to its (85, 27) panel origin.
private val numberPositions = listOf(89 to 37, 125 to 77, 89 to 114, 53 to 77)
private var hoveredDirection: Direction? = null
private var showInfo = false
val isInfoOpen get() = showInfo
fun closeInfo() { showInfo = false }
private val infoButtonX get() = x + 5
private val infoButtonY get() = y + 5
private val infoPanelX get() = x + 7
private val infoPanelY get() = y + 40
private val infoPanelWidth = 160
private val infoPanelHeight = 74
override fun renderWidget(context: GuiGraphics, mouseX: Int, mouseY: Int, delta: Float) {
blitk(
matrixStack = context.pose(), texture = PCBoxWallpaperRepository.defaultWallpaper,
x = x, y = y, width = width, height = height
)
blitk(
matrixStack = context.pose(), texture = rangeResource,
x = x + 3, y = y + 3, width = width - 6, height = height - 6,
uOffset = 88, vOffset = 30, textureWidth = 349, textureHeight = 205
)
blitk(
matrixStack = context.pose(), texture = glowResource,
x = x - 17, y = y - 17, width = 208, height = 189
)
blitk(matrixStack = context.pose(), texture = overlayResource, x = x, y = y, width = width, height = height)
hoveredDirection = if (showInfo) null else directionAt(mouseX.toDouble(), mouseY.toDouble())
directions.indexOf(hoveredDirection).takeIf { it >= 0 }?.let { index ->
renderArrowHighlight(context, index)
}
context.pose().pushPose()
context.pose().translate(-0.5F, 0F, 0F)
directions.forEachIndexed { index, direction ->
val (numberX, numberY) = numberPositions[index]
drawScaledText(context, text = Component.literal(configuration.range[direction].toString()),
x = x + numberX + 1, y = y + numberY - 7, centered = true,
colour = 0xFFFFFFFF.toInt())
}
context.pose().popPose()
if (showInfo) context.fill(x + 3, y + 3, x + width - 3, y + height - 3, 0xAA002730.toInt())
val infoHovered = isOverInfoButton(mouseX.toDouble(), mouseY.toDouble())
// Use the same button face and persistent open-state highlight as the gear.
blitk(matrixStack = context.pose(), texture = infoButtonResource,
x = infoButtonX, y = infoButtonY, width = 13, height = infoButtonSize,
textureWidth = 70, textureHeight = 34)
blitk(matrixStack = context.pose(), texture = infoButtonResource,
x = infoButtonX + 13, y = infoButtonY, width = 4, height = infoButtonSize,
uOffset = 66, textureWidth = 70, textureHeight = 34)
if (showInfo || infoHovered) context.fill(infoButtonX + 2, infoButtonY + 2,
infoButtonX + 16, infoButtonY + 15, 0x88FFFFFF.toInt())
blitk(matrixStack = context.pose(), texture = infoResource,
x = infoButtonX + 4.5F, y = infoButtonY + 3.5F, width = 8, height = 10)
if (showInfo) {
val options = Minecraft.getInstance().options
val boxX = infoPanelX
val boxY = infoPanelY
val boxWidth = infoPanelWidth
val boxHeight = infoPanelHeight
context.fill(boxX + 1, boxY, boxX + boxWidth - 1, boxY + boxHeight, 0x96FFFFFF.toInt())
context.fill(boxX, boxY + 1, boxX + boxWidth, boxY + boxHeight - 1, 0x96FFFFFF.toInt())
blitk(matrixStack = context.pose(), texture = PCBoxWallpaperRepository.defaultWallpaper,
x = boxX + 1, y = boxY + 1, width = boxWidth - 2, height = boxHeight - 2,
textureWidth = StorageWidget.SCREEN_WIDTH, textureHeight = StorageWidget.SCREEN_HEIGHT)
val increaseBinding = if (options.keyAttack.matchesMouse(0)) lang("ui.pasture.range.left_click")
else options.keyAttack.translatedKeyMessage.copy()
val decreaseBinding = if (options.keyUse.matchesMouse(1)) lang("ui.pasture.range.right_click")
else options.keyUse.translatedKeyMessage.copy()
val columns = listOf(
Triple(boxX + 43, lang("ui.pasture.range.increase").bold(), listOf(increaseBinding, lang("ui.pasture.range.scroll_up"))),
Triple(boxX + 117, lang("ui.pasture.range.decrease").bold(), listOf(decreaseBinding, lang("ui.pasture.range.scroll_down")))
)
val detailWidth = columns.flatMap { it.third }.maxOf {
Minecraft.getInstance().font.width(it.copy().font(CobblemonResources.DEFAULT_LARGE))
}
val detailScale = minOf(1F, 72F / detailWidth)
drawScaledText(context, font = CobblemonResources.DEFAULT_LARGE,
text = lang("ui.pasture.range.help_title").bold(), x = boxX + 80, y = boxY + 8,
centered = true, shadow = true)
context.fill(boxX + 8, boxY + 22, boxX + boxWidth - 8, boxY + 23, 0x96FFFFFF.toInt())
context.fill(boxX + 80, boxY + 27, boxX + 81, boxY + 66, 0x96FFFFFF.toInt())
columns.forEach { (centerX, title, details) ->
drawScaledText(context, font = CobblemonResources.DEFAULT_LARGE,
text = title, x = centerX, y = boxY + 29, centered = true, shadow = true)
details.forEachIndexed { index, line ->
drawScaledText(context, font = CobblemonResources.DEFAULT_LARGE,
text = line, x = centerX, y = boxY + 44 + index * 14,
scale = detailScale, centered = true, shadow = true)
}
}
}
}
private fun renderArrowHighlight(context: GuiGraphics, index: Int) {
fun fill(left: Int, top: Int, right: Int, bottom: Int) {
context.fill(x + left, y + top, x + right, y + bottom, 0x66FFFFFF)
}
// Trace the arrow faces in pasture_range.png; horizontal arrows have longer stems.
// Keep their offset drop shadows visible instead of brightening the surrounding background.
when (index) {
0 -> {
for (row in 0..14) {
val halfWidth = 3 + minOf(row, 11)
fill(89 - halfWidth, 17 + row, 89 + halfWidth, 18 + row)
}
fill(81, 32, 97, 41)
}
1, 3 -> {
for (row in 0..26) {
val tip = 141 + minOf(row, 11, 26 - row)
if (index == 1) fill(137, 64 + row, tip, 65 + row)
else fill(178 - tip, 64 + row, 41, 65 + row)
}
if (index == 1) fill(116, 72, 137, 83)
else fill(41, 72, 62, 83)
}
2 -> {
fill(81, 109, 97, 123)
for (row in 0..14) {
val halfWidth = 14 - maxOf(0, row - 3)
fill(89 - halfWidth, 123 + row, 89 + halfWidth, 124 + row)
}
}
}
}
private fun directionAt(mouseX: Double, mouseY: Double): Direction? {
val index = arrowBounds.indexOfFirst { (left, top, right, bottom) ->
mouseX >= x + left && mouseX < x + right &&
mouseY >= y + top && mouseY < y + bottom
}
return directions.getOrNull(index)
}
private fun adjust(direction: Direction, increase: Boolean): Boolean {
AdjustPastureRangePacket(configuration.pastureId, direction, increase).sendToServer()
return true
}
private fun isOverInfoButton(mouseX: Double, mouseY: Double) =
mouseX >= infoButtonX && mouseX < infoButtonX + infoButtonSize &&
mouseY >= infoButtonY && mouseY < infoButtonY + infoButtonSize
override fun mouseClicked(pMouseX: Double, pMouseY: Double, pButton: Int): Boolean {
if (pButton == 0 && isOverInfoButton(pMouseX, pMouseY)) {
showInfo = !showInfo
Minecraft.getInstance().soundManager.play(SimpleSoundInstance.forUI(CobblemonSounds.PC_CLICK, 1F))
return true
}
if (showInfo) {
if (pMouseX < infoPanelX || pMouseX >= infoPanelX + infoPanelWidth ||
pMouseY < infoPanelY || pMouseY >= infoPanelY + infoPanelHeight) closeInfo()
return true
}
val direction = directionAt(pMouseX, pMouseY) ?: return false
val options = Minecraft.getInstance().options
return when {
options.keyAttack.matchesMouse(pButton) -> adjust(direction, true)
options.keyUse.matchesMouse(pButton) -> adjust(direction, false)
else -> false
}
}
override fun mouseScrolled(mouseX: Double, mouseY: Double, scrollX: Double, scrollY: Double): Boolean {
if (showInfo) return true
val direction = directionAt(mouseX, mouseY) ?: return false
if (scrollY == 0.0) return false
return adjust(direction, scrollY > 0)
}
override fun keyPressed(pKeyCode: Int, pScanCode: Int, pModifiers: Int): Boolean {
if (showInfo) return !Minecraft.getInstance().options.keyInventory.matches(pKeyCode, pScanCode)
val direction = hoveredDirection ?: return false
val options = Minecraft.getInstance().options
return when {
options.keyAttack.matches(pKeyCode, pScanCode) -> adjust(direction, true)
options.keyUse.matches(pKeyCode, pScanCode) -> adjust(direction, false)
else -> false
}
}
}
@@ -20,7 +20,9 @@ import com.cobblemon.mod.common.net.messages.server.pasture.UnpastureAllPokemonP
import com.cobblemon.mod.common.util.cobblemonResource
import com.cobblemon.mod.common.util.lang
import net.minecraft.client.gui.GuiGraphics
import net.minecraft.client.sounds.SoundManager
import net.minecraft.network.chat.Component
import net.minecraft.client.gui.components.Button
class PastureWidget(
val storageWidget: StorageWidget,
@@ -32,6 +34,8 @@ class PastureWidget(
companion object {
private val baseResource = cobblemonResource("textures/gui/pasture/pasture_panel.png")
private val buttonResource = cobblemonResource("textures/gui/pasture/pasture_button.png")
private val gearResource = cobblemonResource("textures/gui/pasture/pasture_range_gear.png")
}
private val recallButton = RecallButton(
@@ -42,6 +46,14 @@ class PastureWidget(
UnpastureAllPokemonPacket(pasturePCGUIConfiguration.pastureId).sendToServer()
}
private val rangeButton = object : Button(x + 6, y + 174, 27, 17, lang("ui.pasture.range"), {
storageWidget.pcGui.setPastureRangeEditing(!pasturePCGUIConfiguration.editingRange)
}, DEFAULT_NARRATION) {
override fun playDownSound(soundManager: SoundManager) {
storageWidget.pcGui.playSound(CobblemonSounds.PC_CLICK)
}
}
val pastureScrollList = PasturePokemonScrollList(
listX = x + 6,
listY = y + 31,
@@ -70,11 +82,29 @@ class PastureWidget(
pastureScrollList.render(context, mouseX, mouseY, delta)
recallButton.render(context, mouseX, mouseY, delta)
rangeButton.message = lang(if (pasturePCGUIConfiguration.editingRange) "ui.pasture.storage" else "ui.pasture.range")
val buttonX = rangeButton.x
val buttonY = rangeButton.y
val highlighted = pasturePCGUIConfiguration.editingRange || rangeButton.isMouseOver(mouseX.toDouble(), mouseY.toDouble())
blitk(matrixStack = context.pose(), texture = buttonResource, x = buttonX, y = buttonY,
width = 23, height = 17, textureWidth = 70, textureHeight = 34)
blitk(matrixStack = context.pose(), texture = buttonResource, x = buttonX + 23, y = buttonY,
width = 4, height = 17, uOffset = 66, textureWidth = 70, textureHeight = 34)
if (highlighted) context.fill(buttonX + 2, buttonY + 2, buttonX + 26, buttonY + 15, 0x88FFFFFF.toInt())
val gearSize = 11
val gearX = buttonX + (rangeButton.width - gearSize) / 2
val gearY = buttonY + (rangeButton.height - gearSize) / 2
if (highlighted) blitk(matrixStack = context.pose(), texture = gearResource,
x = gearX + 1, y = gearY, width = gearSize, height = gearSize,
red = 0.2F, green = 0.2F, blue = 0.2F)
blitk(matrixStack = context.pose(), texture = gearResource,
x = gearX, y = gearY, width = gearSize, height = gearSize)
}
override fun mouseClicked(pMouseX: Double, pMouseY: Double, pButton: Int): Boolean {
if (rangeButton.mouseClicked(pMouseX, pMouseY, pButton)) return true
if (recallButton.isHovered(pMouseX, pMouseY)) recallButton.mouseClicked(pMouseX, pMouseY, pButton)
if (pastureScrollList.isHovered(pMouseX, pMouseY)) pastureScrollList.mouseClicked(pMouseX, pMouseY, pButton)
return super.mouseClicked(pMouseX, pMouseY, pButton)
}
}
}
@@ -16,7 +16,6 @@ import com.cobblemon.mod.common.api.text.text
import com.cobblemon.mod.common.client.CobblemonResources
import com.cobblemon.mod.common.client.render.drawScaledText
import com.cobblemon.mod.common.util.cobblemonResource
import com.cobblemon.mod.common.util.lang
import net.minecraft.client.Minecraft
import net.minecraft.client.gui.GuiGraphics
import net.minecraft.client.resources.sounds.SimpleSoundInstance
@@ -65,9 +64,6 @@ class FilterWidget(
renderCursor(context, input)
if (iconHovered(mouseX, mouseY)) {
context.renderTooltip(Minecraft.getInstance().font, lang("ui.pc.filter.tooltip"), mouseX, mouseY)
}
}
override fun mouseClicked(mouseX: Double, mouseY: Double, button: Int): Boolean {
@@ -81,4 +77,4 @@ class FilterWidget(
fun iconHovered(mouseX: Int, mouseY: Int): Boolean = mouseX >= (x - 9) && mouseY >= (y + 3)
&& mouseX <= ((x - 9) + (ICON_SIZE * SCALE)) && mouseY <= ((y + 3) + (ICON_SIZE * SCALE))
}
}
@@ -20,6 +20,7 @@ import com.cobblemon.mod.common.client.CobblemonClient
import com.cobblemon.mod.common.client.CobblemonResources
import com.cobblemon.mod.common.client.gui.CobblemonRenderable
import com.cobblemon.mod.common.client.gui.ExitButton
import com.cobblemon.mod.common.client.gui.pasture.PasturePCGUIConfiguration
import com.cobblemon.mod.common.client.gui.TypeIcon
import com.cobblemon.mod.common.client.gui.summary.Summary
import com.cobblemon.mod.common.client.gui.summary.Summary.Companion.iconCosmeticItemResource
@@ -140,7 +141,10 @@ class PCGUI(
// Add Exit Button
this.addRenderableWidget(
ExitButton(pX = x + 320, pY = y + 186) {
if (::wallpaperWidget.isInitialized && wallpaperWidget.visible) {
if (storageWidget.editingPastureRange) {
setPastureRangeEditing(false)
playSound(CobblemonSounds.PC_CLICK)
} else if (::wallpaperWidget.isInitialized && wallpaperWidget.visible) {
wallpaperWidget.visible = false
configuration.showParty = true
for (button in optionButtons) button.highlighted = false
@@ -158,7 +162,7 @@ class PCGUI(
pX = x + 220,
pY = y + 16,
forward = true
) { storageWidget.box += 1 }
) { if (!storageWidget.editingPastureRange) storageWidget.box += 1 }
)
// Add Backwards Button
@@ -167,7 +171,7 @@ class PCGUI(
pX = x + 117,
pY = y + 16,
forward = false
) { storageWidget.box -= 1 }
) { if (!storageWidget.editingPastureRange) storageWidget.box -= 1 }
)
// Add Filter Widget
@@ -197,6 +201,8 @@ class PCGUI(
storageWidget = storageWidget
)
this.addRenderableWidget(boxNameWidget)
filterWidget.active = !storageWidget.editingPastureRange
boxNameWidget.active = !storageWidget.editingPastureRange
// Initialise box options if not pasture
if (storageWidget.pastureWidget == null) {
@@ -691,6 +697,10 @@ class PCGUI(
super.render(context, mouseX, mouseY, delta)
if (!storageWidget.editingPastureRange && filterWidget.iconHovered(mouseX, mouseY)) {
context.renderTooltip(Minecraft.getInstance().font, lang("ui.pc.filter.tooltip"), mouseX, mouseY)
}
// Item Tooltip
if (pokemon != null) {
val displayedItem = if (showCosmeticItem) pokemon.cosmeticItem else pokemon.heldItemNoCopy()
@@ -711,17 +721,34 @@ class PCGUI(
}
}
fun setPastureRangeEditing(editing: Boolean) {
val pasture = configuration as? PasturePCGUIConfiguration ?: return
pasture.editingRange = editing
if (!editing) storageWidget.pastureRangeWidget?.closeInfo()
filterWidget.active = !editing
boxNameWidget.active = !editing
focused = null
storageWidget.resetSelected()
}
override fun mouseClicked(mouseX: Double, mouseY: Double, button: Int): Boolean {
val rangeWidget = storageWidget.pastureRangeWidget
if (storageWidget.editingPastureRange && rangeWidget?.isInfoOpen == true &&
children().none { it is ExitButton && it.isHovered(mouseX, mouseY) }) {
return rangeWidget.mouseClicked(mouseX, mouseY, button)
}
// Trigger child component function as they will need to check the entire screen click area
if (::boxNameWidget.isInitialized) boxNameWidget.mouseClicked(mouseX, mouseY, button)
if (::boxNameWidget.isInitialized && !storageWidget.editingPastureRange) boxNameWidget.mouseClicked(mouseX, mouseY, button)
return super.mouseClicked(mouseX, mouseY, button)
}
override fun mouseScrolled(mouseX: Double, mouseY: Double, amount: Double, verticalAmount: Double): Boolean {
if (storageWidget.editingPastureRange &&
storageWidget.pastureRangeWidget?.mouseScrolled(mouseX, mouseY, amount, verticalAmount) == true) return true
storageWidget.pastureWidget?.let { pasture ->
if (pasture.pastureScrollList.isHovered) pasture.pastureScrollList.mouseScrolled(mouseX, mouseY, amount, verticalAmount)
}
if (storageWidget.isHovered && mouseX < (storageWidget.x + StorageWidget.SCREEN_WIDTH)) this.storageWidget.box -= verticalAmount.toInt()
if (!storageWidget.editingPastureRange && storageWidget.isHovered && mouseX < (storageWidget.x + StorageWidget.SCREEN_WIDTH)) this.storageWidget.box -= verticalAmount.toInt()
if (::wallpaperWidget.isInitialized && wallpaperWidget.isHovered) wallpaperWidget.mouseScrolled(mouseX, mouseY, amount, verticalAmount)
val infoBoxX = ((width - BASE_WIDTH) / 2) + 9
@@ -744,6 +771,11 @@ class PCGUI(
}
override fun keyPressed(keyCode: Int, scanCode: Int, modifiers: Int): Boolean {
if (storageWidget.editingPastureRange) {
if (keyCode != InputConstants.KEY_ESCAPE &&
storageWidget.pastureRangeWidget?.keyPressed(keyCode, scanCode, modifiers) == true) return true
if (keyCode == InputConstants.KEY_RIGHT || keyCode == InputConstants.KEY_LEFT) return true
}
val boxNameFocused = this::boxNameWidget.isInitialized && boxNameWidget.isFocused
val filterFocused = this::filterWidget.isInitialized && filterWidget.isFocused
@@ -19,6 +19,7 @@ import com.cobblemon.mod.common.client.CobblemonClient
import com.cobblemon.mod.common.client.CobblemonResources
import com.cobblemon.mod.common.client.gui.pasture.PasturePCGUIConfiguration
import com.cobblemon.mod.common.client.gui.pasture.PastureWidget
import com.cobblemon.mod.common.client.gui.pasture.PastureRangeWidget
import com.cobblemon.mod.common.client.gui.summary.widgets.SoundlessWidget
import com.cobblemon.mod.common.client.render.drawScaledText
import com.cobblemon.mod.common.client.render.gui.PCBoxWallpaperRepository
@@ -74,6 +75,9 @@ class StorageWidget(
private val releaseNoButton: ReleaseConfirmButton
var pastureWidget: PastureWidget? = null
val pastureRangeWidget = (pcGui.configuration as? PasturePCGUIConfiguration)?.let { PastureRangeWidget(x, y, it) }
val editingPastureRange: Boolean
get() = (pcGui.configuration as? PasturePCGUIConfiguration)?.editingRange == true
var displayConfirmRelease = false
var screenLoaded = false
@@ -218,6 +222,11 @@ class StorageWidget(
}
override fun renderWidget(context: GuiGraphics, mouseX: Int, mouseY: Int, delta: Float) {
if (editingPastureRange) {
pastureRangeWidget?.render(context, mouseX, mouseY, delta)
pastureWidget?.render(context, mouseX, mouseY, delta)
return
}
val matrices = context.pose()
// Party Label
if (pcGui.configuration.showParty) {
@@ -340,6 +349,10 @@ class StorageWidget(
}
override fun mouseClicked(pMouseX: Double, pMouseY: Double, pButton: Int): Boolean {
if (editingPastureRange) {
return pastureRangeWidget?.mouseClicked(pMouseX, pMouseY, pButton) == true ||
pastureWidget?.mouseClicked(pMouseX, pMouseY, pButton) == true
}
if (displayConfirmRelease) {
if (releaseYesButton.isHovered(pMouseX, pMouseY)) releaseYesButton.mouseClicked(pMouseX, pMouseY, pButton)
if (releaseNoButton.isHovered(pMouseX, pMouseY)) releaseNoButton.mouseClicked(pMouseX, pMouseY, pButton)
@@ -23,6 +23,8 @@ object OpenPastureHandler : ClientNetworkPacketHandler<OpenPasturePacket> {
pastureId = packet.pastureId,
limit = packet.limit,
permissions = packet.permissions,
range = packet.range,
facing = packet.facing,
pasturedPokemon = SettableObservable(packet.tetheredPokemon)
)
@@ -0,0 +1,26 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.client.net.pasture
import com.cobblemon.mod.common.CobblemonSounds
import com.cobblemon.mod.common.api.net.ClientNetworkPacketHandler
import com.cobblemon.mod.common.client.gui.pasture.PasturePCGUIConfiguration
import com.cobblemon.mod.common.client.gui.pc.PCGUI
import com.cobblemon.mod.common.net.messages.client.pasture.UpdatePastureRangePacket
import net.minecraft.client.Minecraft
import net.minecraft.client.resources.sounds.SimpleSoundInstance
object UpdatePastureRangeHandler : ClientNetworkPacketHandler<UpdatePastureRangePacket> {
override fun handle(packet: UpdatePastureRangePacket, client: Minecraft) {
val configuration = (client.screen as? PCGUI)?.configuration as? PasturePCGUIConfiguration ?: return
if (configuration.pastureId != packet.pastureId) return
configuration.range = packet.range
client.soundManager.play(SimpleSoundInstance.forUI(CobblemonSounds.PC_CLICK, 1F))
}
}
@@ -0,0 +1,24 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.client.net.pasture
import com.cobblemon.mod.common.api.net.ClientNetworkPacketHandler
import com.cobblemon.mod.common.client.gui.pc.PCGUI
import com.cobblemon.mod.common.net.messages.client.pasture.UpdatePastureRecoveryPacket
import net.minecraft.client.Minecraft
object UpdatePastureRecoveryHandler : ClientNetworkPacketHandler<UpdatePastureRecoveryPacket> {
override fun handle(packet: UpdatePastureRecoveryPacket, client: Minecraft) {
val slots = (client.screen as? PCGUI)?.storage?.pastureWidget?.pastureScrollList?.children() ?: return
slots.firstOrNull { it.pokemon.pokemonId == packet.pokemonId }?.pokemon?.apply {
healingAfterFaint = packet.fainted
respawnAt = packet.respawnAt
}
}
}
@@ -34,7 +34,7 @@ class DusclopsModel (root: ModelPart) : PokemonPosableModel(root) {
lateinit var battleidle: Pose
override fun registerPoses() {
animations["cry"] = "q.bedrock_stateful('squirtle', 'cry')".asExpressionLike()
animations["cry"] = "q.bedrock_stateful('dusclops', 'cry')".asExpressionLike()
val blink = quirk { bedrockStateful("dusclops", "blink") }
@@ -166,7 +166,6 @@ import net.minecraft.world.item.Items
import net.minecraft.world.level.Level
import net.minecraft.world.level.LightLayer
import net.minecraft.world.level.block.Blocks
import net.minecraft.world.level.block.HorizontalDirectionalBlock
import net.minecraft.world.level.block.SuspiciousEffectHolder
import net.minecraft.world.level.block.state.BlockState
import net.minecraft.world.level.gameevent.GameEvent
@@ -304,6 +303,7 @@ open class PokemonEntity(
var drops: DropTable? = null
var tethering: PokemonPastureBlockEntity.Tethering? = null
private var nextPastureReturnAttempt = 0
// TODO review if we still want this
var queuedToDespawn = false
@@ -738,34 +738,29 @@ open class PokemonEntity(
// Check to see if the entity needs recalled or repositioned if pastured.
fun checkPastureTether() {
// Teleport a pastured mon back to the pasture block if they are out of range
if (this.tethering != null && !this.tethering!!.box.contains(this.x, this.y, this.z)) {
// Gather the ideal position (behind the pastureBlock)
val pastureBlockPos = this.tethering!!.pasturePos
val state = this.level().getBlockState(pastureBlockPos)
// Check to ensure we are working with a pastureblock here and it hasn't been broken
if (state.block == CobblemonBlocks.PASTURE) {
val direction = state.getValue(HorizontalDirectionalBlock.FACING)
val width = this.boundingBox.xsize
val tpPos = pastureBlockPos.offset(direction.normal.multiply(ceil(width).toInt() + 1)).center
val heightAllowance = 4.0 // Allow spawning up to x blocks above the pastureBlock y level
// Attempt tp and recall if it fails
if (!this.randomTeleport(tpPos.x, tpPos.y + heightAllowance, tpPos.z, false)) {
// If the teleport was not successful then recall the mon
this.tethering = null
this.pokemon.recall()
} else {
// Stop any now invalid navigation post teleport
this.navigation.stop()
}
} else {
// If the block is destroyed or something else went wrong.
this.tethering = null
this.pokemon.recall()
}
val currentTethering = tethering ?: return
val world = level() as? ServerLevel ?: return
if (ticksLived == 1 && world.hasChunkAt(currentTethering.pasturePos)) {
val pasture = world.getBlockEntity(currentTethering.pasturePos) as? PokemonPastureBlockEntity
pasture?.tetheredPokemon?.find { it.tetheringId == currentTethering.tetheringId }?.let { tethering = it }
}
if (tethering!!.canRoamTo(x, z) || !world.hasChunkAt(currentTethering.pasturePos)) return
navigation.stop()
(moveControl as? PokemonMoveControl)?.apply { stop(); stopBanking() }
brain.eraseMemory(MemoryModuleType.WALK_TARGET)
deltaMovement = Vec3.ZERO
if (ticksLived < nextPastureReturnAttempt) return
val pasture = world.getBlockEntity(currentTethering.pasturePos) as? PokemonPastureBlockEntity
val position = pasture?.findSpawnPosition(this, blockPosition())
if (position != null) {
teleportTo(position.x, position.y, position.z)
nextPastureReturnAttempt = 0
} else if (pasture == null) {
tethering = null
pokemon.recall()
return
} else {
nextPastureReturnAttempt = ticksLived + 20
}
}
@@ -1800,7 +1795,7 @@ open class PokemonEntity(
removalObservable.emit(reason)
this.brain.clearMemories()
if (reason.shouldDestroy() && pokemon.tetheringId != null) {
if (reason.shouldDestroy() && pokemon.tetheringId != null && tethering == null) {
pokemon.tetheringId = null
}
if (evolutionEntity != null) {
@@ -29,6 +29,7 @@ import net.minecraft.tags.FluidTags
import net.minecraft.util.Mth
import net.minecraft.world.entity.ai.attributes.Attributes
import net.minecraft.world.entity.ai.control.MoveControl
import net.minecraft.world.entity.ai.memory.MemoryModuleType
import net.minecraft.world.level.material.FluidState
import net.minecraft.world.level.pathfinder.PathType
import net.minecraft.world.phys.AABB
@@ -106,7 +107,14 @@ class PokemonMoveControl(val pokemonEntity: PokemonEntity) : MoveControl(pokemon
if (banking) {
pokemonEntity.yRot += bankRightDegreesPerTick
pokemonEntity.travel(Vec3(0.0, bankUpwardsBlocksPerTick.toDouble(), bankForwardBlocksPerTick.toDouble()).scale(mediumSpeed.toDouble()))
val forward = bankForwardBlocksPerTick * mediumSpeed
val tethering = pokemonEntity.tethering
if (tethering?.canRoamTo(
pokemonEntity.x - Mth.sin(pokemonEntity.yRot.toRadians()) * forward,
pokemonEntity.z + Mth.cos(pokemonEntity.yRot.toRadians()) * forward
) != false) {
pokemonEntity.travel(Vec3(0.0, bankUpwardsBlocksPerTick.toDouble(), bankForwardBlocksPerTick.toDouble()).scale(mediumSpeed.toDouble()))
}
if (bankDurationTicks > 0) {
bankDurationTicks--
}
@@ -280,6 +288,16 @@ class PokemonMoveControl(val pokemonEntity: PokemonEntity) : MoveControl(pokemon
}
}
}
val tethering = pokemonEntity.tethering
val motion = mob.deltaMovement
if (tethering?.canRoamTo(mob.x, mob.z) == true &&
!tethering.canRoamTo(mob.x + motion.x, mob.z + motion.z)) {
mob.navigation.stop()
pokemonEntity.brain.eraseMemory(MemoryModuleType.WALK_TARGET)
stop()
stopBanking()
mob.deltaMovement = Vec3(0.0, motion.y, 0.0)
}
}
/*
@@ -369,4 +387,4 @@ class PokemonMoveControl(val pokemonEntity: PokemonEntity) : MoveControl(pokemon
strafeForwards = 0.0f
strafeRight = 0.0f
}
}
}
@@ -10,6 +10,7 @@ package com.cobblemon.mod.common.net.messages.client.pasture
import com.cobblemon.mod.common.api.net.NetworkPacket
import com.cobblemon.mod.common.api.pasture.PasturePermissions
import com.cobblemon.mod.common.api.pasture.PastureRange
import com.cobblemon.mod.common.client.net.pasture.OpenPastureHandler
import com.cobblemon.mod.common.entity.pokemon.PokemonBehaviourFlag
import com.cobblemon.mod.common.net.IntSize
@@ -19,6 +20,7 @@ import net.minecraft.world.item.ItemStack
import net.minecraft.network.RegistryFriendlyByteBuf
import net.minecraft.network.chat.Component
import net.minecraft.resources.ResourceLocation
import net.minecraft.core.Direction
/**
* Opens a pasture GUI using the provided data.
@@ -28,7 +30,7 @@ import net.minecraft.resources.ResourceLocation
* @author Hiroku
* @since April 9th, 2023
*/
class OpenPasturePacket(val pcId: UUID, val pastureId: UUID, val limit: Int, val tetheredPokemon: List<PasturePokemonDataDTO>, val permissions: PasturePermissions) : NetworkPacket<OpenPasturePacket> {
class OpenPasturePacket(val pcId: UUID, val pastureId: UUID, val limit: Int, val tetheredPokemon: List<PasturePokemonDataDTO>, val permissions: PasturePermissions, val range: PastureRange, val facing: Direction) : NetworkPacket<OpenPasturePacket> {
class PasturePokemonDataDTO(
val pokemonId: UUID,
val playerId: UUID,
@@ -39,7 +41,9 @@ class OpenPasturePacket(val pcId: UUID, val pastureId: UUID, val limit: Int, val
val heldItem: ItemStack,
val level: Int,
val entityKnown: Boolean,
var behaviourFlags: Set<PokemonBehaviourFlag> = emptySet()
var behaviourFlags: Set<PokemonBehaviourFlag> = emptySet(),
var healingAfterFaint: Boolean = false,
var respawnAt: Long = 0L
) {
companion object {
fun decode(buffer: RegistryFriendlyByteBuf): PasturePokemonDataDTO {
@@ -53,6 +57,8 @@ class OpenPasturePacket(val pcId: UUID, val pastureId: UUID, val limit: Int, val
val level = buffer.readSizedInt(IntSize.U_SHORT)
val entityKnown = buffer.readBoolean()
val behaviourFlags = buffer.readList { it.readEnumConstant(PokemonBehaviourFlag::class.java) }.toSet()
val healingAfterFaint = buffer.readBoolean()
val respawnAt = buffer.readLong()
return PasturePokemonDataDTO(
pokemonId = pokemonId,
@@ -64,7 +70,9 @@ class OpenPasturePacket(val pcId: UUID, val pastureId: UUID, val limit: Int, val
heldItem = heldItem,
level = level,
entityKnown = entityKnown,
behaviourFlags = behaviourFlags
behaviourFlags = behaviourFlags,
healingAfterFaint = healingAfterFaint,
respawnAt = respawnAt
)
}
}
@@ -80,6 +88,8 @@ class OpenPasturePacket(val pcId: UUID, val pastureId: UUID, val limit: Int, val
buffer.writeSizedInt(IntSize.U_SHORT, level)
buffer.writeBoolean(entityKnown)
buffer.writeCollection(behaviourFlags) { _, flag -> buffer.writeEnumConstant(flag) }
buffer.writeBoolean(healingAfterFaint)
buffer.writeLong(respawnAt)
}
}
@@ -95,7 +105,7 @@ class OpenPasturePacket(val pcId: UUID, val pastureId: UUID, val limit: Int, val
dtos.add(PasturePokemonDataDTO.decode(buffer))
}
val permissions = PasturePermissions.decode(buffer)
return OpenPasturePacket(pcId, pastureId, limit, dtos, permissions)
return OpenPasturePacket(pcId, pastureId, limit, dtos, permissions, PastureRange.decode(buffer), buffer.readEnum(Direction::class.java))
}
}
@@ -110,5 +120,7 @@ class OpenPasturePacket(val pcId: UUID, val pastureId: UUID, val limit: Int, val
tethered.encode(buffer)
}
permissions.encode(buffer)
range.encode(buffer)
buffer.writeEnum(facing)
}
}
@@ -0,0 +1,31 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.net.messages.client.pasture
import com.cobblemon.mod.common.api.net.NetworkPacket
import com.cobblemon.mod.common.api.pasture.PastureRange
import com.cobblemon.mod.common.util.cobblemonResource
import net.minecraft.network.RegistryFriendlyByteBuf
import java.util.UUID
class UpdatePastureRangePacket(val pastureId: UUID, val range: PastureRange) : NetworkPacket<UpdatePastureRangePacket> {
override val id = ID
override fun encode(buffer: RegistryFriendlyByteBuf) {
buffer.writeUUID(pastureId)
range.encode(buffer)
}
companion object {
val ID = cobblemonResource("update_pasture_range")
fun decode(buffer: RegistryFriendlyByteBuf) = UpdatePastureRangePacket(
buffer.readUUID(), PastureRange.decode(buffer)
)
}
}
@@ -0,0 +1,29 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.net.messages.client.pasture
import com.cobblemon.mod.common.api.net.NetworkPacket
import com.cobblemon.mod.common.util.cobblemonResource
import java.util.UUID
import net.minecraft.network.RegistryFriendlyByteBuf
data class UpdatePastureRecoveryPacket(val pokemonId: UUID, val fainted: Boolean, val respawnAt: Long) : NetworkPacket<UpdatePastureRecoveryPacket> {
override val id = ID
companion object {
val ID = cobblemonResource("update_pasture_recovery")
fun decode(buffer: RegistryFriendlyByteBuf) = UpdatePastureRecoveryPacket(buffer.readUUID(), buffer.readBoolean(), buffer.readLong())
}
override fun encode(buffer: RegistryFriendlyByteBuf) {
buffer.writeUUID(pokemonId)
buffer.writeBoolean(fainted)
buffer.writeLong(respawnAt)
}
}
@@ -0,0 +1,32 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.net.messages.server.pasture
import com.cobblemon.mod.common.api.net.NetworkPacket
import com.cobblemon.mod.common.util.cobblemonResource
import net.minecraft.core.Direction
import net.minecraft.network.RegistryFriendlyByteBuf
import java.util.UUID
class AdjustPastureRangePacket(val pastureId: UUID, val direction: Direction, val increase: Boolean) : NetworkPacket<AdjustPastureRangePacket> {
override val id = ID
override fun encode(buffer: RegistryFriendlyByteBuf) {
buffer.writeUUID(pastureId)
buffer.writeEnum(direction)
buffer.writeBoolean(increase)
}
companion object {
val ID = cobblemonResource("adjust_pasture_range")
fun decode(buffer: RegistryFriendlyByteBuf) = AdjustPastureRangePacket(
buffer.readUUID(), buffer.readEnum(Direction::class.java), buffer.readBoolean()
)
}
}
@@ -8,9 +8,12 @@
package com.cobblemon.mod.common.net.serverhandling.battle
import com.cobblemon.mod.common.Cobblemon
import com.cobblemon.mod.common.api.net.ServerNetworkPacketHandler
import com.cobblemon.mod.common.api.text.red
import com.cobblemon.mod.common.battles.BattleRegistry
import com.cobblemon.mod.common.battles.HealItemActionResponse
import com.cobblemon.mod.common.battles.MoveActionResponse
import com.cobblemon.mod.common.exception.IllegalActionChoiceException
import com.cobblemon.mod.common.net.messages.client.battle.BattleMakeChoicePacket
import com.cobblemon.mod.common.net.messages.client.battle.BattleQueueRequestPacket
@@ -25,6 +28,27 @@ object BattleSelectActionsHandler : ServerNetworkPacketHandler<BattleSelectActio
if (!actor.mustChoose) {
return
}
// Battle command injection attempt detection
packet.showdownActionResponses.asSequence()
.flatMap {
when (it) {
is MoveActionResponse -> sequenceOf(it.moveName, it.targetPnx, it.gimmickID)
is HealItemActionResponse -> sequenceOf(it.item)
else -> emptySequence()
}
}
.filterNotNull()
.firstOrNull { field -> field.any(Char::isISOControl) }
?.let {
// Escapes control chars as \uXXXX to prevent forging logs.
val printable = it.replace(Regex("\\p{Cc}")) { "\\u%04x".format(it.value[0].code) }
Cobblemon.LOGGER.warn("Blocked battle command injection from ${player.name.string}: $printable")
actor.sendUpdate(BattleQueueRequestPacket(actor.request!!))
actor.sendUpdate(BattleMakeChoicePacket())
return
}
try {
actor.setActionResponses(packet.showdownActionResponses)
} catch (e: IllegalActionChoiceException) {
@@ -0,0 +1,39 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.net.serverhandling.pasture
import com.cobblemon.mod.common.api.net.ServerNetworkPacketHandler
import com.cobblemon.mod.common.api.pasture.PastureLinkManager
import com.cobblemon.mod.common.api.pasture.PastureRange
import com.cobblemon.mod.common.block.entity.PokemonPastureBlockEntity
import com.cobblemon.mod.common.net.messages.client.pasture.UpdatePastureRangePacket
import com.cobblemon.mod.common.net.messages.server.pasture.AdjustPastureRangePacket
import net.minecraft.core.Direction
import net.minecraft.server.MinecraftServer
import net.minecraft.server.level.ServerPlayer
object AdjustPastureRangeHandler : ServerNetworkPacketHandler<AdjustPastureRangePacket> {
override fun handle(packet: AdjustPastureRangePacket, server: MinecraftServer, player: ServerPlayer) {
val link = PastureLinkManager.getLinkByPlayer(player) ?: return
if (link.linkId != packet.pastureId || packet.direction.axis == Direction.Axis.Y) return
val pasture = player.serverLevel().getBlockEntity(link.pos) as? PokemonPastureBlockEntity ?: return
val range = pasture.getRange().adjusted(packet.direction, if (packet.increase) 1 else -1)
if (!range.isValid(PastureRange.MAX_DISTANCE)) {
UpdatePastureRangePacket(link.linkId, pasture.getRange()).sendToPlayer(player)
return
}
pasture.setRange(range)
for (viewer in player.serverLevel().players()) {
val viewerLink = PastureLinkManager.getLinkByPlayer(viewer) ?: continue
if (viewerLink.pos == link.pos && viewerLink.dimension == link.dimension) {
UpdatePastureRangePacket(viewerLink.linkId, range).sendToPlayer(viewer)
}
}
}
}
@@ -9,24 +9,18 @@
package com.cobblemon.mod.common.net.serverhandling.pasture
import com.cobblemon.mod.common.api.net.ServerNetworkPacketHandler
import com.cobblemon.mod.common.entity.pokemon.PokemonBehaviourFlag
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
import com.cobblemon.mod.common.api.pasture.PastureLinkManager
import com.cobblemon.mod.common.block.entity.PokemonPastureBlockEntity
import com.cobblemon.mod.common.net.messages.server.pasture.SetPastureConflictPacket
import net.minecraft.server.MinecraftServer
import net.minecraft.server.level.ServerPlayer
import com.cobblemon.mod.common.net.messages.client.pasture.UpdatePastureConflictFlagPacket
object SetPastureConflictHandler : ServerNetworkPacketHandler<SetPastureConflictPacket> {
override fun handle(packet: SetPastureConflictPacket, server: MinecraftServer, player: ServerPlayer) {
val world = player.level()
val entity = world.getEntitiesOfClass(PokemonEntity::class.java, player.boundingBox.inflate(64.0))
.firstOrNull { it.pokemon.uuid == packet.pokemonId }
?: return
val link = PastureLinkManager.getLinkByPlayer(player) ?: return
val pasture = player.level().getBlockEntity(link.pos) as? PokemonPastureBlockEntity ?: return
val tethering = pasture.tetheredPokemon.firstOrNull { it.pokemonId == packet.pokemonId && it.playerId == player.uuid } ?: return
pasture.setConflict(tethering, packet.enabled)
entity.setBehaviourFlag(PokemonBehaviourFlag.PASTURE_CONFLICT, packet.enabled)
entity.remakeBrain()
// Send packet from the server to client GUI to update the toggle button
UpdatePastureConflictFlagPacket(packet.pokemonId, packet.enabled).sendToPlayer(player)
}
}
}
@@ -64,7 +64,7 @@
"rotation": "math.random_integer(0,3)*90"
},
"minecraft:particle_motion_parametric": {
"relative_position": ["-(v.target_deltax+((v.particle_random_1-0.5)*2))*(v.particle_age / v.particle_lifetime)", "(v.target_deltay+((v.particle_random_2-0.5)*2))*(v.particle_age / v.particle_lifetime)", "-v.target_deltaz*(v.particle_age / v.particle_lifetime)"]
"relative_position": ["-(v.target_deltax+((v.particle_random_1-0.5)*1.33))*(v.particle_age / v.particle_lifetime)", "(v.target_deltay+((v.particle_random_2-0.5)*1.33))*(v.particle_age / v.particle_lifetime)", "-v.target_deltaz*(v.particle_age / v.particle_lifetime)"]
},
"minecraft:particle_appearance_billboard": {
"size": ["0.4*v.rsize", "0.4*v.rsize"],
@@ -227,6 +227,14 @@
{"origin": [3.1, 20.8, -0.84], "size": [2, 1, 1], "inflate": 0.1, "uv": [60, 42]}
]
},
{
"name": "eyelid_closed_left",
"parent": "head_left",
"pivot": [3.6, 19.7, -0.91],
"cubes": [
{"origin": [2.1, 17.2, -0.66], "size": [3, 5, 1], "inflate": 0.25, "uv": [98, 2]}
]
},
{
"name": "face_ditto_left",
"parent": "head_left",
@@ -332,6 +340,14 @@
{"origin": [-5.1, 20.8, -0.84], "size": [2, 1, 1], "inflate": 0.1, "uv": [51, 42], "mirror": true}
]
},
{
"name": "eyelid_closed_right",
"parent": "head_right",
"pivot": [-3.6, 19.7, -0.91],
"cubes": [
{"origin": [-5.1, 17.2, -0.66], "size": [3, 5, 1], "inflate": 0.25, "uv": [89, 2], "mirror": true}
]
},
{
"name": "face_ditto_right",
"parent": "head_right",
@@ -134,229 +134,114 @@
"jaw2": [0, 27, -7.35]
}
},
{
"name": "head_right",
"parent": "head_angle",
"pivot": [-3.525, 31, 0.25],
"rotation": [5, 0, 0],
"cubes": [
{"origin": [-4.525, 29.5, -4.75], "size": [2, 5, 5], "uv": [51, 11]},
{"origin": [-3.625, 31.5, 0.25], "size": [0, 3, 5], "uv": [52, 55]}
]
},
{
"name": "locator_eye_right",
"parent": "head_right",
"pivot": [-4.5, 31, -2.5],
"rotation": [0, 90, 0],
"locators": {
"eye1": [-4.5, 31, -2.5]
}
},
{
"name": "eye_right",
"parent": "head_right",
"pivot": [-4.525, 31.35, -2.25],
"cubes": [
{"origin": [-4.525, 28.85, -4.25], "size": [1, 5, 4], "inflate": 0.01, "uv": [66, 2], "mirror": true}
]
},
{
"name": "eye_neutral_right",
"parent": "eye_right",
"pivot": [-4.525, 32.85095, -2.27179],
"cubes": [
{"origin": [-4.505, 31.85, -4.25], "size": [1, 2, 4], "inflate": 0.05, "uv": [66, 12], "mirror": true}
]
},
{
"name": "eye_angry_right",
"parent": "eye_right",
"pivot": [-4.435, 32.1, -2.5],
"cubes": [
{"origin": [-4.405, 30.85, -4.25], "size": [1, 3, 4], "inflate": 0.05, "uv": [66, 26], "mirror": true},
{"origin": [-4.44, 31.35, -3.27], "size": [1, 1, 1], "inflate": 0.02, "uv": [73, 27], "mirror": true}
]
},
{
"name": "eye_sad_right",
"parent": "eye_right",
"pivot": [-4.435, 32.85, -2.5],
"cubes": [
{"origin": [-4.405, 31.85, -4.25], "size": [1, 2, 4], "inflate": 0.05, "uv": [66, 19], "mirror": true},
{"origin": [-4.44, 32.35, -3.27], "size": [1, 1, 1], "inflate": 0.02, "uv": [73, 20], "mirror": true}
]
},
{
"name": "pupil_right",
"parent": "eye_right",
"pivot": [-4.525, 30.85095, -3.02179],
"cubes": [
{"origin": [-4.525, 29.35, -4.04], "size": [1, 3, 2], "inflate": 0.02, "uv": [73, 0], "mirror": true}
]
},
{
"name": "pupil_right2",
"parent": "pupil_right",
"pivot": [-4.55, 31.35095, -3.02179],
"cubes": [
{"origin": [-4.55, 30.35, -3.55], "size": [1, 2, 1], "uv": [84, 2], "mirror": true}
]
},
{
"name": "eyelid_right",
"parent": "head_right",
"pivot": [-3.925, 31.35095, -2.27179],
"cubes": [
{"origin": [-4.425, 28.85, -4.25], "size": [1, 5, 4], "inflate": 0.01, "uv": [77, 2], "mirror": true}
]
},
{
"name": "pupil_eyelid_right",
"parent": "eyelid_right",
"pivot": [-4.425, 30.80095, -2.27179],
"cubes": [
{"origin": [-4.435, 30.3, -3.75], "size": [1, 1, 3], "inflate": 0.01, "uv": [77, 14], "mirror": true}
]
},
{
"name": "eyelid_right2",
"parent": "eyelid_right",
"pivot": [-3.925, 32.85095, -2.27179],
"cubes": [
{"origin": [-4.405, 31.85, -4.25], "size": [1, 2, 4], "inflate": 0.05, "uv": [66, 12], "mirror": true}
]
},
{
"name": "pupil_happy_right",
"parent": "eyelid_right",
"pivot": [-4.325, 30.80095, -2.27179],
"cubes": [
{"origin": [-4.325, 30.30095, -3.77179], "size": [1, 2, 3], "inflate": 0.05, "uv": [77, 20], "mirror": true}
]
},
{
"name": "face_ditto_right",
"parent": "head_right",
"pivot": [-4.435, 32, -2.25]
},
{
"name": "eye_ditto_right",
"parent": "face_ditto_right",
"pivot": [-4.435, 32, -2.25],
"cubes": [
{"origin": [-4.435, 31.5, -2.75], "size": [0, 1, 1], "uv": [113, 1]}
]
},
{
"name": "eye_closed_ditto_right",
"parent": "face_ditto_right",
"pivot": [-4.335, 32, -2.25],
"cubes": [
{"origin": [-4.335, 31.5, -3.25], "size": [0, 1, 2], "uv": [112, 2]},
{"origin": [-4.345, 32, -2.75], "size": [0, 1, 1], "uv": [113, 5]}
]
},
{
"name": "head_left",
"parent": "head_angle",
"pivot": [3.525, 31, 0.25],
"pivot": [3.53, 31, 0.25],
"rotation": [5, 0, 0],
"cubes": [
{"origin": [2.525, 29.5, -4.75], "size": [2, 5, 5], "uv": [51, 21], "mirror": true},
{"origin": [3.625, 31.5, 0.25], "size": [0, 3, 5], "uv": [40, 55], "mirror": true}
{"origin": [2.53, 29.5, -4.75], "size": [2, 5, 5], "uv": [51, 21], "mirror": true},
{"origin": [3.63, 31.5, 0.25], "size": [0, 3, 5], "uv": [40, 55], "mirror": true}
]
},
{
"name": "locator_eye_left",
"parent": "head_left",
"pivot": [4.5, 31, -2.5],
"rotation": [0, -90, 0],
"locators": {
"eye2": [4.5, 31, -2.5]
}
},
{
"name": "eye_left",
"parent": "head_left",
"pivot": [4.525, 31.35, -2.25],
"pivot": [4.53, 31.5, -2.25],
"cubes": [
{"origin": [3.525, 28.85, -4.25], "size": [1, 5, 4], "inflate": 0.01, "uv": [88, 2]}
{"origin": [3.54, 29, -4.25], "size": [1, 5, 4], "uv": [88, 2]}
]
},
{
"name": "eye_neutral_left",
"parent": "eye_left",
"pivot": [4.525, 32.85095, -2.27179],
"pivot": [4.54, 33, -2.25],
"cubes": [
{"origin": [3.505, 31.85, -4.25], "size": [1, 2, 4], "inflate": 0.05, "uv": [88, 12]}
{"origin": [3.54, 32, -4.25], "size": [1, 2, 4], "inflate": 0.021, "uv": [88, 12]}
]
},
{
"name": "eye_angry_left",
"parent": "eye_left",
"pivot": [4.435, 32.1, -2.5],
"pivot": [4.44, 32.5, -2.25],
"cubes": [
{"origin": [3.405, 30.85, -4.25], "size": [1, 3, 4], "inflate": 0.05, "uv": [88, 26]},
{"origin": [3.44, 31.35, -3.27], "size": [1, 1, 1], "inflate": 0.02, "uv": [95, 27]}
{"origin": [3.44, 31, -4.25], "size": [1, 3, 4], "inflate": 0.021, "uv": [88, 26]},
{"origin": [3.44, 31.5, -3.25], "size": [1, 1, 1], "inflate": 0.03, "uv": [95, 27]}
]
},
{
"name": "eye_sad_left",
"parent": "eye_left",
"pivot": [4.435, 32.85, -2.5],
"pivot": [4.43, 33, -2.25],
"cubes": [
{"origin": [3.405, 31.85, -4.25], "size": [1, 2, 4], "inflate": 0.05, "uv": [88, 19]},
{"origin": [3.44, 32.35, -3.27], "size": [1, 1, 1], "inflate": 0.02, "uv": [95, 20]}
{"origin": [3.44, 32, -4.25], "size": [1, 2, 4], "inflate": 0.021, "uv": [88, 19]},
{"origin": [3.44, 32.5, -3.25], "size": [1, 1, 1], "inflate": 0.03, "uv": [95, 20]}
]
},
{
"name": "pupil_left",
"parent": "eye_left",
"pivot": [4.525, 30.85095, -3.02179],
"pivot": [4.55, 31, -3.05],
"cubes": [
{"origin": [3.525, 29.35, -4.04], "size": [1, 3, 2], "inflate": 0.02, "uv": [95, 0]}
{"origin": [3.55, 29.5, -4.05], "size": [1, 3, 2], "uv": [95, 0]}
]
},
{
"name": "pupil_left2",
"name": "eye_shine_left",
"parent": "pupil_left",
"pivot": [4.55, 31.35095, -3.02179],
"pivot": [4.55, 31.5, -3.05],
"cubes": [
{"origin": [3.55, 30.35, -3.55], "size": [1, 2, 1], "uv": [106, 2]}
{"origin": [3.56, 30.5, -3.55], "size": [1, 2, 1], "uv": [106, 2]}
]
},
{
"name": "open_eye_left",
"parent": "head_left",
"pivot": [4.44, 31.5, -2.25],
"cubes": [
{"origin": [3.44, 29, -4.25], "size": [1, 5, 4], "uv": [99, 2]}
]
},
{
"name": "open_pupil_left",
"parent": "open_eye_left",
"pivot": [4.45, 31.5, -2.25],
"cubes": [
{"origin": [3.45, 31, -3.75], "size": [1, 1, 3], "uv": [99, 14]}
]
},
{
"name": "open_neutral_left",
"parent": "open_eye_left",
"pivot": [4.34, 33, -2.25],
"cubes": [
{"origin": [3.34, 32, -4.25], "size": [1, 2, 4], "inflate": 0.021, "uv": [88, 12]}
]
},
{
"name": "open_happy_left",
"parent": "open_eye_left",
"pivot": [4.35, 32, -2.25],
"cubes": [
{"origin": [3.35, 31, -3.75], "size": [1, 2, 3], "uv": [99, 20]}
]
},
{
"name": "eyelid_left",
"parent": "head_left",
"pivot": [3.925, 31.35095, -2.27179],
"pivot": [4.44, 31.5, -2.25],
"cubes": [
{"origin": [3.425, 28.85, -4.25], "size": [1, 5, 4], "inflate": 0.01, "uv": [99, 2]}
{"origin": [3.44, 29, -4.25], "size": [1, 5, 4], "inflate": 0.022, "uv": [99, 26]}
]
},
{
"name": "pupil_eyelid_left",
"parent": "eyelid_left",
"pivot": [4.425, 30.80095, -2.27179],
"cubes": [
{"origin": [3.435, 30.3, -3.75], "size": [1, 1, 3], "inflate": 0.01, "uv": [99, 14]}
]
},
{
"name": "eyelid_left2",
"parent": "eyelid_left",
"pivot": [3.925, 32.85095, -2.27179],
"cubes": [
{"origin": [3.405, 31.85, -4.25], "size": [1, 2, 4], "inflate": 0.05, "uv": [88, 12]}
]
},
{
"name": "pupil_happy_left",
"parent": "eyelid_left",
"pivot": [4.325, 30.80095, -2.27179],
"cubes": [
{"origin": [3.325, 30.30095, -3.77179], "size": [1, 2, 3], "inflate": 0.05, "uv": [99, 20]}
]
"name": "locator_eye_left",
"parent": "head_left",
"pivot": [4.54, 31, -2.46],
"rotation": [0, -90, 0],
"locators": {
"eye2": [4.54, 31, -2.46]
}
},
{
"name": "face_ditto_left",
@@ -368,7 +253,7 @@
"parent": "face_ditto_left",
"pivot": [4.435, 32, -2.25],
"cubes": [
{"origin": [4.435, 31.5, -2.75], "size": [0, 1, 1], "uv": [118, 1], "mirror": true}
{"origin": [4.435, 31.5, -2.75], "size": [0, 1, 1], "uv": [113, 1]}
]
},
{
@@ -376,8 +261,139 @@
"parent": "face_ditto_left",
"pivot": [4.335, 32, -2.25],
"cubes": [
{"origin": [4.335, 31.5, -3.25], "size": [0, 1, 2], "uv": [117, 2], "mirror": true},
{"origin": [4.345, 32, -2.75], "size": [0, 1, 1], "uv": [118, 5], "mirror": true}
{"origin": [4.335, 31.5, -3.25], "size": [0, 1, 2], "uv": [112, 2]},
{"origin": [4.345, 32, -2.75], "size": [0, 1, 1], "uv": [113, 5]}
]
},
{
"name": "head_right",
"parent": "head_angle",
"pivot": [-3.53, 31, 0.25],
"rotation": [5, 0, 0],
"cubes": [
{"origin": [-4.53, 29.5, -4.75], "size": [2, 5, 5], "uv": [51, 11]},
{"origin": [-3.63, 31.5, 0.25], "size": [0, 3, 5], "uv": [40, 55]}
]
},
{
"name": "eye_right",
"parent": "head_right",
"pivot": [-4.53, 31.5, -2.25],
"cubes": [
{"origin": [-4.54, 29, -4.25], "size": [1, 5, 4], "uv": [66, 2], "mirror": true}
]
},
{
"name": "eye_neutral_right",
"parent": "eye_right",
"pivot": [-4.54, 33, -2.25],
"cubes": [
{"origin": [-4.54, 32, -4.25], "size": [1, 2, 4], "inflate": 0.021, "uv": [66, 12], "mirror": true}
]
},
{
"name": "eye_angry_right",
"parent": "eye_right",
"pivot": [-4.44, 32.5, -2.25],
"cubes": [
{"origin": [-4.44, 31, -4.25], "size": [1, 3, 4], "inflate": 0.021, "uv": [66, 26], "mirror": true},
{"origin": [-4.44, 31.5, -3.25], "size": [1, 1, 1], "inflate": 0.03, "uv": [73, 27], "mirror": true}
]
},
{
"name": "eye_sad_right",
"parent": "eye_right",
"pivot": [-4.43, 33, -2.25],
"cubes": [
{"origin": [-4.44, 32, -4.25], "size": [1, 2, 4], "inflate": 0.021, "uv": [66, 19], "mirror": true},
{"origin": [-4.44, 32.5, -3.25], "size": [1, 1, 1], "inflate": 0.03, "uv": [73, 20], "mirror": true}
]
},
{
"name": "pupil_right",
"parent": "eye_right",
"pivot": [-4.55, 31, -3.05],
"cubes": [
{"origin": [-4.55, 29.5, -4.05], "size": [1, 3, 2], "uv": [73, 0], "mirror": true}
]
},
{
"name": "eye_shine_right",
"parent": "pupil_right",
"pivot": [-4.55, 31.5, -3.05],
"cubes": [
{"origin": [-4.56, 30.5, -3.55], "size": [1, 2, 1], "uv": [84, 2], "mirror": true}
]
},
{
"name": "open_eye_right",
"parent": "head_right",
"pivot": [-4.44, 31.5, -2.25],
"cubes": [
{"origin": [-4.44, 29, -4.25], "size": [1, 5, 4], "uv": [77, 2], "mirror": true}
]
},
{
"name": "open_pupil_right",
"parent": "open_eye_right",
"pivot": [-4.45, 31.5, -2.25],
"cubes": [
{"origin": [-4.45, 31, -3.75], "size": [1, 1, 3], "uv": [77, 14], "mirror": true}
]
},
{
"name": "open_neutral_right",
"parent": "open_eye_right",
"pivot": [-4.34, 33, -2.25],
"cubes": [
{"origin": [-4.34, 32, -4.25], "size": [1, 2, 4], "inflate": 0.021, "uv": [66, 12], "mirror": true}
]
},
{
"name": "open_happy_right",
"parent": "open_eye_right",
"pivot": [-4.35, 32, -2.25],
"cubes": [
{"origin": [-4.35, 31, -3.75], "size": [1, 2, 3], "uv": [77, 20], "mirror": true}
]
},
{
"name": "eyelid_right",
"parent": "head_right",
"pivot": [-4.44, 31.5, -2.25],
"cubes": [
{"origin": [-4.44, 29, -4.25], "size": [1, 5, 4], "inflate": 0.022, "uv": [77, 26], "mirror": true}
]
},
{
"name": "locator_eye_right",
"parent": "head_right",
"pivot": [-4.54, 31, -2.46],
"rotation": [0, 90, 0],
"locators": {
"eye1": [-4.54, 31, -2.46]
}
},
{
"name": "face_ditto_right",
"parent": "head_right",
"pivot": [-4.435, 32, -2.25]
},
{
"name": "eye_ditto_right",
"parent": "face_ditto_right",
"pivot": [-4.435, 32, -2.25],
"cubes": [
{"origin": [-4.435, 31.5, -2.75], "size": [0, 1, 1], "uv": [118, 1], "mirror": true}
]
},
{
"name": "eye_closed_ditto_right",
"parent": "face_ditto_right",
"pivot": [-4.335, 32, -2.25],
"cubes": [
{"origin": [-4.335, 31.5, -3.25], "size": [0, 1, 2], "uv": [117, 2], "mirror": true},
{"origin": [-4.345, 32, -2.75], "size": [0, 1, 1], "uv": [118, 5], "mirror": true}
]
},
{
@@ -830,11 +830,6 @@
{"origin": [-3.5, 38.3, 33.75], "size": [7, 5, 9], "uv": [106, 33]}
]
},
{
"name": "tongue6",
"parent": "tongue5",
"pivot": [0, 40.8, 40.5]
},
{
"name": "muzzle",
"parent": "head_angle",
@@ -913,6 +908,15 @@
{"origin": [-0.1, 44.3, -8.11], "size": [4, 2, 1], "uv": [87, 72]}
]
},
{
"name": "eyelid_base_left",
"parent": "eye_left_base",
"pivot": [1.9, 43.9, -8.11],
"cubes": [
{"origin": [-0.1, 45.3, -8.11], "size": [4, 1, 1], "uv": [87, 76]},
{"origin": [-0.1, 41.9, -8.11], "size": [4, 4, 1], "uv": [87, 79]}
]
},
{
"name": "eye_left",
"parent": "eye_left_base",
@@ -950,7 +954,7 @@
"parent": "eye_left",
"pivot": [1.9, 44.2, -8.07],
"cubes": [
{"origin": [0.4, 43.7, -8.07], "size": [3, 1, 1], "inflate": 0.02, "uv": [87, 76]}
{"origin": [0.4, 43.7, -8.07], "size": [3, 1, 1], "inflate": 0.02, "uv": [87, 85]}
]
},
{
@@ -958,7 +962,7 @@
"parent": "eye_left",
"pivot": [1.9, 44.2, -8.07],
"cubes": [
{"origin": [0.4, 42.95, -8.07], "size": [3, 2, 1], "inflate": 0.02, "uv": [87, 79]}
{"origin": [0.4, 42.95, -8.07], "size": [3, 2, 1], "inflate": 0.02, "uv": [87, 88]}
]
},
{
@@ -995,6 +999,15 @@
{"origin": [-3.9, 44.3, -8.11], "size": [4, 2, 1], "uv": [76, 72], "mirror": true}
]
},
{
"name": "eyelid_base_right",
"parent": "eye_right_base",
"pivot": [-1.9, 43.9, -8.11],
"cubes": [
{"origin": [-3.9, 45.3, -8.11], "size": [4, 1, 1], "uv": [76, 76], "mirror": true},
{"origin": [-3.9, 41.9, -8.11], "size": [4, 4, 1], "uv": [76, 79], "mirror": true}
]
},
{
"name": "eye_right",
"parent": "eye_right_base",
@@ -1032,7 +1045,7 @@
"parent": "eye_right",
"pivot": [-1.9, 44.2, -8.07],
"cubes": [
{"origin": [-3.4, 43.7, -8.07], "size": [3, 1, 1], "inflate": 0.02, "uv": [76, 76], "mirror": true}
{"origin": [-3.4, 43.7, -8.07], "size": [3, 1, 1], "inflate": 0.02, "uv": [76, 85], "mirror": true}
]
},
{
@@ -1040,7 +1053,7 @@
"parent": "eye_right",
"pivot": [-1.9, 44.2, -8.07],
"cubes": [
{"origin": [-3.4, 42.95, -8.07], "size": [3, 2, 1], "inflate": 0.02, "uv": [76, 79], "mirror": true}
{"origin": [-3.4, 42.95, -8.07], "size": [3, 2, 1], "inflate": 0.02, "uv": [76, 88], "mirror": true}
]
},
{
@@ -8,7 +8,6 @@
"poses": {
"standing": {
"poseTypes": ["STAND", "NONE", "PORTRAIT", "PROFILE"],
"isBattle": false,
"animations": [
"q.look('neck', 1, 1, 70, -10, 20, -20)",
"q.look('head_ai')",
@@ -35,6 +34,9 @@
"part": "wing_closed_left",
"isVisible": true
}
],
"quirks": [
"q.bedrock_quirk('fearow', 'blink')"
]
},
"walking": {
@@ -65,6 +67,9 @@
"part": "wing_closed_left",
"isVisible": true
}
],
"quirks": [
"q.bedrock_quirk('fearow', 'blink')"
]
},
"hover": {
@@ -96,6 +101,9 @@
"part": "wing_closed_left",
"isVisible": false
}
],
"quirks": [
"q.bedrock_quirk('fearow', 'blink')"
]
},
"fly": {
@@ -128,6 +136,9 @@
"part": "wing_closed_left",
"isVisible": false
}
],
"quirks": [
"q.bedrock_quirk('fearow', 'blink')"
]
},
"sleep": {
@@ -27,7 +27,7 @@
"q.look('head_ai')",
"q.bedrock('froakie', 'ground_idle')"
],
"quirks": []
"quirks": ["q.bedrock_quirk('froakie', 'blink')"]
},
"walking": {
"poseTypes": ["WALK"],
@@ -36,7 +36,7 @@
"q.look('head_ai')",
"q.bedrock('froakie', 'ground_walk')"
],
"quirks": []
"quirks": ["q.bedrock_quirk('froakie', 'blink')"]
},
"swimming": {
"poseTypes": ["WALK","SWIM"],
@@ -46,7 +46,7 @@
"q.look('head_ai')",
"q.bedrock('froakie', 'water_swim')"
],
"quirks": []
"quirks": ["q.bedrock_quirk('froakie', 'blink')"]
},
"float": {
"poseTypes": ["STAND","FLOAT"],
@@ -55,7 +55,7 @@
"q.look('head_ai')",
"q.bedrock('froakie', 'water_idle')"
],
"quirks": []
"quirks": ["q.bedrock_quirk('froakie', 'blink')"]
},
"sleep": {
"poseTypes": ["SLEEP"],
@@ -27,7 +27,7 @@
"q.look('head_ai', 1, 1, 5, -45, 45, -45)",
"q.bedrock('frogadier', 'ground_idle')"
],
"quirks": []
"quirks": ["q.bedrock_quirk('frogadier', 'blink')"]
},
"walking": {
"poseTypes": ["WALK"],
@@ -36,7 +36,7 @@
"q.look('head_ai', 1, 1, 0, -45, 45, -45)",
"q.bedrock('frogadier', 'ground_walk')"
],
"quirks": []
"quirks": ["q.bedrock_quirk('frogadier', 'blink')"]
},
"swimming": {
"poseTypes": ["WALK","SWIM"],
@@ -46,7 +46,7 @@
"q.look('head_ai')",
"q.bedrock('frogadier', 'water_swim')"
],
"quirks": []
"quirks": ["q.bedrock_quirk('frogadier', 'blink')"]
},
"float": {
"poseTypes": ["STAND","FLOAT"],
@@ -55,7 +55,7 @@
"q.look('head_ai')",
"q.bedrock('frogadier', 'water_idle')"
],
"quirks": []
"quirks": ["q.bedrock_quirk('frogadier', 'blink')"]
},
"sleep": {
"poseTypes": ["SLEEP"],
@@ -66,7 +66,7 @@
"q.bedrock('greninja', math.random(0, 1) < 0.4 ? 'ground_idle_alt' : 'ground_idle')"
],
"quirks": [
"q.bedrock_quirk('greninja', q.array('quirk_look_left', 'quirk_look_right'), 8, 30, 1)"
"q.bedrock_quirk('greninja', 'blink')","q.bedrock_quirk('greninja', q.array('quirk_look_left', 'quirk_look_right'), 8, 30, 1)"
]
},
"walking": {
@@ -78,7 +78,7 @@
"q.look('tongue1', -1, 1, 70, -45, 0, 0)",
"q.bedrock('greninja', 'ground_walk')"
],
"quirks": []
"quirks": ["q.bedrock_quirk('greninja', 'blink')"]
},
"running": {
"poseTypes": ["WALK"],
@@ -89,7 +89,7 @@
"q.look('tongue1', -1, 1, 70, -45, 0, 0)",
"q.bedrock('greninja', 'ground_run')"
],
"quirks": []
"quirks": ["q.bedrock_quirk('greninja', 'blink')"]
},
"surface-swimming": {
"poseTypes": ["WALK","SWIM"],
@@ -101,7 +101,7 @@
"q.look('tongue1', -1, 1, 70, -45, 0, 0)",
"q.bedrock('greninja', 'water_swim')"
],
"quirks": [],
"quirks": ["q.bedrock_quirk('greninja', 'blink')"],
"transformedParts": [
{
"part": "body",
@@ -118,7 +118,7 @@
"q.look('tongue1', -1, 1, 70, -45, 0, 0)",
"q.bedrock('greninja', 'water_idle')"
],
"quirks": [],
"quirks": ["q.bedrock_quirk('greninja', 'blink')"],
"transformedParts": [
{
"part": "body",
@@ -136,7 +136,7 @@
"q.look('tongue1', -1, 1, 70, -45, 0, 0)",
"q.bedrock('greninja', 'water_swim')"
],
"quirks": [],
"quirks": ["q.bedrock_quirk('greninja', 'blink')"],
"transformedParts": [
{
"part": "body",
@@ -153,7 +153,7 @@
"q.look('tongue1', -1, 1, 70, -45, 0, 0)",
"q.bedrock('greninja', 'water_idle')"
],
"quirks": [],
"quirks": ["q.bedrock_quirk('greninja', 'blink')"],
"transformedParts": [
{
"part": "body",
@@ -383,7 +383,7 @@
"item.cobblemon.eject_pack.tooltip_1": "Switches out the holder if any stats are lowered",
"item.cobblemon.eject_pack.tooltip_2": "Consumed after use",
"item.cobblemon.electric_seed": "Electric Seed",
"item.cobblemon.electric_seed.tooltip": "Boosts the holder's Defense in Electric terrain",
"item.cobblemon.electric_seed.tooltip": "Boosts the holder's Defense in Electric Terrain",
"item.cobblemon.everstone": "Everstone",
"item.cobblemon.everstone.tooltip": "Prevents the holder from evolving",
"item.cobblemon.eviolite": "Eviolite",
@@ -402,7 +402,7 @@
"item.cobblemon.focus_sash.tooltip_1": "Prevents the holder from fainting in a single hit",
"item.cobblemon.focus_sash.tooltip_2": "Consumed after use",
"item.cobblemon.grassy_seed": "Grassy Seed",
"item.cobblemon.grassy_seed.tooltip": "Boosts the holder's Defense in Grassy terrain",
"item.cobblemon.grassy_seed.tooltip": "Boosts the holder's Defense in Grassy Terrain",
"item.cobblemon.grip_claw": "Grip Claw",
"item.cobblemon.hard_stone": "Hard Stone",
"item.cobblemon.hard_stone.tooltip": "Boosts the power of the holder's Rock-type moves",
@@ -507,7 +507,7 @@
"item.cobblemon.mirror_herb.tooltip_1": "Allows the holder to mirror an opponent's stat increases to boost its own stats",
"item.cobblemon.mirror_herb.tooltip_2": "Consumed after use",
"item.cobblemon.misty_seed": "Misty Seed",
"item.cobblemon.misty_seed.tooltip": "Boosts the holder's Sp. Def in Misty terrain",
"item.cobblemon.misty_seed.tooltip": "Boosts the holder's Sp. Def in Misty Terrain",
"item.cobblemon.power_herb": "Power Herb",
"item.cobblemon.power_herb.tooltip_1": "Allows the holder to immediately use a move that normally requires a change of turn to charge",
"item.cobblemon.power_herb.tooltip_2": "Consumed after use",
@@ -535,7 +535,7 @@
"item.cobblemon.power_weight": "Power Weight",
"item.cobblemon.power_weight.tooltip": "Grants 8 HP EVs when gaining experience in battle",
"item.cobblemon.psychic_seed": "Psychic Seed",
"item.cobblemon.psychic_seed.tooltip": "Boosts the holder's Sp. Def in Psychic terrain",
"item.cobblemon.psychic_seed.tooltip": "Boosts the holder's Sp. Def in Psychic Terrain",
"item.cobblemon.flame_orb": "Flame Orb",
"item.cobblemon.flame_orb.tooltip": "Burns the holder",
"item.cobblemon.smoke_ball": "Smoke Ball",
@@ -1307,6 +1307,18 @@
"cobblemon.ui.sort.discovered": "Sort by discovered status",
"cobblemon.ui.pasture": "Pasture",
"cobblemon.ui.pasture.recall_all": "Recall All",
"cobblemon.ui.pasture.range": "Range",
"cobblemon.ui.pasture.storage": "PC",
"cobblemon.ui.pasture.fainted": "Fainted",
"cobblemon.ui.pasture.returning": "Returning",
"cobblemon.ui.pasture.ready": "Waiting",
"cobblemon.ui.pasture.range.left_click": "Left click",
"cobblemon.ui.pasture.range.right_click": "Right click",
"cobblemon.ui.pasture.range.help_title": "Range controls",
"cobblemon.ui.pasture.range.increase": "Increase",
"cobblemon.ui.pasture.range.decrease": "Decrease",
"cobblemon.ui.pasture.range.scroll_up": "Scroll up",
"cobblemon.ui.pasture.range.scroll_down": "Scroll down",
"cobblemon.pasture.too_many_nearby": "There are too many Pokémon nearby.",
"cobblemon.ui.interact.give.item": "Change held item",
"cobblemon.ui.interact.give.cosmetic_item": "Change cosmetic item",
@@ -6526,7 +6526,7 @@
"cobblemon.move.10000000voltthunderbolt": "1000만볼트",
"cobblemon.species.unown-x.desc": "고대 문자를 닮은 모습의 포켓몬이다. 먼저 생겨난 것은 문자인가 안농인가. 연구 중이지만 아직도 수수께끼다.",
"cobblemon.ui.pokedex.info.form.qwilfish-hisui": "히스이의 모습",
"cobblemon.ui.pokedex.info.form.groudon-primal": "원시그란돈",
"cobblemon.ui.pokedex.info.form.groudon-primal": "원시회귀",
"cobblemon.ui.pokedex.info.form.burmy-sandy": "모래땅도롱",
"cobblemon.ui.pokedex.info.form.abomasnow-mega": "메가눈설왕",
"cobblemon.species.rotom-frost.desc": "특수한 모터로 움직이는 냉장고에 들어갔다. 냉기를 뿜으며 싸운다.",
@@ -6758,7 +6758,7 @@
"cobblemon.species.salamence-mega.desc": "앞다리를 껍질 틈에 얹어서 비행 태세를 갖춘다. 복잡한 지형도 고속으로 날아다닌다.",
"cobblemon.species.metagross-mega.desc": "이길 수 없다고 판단하면 발톱으로 상대를 붙잡고 대폭발의 카운트를 시작한다.",
"cobblemon.species.latios-mega.desc": "본 것이나 생각한 이미지를 상대방에게 영상으로 보여주는 능력을 지녔다. 인간의 말을 이해할 수 있다.",
"cobblemon.ui.pokedex.info.form.kyogre-primal": "원시가이오가",
"cobblemon.ui.pokedex.info.form.kyogre-primal": "원시회귀",
"cobblemon.species.deoxys-attack.desc": "공격적인 형상으로 변화한 테오키스. 다른 모습을 보여 적을 혼란시키는 힘을 가졌다.",
"cobblemon.ui.pokedex.info.form.deoxys-speed": "스피드폼",
"cobblemon.ui.pokedex.info.form.burmy-trash": "슈레도롱",
@@ -9549,5 +9549,125 @@
"cobblemon.config.ui.world_spawning_blocklist": "월드별 스폰 차단 목록",
"cobblemon.config.ui.world_spawning_blocklist.tooltip": "포켓몬 생성 로직을 비활성화하는 월드입니다.",
"advancements.cobblemon.obtain_tm": "기술을 보여줘!",
"advancements.cobblemon.obtain_tm.description": "TM을 찾거나 제작하세요"
"advancements.cobblemon.obtain_tm.description": "TM을 찾거나 제작하세요",
"itemGroup.cobblemon.tm_item": "코블몬: 기술머신",
"block.cobblemon.pomohana": "이글이글꽃",
"block.cobblemon.pauvillea": "파칙파칙꽃",
"block.cobblemon.lobaila": "훌라훌라꽃",
"block.cobblemon.wistensu": "하늘하늘꽃",
"block.cobblemon.voltaconia": "찌릿꽃",
"block.cobblemon.verdroot": "풀빛뿌리",
"block.cobblemon.lucibell": "빛방울꽃",
"block.cobblemon.mistleaf": "안개잎",
"cobblemon.ui.pokedex.info.evolution_tree": "진화 계통",
"cobblemon.ui.pokedex.evolution.item_interact.tooltip": "진화하려면 %1$s 필요",
"cobblemon.ui.pokedex.evolution.trade.tooltip.with_species": "%1$s와(과) 교환 시 진화",
"cobblemon.ui.pokedex.evolution.trade.tooltip.with_any_species": "교환 시 진화",
"cobblemon.ui.pokedex.evolution.shedder.tooltip": "남는 몬스터볼과 파티 빈칸도 필요",
"cobblemon.ui.pokedex.evolution.or": "또는",
"cobblemon.ui.pokedex.evolution.one_of": "다음 중 하나:",
"cobblemon.ui.pokedex.requirement.advancement.tooltip": "발전 과제 %1$s 달성 필요",
"cobblemon.ui.pokedex.requirement.battle_critical_hits.tooltip": "배틀에서 급소 %1$s회 맞히기",
"cobblemon.ui.pokedex.requirement.biome.anticondition.tooltip": "%1$s 바이옴 밖에 있기",
"cobblemon.ui.pokedex.requirement.biome.both.tooltip": "%1$s 바이옴 안, %2$s 바이옴 밖에 있기",
"cobblemon.ui.pokedex.requirement.biome.tooltip": "%1$s 바이옴에 있기",
"cobblemon.ui.pokedex.requirement.blocks_traveled.tooltip": "%1$s블록 이동하기",
"cobblemon.ui.pokedex.requirement.damage_taken.tooltip": "배틀에서 기절하지 않고 데미지 %1$s 받기",
"cobblemon.ui.pokedex.requirement.defeat.tooltip": "배틀에서 %1$s을(를) 쓰러뜨리기",
"cobblemon.ui.pokedex.requirement.friendship.tooltip": "친밀도 %1$s 이상 필요",
"cobblemon.ui.pokedex.requirement.has_move.tooltip": "기술 %1$s 배우고 있기",
"cobblemon.ui.pokedex.requirement.has_move_type.tooltip": "%1$s 타입 기술 배우고 있기",
"cobblemon.ui.pokedex.requirement.held_item.tooltip": "%1$s 지니고 있기",
"cobblemon.ui.pokedex.requirement.level.tooltip.min": "레벨 %1$s부터 진화",
"cobblemon.ui.pokedex.requirement.level.tooltip.between": "레벨 %1$s~%2$s 사이에 진화",
"cobblemon.ui.pokedex.requirement.moon_phase.tooltip": "달 모양이 %1$s일 때 진화",
"cobblemon.ui.pokedex.requirement.nature.toxtricity_amped": "§a노력§r, §a용감§r, §a고집§r, §a개구쟁이§r, §a온순§r, §a장난꾸러기§r, §a촐랑§r, §a성급§r, §a명랑§r, §a천진난만§r, §a덜렁§r, §a건방§r, §a변덕§r 성격 중 하나",
"cobblemon.ui.pokedex.requirement.nature.toxtricity_low_key": "§a외로움§r, §a대담§r, §a무사태평§r, §a겁쟁이§r, §a성실§r, §a조심§r, §a의젓§r, §a냉정§r, §a수줍음§r, §a차분§r, §a얌전§r, §a신중§r 성격 중 하나",
"cobblemon.ui.pokedex.requirement.negate.tooltip": "아님: %1$s",
"cobblemon.ui.pokedex.requirement.nickname.malamar": "이름이 §aDinnerbone§r 또는 §aGrumm§r이어야 함",
"cobblemon.ui.pokedex.requirement.party_member.anticondition.tooltip": "파티에 %1$s 포켓몬이 없기",
"cobblemon.ui.pokedex.requirement.party_member.tooltip": "파티에 %1$s 포켓몬이 있기",
"cobblemon.ui.pokedex.requirement.pokemon_properties.tooltip": "조건: %1$s",
"cobblemon.ui.pokedex.requirement.properties.and": "%1$s, %2$s",
"cobblemon.ui.pokedex.requirement.properties.custom.cocoon_species": "%1$s 고치",
"cobblemon.ui.pokedex.requirement.properties.held_item": "%1$s 지닌",
"cobblemon.ui.pokedex.requirement.properties.int_feature": "%1$s %2$s",
"cobblemon.ui.pokedex.requirement.properties.nature": "%1$s 성격",
"cobblemon.ui.pokedex.requirement.properties.nickname": "이름이 %1$s인",
"cobblemon.ui.pokedex.requirement.properties.type": "%1$s 타입",
"cobblemon.ui.pokedex.requirement.property_range.tooltip": "%1$s이(가) %2$s~%3$s 사이여야 함",
"cobblemon.ui.pokedex.requirement.recoil.tooltip": "배틀에서 반동 데미지 %1$s 받기",
"cobblemon.ui.pokedex.requirement.stat_compare.tooltip": "%1$s이(가) %2$s보다 높아야 함",
"cobblemon.ui.pokedex.requirement.stat_equal.tooltip": "%1$s와(과) %2$s이(가) 같아야 함",
"cobblemon.ui.pokedex.requirement.structure.anticondition.tooltip": "%1$s 구조물 밖에 있기",
"cobblemon.ui.pokedex.requirement.structure.both.tooltip": "%1$s 구조물 안, %2$s 구조물 밖에 있기",
"cobblemon.ui.pokedex.requirement.structure.tooltip": "%1$s 구조물에 있기",
"cobblemon.ui.pokedex.requirement.time_range.tooltip": "%1$s에 진화",
"cobblemon.ui.pokedex.requirement.use_move.tooltip": "배틀에서 기술 %1$s 사용하기",
"cobblemon.ui.pokedex.requirement.weather.tooltip.raining": "비가 올 때 진화",
"cobblemon.ui.pokedex.requirement.weather.tooltip.thundering": "뇌우가 칠 때 진화",
"cobblemon.ui.moon_phase.full_moon": "보름달",
"cobblemon.ui.moon_phase.waning_gibbous": "기우는 볼록달",
"cobblemon.ui.moon_phase.third_quarter": "하현달",
"cobblemon.ui.moon_phase.waning_crescent": "그믐달",
"cobblemon.ui.moon_phase.new_moon": "삭",
"cobblemon.ui.moon_phase.waxing_crescent": "초승달",
"cobblemon.ui.moon_phase.first_quarter": "상현달",
"cobblemon.ui.moon_phase.waxing_gibbous": "차오르는 볼록달",
"cobblemon.ui.time_range.any": "언제든",
"cobblemon.ui.time_range.day": "낮",
"cobblemon.ui.time_range.night": "밤",
"cobblemon.ui.time_range.noon": "정오",
"cobblemon.ui.time_range.midnight": "자정",
"cobblemon.ui.time_range.dawn": "새벽",
"cobblemon.ui.time_range.dusk": "해 질 녘",
"cobblemon.ui.time_range.twilight": "황혼",
"cobblemon.ui.time_range.morning": "아침",
"cobblemon.ui.time_range.afternoon": "오후",
"cobblemon.ui.time_range.predawn": "동트기 전",
"cobblemon.ui.time_range.evening": "저녁",
"cobblemon.subtitle.item.bright_powder.use": "반짝가루가 빛남",
"cobblemon.config.ui.type_gem_max_connected": "연결된 타입주얼 블록 최대 수",
"cobblemon.config.ui.type_gem_min_growth": "타입주얼 최소 성장",
"cobblemon.config.ui.type_gem_growth_chance": "타입주얼 성장 확률",
"cobblemon.config.ui.type_gem_initial_expansion_cycles": "타입주얼 초기 확장 횟수",
"cobblemon.battle.activate.ficklebeam": "%1$s은(는) 전력을 다해 공격한다!",
"tag.item.cobblemon.oricorio_flowers": "꽃꿀 꽃",
"tag.item.cobblemon.terrain_plants": "필드 식물",
"tag.item.cobblemon.tall_flowers": "큰 꽃",
"tag.worldgen.biome.cobblemon.evolution.regional.bergmite_hisuibiome": "히스이",
"tag.worldgen.biome.cobblemon.evolution.regional.bergmite_kalosbiome": "칼로스",
"tag.worldgen.biome.cobblemon.evolution.regional.cubone_alolabiome": "알로라",
"tag.worldgen.biome.cobblemon.evolution.regional.cubone_kantobiome": "관동",
"tag.worldgen.biome.cobblemon.evolution.regional.dartrix_alolabiome": "알로라",
"tag.worldgen.biome.cobblemon.evolution.regional.dartrix_hisuibiome": "히스이",
"tag.worldgen.biome.cobblemon.evolution.regional.dewott_hisuibiome": "히스이",
"tag.worldgen.biome.cobblemon.evolution.regional.dewott_unovabiome": "하나",
"tag.worldgen.biome.cobblemon.evolution.regional.exeggcute_alolabiome": "알로라",
"tag.worldgen.biome.cobblemon.evolution.regional.exeggcute_kantobiome": "관동",
"tag.worldgen.biome.cobblemon.evolution.regional.goomy_hisuibiome": "히스이",
"tag.worldgen.biome.cobblemon.evolution.regional.goomy_kalosbiome": "칼로스",
"tag.worldgen.biome.cobblemon.evolution.regional.koffing_galarbiome": "가라르",
"tag.worldgen.biome.cobblemon.evolution.regional.koffing_kantobiome": "관동",
"tag.worldgen.biome.cobblemon.evolution.regional.mimejr_galarbiome": "가라르",
"tag.worldgen.biome.cobblemon.evolution.regional.mimejr_sinnohbiome": "신오",
"tag.worldgen.biome.cobblemon.evolution.regional.petilil_hisuibiome": "히스이",
"tag.worldgen.biome.cobblemon.evolution.regional.petilil_unovabiome": "하나",
"tag.worldgen.biome.cobblemon.evolution.regional.pikachu_alolabiome": "알로라",
"tag.worldgen.biome.cobblemon.evolution.regional.pikachu_kantobiome": "관동",
"tag.worldgen.biome.cobblemon.evolution.regional.quilava_hisuibiome": "히스이",
"tag.worldgen.biome.cobblemon.evolution.regional.quilava_johtobiome": "성도",
"tag.worldgen.biome.cobblemon.evolution.regional.rufflet_hisuibiome": "히스이",
"tag.worldgen.biome.cobblemon.evolution.regional.rufflet_unovabiome": "하나",
"cobblemon.ui.pokedex.info.form.vivillon-icy snow": "빙설의 모양",
"cobblemon.species.vivillon-icy-snow.desc": "태어난 땅의 기후나 풍토에 영향을 받아 모양이 달라진다. 얼어붙은 땅에서의 모습이다.",
"cobblemon.ui.pokedex.info.form.vivillon-high plains": "황야의 모양",
"cobblemon.species.vivillon-high-plains.desc": "태어난 땅의 기후나 풍토에 영향을 받아 모양이 달라진다. 비가 적게 내리는 땅에서의 모습이다.",
"cobblemon.ui.pokedex.info.form.vivillon-inferno": "지옥의 모양",
"cobblemon.species.vivillon-inferno.desc": "살고 있는 장소의 기후나 풍토에 따라 날개의 모양이 다른 포켓몬이다. 화려한 색의 날개 가루를 뿌린다.",
"cobblemon.ui.pokedex.info.form.vivillon-void": "공허의 모양",
"cobblemon.species.vivillon-void.desc": "살고 있는 장소의 기후나 풍토에 따라 날개의 모양이 다른 포켓몬이다. 화려한 색의 날개 가루를 뿌린다.",
"cobblemon.ui.pokedex.info.form.vivillon-forsaken": "망각의 모양",
"cobblemon.species.vivillon-forsaken.desc": "살고 있는 장소의 기후나 풍토에 따라 날개의 모양이 다른 포켓몬이다. 화려한 색의 날개 가루를 뿌린다.",
"cobblemon.species.minior-red.desc": "겉껍질이 벗겨진 모습. 코어의 색이 다른 이유는 먹은 먹이의 성분이 다르기 때문이다."
}
@@ -9677,5 +9677,6 @@
"cobblemon.config.ui.world_spawning_blocklist": "维度生成黑名单",
"cobblemon.config.ui.world_spawning_blocklist.tooltip": "禁用宝可梦生成逻辑的维度。",
"advancements.cobblemon.obtain_tm": "让我看看你的招式",
"advancements.cobblemon.obtain_tm.description": "发现或刻写一个招式学习器"
"advancements.cobblemon.obtain_tm.description": "发现或刻写一个招式学习器",
"itemGroup.cobblemon.tm_item": "招式学习器"
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 347 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 788 B

After

Width:  |  Height:  |  Size: 417 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

@@ -42,7 +42,8 @@
},
{
"type": "pause",
"pause": 0.5
"condition": "q.target_fainted == false",
"pause": 1.25
}
]
}
@@ -141,7 +141,8 @@
},
{
"type": "pause",
"pause": 0.5
"condition": "q.target_fainted == false",
"pause": 1.25
}
]
}
@@ -1,3 +1,3 @@
{
"showdownVersion": 18
"showdownVersion": 19
}
@@ -1,6 +1,6 @@
{
"condition": {
"minY": 62,
"minY": 48,
"neededBaseBlocks": [
"minecraft:sandstone"
],
@@ -1,15 +0,0 @@
{
"condition": {
"structures": [
"minecraft:end_city"
],
"neededBaseBlocks": [
"minecraft:end_stone_bricks",
"minecraft:purpur_block",
"minecraft:purpur_pillar"
],
"neededNearbyBlocks": [
"#cobblemon:end_city_blocks"
]
}
}
@@ -1,10 +0,0 @@
{
"condition": {
"structures": [
"minecraft:pillager_outpost",
"minecraft:swamp_hut",
"minecraft:mansion"
],
"minY": 62
}
}
@@ -1,6 +1,6 @@
{
"condition": {
"minY": 62,
"minY": 48,
"neededBaseBlocks": [
"minecraft:cobblestone",
"minecraft:mossy_cobblestone"
@@ -1,19 +0,0 @@
{
"condition": {
"structures": [
"minecraft:bastion_remnant",
"minecraft:fortress"
],
"neededBaseBlocks": [
"minecraft:chiseled_polished_blackstone",
"minecraft:cracked_polished_blackstone_bricks",
"minecraft:gilded_blackstone",
"minecraft:nether_bricks",
"minecraft:polished_basalt",
"minecraft:polished_blackstone_bricks"
],
"neededNearbyBlocks": [
"#cobblemon:nether_structure_blocks"
]
}
}
@@ -1,8 +0,0 @@
{
"condition": {
"structures": [
"minecraft:monument"
],
"maxY": 62
}
}
@@ -1,11 +0,0 @@
{
"condition": {
"structures": [
"#minecraft:ocean_ruin"
],
"maxY": 62,
"neededNearbyBlocks": [
"#cobblemon:ocean_ruin_blocks"
]
}
}
@@ -1,11 +0,0 @@
{
"condition": {
"structures": [
"minecraft:pillager_outpost"
],
"minY": 62,
"neededNearbyBlocks": [
"#cobblemon:pillager_outpost_blocks"
]
}
}
@@ -0,0 +1,21 @@
{
"values": [
"#minecraft:village",
{
"id": "nova_structures:village_birch",
"required": false
},
{
"id": "nova_structures:village_jungle",
"required": false
},
{
"id": "nova_structures:village_swamp",
"required": false
},
{
"id": "#terralith:fortified_villages",
"required": false
}
]
}
@@ -0,0 +1,13 @@
{
"values": [
"minecraft:desert_pyramid",
{
"id": "#nova_structures:desert_ruins",
"required": false
},
{
"id": "#betterdeserttemples:desert_temple",
"required": false
}
]
}
@@ -0,0 +1,20 @@
{
"values": [
{
"id": "nova_structures:bunker",
"required": false
},
{
"id": "nova_structures:creeping_crypt",
"required": false
},
{
"id": "nova_structures:undead_crypt",
"required": false
},
{
"id": "#betterdungeons:better_dungeons",
"required": false
}
]
}
@@ -0,0 +1,17 @@
{
"values": [
"minecraft:end_city",
{
"id": "#nova_structures:end_castle",
"required": false
},
{
"id": "nova_structures:creeping_crypt",
"required": false
},
{
"id": "enderscape:end_city",
"required": false
}
]
}
@@ -0,0 +1,20 @@
{
"values": [
{
"id": "nova_structures:remnant_graveyard",
"required": false
},
{
"id": "nova_structures:remnant_birch_graveyard",
"required": false
},
{
"id": "nova_structures:creeping_crypt",
"required": false
},
{
"id": "nova_structures:undead_crypt",
"required": false
}
]
}
@@ -0,0 +1,5 @@
{
"values": [
"minecraft:igloo"
]
}
@@ -0,0 +1,21 @@
{
"values": [
"minecraft:pillager_outpost",
{
"id": "nova_structures:illager_camp",
"required": false
},
{
"id": "nova_structures:tavern_dark_oak",
"required": false
},
{
"id": "nova_structures:well_dark_oak",
"required": false
},
{
"id": "nova_structures:firewatch_tower_dark_oak",
"required": false
}
]
}
@@ -0,0 +1,11 @@
{
"values": [
"#cobblemon:spawns/is_illager_outpost",
"#cobblemon:spawns/is_witch_structure",
"minecraft:mansion",
{
"id": "#nova_structures:illager_structures",
"required": false
}
]
}
@@ -0,0 +1,13 @@
{
"values": [
"minecraft:jungle_pyramid",
{
"id": "#nova_structures:jungle_ruins",
"required": false
},
{
"id": "#betterjungletemples:better_jungle_temples",
"required": false
}
]
}
@@ -0,0 +1,5 @@
{
"values": [
"#minecraft:mineshaft"
]
}
@@ -0,0 +1,14 @@
{
"values": [
"#cobblemon:spawns/is_piglin_structure",
"minecraft:fortress",
{
"id": "#nova_structures:nether_skeleton_structures",
"required": false
},
{
"id": "#betterfortresses:better_fortresses",
"required": false
}
]
}
@@ -0,0 +1,13 @@
{
"values": [
"minecraft:monument",
{
"id": "#nova_structures:trident_trial_monument",
"required": false
},
{
"id": "#betteroceanmonuments:better_ocean_monuments",
"required": false
}
]
}
@@ -0,0 +1,5 @@
{
"values": [
"#minecraft:ocean_ruin"
]
}
@@ -0,0 +1,9 @@
{
"values": [
"minecraft:bastion_remnant",
{
"id": "#nova_structures:piglin_structures",
"required": false
}
]
}
@@ -0,0 +1,85 @@
{
"values": [
"#cobblemon:ruin",
{
"id": "nova_structures:remnant_bee_keeper",
"required": false
},
{
"id": "nova_structures:remnant_big_remnant",
"required": false
},
{
"id": "nova_structures:remnant_big_remnant_2",
"required": false
},
{
"id": "nova_structures:remnant_big_remnant_3",
"required": false
},
{
"id": "nova_structures:remnant_medium_remnant",
"required": false
},
{
"id": "nova_structures:remnant_medium_remnant_2",
"required": false
},
{
"id": "nova_structures:remnant_bridge_remnant",
"required": false
},
{
"id": "nova_structures:remnant_bunny_base",
"required": false
},
{
"id": "nova_structures:remnant_desert_remnant",
"required": false
},
{
"id": "nova_structures:remnant_forest_smith",
"required": false
},
{
"id": "nova_structures:remnant_miner_hut",
"required": false
},
{
"id": "nova_structures:remnant_ruin_farmer",
"required": false
},
{
"id": "nova_structures:remnant_ruin_smith",
"required": false
},
{
"id": "nova_structures:remnant_sawmill",
"required": false
},
{
"id": "nova_structures:remnant_school_remnant",
"required": false
},
{
"id": "nova_structures:remnant_taiga_castle",
"required": false
},
{
"id": "nova_structures:remnant_zombie_horse_ranch",
"required": false
},
{
"id": "nova_structures:remnant_classic_village",
"required": false
},
{
"id": "#nova_structures:ruin_town",
"required": false
},
{
"id": "nova_structures:wild_ruin",
"required": false
}
]
}
@@ -0,0 +1,10 @@
{
"values": [
"#minecraft:shipwreck",
"#cobblemon:fishing_boat",
{
"id": "aquamirae:shipwreck",
"required": false
}
]
}
@@ -0,0 +1,34 @@
{
"values": [
"minecraft:swamp_hut",
"#minecraft:cats_spawn_as_black",
{
"id": "#nova_structures:witch_villa",
"required": false
},
{
"id": "nova_structures:tavern_mangrove",
"required": false
},
{
"id": "nova_structures:tavern_swamp",
"required": false
},
{
"id": "nova_structures:village_swamp",
"required": false
},
{
"id": "nova_structures:firewatch_tower_swamp",
"required": false
},
{
"id": "nova_structures:remnant_ominous_shop",
"required": false
},
{
"id": "betterwitchhuts:witch_hut",
"required": false
}
]
}
@@ -0,0 +1,120 @@
/*
* Copyright (C) 2023 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.api.pasture
import com.cobblemon.mod.common.block.entity.PokemonPastureBlockEntity.Tethering
import net.minecraft.core.BlockPos
import net.minecraft.core.Direction
import org.junit.jupiter.api.Assertions.*
import org.junit.jupiter.api.Test
import java.util.UUID
class PastureRangeTest {
@Test
fun `spec examples allow zero sides while requiring eight blocks on both axes`() {
listOf(
PastureRange(0, 8, 8, 0), PastureRange(4, 4, 4, 4), PastureRange(2, 8, 6, 0)
).forEach { assertTrue(it.isValid(64), it.toString()) }
listOf(
PastureRange(8, 7, 8, 0), PastureRange(64, 4, 64, 3)
).forEach { assertFalse(it.isValid(64), it.toString()) }
}
@Test
fun `every side obeys the configured maximum and rejects negative or overflowing input`() {
assertTrue(PastureRange(32, 32, 32, 32).isValid(32))
assertTrue(PastureRange(64, 64, 64, 64).isValid(PastureRange.MAX_DISTANCE))
assertFalse(PastureRange(65, 64, 64, 64).isValid(PastureRange.MAX_DISTANCE))
listOf(
PastureRange(33, 32, 32, 32), PastureRange(32, 33, 32, 32),
PastureRange(32, 32, 33, 32), PastureRange(32, 32, 32, 33),
PastureRange(-1, 8, 9, 0), PastureRange(Int.MAX_VALUE, 8, Int.MAX_VALUE, 0)
).forEach { assertFalse(it.isValid(32), it.toString()) }
}
@Test
fun `an adjustment changes only the requested cardinal side`() {
val range = PastureRange(4, 4, 4, 4)
Direction.Plane.HORIZONTAL.forEach { direction ->
val changed = range.adjusted(direction, 1)
assertEquals(5, changed[direction])
assertEquals(4, changed[direction.opposite])
assertTrue(changed.isValid(32))
assertFalse(range.adjusted(direction, -1).isValid(32))
}
}
@Test
fun `saved bounds round trip at negative world coordinates`() {
val origin = BlockPos(-100, 70, -200)
val range = PastureRange(2, 8, 6, 0)
assertEquals(range, PastureRange.fromBounds(origin, range.minPos(origin), range.maxPos(origin)))
}
@Test
fun `a zero length facing side still offers spawn blocks elsewhere in the minimum range`() {
val range = PastureRange(0, 8, 8, 0)
val candidates = range.nearbyBlocks(BlockPos.ZERO, BlockPos(0, 0, -4), 1.0).toList()
assertEquals(BlockPos.ZERO, candidates.first())
assertTrue(BlockPos(7, 0, 7) in candidates)
assertTrue(candidates.all { it.x in 0..7 && it.z in 0..7 })
}
@Test
fun `return search starts at the nearest block that fits the pokemon inside the edge`() {
val range = PastureRange(4, 4, 4, 4)
val candidates = range.nearbyBlocks(BlockPos.ZERO, BlockPos(99, 0, 1), 2.0).toList()
assertEquals(BlockPos(2, 0, 1), candidates.first())
assertTrue(candidates.all { it.x in -3..2 && it.z in -3..2 })
}
@Test
fun `a pokemon wider than the entire range has no safe center`() {
assertTrue(PastureRange(0, 8, 8, 0).nearbyBlocks(BlockPos.ZERO, BlockPos.ZERO, 9.0).none())
}
@Test
fun `pasture bounds constrain horizontal movement without a ceiling`() {
val tether = tether()
assertTrue(tether.canRoamTo(BlockPos(0, -10000, 0)))
assertTrue(tether.canRoamTo(BlockPos(0, 10000, 0)))
assertFalse(tether.canRoamTo(-4.01, 0.0))
assertFalse(tether.canRoamTo(4.0, 0.0))
tether.maxRoamPos = BlockPos(8, 4, 4)
assertTrue(tether.canRoamTo(7.5, 0.0))
}
@Test
fun `fainting starts one day of recovery without restarting it each check`() {
val tether = tether()
tether.beginRecovery(100L, fainted = true)
assertEquals(24100L, tether.respawnAt)
assertTrue(tether.healingAfterFaint)
tether.beginRecovery(140L, fainted = true)
assertEquals(24100L, tether.respawnAt)
}
@Test
fun `accidental disappearance has a shorter cooldown and fainting takes precedence`() {
val tether = tether()
tether.beginRecovery(100L, fainted = false)
assertEquals(300L, tether.respawnAt)
assertFalse(tether.healingAfterFaint)
tether.beginRecovery(140L, fainted = true)
assertEquals(24140L, tether.respawnAt)
tether.beginRecovery(180L, fainted = false)
assertEquals(24140L, tether.respawnAt)
assertTrue(tether.healingAfterFaint)
}
private fun tether() = Tethering(
BlockPos(-4, -4, -4), BlockPos(4, 4, 4), UUID.randomUUID(), "Owner",
UUID.randomUUID(), UUID.randomUUID(), UUID.randomUUID(), 1, BlockPos.ZERO
)
}
+2 -2
View File
@@ -14,7 +14,7 @@ parchment_version = 2024.07.28@zip
java_version = 21
mod_id=cobblemon
mod_version=1.8.3
snapshot=false
mod_version=1.8.5
snapshot=true
fabric.loom.multiProjectOptimisation=false