mirror of
https://gitlab.com/cable-mc/cobblemon.git
synced 2026-10-27 04:26:27 -04:00
@@ -313,7 +313,6 @@ object CobblemonNetwork {
|
||||
list.add(PacketRegisterInfo(MarkingsUpdatePacket.ID, MarkingsUpdatePacket::decode, PokemonUpdatePacketHandler()))
|
||||
list.add(PacketRegisterInfo(RideBoostsUpdatePacket.ID, RideBoostsUpdatePacket::decode, PokemonUpdatePacketHandler()))
|
||||
list.add(PacketRegisterInfo(RideStaminaUpdatePacket.ID, RideStaminaUpdatePacket::decode, PokemonUpdatePacketHandler()))
|
||||
list.add(PacketRegisterInfo(IgnoredRenderableFeaturesUpdatePacket.ID, IgnoredRenderableFeaturesUpdatePacket::decode, PokemonUpdatePacketHandler()))
|
||||
|
||||
// Evolution start
|
||||
list.add(PacketRegisterInfo(AddEvolutionPacket.ID, AddEvolutionPacket::decode, PokemonUpdatePacketHandler()))
|
||||
|
||||
+2
-7
@@ -260,13 +260,8 @@ class StatWidget(
|
||||
val barPosX = x + 9F
|
||||
var drawY = y + 15F
|
||||
|
||||
val featuresList: MutableList<Any> = renderableFeatures.filter {
|
||||
!pokemon.ignoredRenderableFeatures.contains(it.name)
|
||||
}.toMutableList()
|
||||
|
||||
featuresList.addAll(0, universalFeatures.filter {
|
||||
!pokemon.ignoredRenderableFeatures.contains(it.name)
|
||||
})
|
||||
val featuresList: MutableList<Any> = renderableFeatures.toMutableList()
|
||||
featuresList.addAll(0, universalFeatures)
|
||||
|
||||
val pageFeatures = featuresList.subList(
|
||||
otherStatsPageIndex * OTHER_STAT_BARS_PER_PAGE,
|
||||
|
||||
-37
@@ -1,37 +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://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package com.cobblemon.mod.common.net.messages.client.pokemon.update
|
||||
|
||||
import com.cobblemon.mod.common.pokemon.Pokemon
|
||||
import com.cobblemon.mod.common.util.cobblemonResource
|
||||
import com.cobblemon.mod.common.util.readString
|
||||
import com.cobblemon.mod.common.util.writeString
|
||||
import io.netty.buffer.ByteBuf
|
||||
import net.minecraft.network.RegistryFriendlyByteBuf
|
||||
|
||||
class IgnoredRenderableFeaturesUpdatePacket(pokemon: () -> Pokemon?, value: Set<String>): SingleUpdatePacket<Set<String>, IgnoredRenderableFeaturesUpdatePacket>(pokemon, value) {
|
||||
override val id = ID
|
||||
override fun encodeValue(buffer: RegistryFriendlyByteBuf) {
|
||||
buffer.writeCollection(this.value) { pb, value -> pb.writeString(value) }
|
||||
}
|
||||
|
||||
override fun set(pokemon: Pokemon, value: Set<String>) {
|
||||
pokemon.ignoredRenderableFeatures = value
|
||||
}
|
||||
|
||||
companion object {
|
||||
val ID = cobblemonResource("ignored_renderable_features_update")
|
||||
fun decode(buffer: RegistryFriendlyByteBuf): IgnoredRenderableFeaturesUpdatePacket {
|
||||
val pokemon = decodePokemon(buffer)
|
||||
val ignoredRenderableFeatures = buffer.readList(ByteBuf::readString).toSet()
|
||||
return IgnoredRenderableFeaturesUpdatePacket(pokemon, ignoredRenderableFeatures)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -579,16 +579,6 @@ open class Pokemon : ShowdownIdentifiable {
|
||||
onChange(MarkingsUpdatePacket({ this }, value))
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* A set of features to be ignored when drawing the OTHER screen in the summary UI.
|
||||
*/
|
||||
var ignoredRenderableFeatures = setOf<String>()
|
||||
set(value) {
|
||||
field = value
|
||||
onChange(IgnoredRenderableFeaturesUpdatePacket({ this }, value))
|
||||
}
|
||||
|
||||
fun asRenderablePokemon() = RenderablePokemon(species, aspects, if (heldItemVisible) heldItem else ItemStack.EMPTY)
|
||||
|
||||
/**
|
||||
@@ -1420,7 +1410,6 @@ open class Pokemon : ShowdownIdentifiable {
|
||||
this.potentialMarks.clear()
|
||||
this.potentialMarks += other.marks
|
||||
this.markings = other.markings
|
||||
this.ignoredRenderableFeatures = other.ignoredRenderableFeatures
|
||||
this.updateAspects()
|
||||
this.refreshOriginalTrainer()
|
||||
this.initialize()
|
||||
|
||||
@@ -61,7 +61,6 @@ object DataKeys {
|
||||
const val POKEMON_MARKINGS = "Markings"
|
||||
const val POKEMON_RIDE_BOOSTS = "RideBoosts"
|
||||
const val POKEMON_RIDE_STAMINA = "RideStamina"
|
||||
const val POKEMON_IGNORED_RENDERABLE_FEATURES = "IgnoredRenderableFeatures"
|
||||
|
||||
const val POKEMON_STATE = "State"
|
||||
const val POKEMON_STATE_TYPE = "StateType"
|
||||
|
||||
@@ -43,7 +43,6 @@ internal data class PokemonP3(
|
||||
val rideBoosts: Map<String, Float>,
|
||||
val rideStamina: Float,
|
||||
val currentFullness: Int,
|
||||
val ignoredRenderableFeatures: Set<String>,
|
||||
val interactionCooldowns: Map<ResourceLocation, Int>
|
||||
) : Partial<Pokemon> {
|
||||
|
||||
@@ -81,7 +80,6 @@ internal data class PokemonP3(
|
||||
this.rideBoosts.let { other.setRideBoosts(it.mapKeys { RidingStat.valueOf(it.key) }) }
|
||||
other.rideStamina = this.rideStamina
|
||||
other.currentFullness = this.currentFullness
|
||||
other.ignoredRenderableFeatures = this.ignoredRenderableFeatures
|
||||
other.interactionCooldowns = this.interactionCooldowns.toMutableMap()
|
||||
return other
|
||||
}
|
||||
@@ -103,9 +101,8 @@ internal data class PokemonP3(
|
||||
Codec.unboundedMap(Codec.STRING, Codec.FLOAT).optionalFieldOf(DataKeys.POKEMON_RIDE_BOOSTS, emptyMap<String, Float>()).forGetter(PokemonP3::rideBoosts),
|
||||
Codec.FLOAT.optionalFieldOf(DataKeys.POKEMON_RIDE_STAMINA, 1F).forGetter(PokemonP3::rideStamina),
|
||||
Codec.intRange(0, 100).optionalFieldOf(DataKeys.POKEMON_FULLNESS, 0).forGetter(PokemonP3::currentFullness),
|
||||
Codec.list(Codec.STRING).optionalFieldOf(DataKeys.POKEMON_IGNORED_RENDERABLE_FEATURES, emptyList()).forGetter { it.ignoredRenderableFeatures.toMutableList() },
|
||||
Codec.unboundedMap(ResourceLocation.CODEC, Codec.INT).optionalFieldOf(DataKeys.POKEMON_INTERACTION_COOLDOWN, emptyMap<ResourceLocation, Int>()).forGetter(PokemonP3::interactionCooldowns)
|
||||
).apply(instance) { originalTrainerType, originalTrainer, forcedAspects, features, heldItemVisible, canDropHeldItem, cosmeticItem, activeMark, marks, potentialMarks, markings, rideBoosts, rideStamina, currentFullness, ignoredRenderableFeatures, interactionCooldown -> PokemonP3(originalTrainerType, originalTrainer, forcedAspects.toSet(), features, heldItemVisible, canDropHeldItem, cosmeticItem.orElse(ItemStack.EMPTY), activeMark, marks.toMutableSet(), potentialMarks.toMutableSet(), markings, rideBoosts, rideStamina, currentFullness, ignoredRenderableFeatures.toSet(), interactionCooldown) }
|
||||
).apply(instance) { originalTrainerType, originalTrainer, forcedAspects, features, heldItemVisible, canDropHeldItem, cosmeticItem, activeMark, marks, potentialMarks, markings, rideBoosts, rideStamina, currentFullness, interactionCooldown -> PokemonP3(originalTrainerType, originalTrainer, forcedAspects.toSet(), features, heldItemVisible, canDropHeldItem, cosmeticItem.orElse(ItemStack.EMPTY), activeMark, marks.toMutableSet(), potentialMarks.toMutableSet(), markings, rideBoosts, rideStamina, currentFullness, interactionCooldown) }
|
||||
}
|
||||
|
||||
internal fun from(pokemon: Pokemon): PokemonP3 = PokemonP3(
|
||||
@@ -127,7 +124,6 @@ internal data class PokemonP3(
|
||||
pokemon.getRideBoosts().mapKeys { it.key.name },
|
||||
pokemon.rideStamina,
|
||||
pokemon.currentFullness,
|
||||
pokemon.ignoredRenderableFeatures,
|
||||
pokemon.interactionCooldowns
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user