Skip to content

Commit

Permalink
1.0.24
Browse files Browse the repository at this point in the history
Removed TextHandlerAccessor mixin, should prevent issues on some specific Environments
 Added Craft Recipe!
  • Loading branch information
Rafacasari committed Jun 22, 2024
1 parent 80a2e21 commit 41a11e7
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 22 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,20 @@ class CobbledexGUI(var selectedPokemon: FormData?, var selectedAspects: Set<Stri

fun setPreviewPokemon(pokemon: FormData?, pokemonAspects: Set<String>? = 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)
// if (pokemon != null) {
// val species = pokemon.species
// val features = SpeciesFeatureAssignments.getFeatures(species).mapNotNull { featureName ->
// val feature: SpeciesFeatureProvider<out SpeciesFeature>? = SpeciesFeatures.getFeature(featureName)
//
// if (feature != null && feature is ChoiceSpeciesFeatureProvider)
// return@mapNotNull featureName to feature.choices
// else return@mapNotNull null
// }.toMap()
// }

val x = (width - BASE_WIDTH) / 2
val y = (height - BASE_HEIGHT) / 2

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import com.cobblemon.mod.common.pokemon.FormData
import com.rafacasari.mod.cobbledex.client.widget.LongTextDisplay
import com.rafacasari.mod.cobbledex.utils.TypeChartUtils
import com.rafacasari.mod.cobbledex.utils.withRGBColor
import net.minecraft.text.Text

object BattleMenu {
fun drawText(longTextDisplay: LongTextDisplay?, pokemon: FormData?) {
Expand All @@ -20,7 +21,8 @@ object BattleMenu {

elementalMultipliers.filter { it.key != 1f }.forEach { elementalKey ->

longTextDisplay.addText("${elementalKey.key}x damage from".text())
val translation = Text.translatable("cobbledex.texts.battle.damage_from", elementalKey.key)
longTextDisplay.addText(translation)

val typesText = elementalKey.value.fold("".text()) { acc, element ->
if (elementalKey.value.first() != element)
Expand All @@ -29,7 +31,6 @@ object BattleMenu {
acc.add(element.displayName.bold().withRGBColor(element.hue))
}


longTextDisplay.addText(typesText, false)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.rafacasari.mod.cobbledex.client.widget.entries

import com.rafacasari.mod.cobbledex.client.widget.LongTextDisplay
import com.rafacasari.mod.cobbledex.mixins.TextHandlerAccessor
import com.rafacasari.mod.cobbledex.utils.logError
import net.minecraft.client.MinecraftClient
import net.minecraft.client.gui.DrawContext
Expand Down Expand Up @@ -57,10 +56,12 @@ class TextEntry(private val line: OrderedText?, private val shadow: Boolean = fa
var charX = x.toFloat()
val charY = y.toFloat()

text.accept { _, style, codePoint ->

text.accept { index, style, codePoint ->
try {
val widthRetriever = (textRenderer.textHandler as TextHandlerAccessor).cobbledexWidthRetriever
val charWidth = widthRetriever.getWidth(codePoint, style)
val charWidth: Float = textRenderer.textHandler.getWidth {
x -> x.accept(index, style, codePoint)
}

if (pMouseX!! >= charX && pMouseX < charX + charWidth && pMouseY!! >= charY && pMouseY < charY + textRenderer.fontHeight) {
hoveredStyle = style
Expand Down
1 change: 1 addition & 0 deletions common/src/main/resources/assets/cobbledex/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"cobbledex.texts.weight": "Weight",
"cobbledex.texts.height": "Height",
"cobbledex.texts.select": "Select",
"cobbledex.texts.battle.damage_from": "%sx damage from:",

"cobbledex.texts.drops.item": "%s | %s%% | %sx",
"cobbledex.texts.weather.clear": "Clear",
Expand Down
1 change: 0 additions & 1 deletion common/src/main/resources/cobbledex-common.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"compatibilityLevel": "JAVA_17",
"minVersion": "0.8",
"client": [
"TextHandlerAccessor",
"ItemRendererMixin"
],
"injectors": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"type": "minecraft:crafting_shaped",
"category": "misc",
"pattern": [
"iai",
"gbg",
"iri"
],
"key": {
"i": {
"item": "minecraft:iron_ingot"
},
"r": {
"item": "minecraft:redstone"
},
"b": {
"item": "minecraft:book"
},
"g": {
"item": "minecraft:glass_pane"
},
"a": {
"item": "cobblemon:red_apricorn"
}
},
"result": {
"item": "cobbledex:cobbledex_item",
"count": 1
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.23
mod_version=1.0.24
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
Expand Down

0 comments on commit 41a11e7

Please sign in to comment.