From 57a0397d884b79a3d6a039b497817007aecd13c9 Mon Sep 17 00:00:00 2001 From: Rafa <32463720+Rafacasari@users.noreply.github.com> Date: Sun, 30 Jun 2024 09:00:46 -0300 Subject: [PATCH] 1.0.31 Icons for caught and shiny entries! Hopefully fixed tabs rendering over hover-text on Where to Find --- .../client/gui/CobbledexCollectionGUI.kt | 39 ++++++-- .../mod/cobbledex/client/gui/CobbledexGUI.kt | 88 ++++++++---------- .../textures/gui/collection/pokeball.png | Bin 0 -> 260 bytes .../textures/gui/collection/shiny_icon.png | Bin 182 -> 299 bytes gradle.properties | 2 +- 5 files changed, 73 insertions(+), 56 deletions(-) create mode 100644 common/src/main/resources/assets/cobbledex/textures/gui/collection/pokeball.png diff --git a/common/src/main/kotlin/com/rafacasari/mod/cobbledex/client/gui/CobbledexCollectionGUI.kt b/common/src/main/kotlin/com/rafacasari/mod/cobbledex/client/gui/CobbledexCollectionGUI.kt index d67d372..07022c3 100644 --- a/common/src/main/kotlin/com/rafacasari/mod/cobbledex/client/gui/CobbledexCollectionGUI.kt +++ b/common/src/main/kotlin/com/rafacasari/mod/cobbledex/client/gui/CobbledexCollectionGUI.kt @@ -16,7 +16,6 @@ import com.cobblemon.mod.common.pokemon.Species import com.cobblemon.mod.common.util.math.fromEulerXYZDegrees import com.rafacasari.mod.cobbledex.CobbledexConstants.Client.discoveredList import com.rafacasari.mod.cobbledex.api.classes.DiscoveryRegister -import com.rafacasari.mod.cobbledex.client.gui.CobbledexGUI.Companion.SCALE import com.rafacasari.mod.cobbledex.client.gui.CobbledexGUI.Companion.TYPE_SPACER import com.rafacasari.mod.cobbledex.client.gui.CobbledexGUI.Companion.TYPE_SPACER_DOUBLE import com.rafacasari.mod.cobbledex.client.widget.ImageButton @@ -43,6 +42,7 @@ class CobbledexCollectionGUI : Screen(cobbledexTextTranslation("cobbledex")) { const val BASE_WIDTH: Int = 349 const val BASE_HEIGHT: Int = 205 const val PORTRAIT_SIZE = 58F + const val SCALE = 0.5F const val LINES_SIZE = 6 const val COLUMN_SIZE = 11 @@ -65,6 +65,9 @@ class CobbledexCollectionGUI : Screen(cobbledexTextTranslation("cobbledex")) { private val LEFT_ARROW: Identifier = cobbledexResource("textures/gui/collection/left_arrow.png") private val RIGHT_ARROW: Identifier = cobbledexResource("textures/gui/collection/right_arrow.png") + private val CAUGHT_ICON: Identifier = cobbledexResource("textures/gui/collection/pokeball.png") + private val SHINY_ICON: Identifier = cobbledexResource("textures/gui/collection/shiny_icon.png") + fun show(skipSound: Boolean = false) { if (!skipSound) playSound(CobblemonSounds.PC_ON) @@ -270,6 +273,9 @@ class CobbledexCollectionGUI : Screen(cobbledexTextTranslation("cobbledex")) { species?.let { val isMouseOver = mouseX.toDouble() in entryX .. (entryX + ENTRY_SIZE) && mouseY.toDouble() in entryY .. (entryY + ENTRY_SIZE) val isDiscovered = discoveredList.contains(species.showdownId()) + val isCaught = discoveredList[species.showdownId()]?.any { x -> x.value.status == DiscoveryRegister.RegisterType.CAUGHT } == true + val isShiny = discoveredList[species.showdownId()]?.any { x -> x.value.status == DiscoveryRegister.RegisterType.CAUGHT && x.value.isShiny } == true + if (lastHoveredEntry != species && isMouseOver) { lastHoveredEntry = species loadSpecies(species, isDiscovered) @@ -321,6 +327,30 @@ class CobbledexCollectionGUI : Screen(cobbledexTextTranslation("cobbledex")) { context.disableScissor() + if (isCaught) { + blitk( + matrixStack = matrices, + texture = CAUGHT_ICON, + x = (entryX + ENTRY_SIZE - (11 * SCALE) - 1F) / SCALE, + y = (entryY + 1F) / SCALE, + width = 11, + height = 11, + scale = SCALE, + alpha = 0.75f + ) + + if (isShiny) + blitk( + matrixStack = matrices, + texture = SHINY_ICON, + x = (entryX + ENTRY_SIZE - (11 * SCALE) - 1F) / SCALE, + y = (entryY + ENTRY_SIZE - (11 * SCALE) - 1) / SCALE, + width = 11, + height = 11, + scale = SCALE + ) + } + drawScaledText( context = context, text = "${species.nationalPokedexNumber}".text(), @@ -333,7 +363,6 @@ class CobbledexCollectionGUI : Screen(cobbledexTextTranslation("cobbledex")) { if (isMouseOver && isDiscovered) { - discoveredList[species.showdownId()]?.let { entry -> val tooltip: MutableList = mutableListOf() @@ -429,11 +458,7 @@ class CobbledexCollectionGUI : Screen(cobbledexTextTranslation("cobbledex")) { if ((!config.Collection_NeedCatch || hasCaught) && (!config.Collection_NeedSeen || hasSeen)) { playSound(CobblemonSounds.PC_CLICK) - CobbledexGUI.openCobbledexScreen( - species.standardForm, setOf(), - skipSound = true, - cameFromCollection = true - ) + CobbledexGUI.openCobbledexScreen(species.standardForm, species.standardForm.aspects.toSet(), skipSound = true) } return true } diff --git a/common/src/main/kotlin/com/rafacasari/mod/cobbledex/client/gui/CobbledexGUI.kt b/common/src/main/kotlin/com/rafacasari/mod/cobbledex/client/gui/CobbledexGUI.kt index 7be3a69..825bd5a 100644 --- a/common/src/main/kotlin/com/rafacasari/mod/cobbledex/client/gui/CobbledexGUI.kt +++ b/common/src/main/kotlin/com/rafacasari/mod/cobbledex/client/gui/CobbledexGUI.kt @@ -43,8 +43,7 @@ class CobbledexGUI(var selectedPokemon: FormData?, var selectedAspects: Set? = null, skipSound: Boolean = false, cameFromCollection: Boolean = false) { + fun openCobbledexScreen(pokemon: FormData? = null, aspects: Set? = null, skipSound: Boolean = false) { if (!skipSound) playSound(CobblemonSounds.PC_ON) Instance = CobbledexGUI(pokemon, aspects) @@ -73,8 +72,8 @@ class CobbledexGUI(var selectedPokemon: FormData?, var selectedAspects: Set CobbledexRelatedMenu.entries.size - 1) CobbledexRelatedMenu.Evolutions else CobbledexRelatedMenu.entries[newTab] + selectedRelatedTab = + if (newTab > CobbledexRelatedMenu.entries.size - 1) CobbledexRelatedMenu.Evolutions else CobbledexRelatedMenu.entries[newTab] updateRelatedSpecies() evolutionDisplay?.resetScrollPosition() @@ -205,7 +202,7 @@ class CobbledexGUI(var selectedPokemon: FormData?, var selectedAspects: Set { // Use cache to load spawnDetails // We don't need to worry about being null, server should send information and packet handler will update automatically @@ -370,8 +367,7 @@ class CobbledexGUI(var selectedPokemon: FormData?, var selectedAspects: Set? = null) - { + fun setPreviewPokemon(pokemon: FormData?, formAspects: Set? = null) { // TODO: Implement this when make the shiny/gender buttons // This should be possible to get all possible choice-features // Will be useful for Pokémon that have a lot of non-form variants (recolors) @@ -417,30 +413,21 @@ class CobbledexGUI(var selectedPokemon: FormData?, var selectedAspects: Set { // TODO: Rework the evolution display evolutionDisplay?.selectEvolutions(lastLoadedEvolutions?.mapNotNull { @@ -465,7 +452,12 @@ class CobbledexGUI(var selectedPokemon: FormData?, var selectedAspects: Set?, itemDrops: List?, fromCache: Boolean = false) { + fun updateInfoPage( + species: Species?, + spawnDetails: List?, + itemDrops: List?, + fromCache: Boolean = false + ) { if (!fromCache) { // If our call isn't from cache, then we can update the current cache lastLoadedSpawnDetails = spawnDetails diff --git a/common/src/main/resources/assets/cobbledex/textures/gui/collection/pokeball.png b/common/src/main/resources/assets/cobbledex/textures/gui/collection/pokeball.png new file mode 100644 index 0000000000000000000000000000000000000000..7cbc92f8a9fc8430a19d175ce01e4b7fe5bc9dc9 GIT binary patch literal 260 zcmeAS@N?(olHy`uVBq!ia0vp^+#t-s1|(OmDOUqhoCO|{#XvD(5N2eUHAey{xXshW zF+^hO)QN^%M-&8H_bVPXs+xGyC}Do_6QkKNr>ypFNR7&_ZY|mDE21iJW96KWKmVtP zoatE|#vp$ud-pqoZ4VO9^wum7VY&8^lcnMCj9(6ho3}jBY|>1x*?P=-?+agnz_64`@VT=x7MnqO`9_5h=gj3!qW6KPDPKNjo)HfqcW{~e zfgvILZ3oBiec=Jwv5#^NZ{3wT@A>UpQU#0~R@K*iU{5(8;XL=HU=`2@44$rjF6*2U FngCK%Xutpf literal 0 HcmV?d00001 diff --git a/common/src/main/resources/assets/cobbledex/textures/gui/collection/shiny_icon.png b/common/src/main/resources/assets/cobbledex/textures/gui/collection/shiny_icon.png index 6dc25bab38c8a8d2ecd08abf1ac3079a8141bc7f..d1f4badf7c9ed35e5ab3ecdac42af6b10e3ca2df 100644 GIT binary patch delta 285 zcmV+&0pk9)0jmNbiBL{Q4GJ0x0000DNk~Le0000B0000B2nGNE0I95ZCXpc+f89w$ zK~xx(b&x%7!axv(zcE%qzYlc7D0Kp=g0u{|hiD%-DbMrywDgY2=Q+FyVbhm&rT)!6P;n_P|Yw6`n0S`+3 z>Z9#Jk{sQZqN>ASho!=~H`s^z*uAb*JQHM+dnkaClUTAw{RLUJT_t}J}~u)d$YhICa$8II}x8IzfDNn@oH6n!?|kihCc@kdmPrR zmTO2zTWZ)VBfX*F2}_2>^>fm$r*kJwX6Q0`$rsPCqCSgL?!(_NXJ0TpV7gYNZd`ME R?-HQh44$rjF6*2UngH+yKCl1) diff --git a/gradle.properties b/gradle.properties index 9697d0c..6d85040 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,7 +8,7 @@ mod_id=cobbledex generated_file_name_addon=-1.20.1 archives_base_name=cobbledex-1.20.1 -mod_version=1.0.30 +mod_version=1.0.31 mod_description=A mod to track your progress on Cobblemon. Fabric and Forge compatible. mod_icon=assets/cobbledex/icon.png repository=https://github.com/rafacasari/cobbledex