mirror of
https://gitlab.com/cable-mc/cobblemon.git
synced 2026-11-18 14:18:54 -05:00
Compare commits
29
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e94b5f775a | ||
|
|
069694c782 | ||
|
|
3ab78e0f0b | ||
|
|
acb2a6aeaa | ||
|
|
d5ea6e5494 | ||
|
|
99e0a26d7b | ||
|
|
71753df513 | ||
|
|
729f080f6e | ||
|
|
13eb57afb1 | ||
|
|
72b6cb06ff | ||
|
|
74a57eb972 | ||
|
|
7246c7f8e6 | ||
|
|
cd05f741ae | ||
|
|
00222d929d | ||
|
|
b8f4637cb3 | ||
|
|
9f572250f5 | ||
|
|
0927d6fa43 | ||
|
|
a293b3d71f | ||
|
|
162b1cc68f | ||
|
|
066a6b56f7 | ||
|
|
7687833add | ||
|
|
cb9ba82fcc | ||
|
|
4221993f7d | ||
|
|
a616c25c8c | ||
|
|
6ce4bf5673 | ||
|
|
1b652ba99f | ||
|
|
11b59df386 | ||
|
|
ac2b068bf3 | ||
|
|
8e8f346e52 |
No files matched your search
+10
-18
@@ -2,28 +2,18 @@
|
||||
## [1.8.5 (MONTH xth, 2026)](#1-8-5)
|
||||
|
||||
### Additions
|
||||
- You can now drag to select multiple Pokémon inside the PC menu.
|
||||
|
||||
### Pokémon Added
|
||||
#### Generation 4
|
||||
|
||||
#### Generation 5
|
||||
|
||||
#### Generation 6
|
||||
|
||||
#### Generation 7
|
||||
|
||||
#### Generation 8
|
||||
|
||||
#### Generation 9
|
||||
|
||||
### Model updates for the following Pokémon
|
||||
|
||||
### Animation updates for the following Pokémon
|
||||
- Added the `healersSetSpawn` gamerule. When enabled, using a healing machine will set your spawnpoint.
|
||||
- A Pokémon holding a Power item now gains 1 point in the corresponding riding stat every two minutes while being ridden. The interval is configurable, and can be disabled with `-1`.
|
||||
- Added sounds to Gigaton Hammer and Pyro Ball
|
||||
- Added stepsounds to Venusaur, Blastoise, Dewgong, Rhydon, Rhyhorn, Parasect and Mr. Mime.
|
||||
- Added `cosmetic_item` command
|
||||
|
||||
### Changes
|
||||
- Amethyst now grows from Typegem core blocks like typegems do
|
||||
- Updated the recipe category for the Create compatibility EXP Candy recipe
|
||||
- Added No Man's Lands' Honeyed Apple to the Leaves Leftovers tag
|
||||
- Added lore support to held and cosmetic items
|
||||
- Pokemon can now wear every item with `cobblemon:aspect` component in their cosmetic slot
|
||||
|
||||
### Fixes
|
||||
- Fixed Ponigiri food values for AppleSkin integration
|
||||
@@ -35,6 +25,8 @@
|
||||
- `q.is_standing_on_blocks` now properly checks for non-full blocks like slabs, Mud or Soul Sand
|
||||
- Added Molang functions to play footstep sounds based on the corresponding surface. These are intended to be used by Pokémon animations.
|
||||
- Pokémon can now have their Minecraft footstep sounds silenced in their poser. This doesn't affect emitting game events.
|
||||
- Cosmetic items can now add aspects automatically to pokemon when wore. for example `cosmetic_minecraft-dirt-test` if pokemon wears a dirt block with `[cobblemon:aspect='test']` component
|
||||
- Held items can now add automatically aspects to pokemon when held. for example `held_minecraft-dirt` if pokemon holds a dirt block or `cosmetic_minecraft-dirt-test` if pokemon holds a dirt block with `[cobblemon:aspect='test']` component
|
||||
|
||||
### Particles
|
||||
|
||||
|
||||
@@ -98,6 +98,7 @@ import com.cobblemon.mod.common.pokemon.aspects.ALPHA_ASPECT
|
||||
import com.cobblemon.mod.common.pokemon.aspects.CHARACTERISTIC_RAINBOW_ASPECT
|
||||
import com.cobblemon.mod.common.pokemon.aspects.COSMETIC_SLOT_ASPECT
|
||||
import com.cobblemon.mod.common.pokemon.aspects.GENDER_ASPECT
|
||||
import com.cobblemon.mod.common.pokemon.aspects.HELD_ITEM_ASPECT
|
||||
import com.cobblemon.mod.common.pokemon.aspects.MARK_ASPECT
|
||||
import com.cobblemon.mod.common.pokemon.aspects.SHINY_ASPECT
|
||||
import com.cobblemon.mod.common.pokemon.evolution.variants.BlockClickEvolution
|
||||
@@ -326,6 +327,7 @@ object Cobblemon {
|
||||
|
||||
SHINY_ASPECT.register()
|
||||
GENDER_ASPECT.register()
|
||||
HELD_ITEM_ASPECT.register()
|
||||
COSMETIC_SLOT_ASPECT.register()
|
||||
CHARACTERISTIC_RAINBOW_ASPECT.register()
|
||||
ALPHA_ASPECT.register()
|
||||
|
||||
@@ -39,6 +39,7 @@ object CobblemonCommands {
|
||||
FriendshipCommand.register(dispatcher)
|
||||
GiveAllPokemon.register(dispatcher)
|
||||
HeldItemCommand.register(dispatcher, registry)
|
||||
CosmeticItemCommand.register(dispatcher, registry)
|
||||
PcCommand.register(dispatcher)
|
||||
SpawnPokemonFromPool.register(dispatcher)
|
||||
PokeboxCommand.register(dispatcher)
|
||||
|
||||
@@ -77,15 +77,15 @@ object CobblemonItemComponents : PlatformRegistry<Registry<DataComponentType<*>>
|
||||
|
||||
@JvmField
|
||||
val INGREDIENT: DataComponentType<IngredientComponent> = create("ingredient", DataComponentType.builder<IngredientComponent>()
|
||||
.persistent(IngredientComponent.CODEC)
|
||||
.networkSynchronized(IngredientComponent.PACKET_CODEC)
|
||||
.build())
|
||||
.persistent(IngredientComponent.CODEC)
|
||||
.networkSynchronized(IngredientComponent.PACKET_CODEC)
|
||||
.build())
|
||||
|
||||
@JvmField
|
||||
val FOOD: DataComponentType<FoodComponent> = create("food", DataComponentType.builder<FoodComponent>()
|
||||
.persistent(FoodComponent.CODEC)
|
||||
.networkSynchronized(FoodComponent.PACKET_CODEC)
|
||||
.build())
|
||||
.persistent(FoodComponent.CODEC)
|
||||
.networkSynchronized(FoodComponent.PACKET_CODEC)
|
||||
.build())
|
||||
|
||||
@JvmField
|
||||
val MOB_EFFECTS: DataComponentType<MobEffectsComponent> = create("mob_effects", DataComponentType.builder<MobEffectsComponent>()
|
||||
@@ -95,9 +95,15 @@ object CobblemonItemComponents : PlatformRegistry<Registry<DataComponentType<*>>
|
||||
|
||||
@JvmField
|
||||
val CRAFTED: DataComponentType<Boolean> = create("crafted", DataComponentType.builder<Boolean>()
|
||||
.persistent(Codec.BOOL)
|
||||
.networkSynchronized(ByteBufCodecs.BOOL)
|
||||
.build())
|
||||
.persistent(Codec.BOOL)
|
||||
.networkSynchronized(ByteBufCodecs.BOOL)
|
||||
.build())
|
||||
|
||||
@JvmField
|
||||
val ASPECT: DataComponentType<BedrockAspectComponent> = create("aspect", DataComponentType.builder<BedrockAspectComponent>()
|
||||
.persistent(BedrockAspectComponent.CODEC)
|
||||
.networkSynchronized(BedrockAspectComponent.PACKET_CODEC)
|
||||
.build())
|
||||
|
||||
fun register() {
|
||||
Registry.register(BuiltInRegistries.DATA_COMPONENT_TYPE, ResourceLocation.parse("cobblemon:pokemon_item"), POKEMON_ITEM)
|
||||
@@ -112,9 +118,9 @@ object CobblemonItemComponents : PlatformRegistry<Registry<DataComponentType<*>>
|
||||
Registry.register(BuiltInRegistries.DATA_COMPONENT_TYPE, ResourceLocation.parse("cobblemon:food"), FOOD)
|
||||
Registry.register(BuiltInRegistries.DATA_COMPONENT_TYPE, ResourceLocation.parse("cobblemon:mob_effects"), MOB_EFFECTS)
|
||||
Registry.register(BuiltInRegistries.DATA_COMPONENT_TYPE, ResourceLocation.parse("cobblemon:held_item_effect"), HELD_ITEM_EFFECT)
|
||||
Registry.register(BuiltInRegistries.DATA_COMPONENT_TYPE, ResourceLocation.parse("cobblemon:aspect"), ASPECT)
|
||||
}
|
||||
|
||||
override val registry = BuiltInRegistries.DATA_COMPONENT_TYPE
|
||||
override val resourceKey = Registries.DATA_COMPONENT_TYPE
|
||||
|
||||
}
|
||||
}
|
||||
@@ -566,7 +566,6 @@ object CobblemonNetwork {
|
||||
list.add(PacketRegisterInfo(SwapPartyPokemonPacket.ID, SwapPartyPokemonPacket::decode, SwapPartyPokemonHandler))
|
||||
|
||||
list.add(PacketRegisterInfo(MovePCPokemonPacket.ID, MovePCPokemonPacket::decode, MovePCPokemonHandler))
|
||||
list.add(PacketRegisterInfo(MovePCPokemonBatchPacket.ID, MovePCPokemonBatchPacket::decode, MovePCPokemonBatchHandler))
|
||||
list.add(PacketRegisterInfo(MovePartyPokemonPacket.ID, MovePartyPokemonPacket::decode, MovePartyPokemonHandler))
|
||||
|
||||
list.add(PacketRegisterInfo(SwapPCPartyPokemonPacket.ID, SwapPCPartyPokemonPacket::decode, SwapPCPartyPokemonHandler))
|
||||
|
||||
+3
-7
@@ -37,7 +37,6 @@ object CobblemonPermissions {
|
||||
@JvmStatic
|
||||
val HEAL_POKEMON_OTHER = this.create("$HEAL_POKEMON_BASE.other", PermissionLevel.CHEAT_COMMANDS_AND_COMMAND_BLOCKS)
|
||||
|
||||
|
||||
private const val LEVEL_UP_BASE = "${COMMAND_PREFIX}levelup"
|
||||
@JvmStatic
|
||||
val LEVEL_UP_SELF = this.create("$LEVEL_UP_BASE.self", PermissionLevel.CHEAT_COMMANDS_AND_COMMAND_BLOCKS)
|
||||
@@ -68,27 +67,24 @@ object CobblemonPermissions {
|
||||
@JvmStatic
|
||||
val SPAWN_NPC = this.create("${COMMAND_PREFIX}spawnnpc", PermissionLevel.CHEAT_COMMANDS_AND_COMMAND_BLOCKS)
|
||||
|
||||
|
||||
@JvmStatic
|
||||
val STOP_BATTLE = this.create("${COMMAND_PREFIX}stopbattle", PermissionLevel.CHEAT_COMMANDS_AND_COMMAND_BLOCKS)
|
||||
|
||||
|
||||
@JvmStatic
|
||||
val TAKE_POKEMON = this.create("${COMMAND_PREFIX}takepokemon", PermissionLevel.CHEAT_COMMANDS_AND_COMMAND_BLOCKS)
|
||||
|
||||
|
||||
@JvmStatic
|
||||
val TEACH = this.create("${COMMAND_PREFIX}teach.base", PermissionLevel.CHEAT_COMMANDS_AND_COMMAND_BLOCKS)
|
||||
@JvmStatic
|
||||
val TEACH_BYPASS_LEARNSET = this.create("${COMMAND_PREFIX}teach.bypass", PermissionLevel.CHEAT_COMMANDS_AND_COMMAND_BLOCKS)
|
||||
|
||||
|
||||
@JvmStatic
|
||||
val FRIENDSHIP = this.create("${COMMAND_PREFIX}friendship", PermissionLevel.CHEAT_COMMANDS_AND_COMMAND_BLOCKS)
|
||||
|
||||
|
||||
@JvmStatic
|
||||
val HELD_ITEM = this.create("${COMMAND_PREFIX}helditem", PermissionLevel.CHEAT_COMMANDS_AND_COMMAND_BLOCKS)
|
||||
@JvmStatic
|
||||
val COSMETIC_ITEM = this.create("${COMMAND_PREFIX}cosmeticitem", PermissionLevel.CHEAT_COMMANDS_AND_COMMAND_BLOCKS)
|
||||
|
||||
@JvmStatic
|
||||
val CHANGE_MARK = this.create("${COMMAND_PREFIX}changemark", PermissionLevel.CHEAT_COMMANDS_AND_COMMAND_BLOCKS)
|
||||
@@ -161,4 +157,4 @@ object CobblemonPermissions {
|
||||
return permission
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+3
-2
@@ -26,6 +26,7 @@ import net.minecraft.core.registries.BuiltInRegistries
|
||||
import net.minecraft.locale.Language
|
||||
import net.minecraft.network.chat.Component
|
||||
import net.minecraft.network.chat.MutableComponent
|
||||
import net.minecraft.resources.ResourceLocation
|
||||
import net.minecraft.world.item.Items
|
||||
|
||||
fun describePokemonProperties(properties: PokemonProperties): MutableComponent? {
|
||||
@@ -57,7 +58,7 @@ fun describePokemonProperties(properties: PokemonProperties): MutableComponent?
|
||||
}
|
||||
|
||||
val heldItemDescriptor = properties.heldItem?.let { heldItem ->
|
||||
val itemId = heldItem.substringBefore('[').trim().asIdentifierDefaultingNamespace()
|
||||
val itemId = ResourceLocation.parse("minecraft:dirt")
|
||||
val item = BuiltInRegistries.ITEM.get(itemId)
|
||||
if (item == Items.AIR) null else lang("ui.pokedex.requirement.properties.held_item", item.description.plainCopy().green())
|
||||
}
|
||||
@@ -139,4 +140,4 @@ private fun describeStringSpeciesFeature(property: StringSpeciesFeature): Mutabl
|
||||
?: Component.literal(property.value)
|
||||
|
||||
return lang(key, value.green())
|
||||
}
|
||||
}
|
||||
@@ -36,6 +36,7 @@ import com.cobblemon.mod.common.pokemon.RenderablePokemon
|
||||
import com.cobblemon.mod.common.pokemon.stat.CobblemonStatProvider
|
||||
import com.cobblemon.mod.common.pokemon.status.PersistentStatus
|
||||
import com.cobblemon.mod.common.util.DataKeys
|
||||
import com.cobblemon.mod.common.util.adapters.RegistryAccessResolver
|
||||
import com.cobblemon.mod.common.util.asIdentifierDefaultingNamespace
|
||||
import com.cobblemon.mod.common.util.isDouble
|
||||
import com.cobblemon.mod.common.util.isFloat
|
||||
@@ -52,8 +53,11 @@ import java.util.UUID
|
||||
import kotlin.math.min
|
||||
import kotlin.random.Random
|
||||
import net.minecraft.ResourceLocationException
|
||||
import net.minecraft.advancements.critereon.ItemPredicate
|
||||
import net.minecraft.commands.arguments.item.ItemInput
|
||||
import net.minecraft.commands.arguments.item.ItemParser
|
||||
import net.minecraft.core.HolderLookup
|
||||
import net.minecraft.core.component.DataComponentPredicate
|
||||
import net.minecraft.nbt.CompoundTag
|
||||
import net.minecraft.nbt.ListTag
|
||||
import net.minecraft.nbt.NbtOps
|
||||
@@ -157,7 +161,8 @@ open class PokemonProperties {
|
||||
null
|
||||
}
|
||||
}
|
||||
props.heldItem = parseString(keyPairs, listOf("helditem", "held_item"))
|
||||
props.heldItem = parseItem(keyPairs, listOf("helditem", "held_item"))
|
||||
props.cosmeticItem = parseItem(keyPairs, listOf("cosmetic", "cosmeticitem", "cosmetic_item"))
|
||||
props.minPerfectIVs = parseIntProperty(keyPairs, listOf("min_perfect_ivs"))?.coerceIn(0, Stats.PERMANENT.size)
|
||||
props.scaleModifier = parseFloatProperty(keyPairs, listOf("scale_modifier"))
|
||||
|
||||
@@ -340,6 +345,20 @@ open class PokemonProperties {
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
private fun parseItem(keyPairs: MutableList<Pair<String, String?>>, labels: Iterable<String>): ItemStack? {
|
||||
val matched = getMatchedKeyPair(keyPairs, labels) ?: return null
|
||||
val value = matched.second?.lowercase() ?: return null
|
||||
return try {
|
||||
val parseResult = ItemParser(RegistryAccessResolver.getAccess())
|
||||
.parse(StringReader(value))
|
||||
val input = ItemInput(parseResult.item(), parseResult.components())
|
||||
|
||||
input.createItemStack(1, false)
|
||||
} catch (_: Exception) {
|
||||
null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var originalString: String = ""
|
||||
@@ -366,8 +385,8 @@ open class PokemonProperties {
|
||||
var originalTrainer: String? = null // Original Trainer by Username or UUID
|
||||
var moves: List<String>? = null
|
||||
var movesetBuilders: List<ResourceLocation>? = null
|
||||
var heldItem: String? = null
|
||||
var cosmeticItem: String? = null
|
||||
var heldItem: ItemStack? = null
|
||||
var cosmeticItem: ItemStack? = null
|
||||
var scaleModifier: Float? = null
|
||||
var isAlpha: Boolean? = null
|
||||
|
||||
@@ -494,16 +513,14 @@ open class PokemonProperties {
|
||||
pokemon.initializeMovesetFrom(movesetBuilder)
|
||||
}
|
||||
}
|
||||
heldItem?.let { itemKey ->
|
||||
val server = server() ?: return@let
|
||||
val parser = ItemParser(server.registryAccess())
|
||||
val result = parser.parse(StringReader(itemKey))
|
||||
|
||||
val stack = ItemStack(result.item)
|
||||
stack.applyComponents(result.components)
|
||||
heldItem?.let { stack ->
|
||||
if (stack.isEmpty) return@let
|
||||
pokemon.swapHeldItem(stack, decrement = true, aiCanDrop = false)
|
||||
}
|
||||
cosmeticItem?.let { stack ->
|
||||
if (stack.isEmpty) return@let
|
||||
pokemon.swapCosmeticItem(stack, decrement = true)
|
||||
}
|
||||
scaleModifier?.let { pokemon.scaleModifier = it }
|
||||
pokemon.updateAspects()
|
||||
}
|
||||
@@ -564,21 +581,21 @@ open class PokemonProperties {
|
||||
originalTrainer?.takeIf { it != pokemon.originalTrainer }?.let { return false }
|
||||
originalTrainerType?.takeIf { it != pokemon.originalTrainerType }?.let { return false }
|
||||
moves?.takeIf { it.any { move -> pokemon.moveSet.none { it.template.name == move } } }?.let { return false }
|
||||
heldItem?.takeIf { itemKey ->
|
||||
val server = server() ?: return@takeIf true
|
||||
val parser = ItemParser(server.registryAccess())
|
||||
val result = parser.parse(StringReader(itemKey))
|
||||
heldItem?.takeIf { stack ->
|
||||
val predicate = ItemPredicate.Builder.item()
|
||||
.of(pokemon.heldItem.item)
|
||||
.hasComponents(DataComponentPredicate.allOf(pokemon.heldItem.components))
|
||||
.build()
|
||||
|
||||
if (!pokemon.heldItem.`is`(result.item)) return@takeIf true
|
||||
return@takeIf !predicate.test(stack)
|
||||
}?.let { return false }
|
||||
cosmeticItem?.takeIf { stack ->
|
||||
val predicate = ItemPredicate.Builder.item()
|
||||
.of(pokemon.heldItem.item)
|
||||
.hasComponents(DataComponentPredicate.allOf(pokemon.heldItem.components))
|
||||
.build()
|
||||
|
||||
for (entry in result.components.entrySet()) {
|
||||
val targetPropValue = pokemon.heldItem.get(entry.key)
|
||||
if (targetPropValue != entry.value.get()) {
|
||||
return@takeIf true
|
||||
}
|
||||
}
|
||||
|
||||
return@takeIf false
|
||||
return@takeIf !predicate.test(stack)
|
||||
}?.let { return false }
|
||||
scaleModifier?.takeIf { it != pokemon.scaleModifier }?.let { return false }
|
||||
return true
|
||||
@@ -706,7 +723,14 @@ open class PokemonProperties {
|
||||
originalTrainer?.let { nbt.putString(DataKeys.POKEMON_ORIGINAL_TRAINER, it) }
|
||||
moves?.let { nbt.putString(DataKeys.POKEMON_PROPERTIES_MOVES, it.joinToString(separator = ",")) }
|
||||
movesetBuilders?.let { nbt.putString(DataKeys.POKEMON_PROPERTIES_MOVESET_BUILDERS, it.joinToString(separator = ",") { source -> source.toString() }) }
|
||||
heldItem?.let {nbt.putString(DataKeys.POKEMON_PROPERTIES_HELDITEM, it)}
|
||||
heldItem?.let {
|
||||
val tag = ItemStack.SINGLE_ITEM_CODEC.encodeStart(NbtOps.INSTANCE, it)
|
||||
nbt.put(DataKeys.POKEMON_PROPERTIES_HELDITEM, tag.orThrow)
|
||||
}
|
||||
cosmeticItem?.let {
|
||||
val tag = ItemStack.SINGLE_ITEM_CODEC.encodeStart(NbtOps.INSTANCE, it)
|
||||
nbt.put(DataKeys.POKEMON_PROPERTIES_COSMETICITEM, tag.orThrow)
|
||||
}
|
||||
scaleModifier?.let { nbt.putFloat(DataKeys.POKEMON_SCALE_MODIFIER, it) }
|
||||
val custom = ListTag()
|
||||
customProperties.map { StringTag.valueOf(it.asString()) }.forEach { custom.add(it) }
|
||||
@@ -742,8 +766,16 @@ open class PokemonProperties {
|
||||
originalTrainer = if (tag.contains(DataKeys.POKEMON_ORIGINAL_TRAINER)) tag.getString(DataKeys.POKEMON_ORIGINAL_TRAINER) else null
|
||||
moves = if (tag.contains(DataKeys.POKEMON_PROPERTIES_MOVES)) tag.getString(DataKeys.POKEMON_PROPERTIES_MOVES).split(",") else null
|
||||
movesetBuilders = if (tag.contains(DataKeys.POKEMON_PROPERTIES_MOVESET_BUILDERS)) tag.getString(DataKeys.POKEMON_PROPERTIES_MOVESET_BUILDERS).split(",").map { it.asIdentifierDefaultingNamespace() } else null
|
||||
heldItem = if (tag.contains(DataKeys.POKEMON_PROPERTIES_HELDITEM)) tag.getString(DataKeys.POKEMON_PROPERTIES_HELDITEM) else null
|
||||
scaleModifier = if (tag.contains(DataKeys.POKEMON_SCALE_MODIFIER)) tag.getFloat(DataKeys.POKEMON_SCALE_MODIFIER) else null
|
||||
heldItem = when(tag.contains(DataKeys.POKEMON_PROPERTIES_HELDITEM)) {
|
||||
true -> ItemStack.parse(RegistryAccessResolver.getAccess(), tag.get(DataKeys.POKEMON_PROPERTIES_HELDITEM)!!).getOrNull()
|
||||
false -> null
|
||||
}
|
||||
cosmeticItem = when(tag.contains(DataKeys.POKEMON_PROPERTIES_COSMETICITEM)) {
|
||||
true -> ItemStack.parse(RegistryAccessResolver.getAccess(), tag.get(DataKeys.POKEMON_PROPERTIES_COSMETICITEM)!!).getOrNull()
|
||||
false -> null
|
||||
}
|
||||
|
||||
val custom = tag.getList(DataKeys.POKEMON_PROPERTIES_CUSTOM, Tag.TAG_STRING.toInt())
|
||||
// This is kinda gross
|
||||
custom.forEach { customProperties.addAll(parse(it.asString).customProperties) }
|
||||
@@ -780,7 +812,18 @@ open class PokemonProperties {
|
||||
originalTrainer?.let { json.addProperty(DataKeys.POKEMON_ORIGINAL_TRAINER, it) }
|
||||
moves?.let { json.addProperty(DataKeys.POKEMON_PROPERTIES_MOVES, it.joinToString(separator = ",")) }
|
||||
movesetBuilders?.let { json.addProperty(DataKeys.POKEMON_PROPERTIES_MOVESET_BUILDERS, it.joinToString(separator = ",") { source -> source.toString() }) }
|
||||
heldItem?.let {json.addProperty(DataKeys.POKEMON_PROPERTIES_HELDITEM, it)}
|
||||
heldItem?.let {
|
||||
json.add(
|
||||
DataKeys.POKEMON_PROPERTIES_HELDITEM,
|
||||
ItemStack.SINGLE_ITEM_CODEC.encodeStart(JsonOps.INSTANCE, it).result().get()
|
||||
)
|
||||
}
|
||||
cosmeticItem?.let {
|
||||
json.add(
|
||||
DataKeys.POKEMON_PROPERTIES_COSMETICITEM,
|
||||
ItemStack.SINGLE_ITEM_CODEC.encodeStart(JsonOps.INSTANCE, it).result().get()
|
||||
)
|
||||
}
|
||||
scaleModifier?.let { json.addProperty(DataKeys.POKEMON_SCALE_MODIFIER, it) }
|
||||
val custom = JsonArray()
|
||||
customProperties.map { it.asString() }.forEach { custom.add(it) }
|
||||
@@ -817,7 +860,12 @@ open class PokemonProperties {
|
||||
originalTrainer = json.get(DataKeys.POKEMON_ORIGINAL_TRAINER)?.asString
|
||||
moves = json.get(DataKeys.POKEMON_PROPERTIES_MOVES)?.asString?.split(",")
|
||||
movesetBuilders = json.get(DataKeys.POKEMON_PROPERTIES_MOVESET_BUILDERS)?.asString?.split(",")?.map { it.asIdentifierDefaultingNamespace() }
|
||||
heldItem = json.get(DataKeys.POKEMON_PROPERTIES_HELDITEM)?.asString
|
||||
heldItem = json.getAsJsonObject(DataKeys.POKEMON_PROPERTIES_HELDITEM)?.let {
|
||||
ItemStack.SINGLE_ITEM_CODEC.decode(JsonOps.INSTANCE, it).result().getOrNull()?.first
|
||||
}
|
||||
cosmeticItem = json.getAsJsonObject(DataKeys.POKEMON_PROPERTIES_COSMETICITEM)?.let {
|
||||
ItemStack.SINGLE_ITEM_CODEC.decode(JsonOps.INSTANCE, it).result().getOrNull()?.first
|
||||
}
|
||||
scaleModifier = json.get(DataKeys.POKEMON_SCALE_MODIFIER)?.asFloat
|
||||
val custom = json.get(DataKeys.POKEMON_PROPERTIES_CUSTOM)?.asJsonArray
|
||||
// This is still kinda gross
|
||||
@@ -859,6 +907,7 @@ open class PokemonProperties {
|
||||
moves?.let { pieces.add("moves=${it.joinToString(separator = ",")}") }
|
||||
movesetBuilders?.let { pieces.add("movesetbuilders=${it.joinToString(separator = ",") { source -> source.toString() }}") }
|
||||
heldItem?.let {pieces.add("helditem=$it")}
|
||||
cosmeticItem?.let {pieces.add("cosmeticitem=$it")}
|
||||
scaleModifier?.let { pieces.add("scale_modifier=$it") }
|
||||
return pieces.joinToString(separator)
|
||||
}
|
||||
|
||||
@@ -9,9 +9,12 @@
|
||||
package com.cobblemon.mod.common.api.riding.stats
|
||||
|
||||
import com.cobblemon.mod.common.api.cooking.Flavour
|
||||
import com.cobblemon.mod.common.api.tags.CobblemonItemTags
|
||||
import com.cobblemon.mod.common.util.lang
|
||||
import net.minecraft.network.chat.Component
|
||||
import net.minecraft.network.chat.MutableComponent
|
||||
import net.minecraft.tags.TagKey
|
||||
import net.minecraft.world.item.Item
|
||||
|
||||
/**
|
||||
* A stat that is used for riding Pokémon. The exact implementation of each of these depends on the [com.cobblemon.mod.common.api.riding.controller.RideController].
|
||||
@@ -20,13 +23,14 @@ import net.minecraft.network.chat.MutableComponent
|
||||
* @since February 17th, 2025
|
||||
*/
|
||||
enum class RidingStat(
|
||||
val flavour: Flavour
|
||||
val flavour: Flavour,
|
||||
val powerItem: TagKey<Item>
|
||||
) {
|
||||
ACCELERATION(Flavour.SPICY),
|
||||
SKILL(Flavour.DRY),
|
||||
SPEED(Flavour.SWEET),
|
||||
STAMINA(Flavour.SOUR),
|
||||
JUMP(Flavour.BITTER);
|
||||
ACCELERATION(Flavour.SPICY, CobblemonItemTags.POWER_BRACER),
|
||||
SKILL(Flavour.DRY, CobblemonItemTags.POWER_BELT),
|
||||
SPEED(Flavour.SWEET, CobblemonItemTags.POWER_ANKLET),
|
||||
STAMINA(Flavour.SOUR, CobblemonItemTags.POWER_WEIGHT),
|
||||
JUMP(Flavour.BITTER, CobblemonItemTags.POWER_BAND);
|
||||
|
||||
companion object {
|
||||
fun getByName(name: String) = RidingStat.entries.firstOrNull { it.name.equals(name, ignoreCase = true) }
|
||||
|
||||
@@ -29,7 +29,6 @@ import com.cobblemon.mod.common.net.messages.client.storage.pc.InitializePCPacke
|
||||
import com.cobblemon.mod.common.net.messages.client.storage.pc.MoveClientPCPokemonPacket
|
||||
import com.cobblemon.mod.common.net.messages.client.storage.pc.SetPCPokemonPacket
|
||||
import com.cobblemon.mod.common.net.messages.client.storage.pc.wallpaper.UnlockPCBoxWallpaperPacket
|
||||
import com.cobblemon.mod.common.net.messages.server.storage.pc.MovePCPokemonBatchPacket
|
||||
import com.cobblemon.mod.common.pokemon.Pokemon
|
||||
import com.cobblemon.mod.common.util.DataKeys
|
||||
import com.cobblemon.mod.common.util.asTranslated
|
||||
@@ -271,34 +270,6 @@ open class PCStore(
|
||||
}
|
||||
}
|
||||
|
||||
fun moveBatch(moves: List<Triple<UUID, PCPosition, PCPosition>>): Boolean {
|
||||
if (moves.isEmpty() || moves.size > MovePCPokemonBatchPacket.MAX_MOVES) return false
|
||||
if (moves.map { it.second }.toSet().size != moves.size ||
|
||||
moves.map { it.third }.toSet().size != moves.size ||
|
||||
moves.map { it.first }.toSet().size != moves.size
|
||||
) return false
|
||||
if (moves.any { (_, source, target) -> !isValidPosition(source) || !isValidPosition(target) }) return false
|
||||
|
||||
val sourcePositions = moves.mapTo(mutableSetOf()) { it.second }
|
||||
val pokemonMoves = moves.map { (pokemonID, source, target) ->
|
||||
val pokemon = get(source)?.takeIf { it.uuid == pokemonID } ?: return false
|
||||
Triple(source, target, pokemon)
|
||||
}
|
||||
if (pokemonMoves.any { (_, target, _) -> get(target) != null && target !in sourcePositions }) return false
|
||||
|
||||
pokemonMoves.forEach { (source, _, _) -> setAtPosition(source, null) }
|
||||
pokemonMoves.forEach { (_, target, pokemon) -> setAtPosition(target, pokemon) }
|
||||
|
||||
pokemonMoves.forEach { (_, _, pokemon) ->
|
||||
sendPacketToObservers(RemoveClientPokemonPacket(this, pokemon.uuid))
|
||||
}
|
||||
pokemonMoves.forEach { (_, target, pokemon) ->
|
||||
sendPacketToObservers(SetPCPokemonPacket(uuid, target) { pokemon })
|
||||
}
|
||||
pcChangeObservable.emit(Unit)
|
||||
return true
|
||||
}
|
||||
|
||||
override fun loadPositionFromNBT(nbt: CompoundTag): StoreCoordinates<PCPosition> {
|
||||
return StoreCoordinates(this, PCPosition(nbt.getShort(DataKeys.STORE_BOX).toInt(), nbt.getByte(DataKeys.STORE_SLOT).toInt()))
|
||||
}
|
||||
|
||||
@@ -111,7 +111,6 @@ object CobblemonClient {
|
||||
val battleOverlay: BattleOverlay by lazy { BattleOverlay() }
|
||||
val pokedexUsageContext: PokedexUsageContext by lazy { PokedexUsageContext() }
|
||||
val rideControlsOverlay: RideControlsOverlay by lazy { RideControlsOverlay() }
|
||||
var pcHealthToggle: Boolean = false
|
||||
|
||||
fun onLogin() {
|
||||
clientPlayerData = ClientGeneralPlayerData()
|
||||
|
||||
@@ -29,8 +29,7 @@ class BoxStorageSlot(
|
||||
|
||||
val grabbedSlot = parent.grabbedSlot
|
||||
return if (grabbedSlot == null) {
|
||||
val pokemon = getPokemon()
|
||||
pokemon == null || !parent.isInMultiSelection(pokemon, position)
|
||||
true
|
||||
} else {
|
||||
grabbedSlot.getPokemon() != getPokemon()
|
||||
}
|
||||
|
||||
@@ -50,7 +50,6 @@ import net.minecraft.network.chat.Component
|
||||
import net.minecraft.sounds.SoundEvent
|
||||
import kotlin.isInitialized
|
||||
import net.minecraft.resources.ResourceLocation
|
||||
import net.minecraft.util.FastColor
|
||||
|
||||
class PCGUI(
|
||||
val pc: ClientPC,
|
||||
@@ -99,8 +98,6 @@ class PCGUI(
|
||||
private val buttonWallpaperResource = cobblemonResource("textures/gui/pc/pc_button_set_wallpaper.png")
|
||||
private val buttonInfoArrow = cobblemonResource("textures/gui/pc/info_arrow.png")
|
||||
|
||||
private val buttonHealthToggleResource = cobblemonResource("textures/gui/pc/pc_button_toggle_health.png")
|
||||
|
||||
private val topSpacerResource = cobblemonResource("textures/gui/pc/pc_spacer_top.png")
|
||||
private val bottomSpacerResource = cobblemonResource("textures/gui/pc/pc_spacer_bottom.png")
|
||||
private val rightSpacerResource = cobblemonResource("textures/gui/pc/pc_spacer_right.png")
|
||||
@@ -132,55 +129,6 @@ class PCGUI(
|
||||
var selectPointerOffsetIncrement = false
|
||||
var displayOptions = false
|
||||
|
||||
private var dragStartX: Int? = null
|
||||
private var dragStartY: Int? = null
|
||||
private var dragEndX: Int? = null
|
||||
private var dragEndY: Int? = null
|
||||
private var selectionDragActive = false
|
||||
|
||||
data class SelectionArea(val left: Int, val top: Int, val right: Int, val bottom: Int)
|
||||
|
||||
private data class BoxGridBounds(val left: Int, val top: Int, val right: Int, val bottom: Int) {
|
||||
fun contains(x: Int, y: Int) = x in left..< right && y >= top && y < bottom
|
||||
}
|
||||
|
||||
private fun getBoxGridBounds(): BoxGridBounds {
|
||||
val left = storageWidget.x
|
||||
val top = storageWidget.y
|
||||
return BoxGridBounds(
|
||||
left,
|
||||
top,
|
||||
left + StorageWidget.SCREEN_WIDTH,
|
||||
top + StorageWidget.SCREEN_HEIGHT
|
||||
)
|
||||
}
|
||||
|
||||
fun getSelectionArea(): SelectionArea? {
|
||||
if (!selectionDragActive) return null
|
||||
val startX = dragStartX ?: return null
|
||||
val startY = dragStartY ?: return null
|
||||
val endX = dragEndX ?: return null
|
||||
val endY = dragEndY ?: return null
|
||||
val bounds = getBoxGridBounds()
|
||||
if (!bounds.contains(startX, startY)) return null
|
||||
|
||||
val columns = 6
|
||||
val rows = 5
|
||||
val slotPitch = StorageSlot.SIZE + StorageWidget.BOX_SLOT_PADDING
|
||||
val gridLeft = bounds.left + StorageWidget.BOX_SLOT_START_OFFSET_X
|
||||
val gridTop = bounds.top + StorageWidget.BOX_SLOT_START_OFFSET_Y + if (displayOptions) 5 else 0
|
||||
val startColumn = ((startX - gridLeft) / slotPitch).coerceIn(0, columns - 1)
|
||||
val endColumn = (((endX.coerceIn(bounds.left, bounds.right - 1)) - gridLeft) / slotPitch).coerceIn(0, columns - 1)
|
||||
val startRow = ((startY - gridTop) / slotPitch).coerceIn(0, rows - 1)
|
||||
val endRow = (((endY.coerceIn(bounds.top, bounds.bottom - 1)) - gridTop) / slotPitch).coerceIn(0, rows - 1)
|
||||
return SelectionArea(
|
||||
gridLeft + minOf(startColumn, endColumn) * slotPitch, // left
|
||||
gridTop + minOf(startRow, endRow) * slotPitch, // top
|
||||
gridLeft + (maxOf(startColumn, endColumn) * slotPitch) + StorageSlot.SIZE, // right
|
||||
gridTop + (maxOf(startRow, endRow) * slotPitch) + StorageSlot.SIZE // bottom
|
||||
)
|
||||
}
|
||||
|
||||
override fun renderBlurredBackground(delta: Float) {}
|
||||
|
||||
override fun renderMenuBackground(context: GuiGraphics) {}
|
||||
@@ -271,6 +219,7 @@ class PCGUI(
|
||||
storageWidget.setupStorageSlots()
|
||||
for (button in optionButtons) {
|
||||
button.visible = displayOptions
|
||||
button.highlighted = false
|
||||
}
|
||||
}.also { it.highlighted = displayOptions }
|
||||
)
|
||||
@@ -301,28 +250,12 @@ class PCGUI(
|
||||
configuration.showParty = isVisible
|
||||
wallpaperWidget.visible = !isVisible
|
||||
(it as IconButton).highlighted = !isVisible
|
||||
if (unseenWallpapers.isNotEmpty()) MarkPCBoxWallpapersSeenPacket(unseenWallpapers).sendToServer()
|
||||
if (!unseenWallpapers.isEmpty()) MarkPCBoxWallpapersSeenPacket(unseenWallpapers).sendToServer()
|
||||
}.also {
|
||||
it.visible = displayOptions
|
||||
optionButtons.add(it)
|
||||
})
|
||||
|
||||
val healthButton = this.addRenderableWidget(IconButton(
|
||||
pX = x + 230,
|
||||
pY = y + 31,
|
||||
buttonWidth = 20,
|
||||
buttonHeight = 20,
|
||||
resource = buttonHealthToggleResource,
|
||||
label = "toggle_health_bars",
|
||||
) {
|
||||
CobblemonClient.pcHealthToggle = !CobblemonClient.pcHealthToggle
|
||||
(it as IconButton).highlighted = CobblemonClient.pcHealthToggle
|
||||
}.also {
|
||||
it.visible = displayOptions
|
||||
optionButtons.add(it)
|
||||
})
|
||||
healthButton.highlighted = CobblemonClient.pcHealthToggle
|
||||
|
||||
PokemonSortMode.entries.forEachIndexed { index, sortType ->
|
||||
val typeName = sortType.name.lowercase()
|
||||
this.addRenderableWidget(IconButton(
|
||||
@@ -382,20 +315,6 @@ class PCGUI(
|
||||
super.init()
|
||||
}
|
||||
|
||||
private fun renderSelectionBox(context: GuiGraphics, area: SelectionArea) {
|
||||
context.pose().pushPose()
|
||||
context.pose().translate(0.0, 0.0, 1500.0)
|
||||
val borderColor = FastColor.ARGB32.color(255, 205, 212, 255)
|
||||
val bgColor = FastColor.ARGB32.color(75, 133, 183, 230)
|
||||
val thickness = 1
|
||||
context.fill(area.left, area.top, area.right, area.bottom, bgColor)
|
||||
context.fill(area.left, area.top, area.right, area.top + thickness, borderColor)
|
||||
context.fill(area.left, area.bottom - thickness, area.right, area.bottom, borderColor)
|
||||
context.fill(area.left, area.top, area.left + thickness, area.bottom, borderColor)
|
||||
context.fill(area.right - thickness, area.top, area.right, area.bottom, borderColor)
|
||||
context.pose().popPose()
|
||||
}
|
||||
|
||||
override fun render(context: GuiGraphics, mouseX: Int, mouseY: Int, delta: Float) {
|
||||
val matrices = context.pose()
|
||||
renderBackground(context, mouseX, mouseY, delta)
|
||||
@@ -536,20 +455,6 @@ class PCGUI(
|
||||
shadow = true
|
||||
)
|
||||
|
||||
// var dexNo = pokemon.species.nationalPokedexNumber.toString()
|
||||
// while (dexNo.length < 4) {
|
||||
// dexNo = "0$dexNo"
|
||||
// }
|
||||
// drawScaledText(
|
||||
// context = context,
|
||||
// font = CobblemonResources.DEFAULT_LARGE,
|
||||
// text = Component.literal(dexNo).bold(),
|
||||
// x = x + 38,
|
||||
// y = y + 1.5,
|
||||
// shadow = true,
|
||||
// scale = 0.85f
|
||||
// )
|
||||
|
||||
drawScaledText(
|
||||
context = context,
|
||||
font = CobblemonResources.DEFAULT_LARGE,
|
||||
@@ -780,14 +685,12 @@ class PCGUI(
|
||||
scale = SCALE
|
||||
)
|
||||
|
||||
if (optionButtons.isNotEmpty() && displayOptions) {
|
||||
if (!optionButtons.isEmpty() && displayOptions) {
|
||||
for (button in optionButtons) button.showAlt = hasShiftDown()
|
||||
}
|
||||
|
||||
super.render(context, mouseX, mouseY, delta)
|
||||
|
||||
getSelectionArea()?.let { renderSelectionBox(context, it) }
|
||||
|
||||
// Item Tooltip
|
||||
if (pokemon != null) {
|
||||
val displayedItem = if (showCosmeticItem) pokemon.cosmeticItem else pokemon.heldItemNoCopy()
|
||||
@@ -809,20 +712,6 @@ class PCGUI(
|
||||
}
|
||||
|
||||
override fun mouseClicked(mouseX: Double, mouseY: Double, button: Int): Boolean {
|
||||
storageWidget.clearPendingStorageSlotClick()
|
||||
selectionDragActive = false
|
||||
val clickX = mouseX.toInt()
|
||||
val clickY = mouseY.toInt()
|
||||
if (storageWidget.multiSelection == null && button == 0 &&
|
||||
getBoxGridBounds().contains(clickX, clickY) &&
|
||||
storageWidget.pastureWidget == null) {
|
||||
dragStartX = clickX
|
||||
dragStartY = clickY
|
||||
} else {
|
||||
dragStartX = null
|
||||
dragStartY = null
|
||||
}
|
||||
|
||||
// Trigger child component function as they will need to check the entire screen click area
|
||||
if (::boxNameWidget.isInitialized) boxNameWidget.mouseClicked(mouseX, mouseY, button)
|
||||
return super.mouseClicked(mouseX, mouseY, button)
|
||||
@@ -851,43 +740,9 @@ class PCGUI(
|
||||
storageWidget.pastureWidget?.let { pasture ->
|
||||
if (pasture.pastureScrollList.isHovered) pasture.pastureScrollList.mouseDragged(mouseX, mouseY, button, deltaX, deltaY)
|
||||
}
|
||||
if (button == 0 && storageWidget.pastureWidget == null) {
|
||||
val startX = dragStartX
|
||||
val startY = dragStartY
|
||||
if (startX != null && startY != null) {
|
||||
val offsetX = mouseX - startX
|
||||
val offsetY = mouseY - startY
|
||||
if (offsetX * offsetX + offsetY * offsetY >= 25.0) {
|
||||
selectionDragActive = true
|
||||
storageWidget.clearPendingStorageSlotClick()
|
||||
dragEndX = mouseX.toInt()
|
||||
dragEndY = mouseY.toInt()
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.mouseDragged(mouseX, mouseY, button, deltaX, deltaY)
|
||||
}
|
||||
|
||||
override fun mouseReleased(mouseX: Double, mouseY: Double, button: Int): Boolean {
|
||||
val handled = super.mouseReleased(mouseX, mouseY, button)
|
||||
if (button == 0) {
|
||||
if (selectionDragActive) {
|
||||
dragEndX = mouseX.toInt()
|
||||
dragEndY = mouseY.toInt()
|
||||
storageWidget.updateSelection()
|
||||
storageWidget.clearPendingStorageSlotClick()
|
||||
} else {
|
||||
storageWidget.completePendingStorageSlotClick(mouseX, mouseY)
|
||||
}
|
||||
}
|
||||
dragStartX = null
|
||||
dragStartY = null
|
||||
dragEndX = null
|
||||
dragEndY = null
|
||||
selectionDragActive = false
|
||||
return handled
|
||||
}
|
||||
|
||||
override fun keyPressed(keyCode: Int, scanCode: Int, modifiers: Int): Boolean {
|
||||
val boxNameFocused = this::boxNameWidget.isInitialized && boxNameWidget.isFocused
|
||||
val filterFocused = this::filterWidget.isInitialized && filterWidget.isFocused
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
package com.cobblemon.mod.common.client.gui.pc
|
||||
|
||||
import com.cobblemon.mod.common.pokemon.Pokemon
|
||||
|
||||
data class PCMultiSelection(
|
||||
private val grid: MutableList<MutableList<Pokemon?>> = mutableListOf(),
|
||||
val sourceBox: Int = 0,
|
||||
val sourceColumn: Int = 0,
|
||||
val sourceRow: Int = 0
|
||||
) {
|
||||
fun getHorizontalSize(): Int = grid.firstOrNull()?.size ?: 0
|
||||
fun getVerticalSize(): Int = grid.size
|
||||
|
||||
constructor(horizontalSize: Int, verticalSize: Int, sourceBox: Int, sourceColumn: Int, sourceRow: Int) : this(
|
||||
MutableList(verticalSize) { MutableList<Pokemon?>(horizontalSize) { null } },
|
||||
sourceBox,
|
||||
sourceColumn,
|
||||
sourceRow
|
||||
)
|
||||
|
||||
fun getPokemon(x: Int, y: Int): Pokemon? {
|
||||
return grid[y][x]
|
||||
}
|
||||
|
||||
fun setPokemon(x: Int, y: Int, pokemon: Pokemon?) {
|
||||
grid[y][x] = pokemon
|
||||
}
|
||||
|
||||
fun pokemonEntries(): List<Triple<Int, Int, Pokemon>> {
|
||||
return grid.flatMapIndexed { y, row ->
|
||||
row.mapIndexedNotNull { x, pokemon -> pokemon?.let { Triple(x, y, it) } }
|
||||
}
|
||||
}
|
||||
|
||||
fun getPokemonCount(): Int = pokemonEntries().size
|
||||
|
||||
}
|
||||
@@ -45,13 +45,11 @@ class ReleaseButton(
|
||||
vOffset = if (isHovered(mouseX.toDouble(), mouseY.toDouble())) HEIGHT else 0,
|
||||
textureHeight = HEIGHT * 2
|
||||
)
|
||||
val pokemonCount = parent.multiSelection?.getPokemonCount() ?: 0
|
||||
|
||||
drawScaledText(
|
||||
context = context,
|
||||
font = CobblemonResources.DEFAULT_LARGE,
|
||||
text = if (pokemonCount > 1)
|
||||
{ lang("ui.pc.release_all").bold() } else { lang("ui.pc.release").bold() },
|
||||
text = lang("ui.pc.release").bold(),
|
||||
x = x + (WIDTH / 2),
|
||||
y = y + 3.5,
|
||||
centered = true,
|
||||
|
||||
@@ -10,11 +10,10 @@ package com.cobblemon.mod.common.client.gui.pc
|
||||
|
||||
import com.cobblemon.mod.common.Cobblemon
|
||||
import com.cobblemon.mod.common.api.gui.blitk
|
||||
import com.cobblemon.mod.common.client.CobblemonClient
|
||||
import com.cobblemon.mod.common.client.gui.CobblemonRenderable
|
||||
import com.cobblemon.mod.common.client.gui.PokemonGUIAnimationStyle
|
||||
import com.cobblemon.mod.common.client.gui.drawProfilePokemon
|
||||
import com.cobblemon.mod.common.client.gui.pasture.PasturePCGUIConfiguration
|
||||
import com.cobblemon.mod.common.client.gui.PokemonGUIAnimationStyle
|
||||
import com.cobblemon.mod.common.client.render.drawScaledText
|
||||
import com.cobblemon.mod.common.client.render.models.blockbench.FloatingState
|
||||
import com.cobblemon.mod.common.client.render.renderScaledGuiItemIcon
|
||||
@@ -23,19 +22,13 @@ import com.cobblemon.mod.common.pokemon.Pokemon
|
||||
import com.cobblemon.mod.common.util.cobblemonResource
|
||||
import com.cobblemon.mod.common.util.lang
|
||||
import com.cobblemon.mod.common.util.math.fromEulerXYZDegrees
|
||||
import juuxel.adorn.util.Colors
|
||||
import net.minecraft.client.Minecraft
|
||||
import net.minecraft.client.gui.GuiGraphics
|
||||
import net.minecraft.client.gui.components.Button
|
||||
import net.minecraft.client.renderer.RenderType
|
||||
import net.minecraft.client.sounds.SoundManager
|
||||
import net.minecraft.network.chat.Component
|
||||
import net.minecraft.util.Mth
|
||||
import org.joml.Quaternionf
|
||||
import org.joml.Vector3f
|
||||
import kotlin.math.abs
|
||||
import kotlin.math.max
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
open class StorageSlot(
|
||||
x: Int, y: Int,
|
||||
@@ -61,17 +54,9 @@ open class StorageSlot(
|
||||
}
|
||||
|
||||
override fun renderWidget(context: GuiGraphics, mouseX: Int, mouseY: Int, delta: Float) {
|
||||
val selectionArea = parent.pcGui.getSelectionArea()
|
||||
if (selectionArea != null && parent.getSelectedPokemon(selectionArea).contains(this)) {
|
||||
val highlightColor = 0x40FFFFFF
|
||||
context.fill(x + 1, y, x + (SIZE - 1), y + SIZE, highlightColor)
|
||||
context.fill(x, y + 1, x + 1, y + (SIZE - 1), highlightColor)
|
||||
context.fill(x + SIZE - 1, y + 1, x + SIZE, y + (SIZE - 1), highlightColor)
|
||||
}
|
||||
if (shouldRender()) {
|
||||
renderSlot(context, x, y, delta)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun renderSlot(context: GuiGraphics, posX: Int, posY: Int, partialTicks: Float) {
|
||||
@@ -145,23 +130,6 @@ open class StorageSlot(
|
||||
matrixStack = matrices
|
||||
)
|
||||
}
|
||||
|
||||
// Pokemon health
|
||||
// Taken from vanilla durability rendering
|
||||
val currentHealth = pokemon.currentHealth
|
||||
val maxHealth = pokemon.maxHealth.toFloat()
|
||||
if (currentHealth < maxHealth && CobblemonClient.pcHealthToggle) {
|
||||
val damageValue = maxHealth - currentHealth
|
||||
val f = max(0.0f, (maxHealth - (maxHealth - currentHealth)) / maxHealth)
|
||||
val color = Mth.hsvToRgb(f / 3.0f, 1.0f, 1.0f)
|
||||
val totalWidth = 12
|
||||
val width = (totalWidth - damageValue * totalWidth / pokemon.maxHealth.toFloat()).roundToInt();
|
||||
val k = posX + 1
|
||||
val l = posY + 6
|
||||
val bgColor = if (this is PartyStorageSlot) Colors.BLACK else 0xFF3E3E3E.toInt()
|
||||
context.fill(RenderType.guiOverlay(), k, l, k + totalWidth, l + 1, bgColor)
|
||||
context.fill(RenderType.guiOverlay(), k, l, k + width, l + 1, color or bgColor)
|
||||
}
|
||||
matrices.popPose()
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ package com.cobblemon.mod.common.client.gui.pc
|
||||
import com.cobblemon.mod.common.CobblemonNetwork
|
||||
import com.cobblemon.mod.common.CobblemonSounds
|
||||
import com.cobblemon.mod.common.api.gui.blitk
|
||||
import com.cobblemon.mod.common.api.storage.StorePosition
|
||||
import com.cobblemon.mod.common.api.storage.party.PartyPosition
|
||||
import com.cobblemon.mod.common.api.storage.pc.PCPosition
|
||||
import com.cobblemon.mod.common.api.text.bold
|
||||
@@ -38,9 +39,8 @@ import net.minecraft.client.gui.components.Button
|
||||
import net.minecraft.client.gui.screens.Screen
|
||||
import net.minecraft.client.resources.sounds.SimpleSoundInstance
|
||||
import net.minecraft.network.chat.Component
|
||||
import net.minecraft.resources.ResourceLocation
|
||||
import net.minecraft.sounds.SoundEvent
|
||||
import java.util.UUID
|
||||
import com.cobblemon.mod.common.net.messages.server.storage.pc.MovePCPokemonBatchPacket.PCPokemonMove
|
||||
|
||||
class StorageWidget(
|
||||
pX: Int, pY: Int,
|
||||
@@ -77,14 +77,9 @@ class StorageWidget(
|
||||
|
||||
var displayConfirmRelease = false
|
||||
var screenLoaded = false
|
||||
var selectedPosition: PartyPosition? = null
|
||||
var selectedPosition: StorePosition? = null
|
||||
var grabbedSlot: GrabbedStorageSlot? = null
|
||||
|
||||
var multiSelection: PCMultiSelection? = null
|
||||
private val multiGrabbedSlots = mutableMapOf<UUID, GrabbedStorageSlot>()
|
||||
private var pendingStorageSlotClick: Button? = null
|
||||
private var movePending = false
|
||||
|
||||
var box = 0
|
||||
set(value) {
|
||||
field =
|
||||
@@ -118,22 +113,16 @@ class StorageWidget(
|
||||
subKey = "ui.generic.yes",
|
||||
onPress = {
|
||||
if (canDeleteSelected() && displayConfirmRelease) {
|
||||
val selection = multiSelection
|
||||
if (selection != null) {
|
||||
selection.pokemonEntries().forEach { (column, row, pokemon) ->
|
||||
val position = PCPosition(
|
||||
selection.sourceBox,
|
||||
(selection.sourceRow + row) * 6 + selection.sourceColumn + column
|
||||
)
|
||||
CobblemonNetwork.sendToServer(ReleasePCPokemonPacket(pokemon.uuid, position))
|
||||
}
|
||||
} else {
|
||||
val position = selectedPosition ?: return@ReleaseConfirmButton
|
||||
val pokemon = getSelectedPokemon() ?: return@ReleaseConfirmButton
|
||||
val position = selectedPosition ?: return@ReleaseConfirmButton
|
||||
val pokemon = getSelectedPokemon() ?: return@ReleaseConfirmButton
|
||||
|
||||
CobblemonNetwork.sendToServer(ReleasePartyPokemonPacket(pokemon.uuid, position))
|
||||
val packet = when (position) {
|
||||
is PartyPosition -> ReleasePartyPokemonPacket(pokemon.uuid, position)
|
||||
is PCPosition -> ReleasePCPokemonPacket(pokemon.uuid, position)
|
||||
else -> return@ReleaseConfirmButton
|
||||
}
|
||||
|
||||
CobblemonNetwork.sendToServer(packet)
|
||||
playSound(CobblemonSounds.PC_RELEASE)
|
||||
resetSelected()
|
||||
displayConfirmRelease = false
|
||||
@@ -160,8 +149,9 @@ class StorageWidget(
|
||||
}
|
||||
|
||||
fun canDeleteSelected(): Boolean {
|
||||
multiSelection?.let { return it.pokemonEntries().isNotEmpty() }
|
||||
return party.filterNotNull().size > 1 && selectedPosition != null && grabbedSlot != null
|
||||
return !(selectedPosition is PartyPosition && party.filterNotNull().size <= 1)
|
||||
&& selectedPosition != null
|
||||
&& grabbedSlot != null
|
||||
}
|
||||
|
||||
fun setupStorageSlots() {
|
||||
@@ -180,7 +170,7 @@ class StorageWidget(
|
||||
parent = this,
|
||||
pc = pc,
|
||||
position = PCPosition(box, index),
|
||||
onPress = { pendingStorageSlotClick = it }
|
||||
onPress = { this.onStorageSlotClicked(it) }
|
||||
).also { widget ->
|
||||
this.addWidget(widget)
|
||||
this.boxSlots.add(widget)
|
||||
@@ -210,7 +200,7 @@ class StorageWidget(
|
||||
parent = this,
|
||||
party = party,
|
||||
position = PartyPosition(partyIndex),
|
||||
onPress = { pendingStorageSlotClick = it }
|
||||
onPress = { this.onStorageSlotClicked(it) }
|
||||
).also { widget ->
|
||||
this.addWidget(widget)
|
||||
this.partySlots.add(widget)
|
||||
@@ -220,117 +210,14 @@ class StorageWidget(
|
||||
|
||||
private fun getSelectedPokemon(): Pokemon? {
|
||||
val selectedPosition = this.selectedPosition ?: return null
|
||||
return party.get(selectedPosition)
|
||||
}
|
||||
|
||||
fun getSelectedPokemon(area: PCGUI.SelectionArea): List<BoxStorageSlot> {
|
||||
return boxSlots.filter { slot ->
|
||||
slot.x < area.right && slot.x + StorageSlot.SIZE > area.left &&
|
||||
slot.y < area.bottom && slot.y + StorageSlot.SIZE > area.top &&
|
||||
slot.getPokemon()?.let(pcGui.search::passes) == true
|
||||
return when (selectedPosition) {
|
||||
is PCPosition -> pc.get(selectedPosition)
|
||||
is PartyPosition -> party.get(selectedPosition)
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
fun clearPendingStorageSlotClick() {
|
||||
pendingStorageSlotClick = null
|
||||
}
|
||||
|
||||
fun completePendingStorageSlotClick(mouseX: Double, mouseY: Double) {
|
||||
val button = pendingStorageSlotClick ?: return
|
||||
pendingStorageSlotClick = null
|
||||
if (button.isMouseOver(mouseX, mouseY)) {
|
||||
onStorageSlotClicked(button)
|
||||
}
|
||||
}
|
||||
|
||||
fun updateSelection() {
|
||||
val area = pcGui.getSelectionArea()
|
||||
if (area == null) {
|
||||
multiSelection = null
|
||||
return
|
||||
}
|
||||
|
||||
selectedPosition = null
|
||||
grabbedSlot = null
|
||||
pcGui.setPreviewPokemon(null)
|
||||
|
||||
val selectedSlots = getSelectedPokemon(area)
|
||||
if (selectedSlots.isEmpty()) {
|
||||
multiSelection = null
|
||||
return
|
||||
}
|
||||
|
||||
val minColumn = selectedSlots.minOf { it.position.slot % 6 }
|
||||
val maxColumn = selectedSlots.maxOf { it.position.slot % 6 }
|
||||
val minRow = selectedSlots.minOf { it.position.slot / 6 }
|
||||
val maxRow = selectedSlots.maxOf { it.position.slot / 6 }
|
||||
val selection = PCMultiSelection(maxColumn - minColumn + 1, maxRow - minRow + 1, box, minColumn, minRow)
|
||||
|
||||
selectedSlots.forEach { slot ->
|
||||
val pokemon = slot.getPokemon() ?: return@forEach
|
||||
val slotIndex = slot.position.slot
|
||||
val column = slotIndex % 6
|
||||
val row = slotIndex / 6
|
||||
if (column in minColumn..maxColumn && row in minRow..maxRow) {
|
||||
selection.setPokemon(column - minColumn, row - minRow, pokemon)
|
||||
}
|
||||
}
|
||||
playSound(CobblemonSounds.PC_GRAB)
|
||||
|
||||
multiSelection = selection
|
||||
}
|
||||
|
||||
private fun moveMultiSelectionTo(destination: PCPosition): Boolean {
|
||||
val selection = multiSelection ?: return false
|
||||
|
||||
val width = selection.getHorizontalSize()
|
||||
val height = selection.getVerticalSize()
|
||||
val destinationColumn = destination.slot % 6
|
||||
val destinationRow = destination.slot / 6
|
||||
if (destinationColumn + width > 6 || destinationRow + height > 5) return false
|
||||
|
||||
val moves = mutableListOf<PCPokemonMove>()
|
||||
val selectedSources = mutableSetOf<PCPosition>()
|
||||
for (row in 0 until height) {
|
||||
for (column in 0 until width) {
|
||||
val pokemon = selection.getPokemon(column, row) ?: continue
|
||||
val source = PCPosition(selection.sourceBox, (selection.sourceRow + row) * 6 + selection.sourceColumn + column)
|
||||
val target = PCPosition(destination.box, (destinationRow + row) * 6 + destinationColumn + column)
|
||||
selectedSources.add(source)
|
||||
moves.add(PCPokemonMove(pokemon.uuid, source, target))
|
||||
}
|
||||
}
|
||||
|
||||
if (moves.isEmpty()) return false
|
||||
|
||||
for (row in 0 until height) {
|
||||
for (column in 0 until width) {
|
||||
if (selection.getPokemon(column, row) == null) continue
|
||||
val target = PCPosition(destination.box, (destinationRow + row) * 6 + destinationColumn + column)
|
||||
val displacedPokemon = pc.get(target) ?: continue
|
||||
if (target in selectedSources) continue
|
||||
|
||||
val displacedSource = PCPosition(
|
||||
selection.sourceBox,
|
||||
(selection.sourceRow + row) * 6 + selection.sourceColumn + column
|
||||
)
|
||||
if (pc.get(displacedSource) != null && displacedSource !in selectedSources) return false
|
||||
moves.add(PCPokemonMove(displacedPokemon.uuid, target, displacedSource))
|
||||
}
|
||||
}
|
||||
|
||||
if (moves.map { it.newPosition }.toSet().size != moves.size) return false
|
||||
MovePCPokemonBatchPacket(moves).sendToServer()
|
||||
return true
|
||||
}
|
||||
|
||||
fun isInMultiSelection(pokemon: Pokemon, position: PCPosition): Boolean {
|
||||
val selection = multiSelection ?: return false
|
||||
return selection.sourceBox == position.box && selection.pokemonEntries().any { it.third == pokemon }
|
||||
}
|
||||
|
||||
override fun renderWidget(context: GuiGraphics, mouseX: Int, mouseY: Int, delta: Float) {
|
||||
updatePendingMove()
|
||||
val matrices = context.pose()
|
||||
// Party Label
|
||||
if (pcGui.configuration.showParty) {
|
||||
@@ -353,14 +240,11 @@ class StorageWidget(
|
||||
shadow = true
|
||||
)
|
||||
|
||||
val pokemonCount = multiSelection?.getPokemonCount() ?: 0
|
||||
|
||||
if (canDeleteSelected() && displayConfirmRelease) {
|
||||
drawScaledText(
|
||||
context = context,
|
||||
font = CobblemonResources.DEFAULT_LARGE,
|
||||
text = if (pokemonCount > 1)
|
||||
{ lang("ui.pc.release_all").bold() } else { lang("ui.pc.release").bold() },
|
||||
text = lang("ui.pc.release").bold(),
|
||||
x = x + 223,
|
||||
y = y + 119,
|
||||
centered = true
|
||||
@@ -424,7 +308,6 @@ class StorageWidget(
|
||||
slot.render(context, mouseX, mouseY, delta)
|
||||
val pokemon = slot.getPokemon()
|
||||
if (grabbedSlot == null && slot.isHovered(mouseX, mouseY)
|
||||
&& multiSelection == null
|
||||
&& pokemon != null && pokemon != pcGui.previewPokemon
|
||||
) {
|
||||
pcGui.setPreviewPokemon(pokemon, pcGui.isPreviewInParty ?: false)
|
||||
@@ -441,7 +324,6 @@ class StorageWidget(
|
||||
slot.render(context, mouseX, mouseY, delta)
|
||||
val pokemon = slot.getPokemon()
|
||||
if (grabbedSlot == null && slot.isHovered(mouseX, mouseY)
|
||||
&& multiSelection == null
|
||||
&& pokemon != null && pokemon != pcGui.previewPokemon
|
||||
) {
|
||||
pcGui.setPreviewPokemon(pokemon, pcGui.isPreviewInParty ?: true)
|
||||
@@ -453,32 +335,10 @@ class StorageWidget(
|
||||
pastureWidget?.render(context, mouseX, mouseY, delta)
|
||||
matrices.pushPose()
|
||||
matrices.translate(0.0, 0.0, 1000.0)
|
||||
renderSelectedPokemon(context, mouseX, mouseY, delta)
|
||||
grabbedSlot?.render(context, mouseX, mouseY, delta)
|
||||
matrices.popPose()
|
||||
}
|
||||
|
||||
private fun renderSelectedPokemon(context: GuiGraphics, mouseX: Int, mouseY: Int, delta: Float) {
|
||||
if (movePending) return
|
||||
val selection = multiSelection
|
||||
if (selection == null) {
|
||||
grabbedSlot?.render(context, mouseX, mouseY, delta)
|
||||
return
|
||||
}
|
||||
|
||||
val slotOffset = StorageSlot.SIZE + BOX_SLOT_PADDING
|
||||
selection.pokemonEntries().forEach { (column, row, pokemon) ->
|
||||
val grabbed = multiGrabbedSlots.getOrPut(pokemon.uuid) {
|
||||
GrabbedStorageSlot(0, 0, this, pokemon)
|
||||
}
|
||||
grabbed.render(
|
||||
context,
|
||||
mouseX + column * slotOffset,
|
||||
mouseY + row * slotOffset,
|
||||
delta
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override fun mouseClicked(pMouseX: Double, pMouseY: Double, pButton: Int): Boolean {
|
||||
if (displayConfirmRelease) {
|
||||
if (releaseYesButton.isHovered(pMouseX, pMouseY)) releaseYesButton.mouseClicked(pMouseX, pMouseY, pButton)
|
||||
@@ -511,55 +371,23 @@ class StorageWidget(
|
||||
else -> return
|
||||
}
|
||||
|
||||
val clickedPokemon = when (clickedPosition) {
|
||||
is PCPosition -> pc.get(clickedPosition)
|
||||
is PartyPosition -> party.get(clickedPosition)
|
||||
else -> null
|
||||
}
|
||||
|
||||
multiSelection?.let { selection ->
|
||||
when (clickedPosition) {
|
||||
is PCPosition -> {
|
||||
if (clickedPosition.box == selection.sourceBox &&
|
||||
clickedPosition.slot == selection.sourceRow * 6 + selection.sourceColumn
|
||||
) {
|
||||
resetSelected()
|
||||
} else if (moveMultiSelectionTo(clickedPosition)) {
|
||||
playSound(CobblemonSounds.PC_DROP)
|
||||
movePending = true
|
||||
}
|
||||
}
|
||||
is PartyPosition -> {
|
||||
val selectedPokemon = selection.pokemonEntries().singleOrNull() ?: return
|
||||
val (column, row, pokemon) = selectedPokemon
|
||||
val source = PCPosition(
|
||||
selection.sourceBox,
|
||||
(selection.sourceRow + row) * 6 + selection.sourceColumn + column
|
||||
)
|
||||
if (pc.get(source) !== pokemon) return
|
||||
val packet = clickedPokemon?.let {
|
||||
SwapPCPartyPokemonPacket(it.uuid, clickedPosition, pokemon.uuid, source)
|
||||
} ?: MovePCPokemonToPartyPacket(pokemon.uuid, source, clickedPosition)
|
||||
packet.sendToServer()
|
||||
playSound(CobblemonSounds.PC_DROP)
|
||||
movePending = true
|
||||
}
|
||||
else -> Unit
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Reset release confirmation
|
||||
displayConfirmRelease = false
|
||||
|
||||
// Clicking on itself, so unselect position
|
||||
if (selectedPosition == clickedPosition) {
|
||||
if (this.selectedPosition != null && this.selectedPosition == clickedPosition) {
|
||||
if (grabbedSlot != null) playSound(CobblemonSounds.PC_DROP)
|
||||
resetSelected()
|
||||
return
|
||||
}
|
||||
|
||||
// Check for selecting a Pokémon
|
||||
val clickedPokemon = when(button) {
|
||||
is BoxStorageSlot -> pc.get(clickedPosition as PCPosition)
|
||||
is PartyStorageSlot -> party.get(clickedPosition as PartyPosition)
|
||||
else -> null
|
||||
}
|
||||
|
||||
val selectOverride = pcGui.configuration.selectOverride
|
||||
if (selectOverride != null) {
|
||||
selectOverride(pcGui, clickedPosition, clickedPokemon)
|
||||
@@ -592,47 +420,59 @@ class StorageWidget(
|
||||
}
|
||||
}
|
||||
|
||||
if (clickedPosition is PCPosition) {
|
||||
val column = clickedPosition.slot % 6
|
||||
val row = clickedPosition.slot / 6
|
||||
multiSelection = PCMultiSelection(1, 1, clickedPosition.box, column, row).also {
|
||||
it.setPokemon(0, 0, clickedPokemon)
|
||||
}
|
||||
playSound(CobblemonSounds.PC_GRAB)
|
||||
return
|
||||
} else if (clickedPosition is PartyPosition) {
|
||||
this.selectedPosition = clickedPosition
|
||||
this.pcGui.setPreviewPokemon(clickedPokemon, pcGui.isPreviewInParty ?: false)
|
||||
grabbedSlot = GrabbedStorageSlot(
|
||||
x = button.x,
|
||||
y = button.y,
|
||||
parent = this,
|
||||
pokemon = clickedPokemon
|
||||
)
|
||||
playSound(CobblemonSounds.PC_GRAB)
|
||||
}
|
||||
this.selectedPosition = clickedPosition
|
||||
this.pcGui.setPreviewPokemon(clickedPokemon, pcGui.isPreviewInParty ?: false)
|
||||
grabbedSlot = GrabbedStorageSlot(
|
||||
x = button.x,
|
||||
y = button.y,
|
||||
parent = this,
|
||||
pokemon = clickedPokemon
|
||||
)
|
||||
playSound(CobblemonSounds.PC_GRAB)
|
||||
|
||||
}
|
||||
} else {
|
||||
val sourcePosition = selectedPosition ?: return
|
||||
val selectedPokemon = party.get(sourcePosition) ?: return
|
||||
// Handle movement within the Box
|
||||
val selectedPokemon = when(this.selectedPosition) {
|
||||
is PCPosition -> pc.get(this.selectedPosition as PCPosition)
|
||||
is PartyPosition -> party.get(this.selectedPosition as PartyPosition)
|
||||
else -> null
|
||||
} ?: return
|
||||
|
||||
// Box to Box
|
||||
if (this.selectedPosition is PCPosition && clickedPosition is PCPosition) {
|
||||
val packet = clickedPokemon?.let { SwapPCPokemonPacket(it.uuid, clickedPosition, selectedPokemon.uuid, this.selectedPosition as PCPosition) }
|
||||
?: MovePCPokemonPacket(selectedPokemon.uuid, selectedPosition as PCPosition, clickedPosition)
|
||||
packet.sendToServer()
|
||||
playSound(CobblemonSounds.PC_DROP)
|
||||
resetSelected()
|
||||
}
|
||||
// Box to Party
|
||||
else if (this.selectedPosition is PCPosition && clickedPosition is PartyPosition) {
|
||||
val packet = clickedPokemon?.let { SwapPCPartyPokemonPacket(clickedPokemon.uuid, clickedPosition, selectedPokemon.uuid, this.selectedPosition as PCPosition) }
|
||||
?: MovePCPokemonToPartyPacket(selectedPokemon.uuid, this.selectedPosition as PCPosition, clickedPosition)
|
||||
packet.sendToServer()
|
||||
playSound(CobblemonSounds.PC_DROP)
|
||||
resetSelected()
|
||||
}
|
||||
// Party to Box
|
||||
if (clickedPosition is PCPosition) {
|
||||
else if (this.selectedPosition is PartyPosition && clickedPosition is PCPosition) {
|
||||
if (ServerSettings.preventCompletePartyDeposit && this.party.filterNotNull().size == 1 && clickedPokemon == null) {
|
||||
return
|
||||
}
|
||||
val packet = clickedPokemon?.let { SwapPCPartyPokemonPacket(selectedPokemon.uuid, sourcePosition, clickedPokemon.uuid, clickedPosition) }
|
||||
?: MovePartyPokemonToPCPacket(selectedPokemon.uuid, sourcePosition, clickedPosition)
|
||||
val packet = clickedPokemon?.let { SwapPCPartyPokemonPacket(selectedPokemon.uuid, this.selectedPosition as PartyPosition, clickedPokemon.uuid, clickedPosition) }
|
||||
?: MovePartyPokemonToPCPacket(selectedPokemon.uuid, this.selectedPosition as PartyPosition, clickedPosition)
|
||||
packet.sendToServer()
|
||||
playSound(CobblemonSounds.PC_DROP)
|
||||
movePending = true
|
||||
resetSelected()
|
||||
}
|
||||
// Party to Party
|
||||
else if (clickedPosition is PartyPosition) {
|
||||
val packet = clickedPokemon?.let { SwapPartyPokemonPacket(it.uuid, clickedPosition, selectedPokemon.uuid, sourcePosition) }
|
||||
?: MovePartyPokemonPacket(selectedPokemon.uuid, sourcePosition, clickedPosition)
|
||||
else if (this.selectedPosition is PartyPosition && clickedPosition is PartyPosition) {
|
||||
val packet = clickedPokemon?.let { SwapPartyPokemonPacket(it.uuid, clickedPosition, selectedPokemon.uuid, this.selectedPosition as PartyPosition) }
|
||||
?: MovePartyPokemonPacket(selectedPokemon.uuid, selectedPosition as PartyPosition, clickedPosition)
|
||||
packet.sendToServer()
|
||||
playSound(CobblemonSounds.PC_DROP)
|
||||
movePending = true
|
||||
resetSelected()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -640,36 +480,6 @@ class StorageWidget(
|
||||
fun resetSelected() {
|
||||
selectedPosition = null
|
||||
grabbedSlot = null
|
||||
multiSelection = null
|
||||
multiGrabbedSlots.clear()
|
||||
pcGui.setPreviewPokemon(null)
|
||||
}
|
||||
|
||||
// annoyingly complex solution, but server/client desync causes flashing when moving pokemon. this should fix it
|
||||
// if you can think of a simpler solution, feel free to implement it
|
||||
private fun updatePendingMove() {
|
||||
if (!movePending) return
|
||||
val selection = multiSelection
|
||||
|
||||
if (selection != null) {
|
||||
val updated = selection.pokemonEntries().any { (column, row, pokemon) ->
|
||||
val source = PCPosition(selection.sourceBox, (selection.sourceRow + row) * 6 + selection.sourceColumn + column)
|
||||
pc.get(source)?.uuid != pokemon.uuid
|
||||
}
|
||||
if (updated) {
|
||||
movePending = false
|
||||
resetSelected()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
val source = selectedPosition
|
||||
val pokemon = grabbedSlot?.getPokemon()
|
||||
if (source != null && pokemon != null) {
|
||||
if (party.get(source)?.uuid != pokemon.uuid) {
|
||||
movePending = false
|
||||
resetSelected()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* 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.command
|
||||
|
||||
import com.cobblemon.mod.common.api.permission.CobblemonPermissions
|
||||
import com.cobblemon.mod.common.command.argument.PartySlotArgumentType
|
||||
import com.cobblemon.mod.common.util.commandLang
|
||||
import com.cobblemon.mod.common.util.permission
|
||||
import com.mojang.brigadier.Command
|
||||
import com.mojang.brigadier.CommandDispatcher
|
||||
import com.mojang.brigadier.context.CommandContext
|
||||
import net.minecraft.commands.CommandBuildContext
|
||||
import net.minecraft.commands.CommandSourceStack
|
||||
import net.minecraft.commands.Commands.argument
|
||||
import net.minecraft.commands.Commands.literal
|
||||
import net.minecraft.commands.arguments.EntityArgument
|
||||
import net.minecraft.commands.arguments.item.ItemArgument
|
||||
|
||||
object CosmeticItemCommand {
|
||||
|
||||
private const val NAME = "cosmetic_item"
|
||||
private const val TARGET = "target"
|
||||
private const val SLOT = "slot"
|
||||
private const val ITEM = "item"
|
||||
|
||||
fun register(dispatcher: CommandDispatcher<CommandSourceStack>, commandRegistryAccess: CommandBuildContext) {
|
||||
dispatcher.register(literal(NAME)
|
||||
.permission(CobblemonPermissions.COSMETIC_ITEM)
|
||||
.then(argument(TARGET, EntityArgument.player())
|
||||
.then(argument(SLOT, PartySlotArgumentType.partySlot())
|
||||
.then(argument(ITEM, ItemArgument.item(commandRegistryAccess))
|
||||
.executes(this::execute)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
private fun execute(ctx: CommandContext<CommandSourceStack>): Int {
|
||||
val player = EntityArgument.getPlayer(ctx, TARGET)
|
||||
val pokemon = PartySlotArgumentType.getPokemonOf(ctx, SLOT, player)
|
||||
val stackArgument = ItemArgument.getItem(ctx, ITEM)
|
||||
val stack = stackArgument.createItemStack(1, false)
|
||||
pokemon.swapCosmeticItem(stack, true)
|
||||
ctx.source.sendSuccess({ commandLang(NAME, player.name, pokemon.species.translatedName, stack.displayName) }, true)
|
||||
return Command.SINGLE_SUCCESS
|
||||
}
|
||||
|
||||
}
|
||||
@@ -47,6 +47,10 @@ class CobblemonConfig {
|
||||
@IntConstraint(min = 0, max = 1000)
|
||||
var maxPokemonFriendship = 255
|
||||
|
||||
@CobblemonConfigField(Category.Pokemon, lang = "power_item_ride_stat_gain_interval_seconds", SERVER)
|
||||
@IntConstraint(min = -1, max = Int.MAX_VALUE)
|
||||
var powerItemRideStatGainIntervalSeconds = 120
|
||||
|
||||
@CobblemonConfigField(Category.Pokemon, lang = "announce_drop_items", SERVER)
|
||||
var announceDropItems = true
|
||||
@CobblemonConfigField(Category.Pokemon, lang = "default_drop_item_method", SERVER)
|
||||
|
||||
@@ -107,6 +107,7 @@ import com.cobblemon.mod.common.pokemon.feature.SlowpokeTailRegrowthSpeciesFeatu
|
||||
import com.cobblemon.mod.common.pokemon.feature.StashHandler
|
||||
import com.cobblemon.mod.common.pokemon.properties.UncatchableProperty
|
||||
import com.cobblemon.mod.common.util.*
|
||||
import com.cobblemon.mod.common.util.adapters.RegistryAccessResolver
|
||||
import com.cobblemon.mod.common.util.math.geometry.toRadians
|
||||
import com.cobblemon.mod.common.world.gamerules.CobblemonGameRules
|
||||
import com.google.common.collect.UnmodifiableIterator
|
||||
@@ -1296,17 +1297,11 @@ open class PokemonEntity(
|
||||
private fun showInteractionWheel(player: ServerPlayer, itemStack: ItemStack) {
|
||||
val canRide = isRideableFor(player)
|
||||
if (pokemon.getOwnerPlayer() == player) {
|
||||
val cosmeticItemDefinition = CobblemonCosmeticItems.findValidCosmeticForPokemonAndItem(
|
||||
player.level().registryAccess(),
|
||||
pokemon,
|
||||
itemStack
|
||||
)
|
||||
|
||||
InteractPokemonUIPacket(
|
||||
this.getUUID(),
|
||||
canSitOnShoulder() && pokemon in player.party(),
|
||||
!(pokemon.heldItemNoCopy().isEmpty && itemStack.isEmpty),
|
||||
(!pokemon.cosmeticItem.isEmpty && itemStack.isEmpty) || cosmeticItemDefinition != null,
|
||||
canGiveCosmetic(itemStack),
|
||||
canRide
|
||||
).sendToPlayer(player)
|
||||
}
|
||||
@@ -1328,6 +1323,17 @@ open class PokemonEntity(
|
||||
return@canRide behaviour.isActive(settings, state, this)
|
||||
}
|
||||
|
||||
fun canGiveCosmetic(itemStack: ItemStack): Boolean {
|
||||
val cosmeticItemDefinition = CobblemonCosmeticItems.findValidCosmeticForPokemonAndItem(
|
||||
RegistryAccessResolver.getAccess(),
|
||||
pokemon,
|
||||
itemStack
|
||||
)
|
||||
|
||||
return (!pokemon.cosmeticItem().isEmpty && itemStack.isEmpty)
|
||||
|| (itemStack.has(CobblemonItemComponents.ASPECT) || cosmeticItemDefinition != null)
|
||||
}
|
||||
|
||||
override fun getDimensions(pose: Pose): EntityDimensions {
|
||||
val scale = effects.mockEffect?.scale ?: (form.baseScale * pokemon.effectiveScale)
|
||||
var result = this.exposedForm.hitbox.scale(scale)
|
||||
@@ -1560,7 +1566,7 @@ open class PokemonEntity(
|
||||
return false
|
||||
}
|
||||
|
||||
val possibleReturn = if (isCosmetic) this.pokemon.cosmeticItem.copy() else this.pokemon.heldItemNoCopy()
|
||||
val possibleReturn = if (isCosmetic) this.pokemon.cosmeticItem() else this.pokemon.heldItemNoCopy()
|
||||
val giving = stack.copy().apply { count = 1 }
|
||||
|
||||
if (ItemStack.isSameItemSameComponents(giving, possibleReturn)) {
|
||||
@@ -2749,4 +2755,4 @@ open class PokemonEntity(
|
||||
if (this.pokemon.species.silenceStepSounds) return
|
||||
super.playStepSound(pos, state)
|
||||
}
|
||||
}
|
||||
}
|
||||
+27
@@ -22,6 +22,7 @@ import com.cobblemon.mod.common.api.molang.ObjectValue
|
||||
import com.cobblemon.mod.common.api.pokemon.PokemonProperties
|
||||
import com.cobblemon.mod.common.api.pokemon.feature.TickingSpeciesFeature
|
||||
import com.cobblemon.mod.common.api.pokemon.status.Statuses
|
||||
import com.cobblemon.mod.common.api.riding.stats.RidingStat
|
||||
import com.cobblemon.mod.common.api.spawning.fishing.FishingSpawnCause.Companion.DROPS_REROLL_ASPECT
|
||||
import com.cobblemon.mod.common.api.tags.CobblemonItemTags
|
||||
import com.cobblemon.mod.common.battles.BattleRegistry
|
||||
@@ -46,10 +47,15 @@ import kotlin.math.*
|
||||
|
||||
/** Handles purely server logic for a Pokémon */
|
||||
class PokemonServerDelegate : PokemonSideDelegate {
|
||||
companion object {
|
||||
private const val RIDE_STAT_GAIN_AMOUNT = 1F
|
||||
}
|
||||
|
||||
lateinit var entity: PokemonEntity
|
||||
var acknowledgedHPValue = -1
|
||||
var acknowledgedLevel = -1
|
||||
val passengerOffsets = mutableMapOf<Int, Vec3>()
|
||||
private var rideStatGainAnchor: Vec3? = null
|
||||
|
||||
/** Mocked properties exposed to the client [PokemonEntity]. */
|
||||
private val mock: PokemonProperties?
|
||||
@@ -355,9 +361,30 @@ class PokemonServerDelegate : PokemonSideDelegate {
|
||||
}
|
||||
}
|
||||
|
||||
val rideStatGainIntervalSeconds = Cobblemon.config.powerItemRideStatGainIntervalSeconds
|
||||
if (rideStatGainIntervalSeconds > 0) {
|
||||
val rideStatGainIntervalTicks = rideStatGainIntervalSeconds * 20L
|
||||
if (entity.level().gameTime % rideStatGainIntervalTicks == 0L) {
|
||||
trainRideStats()
|
||||
}
|
||||
}
|
||||
|
||||
updateTrackedValues()
|
||||
}
|
||||
|
||||
private fun trainRideStats() {
|
||||
val position = entity.position()
|
||||
val anchor = rideStatGainAnchor
|
||||
rideStatGainAnchor = position
|
||||
if (anchor == null || anchor == position || entity.passengers.isEmpty()) return
|
||||
|
||||
val heldItem = entity.pokemon.heldItemNoCopy()
|
||||
if (heldItem.isEmpty) return
|
||||
|
||||
val stat = RidingStat.entries.firstOrNull { heldItem.`is`(it.powerItem) } ?: return
|
||||
entity.pokemon.addRideBoost(stat, RIDE_STAT_GAIN_AMOUNT)
|
||||
}
|
||||
|
||||
fun updateShownItem() {
|
||||
val trackedShownItem = when {
|
||||
// Show Hand Item if Held item is hidden
|
||||
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* 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.item.components
|
||||
|
||||
import com.cobblemon.mod.common.CobblemonItemComponents
|
||||
import com.cobblemon.mod.common.util.adapters.RegistryAccessResolver
|
||||
import com.mojang.serialization.Codec
|
||||
import io.netty.buffer.ByteBuf
|
||||
import net.minecraft.core.registries.Registries
|
||||
import net.minecraft.network.codec.ByteBufCodecs
|
||||
import net.minecraft.network.codec.StreamCodec
|
||||
import net.minecraft.util.StringRepresentable
|
||||
import net.minecraft.world.item.Item
|
||||
import net.minecraft.world.item.ItemStack
|
||||
import java.util.Locale.getDefault
|
||||
import kotlin.jvm.optionals.getOrNull
|
||||
|
||||
class BedrockAspectComponent(val aspect: String) {
|
||||
enum class Type: StringRepresentable {
|
||||
HELD,
|
||||
COSMETIC;
|
||||
|
||||
override fun toString(): String = name.lowercase(getDefault())
|
||||
override fun getSerializedName(): String = name.lowercase(getDefault())
|
||||
}
|
||||
|
||||
companion object {
|
||||
val CODEC: Codec<BedrockAspectComponent> = Codec.STRING.xmap(
|
||||
{ aspect -> BedrockAspectComponent(aspect) },
|
||||
{ component -> component.aspect }
|
||||
)
|
||||
|
||||
val PACKET_CODEC: StreamCodec<ByteBuf, BedrockAspectComponent> = ByteBufCodecs.fromCodec(CODEC)
|
||||
|
||||
fun getAspect(stack: ItemStack, type: Type): String {
|
||||
val identifier = RegistryAccessResolver.getAccess()
|
||||
.registry(Registries.ITEM)
|
||||
.getOrNull()
|
||||
?.getResourceKey(stack.item)
|
||||
?.getOrNull()
|
||||
?.location()
|
||||
?.toString()
|
||||
?: "minecraft:dirt"
|
||||
|
||||
val item = identifier.replace("\\W".toRegex(), "-")
|
||||
|
||||
return when (stack.has(CobblemonItemComponents.ASPECT)) {
|
||||
true -> {
|
||||
val aspect = stack[CobblemonItemComponents.ASPECT]!!.aspect.replace("\\W".toRegex(), "-")
|
||||
"${type}_${item}-${aspect}"
|
||||
}
|
||||
false -> "${type}_$item"
|
||||
}
|
||||
}
|
||||
|
||||
fun setAspect(stack: ItemStack, aspect: String) = stack.also {
|
||||
it.set(CobblemonItemComponents.ASPECT, BedrockAspectComponent(aspect))
|
||||
}
|
||||
|
||||
fun createStack(item: Item, aspect: String): ItemStack = item.defaultInstance.also {
|
||||
setAspect(it, aspect)
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-4
@@ -22,9 +22,7 @@ class CosmeticItemUpdatePacket(pokemon: () -> Pokemon?, value: ItemStack) : Sing
|
||||
buffer.writeItemStack(this.value)
|
||||
}
|
||||
|
||||
override fun set(pokemon: Pokemon, value: ItemStack) {
|
||||
pokemon.cosmeticItem = value
|
||||
}
|
||||
override fun set(pokemon: Pokemon, value: ItemStack) { pokemon.swapCosmeticItem(this.value, false) }
|
||||
|
||||
companion object {
|
||||
val ID = cobblemonResource("cosmetic_item_update")
|
||||
@@ -34,4 +32,4 @@ class CosmeticItemUpdatePacket(pokemon: () -> Pokemon?, value: ItemStack) : Sing
|
||||
return CosmeticItemUpdatePacket(pokemon, cosmeticItem)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -34,4 +34,4 @@ class HeldItemUpdatePacket(pokemon: () -> Pokemon?, value: ItemStack): SingleUpd
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
-55
@@ -1,55 +0,0 @@
|
||||
/*
|
||||
* 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://www.mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package com.cobblemon.mod.common.net.messages.server.storage.pc
|
||||
|
||||
import com.cobblemon.mod.common.api.net.NetworkPacket
|
||||
import com.cobblemon.mod.common.api.storage.pc.PCPosition
|
||||
import com.cobblemon.mod.common.util.cobblemonResource
|
||||
import com.cobblemon.mod.common.util.readPCPosition
|
||||
import com.cobblemon.mod.common.util.writePCPosition
|
||||
import java.util.UUID
|
||||
import net.minecraft.network.RegistryFriendlyByteBuf
|
||||
|
||||
class MovePCPokemonBatchPacket(val moves: List<PCPokemonMove>) : NetworkPacket<MovePCPokemonBatchPacket> {
|
||||
override val id = ID
|
||||
|
||||
data class PCPokemonMove(
|
||||
val pokemonID: UUID,
|
||||
val oldPosition: PCPosition,
|
||||
val newPosition: PCPosition
|
||||
)
|
||||
|
||||
override fun encode(buffer: RegistryFriendlyByteBuf) {
|
||||
buffer.writeVarInt(moves.size)
|
||||
moves.forEach { move ->
|
||||
buffer.writeUUID(move.pokemonID)
|
||||
buffer.writePCPosition(move.oldPosition)
|
||||
buffer.writePCPosition(move.newPosition)
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
val ID = cobblemonResource("move_pc_pokemon_batch")
|
||||
const val MAX_MOVES = 60
|
||||
|
||||
fun decode(buffer: RegistryFriendlyByteBuf): MovePCPokemonBatchPacket {
|
||||
val size = buffer.readVarInt()
|
||||
require(size in 1..MAX_MOVES) { "Invalid batch PC move size: $size" }
|
||||
return MovePCPokemonBatchPacket(
|
||||
List(size) {
|
||||
PCPokemonMove(
|
||||
pokemonID = buffer.readUUID(),
|
||||
oldPosition = buffer.readPCPosition(),
|
||||
newPosition = buffer.readPCPosition()
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
-23
@@ -1,23 +0,0 @@
|
||||
/*
|
||||
* 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://www.mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package com.cobblemon.mod.common.net.serverhandling.storage.pc
|
||||
|
||||
import com.cobblemon.mod.common.api.net.ServerNetworkPacketHandler
|
||||
import com.cobblemon.mod.common.api.storage.pc.link.PCLinkManager
|
||||
import com.cobblemon.mod.common.net.messages.client.storage.pc.ClosePCPacket
|
||||
import com.cobblemon.mod.common.net.messages.server.storage.pc.MovePCPokemonBatchPacket
|
||||
import net.minecraft.server.MinecraftServer
|
||||
import net.minecraft.server.level.ServerPlayer
|
||||
|
||||
object MovePCPokemonBatchHandler : ServerNetworkPacketHandler<MovePCPokemonBatchPacket> {
|
||||
override fun handle(packet: MovePCPokemonBatchPacket, server: MinecraftServer, player: ServerPlayer) {
|
||||
val pc = PCLinkManager.getPC(player) ?: return run { ClosePCPacket(null).sendToPlayer(player) }
|
||||
pc.moveBatch(packet.moves.map { Triple(it.pokemonID, it.oldPosition, it.newPosition) })
|
||||
}
|
||||
}
|
||||
@@ -81,6 +81,7 @@ import com.cobblemon.mod.common.entity.PlatformType
|
||||
import com.cobblemon.mod.common.entity.npc.NPCEntity
|
||||
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity
|
||||
import com.cobblemon.mod.common.entity.pokemon.effects.IllusionEffect
|
||||
import com.cobblemon.mod.common.item.components.BedrockAspectComponent
|
||||
import com.cobblemon.mod.common.net.messages.client.PokemonUpdatePacket
|
||||
import com.cobblemon.mod.common.net.messages.client.effect.SpawnSnowstormEntityParticlePacket
|
||||
import com.cobblemon.mod.common.net.messages.client.pokemon.update.*
|
||||
@@ -159,6 +160,7 @@ import net.minecraft.world.entity.LivingEntity
|
||||
import net.minecraft.world.entity.MobSpawnType
|
||||
import net.minecraft.world.entity.player.Player
|
||||
import net.minecraft.world.item.ItemStack
|
||||
import net.minecraft.world.item.Items
|
||||
import net.minecraft.world.level.Level
|
||||
import net.minecraft.world.level.block.CactusBlock
|
||||
import net.minecraft.world.level.block.CampfireBlock
|
||||
@@ -1290,20 +1292,23 @@ open class Pokemon : ShowdownIdentifiable {
|
||||
fun swapHeldItem(stack: ItemStack, decrement: Boolean = true, aiCanDrop: Boolean = true): ItemStack {
|
||||
val existing = this.heldItem()
|
||||
val event = HeldItemEvent.Pre(this, stack, existing, decrement)
|
||||
if (!isClient) {
|
||||
CobblemonEvents.HELD_ITEM_PRE.post(event)
|
||||
}
|
||||
|
||||
if (!isClient) CobblemonEvents.HELD_ITEM_PRE.post(event)
|
||||
|
||||
if (!event.isCanceled) {
|
||||
val giving = event.receiving.copy().apply { count = 1 }
|
||||
if (event.decrement) {
|
||||
event.receiving.shrink(1)
|
||||
}
|
||||
this.heldItem = giving
|
||||
this.canDropHeldItem = giving.isEmpty || aiCanDrop
|
||||
onChange(HeldItemUpdatePacket({ this }, giving))
|
||||
this.heldItem = event.receiving.copy()
|
||||
.apply { count = 1 }
|
||||
.also { if (event.decrement) event.receiving.shrink(1) }
|
||||
|
||||
this.canDropHeldItem = this.heldItem.isEmpty || aiCanDrop
|
||||
|
||||
onChange(HeldItemUpdatePacket({ this }, this.heldItem()))
|
||||
CobblemonEvents.HELD_ITEM_POST.post(HeldItemEvent.Post(this, this.heldItem(), event.returning.copy(), event.decrement)) {
|
||||
StashHandler.giveHeldItem(it)
|
||||
}
|
||||
|
||||
updateAspects()
|
||||
|
||||
return event.returning
|
||||
}
|
||||
return stack
|
||||
@@ -1332,16 +1337,18 @@ open class Pokemon : ShowdownIdentifiable {
|
||||
fun swapCosmeticItem(stack: ItemStack, decrement: Boolean = true): ItemStack {
|
||||
val existing = this.cosmeticItem.copy()
|
||||
val event = HeldItemEvent.Pre(this, stack, existing, decrement)
|
||||
if (!isClient) {
|
||||
CobblemonEvents.COSMETIC_ITEM_PRE.post(event)
|
||||
}
|
||||
|
||||
if (!isClient) CobblemonEvents.COSMETIC_ITEM_PRE.post(event)
|
||||
|
||||
if (!event.isCanceled) {
|
||||
val giving = event.receiving.copy().apply { count = 1 }
|
||||
if (event.decrement) {
|
||||
event.receiving.shrink(1)
|
||||
}
|
||||
this.cosmeticItem = giving
|
||||
CobblemonEvents.COSMETIC_ITEM_POST.post(HeldItemEvent.Post(this, this.cosmeticItem.copy(), event.returning.copy(), event.decrement))
|
||||
this.cosmeticItem = event.receiving.copy()
|
||||
.apply { count = 1 }
|
||||
.also { if (event.decrement) event.receiving.shrink(1) }
|
||||
|
||||
CobblemonEvents.COSMETIC_ITEM_POST.post(HeldItemEvent.Post(this, this.cosmeticItem(), event.returning.copy(), event.decrement))
|
||||
|
||||
updateAspects()
|
||||
|
||||
return event.returning
|
||||
}
|
||||
return stack
|
||||
|
||||
@@ -8,18 +8,17 @@
|
||||
|
||||
package com.cobblemon.mod.common.pokemon.aspects
|
||||
|
||||
import com.cobblemon.mod.common.Cobblemon
|
||||
import com.cobblemon.mod.common.CobblemonCosmeticItems
|
||||
import com.cobblemon.mod.common.CobblemonMemories
|
||||
import com.cobblemon.mod.common.api.pokemon.PokemonProperties
|
||||
import com.cobblemon.mod.common.api.pokemon.aspect.AspectProvider
|
||||
import com.cobblemon.mod.common.api.pokemon.aspect.SingleConditionalAspectProvider
|
||||
import com.cobblemon.mod.common.api.pokemon.stats.Stats
|
||||
import com.cobblemon.mod.common.item.components.BedrockAspectComponent
|
||||
import com.cobblemon.mod.common.pokemon.Characteristic
|
||||
import com.cobblemon.mod.common.pokemon.Gender
|
||||
import com.cobblemon.mod.common.pokemon.Nature
|
||||
import com.cobblemon.mod.common.pokemon.Pokemon
|
||||
import com.cobblemon.mod.common.util.getMemorySafely
|
||||
import com.cobblemon.mod.common.util.adapters.RegistryAccessResolver
|
||||
import com.cobblemon.mod.common.util.server
|
||||
|
||||
val SHINY_ASPECT = object : SingleConditionalAspectProvider {
|
||||
@@ -43,12 +42,35 @@ val GENDER_ASPECT = object : AspectProvider {
|
||||
|
||||
val COSMETIC_SLOT_ASPECT = object : AspectProvider {
|
||||
override fun provide(pokemon: Pokemon): Set<String> {
|
||||
val server = server() ?: return emptySet()
|
||||
server() ?: return emptySet()
|
||||
|
||||
if (pokemon.cosmeticItem.isEmpty) {
|
||||
return emptySet()
|
||||
}
|
||||
val cosmeticItem = CobblemonCosmeticItems.findValidCosmeticForPokemonAndItem(server.registryAccess(), pokemon, pokemon.cosmeticItem)
|
||||
return cosmeticItem?.aspects?.toSet() ?: emptySet()
|
||||
|
||||
val cosmeticItemAspectSet = CobblemonCosmeticItems.findValidCosmeticForPokemonAndItem(
|
||||
RegistryAccessResolver.getAccess(),
|
||||
pokemon,
|
||||
pokemon.cosmeticItem
|
||||
)?.aspects?.toSet() ?: emptySet()
|
||||
|
||||
val stackAspect = BedrockAspectComponent.getAspect(pokemon.cosmeticItem, BedrockAspectComponent.Type.COSMETIC)
|
||||
|
||||
return setOf(stackAspect).plus(cosmeticItemAspectSet)
|
||||
}
|
||||
|
||||
override fun provide(properties: PokemonProperties) = emptySet<String>()
|
||||
}
|
||||
|
||||
val HELD_ITEM_ASPECT = object : AspectProvider {
|
||||
override fun provide(pokemon: Pokemon): Set<String> {
|
||||
server() ?: return emptySet()
|
||||
|
||||
if (pokemon.heldItem.isEmpty) {
|
||||
return emptySet()
|
||||
}
|
||||
|
||||
return setOf(BedrockAspectComponent.getAspect(pokemon.heldItem, BedrockAspectComponent.Type.HELD))
|
||||
}
|
||||
|
||||
override fun provide(properties: PokemonProperties) = emptySet<String>()
|
||||
@@ -118,18 +140,18 @@ val CHARACTERISTIC_RAINBOW_ASPECT = object : AspectProvider {
|
||||
-> "rainbow-green"
|
||||
|
||||
(Stats.SPECIAL_DEFENCE to Stats.SPECIAL_ATTACK),
|
||||
(Stats.SPECIAL_ATTACK to Stats.SPECIAL_DEFENCE)
|
||||
(Stats.SPECIAL_ATTACK to Stats.SPECIAL_DEFENCE)
|
||||
-> "rainbow-cyan"
|
||||
|
||||
(Stats.SPECIAL_ATTACK to Stats.SPECIAL_ATTACK),
|
||||
(Stats.SPECIAL_ATTACK to Stats.HP),
|
||||
(null to Stats.SPECIAL_ATTACK),
|
||||
(Stats.SPECIAL_DEFENCE to Stats.SPEED),
|
||||
(Stats.SPEED to Stats.SPECIAL_DEFENCE)
|
||||
(Stats.SPEED to Stats.SPECIAL_DEFENCE)
|
||||
-> "rainbow-blue"
|
||||
|
||||
(Stats.SPECIAL_ATTACK to Stats.SPEED),
|
||||
(Stats.SPEED to Stats.SPECIAL_ATTACK)
|
||||
(Stats.SPEED to Stats.SPECIAL_ATTACK)
|
||||
-> "rainbow-purple"
|
||||
|
||||
(Stats.SPEED to Stats.SPEED),
|
||||
@@ -143,7 +165,7 @@ val CHARACTERISTIC_RAINBOW_ASPECT = object : AspectProvider {
|
||||
(Stats.ATTACK to Stats.SPEED),
|
||||
-> "rainbow-pink"
|
||||
|
||||
(null to Stats.HP)
|
||||
(null to Stats.HP)
|
||||
-> "rainbow-light-blue"
|
||||
|
||||
else -> null
|
||||
|
||||
@@ -14,20 +14,22 @@ import com.cobblemon.mod.common.api.pokemon.feature.IntSpeciesFeature
|
||||
import com.cobblemon.mod.common.api.pokemon.feature.IntSpeciesFeatureProvider
|
||||
import com.cobblemon.mod.common.api.pokemon.feature.SpeciesFeatures
|
||||
import com.cobblemon.mod.common.pokemon.Pokemon
|
||||
import com.cobblemon.mod.common.util.adapters.RegistryAccessResolver
|
||||
import net.minecraft.core.registries.Registries
|
||||
import net.minecraft.resources.ResourceLocation
|
||||
import net.minecraft.world.entity.player.Player
|
||||
import net.minecraft.world.item.Item
|
||||
import net.minecraft.world.item.ItemStack
|
||||
import net.minecraft.server.level.ServerPlayer
|
||||
import kotlin.jvm.optionals.getOrNull
|
||||
|
||||
object StashHandler {
|
||||
fun interactMob(player: Player, pokemon: Pokemon, itemStack: ItemStack?): Boolean {
|
||||
if (itemStack == null || player !is ServerPlayer|| pokemon.getOwnerPlayer() !== player) return false
|
||||
|
||||
val success = handleItem(pokemon, itemStack.item)
|
||||
if (success) {
|
||||
itemStack.shrink(1)
|
||||
}
|
||||
return success
|
||||
|
||||
return success.also { if (it) itemStack.shrink(1) }
|
||||
}
|
||||
|
||||
fun giveHeldItem(event: HeldItemEvent.Post) {
|
||||
@@ -40,11 +42,19 @@ object StashHandler {
|
||||
}
|
||||
|
||||
fun handleItem(pokemon: Pokemon, item: Item): Boolean {
|
||||
val itemIdentifier: ResourceLocation = item.builtInRegistryHolder().key().location()
|
||||
val itemIdentifier: ResourceLocation = RegistryAccessResolver.getAccess()
|
||||
.registry(Registries.ITEM)
|
||||
.get()
|
||||
.getResourceKey(item)
|
||||
.get()
|
||||
.location()
|
||||
|
||||
val speciesFeatureProviders = SpeciesFeatures.getFeaturesFor(pokemon.species)
|
||||
val relevantSpeciesFeatureProviders: List<IntSpeciesFeatureProvider> = speciesFeatureProviders.filter {
|
||||
it is IntSpeciesFeatureProvider && it.itemPoints.keys.contains(itemIdentifier)
|
||||
}.map { it as IntSpeciesFeatureProvider }
|
||||
|
||||
val relevantSpeciesFeatureProviders: List<IntSpeciesFeatureProvider> = speciesFeatureProviders
|
||||
.filter { it is IntSpeciesFeatureProvider && it.itemPoints.keys.contains(itemIdentifier) }
|
||||
.map { it as IntSpeciesFeatureProvider }
|
||||
|
||||
for (relevantSpeciesFeatureProvider in relevantSpeciesFeatureProviders) {
|
||||
val points = relevantSpeciesFeatureProvider.itemPoints[itemIdentifier]!!
|
||||
val feature = pokemon.getFeature<IntSpeciesFeature>(relevantSpeciesFeatureProvider.keys[0])!!
|
||||
@@ -52,9 +62,11 @@ object StashHandler {
|
||||
pokemon.markFeatureDirty(feature)
|
||||
if (feature.value > relevantSpeciesFeatureProvider.max) feature.value = relevantSpeciesFeatureProvider.max
|
||||
}
|
||||
if (relevantSpeciesFeatureProviders.isNotEmpty()) {
|
||||
if (pokemon.entity != null) pokemon.entity!!.playSound(CobblemonSounds.GIMMIGHOUL_GIVE_ITEM, 1f, 1f)
|
||||
|
||||
if (relevantSpeciesFeatureProviders.isNotEmpty() && pokemon.entity != null) {
|
||||
pokemon.entity!!.playSound(CobblemonSounds.GIMMIGHOUL_GIVE_ITEM, 1f, 1f)
|
||||
}
|
||||
|
||||
return relevantSpeciesFeatureProviders.isNotEmpty()
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
@@ -24,6 +24,7 @@ import com.cobblemon.mod.common.net.messages.client.data.PropertiesCompletionReg
|
||||
import com.cobblemon.mod.common.pokemon.EVs
|
||||
import com.cobblemon.mod.common.pokemon.Gender
|
||||
import com.cobblemon.mod.common.pokemon.IVs
|
||||
import com.cobblemon.mod.common.pokemon.cosmetic.CosmeticItemDefinition
|
||||
import com.cobblemon.mod.common.util.asIdentifierDefaultingNamespace
|
||||
import com.cobblemon.mod.common.util.cobblemonResource
|
||||
import com.cobblemon.mod.common.util.simplify
|
||||
@@ -151,6 +152,7 @@ internal object PropertiesCompletionProvider : DataRegistry {
|
||||
this.inject(setOf("originaltrainertype", "ottype"), setOf("None", "Player", "NPC"))
|
||||
this.inject(setOf("nickname", "nick"), setOf(""))
|
||||
this.inject(setOf("helditem", "held_item"), setOf("cobblemon:exp_share"))
|
||||
this.inject(setOf("cosmetic", "cosmeticitem", "cosmetic_item"), setOf("cobblemon:exp_share"))
|
||||
this.inject(setOf("min_perfect_ivs"), setOf("0", "6"))
|
||||
this.inject(setOf("scale_modifier"), setOf("0.5", "2.0"))
|
||||
|
||||
|
||||
@@ -89,6 +89,7 @@ object DataKeys {
|
||||
|
||||
const val POKEMON_PROPERTIES_MOVES = "Moves"
|
||||
const val POKEMON_PROPERTIES_HELDITEM = "HeldItem"
|
||||
const val POKEMON_PROPERTIES_COSMETICITEM = "CosmeticItem"
|
||||
const val POKEMON_PROPERTIES_MOVESET_BUILDERS = "MovesetBuilders"
|
||||
|
||||
// Entity effects
|
||||
|
||||
+837
-649
File diff suppressed because it is too large.
Load diff
+6
@@ -456,6 +456,12 @@
|
||||
"cannon_left": {
|
||||
"position": [0, 0, 3]
|
||||
}
|
||||
},
|
||||
"timeline": {
|
||||
"0.25": "q.run_molang('cobblemon:stepsound_standard_large');",
|
||||
"1.25": "q.run_molang('cobblemon:stepsound_standard_large');",
|
||||
"2.25": "q.run_molang('cobblemon:stepsound_standard_large');",
|
||||
"3.25": "q.run_molang('cobblemon:stepsound_standard_large');"
|
||||
}
|
||||
},
|
||||
"animation.blastoise.ground_run": {
|
||||
|
||||
+11
@@ -83,6 +83,7 @@
|
||||
},
|
||||
"animation.parasect.ground_walk": {
|
||||
"loop": true,
|
||||
"animation_length": 1,
|
||||
"bones": {
|
||||
"body": {
|
||||
"rotation": [0, 0, 0],
|
||||
@@ -134,6 +135,12 @@
|
||||
"locator_seat_1": {
|
||||
"rotation": [7.5, 0, 0]
|
||||
}
|
||||
},
|
||||
"timeline": {
|
||||
"0.0": "q.run_molang('cobblemon:stepsound_minecraft');",
|
||||
"0.25": "q.run_molang('cobblemon:stepsound_minecraft');",
|
||||
"0.5": "q.run_molang('cobblemon:stepsound_minecraft');",
|
||||
"0.75": "q.run_molang('cobblemon:stepsound_minecraft');"
|
||||
}
|
||||
},
|
||||
"animation.parasect.ground_run": {
|
||||
@@ -258,6 +265,10 @@
|
||||
"rotation": ["5+Math.cos((query.anim_time) * 90 * 16 - 90) * 2", 0, 0],
|
||||
"position": [0, "0+Math.cos((query.anim_time) * 90 * 32) * -0.2", -0.25]
|
||||
}
|
||||
},
|
||||
"timeline": {
|
||||
"0.0": "q.run_molang('cobblemon:stepsound_minecraft');",
|
||||
"0.125": "q.run_molang('cobblemon:stepsound_minecraft');"
|
||||
}
|
||||
},
|
||||
"animation.parasect.ride_ground_run": {
|
||||
|
||||
+4
@@ -391,6 +391,10 @@
|
||||
"0.7083": [0, 0, 0]
|
||||
}
|
||||
}
|
||||
},
|
||||
"timeline": {
|
||||
"0.0833": "q.run_molang('cobblemon:stepsound_standard_medium');",
|
||||
"0.2917": "q.run_molang('cobblemon:stepsound_standard_medium');"
|
||||
}
|
||||
},
|
||||
"animation.dewgong.water_idle": {
|
||||
|
||||
+20
@@ -1071,6 +1071,16 @@
|
||||
"head": {
|
||||
"rotation": ["-0.8*math.cos(q.anim_time*90*8-120)", 0, "3*math.sin(q.anim_time*90*4+70)"]
|
||||
}
|
||||
},
|
||||
"timeline": {
|
||||
"0.0": "q.run_molang('cobblemon:stepsound_standard_large');",
|
||||
"0.5": "q.run_molang('cobblemon:stepsound_standard_large');",
|
||||
"1.0": "q.run_molang('cobblemon:stepsound_standard_large');",
|
||||
"1.5": "q.run_molang('cobblemon:stepsound_standard_large');",
|
||||
"2.0": "q.run_molang('cobblemon:stepsound_standard_large');",
|
||||
"2.5": "q.run_molang('cobblemon:stepsound_standard_large');",
|
||||
"3.0": "q.run_molang('cobblemon:stepsound_standard_large');",
|
||||
"3.5": "q.run_molang('cobblemon:stepsound_standard_large');"
|
||||
}
|
||||
},
|
||||
"animation.rhyhorn.ride_ground_walk": {
|
||||
@@ -1917,6 +1927,16 @@
|
||||
],
|
||||
"position": [0, "0.4+0.6*math.cos(q.anim_time*90*8-120)", 0]
|
||||
}
|
||||
},
|
||||
"timeline": {
|
||||
"0.0": "q.run_molang('cobblemon:stepsound_standard_large');",
|
||||
"0.375": "q.run_molang('cobblemon:stepsound_standard_medium');",
|
||||
"0.5": "q.run_molang('cobblemon:stepsound_standard_large');",
|
||||
"0.875": "q.run_molang('cobblemon:stepsound_standard_medium');",
|
||||
"1.0": "q.run_molang('cobblemon:stepsound_standard_large');",
|
||||
"1.375": "q.run_molang('cobblemon:stepsound_standard_medium');",
|
||||
"1.5": "q.run_molang('cobblemon:stepsound_standard_large');",
|
||||
"1.875": "q.run_molang('cobblemon:stepsound_standard_medium');"
|
||||
}
|
||||
},
|
||||
"animation.rhyhorn.ride_ground_run": {
|
||||
|
||||
+12
@@ -329,6 +329,12 @@
|
||||
"locator_seat_1": {
|
||||
"rotation": [-15, 0, 0]
|
||||
}
|
||||
},
|
||||
"timeline": {
|
||||
"0.0": "q.run_molang('cobblemon:stepsound_standard_large');",
|
||||
"1.0": "q.run_molang('cobblemon:stepsound_standard_large');",
|
||||
"2.0": "q.run_molang('cobblemon:stepsound_standard_large');",
|
||||
"3.0": "q.run_molang('cobblemon:stepsound_standard_large');"
|
||||
}
|
||||
},
|
||||
"animation.rhydon.ride_ground_walk": {
|
||||
@@ -807,6 +813,12 @@
|
||||
"locator_seat_1": {
|
||||
"rotation": [-15, 0, 0]
|
||||
}
|
||||
},
|
||||
"timeline": {
|
||||
"0.3333": "q.run_molang('cobblemon:stepsound_standard_large');",
|
||||
"0.8333": "q.run_molang('cobblemon:stepsound_standard_large');",
|
||||
"1.3333": "q.run_molang('cobblemon:stepsound_standard_large');",
|
||||
"1.8333": "q.run_molang('cobblemon:stepsound_standard_large');"
|
||||
}
|
||||
},
|
||||
"animation.rhydon.ride_ground_run": {
|
||||
|
||||
+4
@@ -391,6 +391,10 @@
|
||||
"1.0": [0, 0, 0]
|
||||
}
|
||||
}
|
||||
},
|
||||
"timeline": {
|
||||
"0.0833": "q.run_molang('cobblemon:stepsound_minecraft');",
|
||||
"0.5833": "q.run_molang('cobblemon:stepsound_minecraft');"
|
||||
}
|
||||
},
|
||||
"animation.mr_mime.ground_run": {
|
||||
|
||||
@@ -1299,7 +1299,6 @@
|
||||
"cobblemon.ui.pc.filter.tooltip": "Format: pikachu shiny held_item lvl=1...",
|
||||
"cobblemon.ui.pc.options": "Options",
|
||||
"cobblemon.ui.pc.release": "Release",
|
||||
"cobblemon.ui.pc.release_all": "Release All",
|
||||
"cobblemon.ui.sort.name": "Sort by name",
|
||||
"cobblemon.ui.sort.level": "Sort by level",
|
||||
"cobblemon.ui.sort.pokedex_number": "Sort by Pokédex number",
|
||||
@@ -2382,6 +2381,7 @@
|
||||
"cobblemon.command.spawnpokemon.nospecies": "Error: You need to include a Pokémon name or 'random'",
|
||||
"cobblemon.command.error.nonpc": "Error: You need to include a valid NPC identifier.",
|
||||
"cobblemon.command.held_item": "%1$s's %2$s was given the %3$s to hold.",
|
||||
"cobblemon.command.cosmetic_item": "%1$s's %2$s was given the %3$s to wear.",
|
||||
"cobblemon.command.giveallmarks": "%1$s's %2$s was given all available marks.",
|
||||
"cobblemon.command.givemark": "%1$s's %2$s was given a %3$s.",
|
||||
"cobblemon.command.givemark.already_has": "%1$s's %2$s already has a %3$s!",
|
||||
@@ -2435,6 +2435,8 @@
|
||||
"cobblemon.config.ui.max_pokemon_level.tooltip": "The maximum level Pokémon can get to.",
|
||||
"cobblemon.config.ui.max_pokemon_friendship": "Max Pokémon Friendship",
|
||||
"cobblemon.config.ui.max_pokemon_friendship.tooltip": "The maximum friendship value.",
|
||||
"cobblemon.config.ui.power_item_ride_stat_gain_interval_seconds": "Power Item Riding Stat Training Interval (Seconds)",
|
||||
"cobblemon.config.ui.power_item_ride_stat_gain_interval_seconds.tooltip": "Seconds between riding stat gains while riding a Pokémon holding a Power item. Defaults to 120 seconds. Set to -1 or 0 to disable; values below -1 are clamped to -1.",
|
||||
"cobblemon.config.ui.announce_drop_items": "Announce Drop Items",
|
||||
"cobblemon.config.ui.announce_drop_items.tooltip": "Whether to notify the Player of dropped items from defeating wild Pokémon.",
|
||||
"cobblemon.config.ui.default_drop_item_method": "Default Drop Item Method",
|
||||
|
||||
@@ -1653,6 +1653,18 @@
|
||||
"move.horndrill.target_2": {
|
||||
"sounds": [ { "name": "cobblemon:move/horndrill/horndrill_target_2", "volume": 1.0 } ]
|
||||
},
|
||||
"move.gigatonhammer.actor": {
|
||||
"sounds": [ { "name": "cobblemon:move/gigatonhammer/gigatonhammer_actor", "volume": 1.0 } ]
|
||||
},
|
||||
"move.gigatonhammer.target": {
|
||||
"sounds": [ { "name": "cobblemon:move/gigatonhammer/gigatonhammer_target", "volume": 1.0 } ]
|
||||
},
|
||||
"move.pyroball.actor": {
|
||||
"sounds": [ { "name": "cobblemon:move/pyroball/pyroball_actor", "volume": 1.0 } ]
|
||||
},
|
||||
"move.pyroball.target": {
|
||||
"sounds": [ { "name": "cobblemon:move/pyroball/pyroball_target", "volume": 1.0 } ]
|
||||
},
|
||||
"impact.normal": {
|
||||
"sounds": [
|
||||
{ "name": "cobblemon:move/impact_generic/impact_generic_fighting_1", "volume": 0.8 },
|
||||
@@ -8672,6 +8684,9 @@
|
||||
"pokemon.cinderace.cry": {
|
||||
"sounds": [ { "name": "cobblemon:pokemon/cinderace/cinderace_cry", "volume": 0.8 } ]
|
||||
},
|
||||
"pokemon.cinderace.pyroball": {
|
||||
"sounds": [ { "name": "cobblemon:pokemon/cinderace/cinderace_pyroball", "volume": 0.5 } ]
|
||||
},
|
||||
"pokemon.sobble.cry": {
|
||||
"sounds": [ { "name": "cobblemon:pokemon/sobble/sobble_cry", "volume": 0.8 } ]
|
||||
},
|
||||
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
|
Before Width: | Height: | Size: 548 B |
+35
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"timeline": [
|
||||
{
|
||||
"type": "add_holds",
|
||||
"holds": ["effects"]
|
||||
},
|
||||
{
|
||||
"type": "animation",
|
||||
"animation": ["gigatonhammer"],
|
||||
"delay": 0.3
|
||||
},
|
||||
{
|
||||
"type": "entity_molang",
|
||||
"entityCondition": "q.entity.is_user == true",
|
||||
"expressions": ["q.sound('move.gigatonhammer.actor');"]
|
||||
},
|
||||
{
|
||||
"type": "pause",
|
||||
"pause": 1.1
|
||||
},
|
||||
{
|
||||
"type": "entity_molang",
|
||||
"entityCondition": "q.entity.is_user == false && q.missed(q.entity.uuid) == false",
|
||||
"expressions": ["q.sound('move.gigatonhammer.target');"]
|
||||
},
|
||||
{
|
||||
"type": "remove_holds",
|
||||
"holds": ["effects"]
|
||||
},
|
||||
{
|
||||
"type": "pause",
|
||||
"pause": 1.5
|
||||
}
|
||||
]
|
||||
}
|
||||
+29
-2
@@ -3,11 +3,38 @@
|
||||
{
|
||||
"type": "add_holds",
|
||||
"holds": ["effects"]
|
||||
|
||||
},
|
||||
{
|
||||
"type": "animation",
|
||||
"animation": ["pyroball"],
|
||||
"delay": 2.05
|
||||
"animation": ["pyroball"]
|
||||
},
|
||||
{
|
||||
"type": "pause",
|
||||
"pause" : 0.1
|
||||
},
|
||||
{
|
||||
"type": "entity_molang",
|
||||
"entityCondition": "q.entity.is_user == true",
|
||||
"expressions": ["q.sound('move.pyroball.actor');"]
|
||||
},
|
||||
{
|
||||
"type": "entity_molang",
|
||||
"entityCondition": "q.entity.is_user == true",
|
||||
"expressions": ["q.sound('pokemon.cinderace.pyroball');"]
|
||||
},
|
||||
{
|
||||
"type": "pause",
|
||||
"pause" : 1.875
|
||||
},
|
||||
{
|
||||
"type": "entity_molang",
|
||||
"entityCondition": "q.entity.is_user == false && q.missed(q.entity.uuid) == false",
|
||||
"expressions": ["q.sound('move.pyroball.target');"]
|
||||
},
|
||||
{
|
||||
"type": "pause",
|
||||
"pause" : 0.175
|
||||
},
|
||||
{
|
||||
"type": "entity_particles",
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
}
|
||||
],
|
||||
"type": "cobblemon:cooking_pot_shapeless",
|
||||
"category": "medicines",
|
||||
"category": "misc",
|
||||
"ingredients": [
|
||||
{
|
||||
"item": "create:experience_nugget"
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
"maleRatio": 0.875,
|
||||
"height": 16,
|
||||
"weight": 855,
|
||||
"silenceStepSounds": true,
|
||||
"pokedex": [
|
||||
"cobblemon.species.blastoise.desc"
|
||||
],
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
"maleRatio": 0.5,
|
||||
"height": 17,
|
||||
"weight": 1200,
|
||||
"silenceStepSounds": true,
|
||||
"pokedex": [
|
||||
"cobblemon.species.dewgong.desc"
|
||||
],
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
"maleRatio": 0.5,
|
||||
"height": 13,
|
||||
"weight": 545,
|
||||
"silenceStepSounds": true,
|
||||
"pokedex": [
|
||||
"cobblemon.species.mrmime.desc"
|
||||
],
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
"maleRatio": 0.5,
|
||||
"height": 10,
|
||||
"weight": 295,
|
||||
"silenceStepSounds": true,
|
||||
"pokedex": [
|
||||
"cobblemon.species.parasect.desc"
|
||||
],
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
"maleRatio": 0.5,
|
||||
"height": 19,
|
||||
"weight": 1200,
|
||||
"silenceStepSounds": true,
|
||||
"pokedex": [
|
||||
"cobblemon.species.rhydon.desc"
|
||||
],
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
"maleRatio": 0.5,
|
||||
"height": 10,
|
||||
"weight": 1150,
|
||||
"silenceStepSounds": true,
|
||||
"pokedex": [
|
||||
"cobblemon.species.rhyhorn.desc"
|
||||
],
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
"maleRatio": 0.875,
|
||||
"height": 20,
|
||||
"weight": 1000,
|
||||
"silenceStepSounds": true,
|
||||
"pokedex": [
|
||||
"cobblemon.species.venusaur.desc"
|
||||
],
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
"cobblemon:tart_apple",
|
||||
"cobblemon:syrupy_apple",
|
||||
"cobblemon:candied_apple",
|
||||
{ "id": "create:honeyed_apple","required": false }
|
||||
{ "id": "create:honeyed_apple","required": false },
|
||||
{ "id": "nomansland:honeyed_apple","required": false }
|
||||
]
|
||||
}
|
||||
Reference in new issue
Block a user