mirror of
https://gitlab.com/cable-mc/cobblemon.git
synced 2026-11-26 01:58:52 -05:00
Compare commits
15
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0f51ad5cf3 | ||
|
|
4159d60535 | ||
|
|
99e72339db | ||
|
|
10c9931d2c | ||
|
|
0e55165570 | ||
|
|
b6b87621a5 | ||
|
|
71b01d562b | ||
|
|
21eb66e69b | ||
|
|
8b04e57a1d | ||
|
|
1ff3b7ee96 | ||
|
|
8a2d6096e3 | ||
|
|
2645b5e375 | ||
|
|
a4c4dadee1 | ||
|
|
990cb1886e | ||
|
|
15ae1100ac |
No files matched your search
@@ -2,6 +2,7 @@
|
||||
## [1.8.5 (MONTH xth, 2026)](#1-8-5)
|
||||
|
||||
### Additions
|
||||
- You can now view the biome, level, and date you caught a 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
|
||||
@@ -11,17 +12,22 @@
|
||||
- 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
|
||||
- Updated Unown's punctuation form names from `!` and `?` to `Exclamation` and `Question`, changing their visible form labels in tooltips and mod integrations.
|
||||
|
||||
### Fixes
|
||||
- Fixed Ponigiri food values for AppleSkin integration
|
||||
- Fixed errors emitted by typos in Parched Peat bog structure files
|
||||
- Fixed Unown punctuation forms (? and !) resolving to duplicate Showdown IDs and colliding in form displays.
|
||||
|
||||
### Developer
|
||||
- Fixed JsonArray to MoValue conversion not working properly.
|
||||
|
||||
### Molang & Datapacks
|
||||
- `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.
|
||||
- Fixed the Molang coalescing operator not working the way you'd expect a coalesce operator to.
|
||||
- Added `v.spawnable_position` to the weight spawn rule component's "weight" expression
|
||||
|
||||
### Particles
|
||||
|
||||
|
||||
@@ -344,6 +344,7 @@ object CobblemonNetwork {
|
||||
list.add(PacketRegisterInfo(RideStaminaUpdatePacket.ID, RideStaminaUpdatePacket::decode, PokemonUpdatePacketHandler()))
|
||||
list.add(PacketRegisterInfo(AlphaUpdatePacket.ID, AlphaUpdatePacket::decode, PokemonUpdatePacketHandler()))
|
||||
list.add(PacketRegisterInfo(ScaleModifierUpdatePacket.ID, ScaleModifierUpdatePacket::decode, PokemonUpdatePacketHandler()))
|
||||
list.add(PacketRegisterInfo(MetDataUpdatePacket.ID, MetDataUpdatePacket::decode, PokemonUpdatePacketHandler()))
|
||||
|
||||
// Evolution start
|
||||
list.add(PacketRegisterInfo(AddEvolutionPacket.ID, AddEvolutionPacket::decode, PokemonUpdatePacketHandler()))
|
||||
|
||||
+1
@@ -41,6 +41,7 @@ class WeightTweakRuleComponent : SpawnRuleComponent {
|
||||
return if (spawnDetailSelector.selects(detail) && spawnablePositionSelector.selects(spawnablePosition)) {
|
||||
runtime.environment.setSimpleVariable("spawn", detail.struct)
|
||||
runtime.environment.setSimpleVariable("spawn_detail", detail.struct)
|
||||
runtime.environment.setSimpleVariable("spawnable_position", spawnablePosition.getOrSetupStruct())
|
||||
runtime.environment.setSimpleVariable("weight", DoubleValue(weight.toDouble()))
|
||||
runtime.resolveFloat(this.weight)
|
||||
} else {
|
||||
|
||||
@@ -169,7 +169,6 @@ class TypeGemCoreBlock(properties: Properties) : Block(properties) {
|
||||
|
||||
if (fullClusterCount == 0) {
|
||||
if (gemCount < Cobblemon.config.typeGemMinGrowth && clusters.isNotEmpty()) {
|
||||
println("Force set a cluster to FULL at size $gemCount")
|
||||
val randomCluster = clusters.random()
|
||||
level.setBlockAndUpdate(randomCluster.second, randomCluster.first.setValue(GROWTH_TYPE, GrowthType.FULL))
|
||||
}
|
||||
|
||||
+67
-7
@@ -6,23 +6,59 @@
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package com.cobblemon.mod.common.client.gui.summary.widgets.screens.moves
|
||||
package com.cobblemon.mod.common.client.gui.summary
|
||||
|
||||
import com.cobblemon.mod.common.client.gui.CobblemonRenderable
|
||||
import com.cobblemon.mod.common.client.render.drawScaledText
|
||||
import net.minecraft.client.Minecraft
|
||||
import net.minecraft.client.gui.GuiGraphics
|
||||
import net.minecraft.client.gui.components.ObjectSelectionList
|
||||
import net.minecraft.network.chat.Component
|
||||
import net.minecraft.network.chat.MutableComponent
|
||||
import net.minecraft.util.Mth
|
||||
|
||||
class MoveDescriptionScrollList(
|
||||
class ScrollableTextBoxEntry(
|
||||
var line : MutableComponent
|
||||
) :
|
||||
ObjectSelectionList.Entry<ScrollableTextBoxEntry>() {
|
||||
|
||||
override fun render(
|
||||
context: GuiGraphics,
|
||||
index: Int,
|
||||
rowTop: Int,
|
||||
rowLeft: Int,
|
||||
rowWidth: Int,
|
||||
rowHeight: Int,
|
||||
mouseX: Int,
|
||||
mouseY: Int,
|
||||
isHovered: Boolean,
|
||||
partialTicks: Float
|
||||
) {
|
||||
drawScaledText(
|
||||
context = context,
|
||||
text = line,
|
||||
x = rowLeft + 82,
|
||||
y = rowTop,
|
||||
scale = 0.5F,
|
||||
shadow = true
|
||||
)
|
||||
}
|
||||
|
||||
override fun getNarration(): Component {
|
||||
return line
|
||||
}
|
||||
}
|
||||
|
||||
class ScrollableTextBox(
|
||||
private val listX: Int,
|
||||
private val listY: Int,
|
||||
height: Int,
|
||||
width: Int,
|
||||
slotHeight: Int
|
||||
) : ObjectSelectionList<MoveDescriptionEntry>(
|
||||
) : ObjectSelectionList<ScrollableTextBoxEntry>(
|
||||
Minecraft.getInstance(),
|
||||
60, // width
|
||||
30, // height
|
||||
width, // width
|
||||
height, // height
|
||||
0, // top
|
||||
slotHeight
|
||||
), CobblemonRenderable {
|
||||
@@ -38,8 +74,31 @@ class MoveDescriptionScrollList(
|
||||
return x + width - 3
|
||||
}
|
||||
|
||||
override fun getMaxPosition(): Int {
|
||||
return super.getMaxPosition() + 3 // add bottom padding
|
||||
}
|
||||
|
||||
// we do our own scrollbar rendering, and this being true renders the vanilla one
|
||||
override fun scrollbarVisible() = false
|
||||
|
||||
override fun renderWidget(context: GuiGraphics, pMouseX: Int, pMouseY: Int, f: Float) {
|
||||
isHovered = pMouseX >= x && pMouseY >= y && pMouseX < x + width && pMouseY < y + height
|
||||
|
||||
if (maxScroll > 0) {
|
||||
val right = x + width
|
||||
val bottom = y + height
|
||||
val darkGray = 0xFF5B595B.toInt()
|
||||
val lightGray = 0xFF8C8C8C.toInt()
|
||||
context.fill(right - 2, y + 2, right - 4, bottom - 2, darkGray)
|
||||
// vanilla scrollbar mumbo jumbo
|
||||
var scrollHeight = ((height * height).toFloat() / maxPosition.toFloat()).toInt()
|
||||
scrollHeight = Mth.clamp(scrollHeight, 32, height - 8)
|
||||
var scrollY = scrollAmount.toInt() * (height - scrollHeight + 2) / maxScroll + y - 1
|
||||
if (scrollY < y) { scrollY = y }
|
||||
|
||||
context.fill(right - 2, scrollY + 2, right - 4, scrollY + scrollHeight - 3, lightGray)
|
||||
}
|
||||
|
||||
context.enableScissor(
|
||||
x,
|
||||
y,
|
||||
@@ -79,7 +138,7 @@ class MoveDescriptionScrollList(
|
||||
&& mouseY < bottom
|
||||
}
|
||||
|
||||
fun setMoveDescription(moveDescription: MutableComponent) {
|
||||
fun setText(moveDescription: MutableComponent) {
|
||||
clearEntries()
|
||||
val splitWidth = 100
|
||||
val text = moveDescription.string
|
||||
@@ -103,7 +162,8 @@ class MoveDescriptionScrollList(
|
||||
}
|
||||
|
||||
for (part in splitText) {
|
||||
addEntry(MoveDescriptionEntry(Component.literal(part)))
|
||||
addEntry(ScrollableTextBoxEntry(Component.literal(part)))
|
||||
}
|
||||
scrollAmount = 0.0
|
||||
}
|
||||
}
|
||||
+23
@@ -13,6 +13,7 @@ import com.cobblemon.mod.common.api.gui.MultiLineLabelK
|
||||
import com.cobblemon.mod.common.api.gui.blitk
|
||||
import com.cobblemon.mod.common.api.text.*
|
||||
import com.cobblemon.mod.common.client.CobblemonResources
|
||||
import com.cobblemon.mod.common.client.gui.summary.ScrollableTextBox
|
||||
import com.cobblemon.mod.common.client.gui.summary.widgets.SoundlessWidget
|
||||
import com.cobblemon.mod.common.client.gui.summary.widgets.common.reformatNatureTextIfMinted
|
||||
import com.cobblemon.mod.common.client.gui.summary.widgets.screens.stats.StatWidget.Companion.SCALE
|
||||
@@ -27,6 +28,7 @@ import net.minecraft.client.Minecraft
|
||||
import net.minecraft.client.gui.GuiGraphics
|
||||
import net.minecraft.network.chat.Component
|
||||
import net.minecraft.network.chat.MutableComponent
|
||||
import net.minecraft.resources.ResourceLocation
|
||||
|
||||
class InfoWidget(
|
||||
pX: Int,
|
||||
@@ -45,6 +47,25 @@ class InfoWidget(
|
||||
private val infoBaseResource = cobblemonResource("textures/gui/summary/summary_info_base.png")
|
||||
}
|
||||
|
||||
private var metDataWidget: ScrollableTextBox = ScrollableTextBox(x + 5, y + 123, 20, 61, 5)
|
||||
|
||||
init {
|
||||
pokemon.metData?.let { metData ->
|
||||
val biome = ResourceLocation.parse(metData.biome.registeredName)
|
||||
val biomeName = Component.translatable("biome.${biome.namespace}.${biome.path}")
|
||||
metDataWidget.setText(lang("ui.info.met_data",
|
||||
biomeName,
|
||||
metData.date.monthValue,
|
||||
metData.date.dayOfMonth,
|
||||
metData.date.year,
|
||||
metData.level
|
||||
))
|
||||
} ?: run {
|
||||
metDataWidget.setText(lang("ui.info.met_data_unavailable"))
|
||||
}
|
||||
addWidget(metDataWidget)
|
||||
}
|
||||
|
||||
override fun renderWidget(context: GuiGraphics, pMouseX: Int, pMouseY: Int, pPartialTicks: Float) {
|
||||
val matrices = context.pose()
|
||||
// Base texture
|
||||
@@ -163,6 +184,8 @@ class InfoWidget(
|
||||
)
|
||||
matrices.popPose()
|
||||
|
||||
metDataWidget.render(context, pMouseX, pMouseY, pPartialTicks)
|
||||
|
||||
drawScaledText(
|
||||
context = context,
|
||||
text = lang("ui.info.experience_points"),
|
||||
|
||||
-47
@@ -1,47 +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.client.gui.summary.widgets.screens.moves
|
||||
|
||||
import com.cobblemon.mod.common.client.render.drawScaledText
|
||||
import net.minecraft.client.gui.GuiGraphics
|
||||
import net.minecraft.client.gui.components.ObjectSelectionList
|
||||
import net.minecraft.network.chat.Component
|
||||
import net.minecraft.network.chat.MutableComponent
|
||||
|
||||
class MoveDescriptionEntry(
|
||||
var line : MutableComponent
|
||||
) :
|
||||
ObjectSelectionList.Entry<MoveDescriptionEntry>() {
|
||||
|
||||
override fun render(
|
||||
context: GuiGraphics,
|
||||
index: Int,
|
||||
rowTop: Int,
|
||||
rowLeft: Int,
|
||||
rowWidth: Int,
|
||||
rowHeight: Int,
|
||||
mouseX: Int,
|
||||
mouseY: Int,
|
||||
isHovered: Boolean,
|
||||
partialTicks: Float
|
||||
) {
|
||||
drawScaledText(
|
||||
context = context,
|
||||
text = line,
|
||||
x = rowLeft + 82,
|
||||
y = rowTop,
|
||||
scale = 0.5F,
|
||||
shadow = true
|
||||
)
|
||||
}
|
||||
|
||||
override fun getNarration(): Component {
|
||||
return line
|
||||
}
|
||||
}
|
||||
+6
-3
@@ -13,6 +13,7 @@ import com.cobblemon.mod.common.api.gui.blitk
|
||||
import com.cobblemon.mod.common.api.moves.Move
|
||||
import com.cobblemon.mod.common.api.text.text
|
||||
import com.cobblemon.mod.common.client.CobblemonClient
|
||||
import com.cobblemon.mod.common.client.gui.summary.ScrollableTextBox
|
||||
import com.cobblemon.mod.common.client.gui.summary.Summary
|
||||
import com.cobblemon.mod.common.client.gui.summary.widgets.SoundlessWidget
|
||||
import com.cobblemon.mod.common.client.render.drawScaledText
|
||||
@@ -70,9 +71,11 @@ class MovesWidget(
|
||||
addWidget(it)
|
||||
}
|
||||
|
||||
private var descriptionScrollList = MoveDescriptionScrollList(
|
||||
x + 69,
|
||||
private var descriptionScrollList = ScrollableTextBox(
|
||||
x + 68,
|
||||
y + 113,
|
||||
30,
|
||||
61,
|
||||
5
|
||||
)
|
||||
|
||||
@@ -215,7 +218,7 @@ class MovesWidget(
|
||||
|
||||
fun selectMove(move: Move?) {
|
||||
selectedMove = if (selectedMove == move || move == null) null else move
|
||||
descriptionScrollList.setMoveDescription(selectedMove?.description ?: "".text())
|
||||
descriptionScrollList.setText(selectedMove?.description ?: "".text())
|
||||
}
|
||||
|
||||
override fun mouseClicked(mouseX: Double, mouseY: Double, button: Int): Boolean {
|
||||
|
||||
+10
@@ -47,6 +47,7 @@ import com.cobblemon.mod.common.net.messages.client.battle.BattleCaptureStartPac
|
||||
import com.cobblemon.mod.common.net.messages.client.effect.SpawnSnowstormEntityParticlePacket
|
||||
import com.cobblemon.mod.common.net.messages.client.spawn.SpawnPokeballPacket
|
||||
import com.cobblemon.mod.common.pokeball.PokeBall
|
||||
import com.cobblemon.mod.common.pokemon.PokemonMetData
|
||||
import com.cobblemon.mod.common.pokemon.ai.PokemonBrain
|
||||
import com.cobblemon.mod.common.pokemon.properties.UncatchableProperty
|
||||
import com.cobblemon.mod.common.util.*
|
||||
@@ -74,6 +75,9 @@ import net.minecraft.world.phys.BlockHitResult
|
||||
import net.minecraft.world.phys.EntityHitResult
|
||||
import net.minecraft.world.phys.HitResult
|
||||
import net.minecraft.world.phys.Vec3
|
||||
import java.time.LocalDate
|
||||
import java.time.ZoneId
|
||||
import java.util.Date
|
||||
import java.util.concurrent.CompletableFuture
|
||||
|
||||
class EmptyPokeBallEntity : ThrowableItemProjectile, PosableEntity, WaterDragModifier, Schedulable {
|
||||
@@ -360,6 +364,12 @@ class EmptyPokeBallEntity : ThrowableItemProjectile, PosableEntity, WaterDragMod
|
||||
party.add(pokemon.pokemon)
|
||||
val leashHolder = pokemon.leashHolder
|
||||
|
||||
pokemon.pokemon.metData = PokemonMetData(
|
||||
this.level().getBiome(this.blockPosition()),
|
||||
LocalDate.now(ZoneId.systemDefault()),
|
||||
pokemon.pokemon.level
|
||||
)
|
||||
|
||||
if (leashHolder != null) {
|
||||
val blockPos = leashHolder.blockPosition()
|
||||
val blockState = level().getBlockState(blockPos)
|
||||
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
package com.cobblemon.mod.common.net.messages.client.pokemon.update
|
||||
|
||||
import com.cobblemon.mod.common.pokemon.Pokemon
|
||||
import com.cobblemon.mod.common.pokemon.PokemonMetData
|
||||
import com.cobblemon.mod.common.util.cobblemonResource
|
||||
import net.minecraft.core.registries.Registries
|
||||
import net.minecraft.network.RegistryFriendlyByteBuf
|
||||
import net.minecraft.resources.ResourceKey
|
||||
import net.minecraft.resources.ResourceLocation
|
||||
import java.time.Instant
|
||||
import java.time.ZoneId
|
||||
import kotlin.jvm.optionals.getOrNull
|
||||
|
||||
class MetDataUpdatePacket(pokemon: () -> Pokemon?, value: PokemonMetData): SingleUpdatePacket<PokemonMetData, MetDataUpdatePacket>(pokemon, value) {
|
||||
override val id = ID
|
||||
|
||||
override fun encodeValue(buffer: RegistryFriendlyByteBuf) {
|
||||
val biome = value.biome.unwrapKey().getOrNull()
|
||||
?: ResourceKey.create(Registries.BIOME, ResourceLocation.parse("minecraft:plains"))
|
||||
buffer.writeResourceKey(biome)
|
||||
buffer.writeLong(value.date.atStartOfDay(ZoneId.systemDefault()).toInstant().toEpochMilli())
|
||||
buffer.writeInt(value.level)
|
||||
}
|
||||
|
||||
override fun set(
|
||||
pokemon: Pokemon,
|
||||
value: PokemonMetData
|
||||
) {
|
||||
pokemon.metData = value
|
||||
}
|
||||
|
||||
companion object {
|
||||
val ID = cobblemonResource("met_data_update")
|
||||
fun decode(buffer: RegistryFriendlyByteBuf): MetDataUpdatePacket {
|
||||
val pokemon = decodePokemon(buffer)
|
||||
val biomeKey = buffer.readResourceKey(Registries.BIOME)
|
||||
val dateTime = buffer.readLong()
|
||||
val date = Instant.ofEpochMilli(dateTime).atZone(ZoneId.systemDefault()).toLocalDate()
|
||||
val level = buffer.readInt()
|
||||
val biome = buffer.registryAccess().lookupOrThrow(Registries.BIOME).getOrThrow(biomeKey)
|
||||
return MetDataUpdatePacket(pokemon, PokemonMetData(biome, date, level))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -550,6 +550,12 @@ open class Pokemon : ShowdownIdentifiable {
|
||||
onChange(OriginalTrainerUpdatePacket({ this }, value))
|
||||
}
|
||||
|
||||
var metData: PokemonMetData? = null
|
||||
set(value) {
|
||||
field = value
|
||||
value?.let { onChange(MetDataUpdatePacket({ this }, it)) }
|
||||
}
|
||||
|
||||
/**
|
||||
* Cache friendship on trade for OT
|
||||
*/
|
||||
@@ -1527,6 +1533,7 @@ open class Pokemon : ShowdownIdentifiable {
|
||||
this.potentialMarks.clear()
|
||||
this.potentialMarks += other.marks
|
||||
this.markings = other.markings
|
||||
this.metData = other.metData
|
||||
this.recalculateCharacteristic()
|
||||
this.updateAspects()
|
||||
this.refreshOriginalTrainer()
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.cobblemon.mod.common.pokemon
|
||||
|
||||
import com.mojang.serialization.Codec
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder
|
||||
import net.minecraft.core.Holder
|
||||
import net.minecraft.world.level.biome.Biome
|
||||
import java.time.LocalDate
|
||||
|
||||
/**
|
||||
* Stores information about the circumstances of a player's meeting with a [Pokemon]
|
||||
*
|
||||
* @param biome A [Holder] for the [Biome] the [Pokemon] was caught in
|
||||
* @param date A [LocalDate] of the real life date the [Pokemon] was caught
|
||||
* @param level The level the [Pokemon] was when caught
|
||||
*/
|
||||
data class PokemonMetData(
|
||||
val biome: Holder<Biome>,
|
||||
val date: LocalDate,
|
||||
val level: Int
|
||||
) {
|
||||
companion object {
|
||||
private val LOCAL_DATE_CODEC: Codec<LocalDate> = Codec.STRING.xmap(
|
||||
LocalDate::parse,
|
||||
LocalDate::toString
|
||||
)
|
||||
|
||||
val CODEC: Codec<PokemonMetData> = RecordCodecBuilder.create { instance ->
|
||||
instance.group(
|
||||
Biome.CODEC
|
||||
.fieldOf("biome")
|
||||
.forGetter { it.biome },
|
||||
LOCAL_DATE_CODEC
|
||||
.fieldOf("date")
|
||||
.forGetter { it.date },
|
||||
Codec.INT
|
||||
.fieldOf("level")
|
||||
.forGetter { it.level }
|
||||
).apply(instance) { biome, date, level ->
|
||||
PokemonMetData(
|
||||
biome = biome,
|
||||
date = date,
|
||||
level = level
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -86,6 +86,7 @@ object DataKeys {
|
||||
const val POKEMON_ORIGINAL_TRAINER_NAME = "PokemonOriginalTrainerName"
|
||||
const val POKEMON_ORIGINAL_TRAINER_TYPE = "PokemonOriginalTrainerType"
|
||||
const val POKEMON_ORIGINAL_TRAINER_FRIENDSHIP = "PokemonOriginalTrainerFriendship"
|
||||
const val POKEMON_MET_DATA = "PokemonMetData"
|
||||
|
||||
const val POKEMON_PROPERTIES_MOVES = "Moves"
|
||||
const val POKEMON_PROPERTIES_HELDITEM = "HeldItem"
|
||||
|
||||
+13
-9
@@ -8,25 +8,23 @@
|
||||
|
||||
package com.cobblemon.mod.common.util.codec.internal
|
||||
|
||||
import com.cobblemon.mod.common.api.mark.Marks
|
||||
import com.cobblemon.mod.common.api.riding.stats.RidingStat
|
||||
import com.cobblemon.mod.common.client.settings.ServerSettings
|
||||
import com.cobblemon.mod.common.pokemon.OriginalTrainerType
|
||||
import com.cobblemon.mod.common.pokemon.Pokemon
|
||||
import com.cobblemon.mod.common.pokemon.PokemonMetData
|
||||
import com.cobblemon.mod.common.util.DataKeys
|
||||
import com.mojang.serialization.Codec
|
||||
import com.mojang.serialization.MapCodec
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder
|
||||
import net.minecraft.resources.ResourceLocation
|
||||
import net.minecraft.world.item.ItemStack
|
||||
import java.util.*
|
||||
|
||||
internal data class ClientPokemonP4(
|
||||
val originalTrainerFriendship: Optional<Int>
|
||||
val originalTrainerFriendship: Optional<Int>,
|
||||
val pokemonMetData: Optional<PokemonMetData>
|
||||
) : Partial<Pokemon> {
|
||||
|
||||
override fun into(other: Pokemon): Pokemon {
|
||||
this.originalTrainerFriendship.ifPresent { other.originalTrainerFriendship = it }
|
||||
other.metData = this.pokemonMetData.orElse(null)
|
||||
return other
|
||||
}
|
||||
|
||||
@@ -36,12 +34,18 @@ internal data class ClientPokemonP4(
|
||||
*/
|
||||
internal val CODEC: MapCodec<ClientPokemonP4> = RecordCodecBuilder.mapCodec { instance ->
|
||||
instance.group(
|
||||
Codec.INT.optionalFieldOf(DataKeys.POKEMON_ORIGINAL_TRAINER_FRIENDSHIP).forGetter(ClientPokemonP4::originalTrainerFriendship)
|
||||
).apply(instance, ::ClientPokemonP4)
|
||||
Codec.INT.optionalFieldOf(DataKeys.POKEMON_ORIGINAL_TRAINER_FRIENDSHIP).forGetter(ClientPokemonP4::originalTrainerFriendship),
|
||||
PokemonMetData.CODEC.optionalFieldOf(DataKeys.POKEMON_MET_DATA).forGetter(ClientPokemonP4::pokemonMetData)
|
||||
).apply(instance) {
|
||||
originalTrainerFriendship, pokemonMetData -> ClientPokemonP4(
|
||||
originalTrainerFriendship, pokemonMetData
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
internal fun from(pokemon: Pokemon): ClientPokemonP4 = ClientPokemonP4(
|
||||
Optional.ofNullable(pokemon.originalTrainerFriendship)
|
||||
Optional.ofNullable(pokemon.originalTrainerFriendship),
|
||||
Optional.ofNullable(pokemon.metData)
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@
|
||||
package com.cobblemon.mod.common.util.codec.internal
|
||||
|
||||
import com.cobblemon.mod.common.pokemon.Pokemon
|
||||
import com.cobblemon.mod.common.pokemon.PokemonMetData
|
||||
import com.cobblemon.mod.common.util.DataKeys
|
||||
import com.mojang.serialization.Codec
|
||||
import com.mojang.serialization.MapCodec
|
||||
@@ -16,28 +17,32 @@ import com.mojang.serialization.codecs.RecordCodecBuilder
|
||||
import java.util.*
|
||||
|
||||
internal data class PokemonP4(
|
||||
val originalTrainerFriendship: Optional<Int>
|
||||
val originalTrainerFriendship: Optional<Int>,
|
||||
val pokemonMetData: Optional<PokemonMetData>
|
||||
) : Partial<Pokemon> {
|
||||
|
||||
override fun into(other: Pokemon): Pokemon {
|
||||
this.originalTrainerFriendship.ifPresent { other.originalTrainerFriendship = it }
|
||||
other.refreshOriginalTrainer()
|
||||
other.metData = this.pokemonMetData.orElse(null)
|
||||
return other
|
||||
}
|
||||
|
||||
companion object {
|
||||
internal val CODEC: MapCodec<PokemonP4> = RecordCodecBuilder.mapCodec { instance ->
|
||||
instance.group(
|
||||
Codec.INT.optionalFieldOf(DataKeys.POKEMON_ORIGINAL_TRAINER_FRIENDSHIP).forGetter(PokemonP4::originalTrainerFriendship)
|
||||
Codec.INT.optionalFieldOf(DataKeys.POKEMON_ORIGINAL_TRAINER_FRIENDSHIP).forGetter(PokemonP4::originalTrainerFriendship),
|
||||
PokemonMetData.CODEC.optionalFieldOf(DataKeys.POKEMON_MET_DATA).forGetter(PokemonP4::pokemonMetData)
|
||||
).apply(instance) {
|
||||
originalTrainerFriendship -> PokemonP4(
|
||||
originalTrainerFriendship
|
||||
originalTrainerFriendship, pokemonMetData -> PokemonP4(
|
||||
originalTrainerFriendship, pokemonMetData
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
internal fun from(pokemon: Pokemon): PokemonP4 = PokemonP4(
|
||||
Optional.ofNullable(pokemon.originalTrainerFriendship)
|
||||
Optional.ofNullable(pokemon.originalTrainerFriendship),
|
||||
Optional.ofNullable(pokemon.metData)
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -1267,6 +1267,8 @@
|
||||
"cobblemon.ui.info.ability": "Ability",
|
||||
"cobblemon.ui.info.experience_points": "Exp. Points",
|
||||
"cobblemon.ui.info.to_next_level": "To Next Lv.",
|
||||
"cobblemon.ui.info.met_data": "Met in %1$s on %2$s/%3$s/%4$s at Lv.%5$s",
|
||||
"cobblemon.ui.info.met_data_unavailable": "Met a long time ago",
|
||||
"cobblemon.ui.trade": "Trade",
|
||||
"cobblemon.trade.expired.sender": "Your request to trade with %1$s has timed out!",
|
||||
"cobblemon.trade.expired.receiver": "The trade request from %1$s has timed out!",
|
||||
|
||||
@@ -548,7 +548,7 @@
|
||||
"battleOnly": false
|
||||
},
|
||||
{
|
||||
"name": "!",
|
||||
"name": "Exclamation",
|
||||
"primaryType": "psychic",
|
||||
"maleRatio": -1,
|
||||
"height": 5,
|
||||
@@ -563,7 +563,7 @@
|
||||
"battleOnly": false
|
||||
},
|
||||
{
|
||||
"name": "?",
|
||||
"name": "Question",
|
||||
"primaryType": "psychic",
|
||||
"maleRatio": -1,
|
||||
"height": 5,
|
||||
|
||||
Binary file not shown.
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>local.com.bedrockk</groupId>
|
||||
<artifactId>molang</artifactId>
|
||||
<version>1.1.12</version>
|
||||
</project>
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>local.com.bedrockk</groupId>
|
||||
<artifactId>molang</artifactId>
|
||||
<version>1.1.14</version>
|
||||
</project>
|
||||
Binary file not shown.
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>local.com.bedrockk</groupId>
|
||||
<artifactId>molang</artifactId>
|
||||
<version>1.1.15</version>
|
||||
</project>
|
||||
Binary file not shown.
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>local.com.bedrockk</groupId>
|
||||
<artifactId>molang</artifactId>
|
||||
<version>1.1.16</version>
|
||||
</project>
|
||||
Binary file not shown.
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>local.com.bedrockk</groupId>
|
||||
<artifactId>molang</artifactId>
|
||||
<version>1.1.18</version>
|
||||
</project>
|
||||
Binary file not shown.
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>local.com.bedrockk</groupId>
|
||||
<artifactId>molang</artifactId>
|
||||
<version>1.1.19</version>
|
||||
</project>
|
||||
Binary file not shown.
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>local.com.bedrockk</groupId>
|
||||
<artifactId>molang</artifactId>
|
||||
<version>1.1.20</version>
|
||||
</project>
|
||||
Binary file not shown.
+1
-1
@@ -4,5 +4,5 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>local.com.bedrockk</groupId>
|
||||
<artifactId>molang</artifactId>
|
||||
<version>1.1.13</version>
|
||||
<version>1.1.21</version>
|
||||
</project>
|
||||
+3
-3
@@ -3,10 +3,10 @@
|
||||
<groupId>local.com.bedrockk</groupId>
|
||||
<artifactId>molang</artifactId>
|
||||
<versioning>
|
||||
<release>1.1.20</release>
|
||||
<release>1.1.21</release>
|
||||
<versions>
|
||||
<version>1.1.20</version>
|
||||
<version>1.1.21</version>
|
||||
</versions>
|
||||
<lastUpdated>20231949390007</lastUpdated>
|
||||
<lastUpdated>20231949390008</lastUpdated>
|
||||
</versioning>
|
||||
</metadata>
|
||||
@@ -14,7 +14,7 @@ architectury-plugin = "3.4-SNAPSHOT"
|
||||
moddev = "1.0.11"
|
||||
|
||||
# Common
|
||||
molang = "1.1.20"
|
||||
molang = "1.1.21"
|
||||
jei-api = "19.22.1.316"
|
||||
appleskin-api = "mc1.21-3.0.5"
|
||||
|
||||
|
||||
Reference in new issue
Block a user