aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-11-27 16:04:05 +0100
committerLinnea Gräf <nea@nea.moe>2024-11-27 16:05:19 +0100
commitee0526ac67e093f77d17747d9316765b2db272a2 (patch)
tree1e2f8a26475afcc8c0d36b85068e1a2b282410ab
parent9df1f12970dafdbf4cb13c76c1df1caed66f4a59 (diff)
downloadFirmament-ee0526ac67e093f77d17747d9316765b2db272a2.tar.gz
Firmament-ee0526ac67e093f77d17747d9316765b2db272a2.tar.bz2
Firmament-ee0526ac67e093f77d17747d9316765b2db272a2.zip
test: Use kotest
-rw-r--r--build.gradle.kts15
-rw-r--r--gradle/libs.versions.toml13
-rw-r--r--src/main/kotlin/util/JvmUtil.kt32
-rw-r--r--src/main/kotlin/util/MC.kt2
-rw-r--r--src/main/kotlin/util/TestUtil.kt5
-rw-r--r--src/test/kotlin/testutil/KotestPlugin.kt16
-rw-r--r--src/test/kotlin/util/ColorCodeTest.kt26
-rw-r--r--src/test/kotlin/util/TextUtilText.kt6
-rw-r--r--src/test/kotlin/util/skyblock/AbilityUtilsTest.kt3
-rw-r--r--src/test/kotlin/util/skyblock/SackUtilTest.kt3
-rw-r--r--src/test/resources/testdata/items/gemstone-gauntlet.snbt103
-rw-r--r--src/test/resources/testdata/items/pets/lion-item.snbt62
-rw-r--r--src/test/resources/testdata/items/pets/mithril-golem-not-selected.snbt52
-rw-r--r--src/test/resources/testdata/items/pets/rabbit-selected.snbt60
14 files changed, 371 insertions, 27 deletions
diff --git a/build.gradle.kts b/build.gradle.kts
index 91ab9e4..05912a7 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -26,7 +26,7 @@ plugins {
// alias(libs.plugins.loom)
// TODO: use arch loom once they update to 1.8
id("fabric-loom") version "1.8.9"
- id("com.github.johnrengelman.shadow") version "8.1.1"
+ alias(libs.plugins.shadow)
id("moe.nea.licenseextractificator")
id("moe.nea.mc-auto-translations") version "0.1.0"
}
@@ -305,7 +305,7 @@ dependencies {
}
- testImplementation("org.junit.jupiter:junit-jupiter:5.9.2")
+ testImplementation("io.kotest:kotest-runner-junit5:6.0.0.M1")
implementation(project(":symbols"))
ksp(project(":symbols"))
@@ -368,14 +368,21 @@ val updateTestRepo by tasks.registering {
tasks.test {
- val wd =file("build/testWorkDir")
+ val wd = file("build/testWorkDir")
workingDir(wd)
dependsOn(downloadTestRepo)
doFirst {
wd.mkdirs()
wd.resolve("config").deleteRecursively()
- systemProperty("firmament.testrepo", downloadTestRepo.flatMap { it.outputDirectory.asFile }.map { it.absolutePath }.get())
+ systemProperty("firmament.testrepo",
+ downloadTestRepo.flatMap { it.outputDirectory.asFile }.map { it.absolutePath }.get())
}
+ systemProperty("jdk.attach.allowAttachSelf", "true")
+ jvmArgs("-XX:+EnableDynamicAgentLoading")
+ systemProperties(
+ "kotest.framework.classpath.scanning.config.disable" to true,
+ "kotest.framework.config.fqn" to "moe.nea.firmament.test.testutil.KotestPlugin",
+ )
useJUnitPlatform()
}
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index 4c6c317..83e1ae7 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -82,6 +82,9 @@ yacl = "3.6.1+1.21.2-fabric"
# Update from https://maven.shedaniel.me/me/shedaniel/cloth/basic-math/0.6.1/
basicMath = "0.6.1"
+# Update from https://mvnrepository.com/artifact/net.lenni0451.classtransform/core
+classtransform = "1.14.0"
+
[libraries]
minecraft = { module = "com.mojang:minecraft", version.ref = "minecraft" }
fabric_loader = { module = "net.fabricmc:fabric-loader", version.ref = "fabric_loader" }
@@ -118,19 +121,22 @@ femalegender = { module = "maven.modrinth:female-gender", version.ref = "femaleg
yacl = { module = "dev.isxander:yet-another-config-lib", version.ref = "yacl" }
basicMath = { module = "me.shedaniel.cloth:basic-math", version.ref = "basicMath" }
+classTransform-mixinsTranslator = { module = "net.lenni0451.classtransform:mixinstranslator", version.ref = "classtransform" }
+classTransform-core = { module = "net.lenni0451.classtransform:core", version.ref = "classtransform" }
+
[bundles]
runtime_required = [
"rei_fabric",
-# "notenoughanimations",
+ # "notenoughanimations",
"hypixelmodapi_fabric",
]
runtime_optional = [
"devauth",
# "freecammod",
-# "sodium",
+ # "sodium",
# "qolify",
"ncr",
-# "citresewn",
+ # "citresewn",
]
[plugins]
@@ -139,3 +145,4 @@ kotlin_plugin_serialization = { id = "org.jetbrains.kotlin.plugin.serialization"
kotlin_plugin_powerassert = { id = "org.jetbrains.kotlin.plugin.power-assert", version.ref = "kotlin" }
kotlin_plugin_ksp = { id = "com.google.devtools.ksp", version.ref = "kotlin_ksp" }
loom = { id = "dev.architectury.loom", version.ref = "loom" }
+shadow = { id = "com.github.johnrengelman.shadow",version="8.1.1" }
diff --git a/src/main/kotlin/util/JvmUtil.kt b/src/main/kotlin/util/JvmUtil.kt
new file mode 100644
index 0000000..5be5ebd
--- /dev/null
+++ b/src/main/kotlin/util/JvmUtil.kt
@@ -0,0 +1,32 @@
+package moe.nea.firmament.util
+
+import com.sun.tools.attach.VirtualMachine
+import java.lang.management.ManagementFactory
+import java.nio.file.Path
+import kotlin.io.path.absolutePathString
+
+object JvmUtil {
+ fun guessJVMPid(): String {
+ val name = ManagementFactory.getRuntimeMXBean().name
+ val pid = name.substringBefore('@')
+ ErrorUtil.softCheck("Not a valid PID: $pid", pid.toIntOrNull() != null)
+ return pid
+ }
+
+ fun getVM(): VirtualMachine {
+ return VirtualMachine.attach(guessJVMPid())
+ }
+
+ fun useVM(block: (VirtualMachine) -> Unit) {
+ val vm = getVM()
+ block(vm)
+ vm.detach()
+ }
+
+ fun loadAgent(jarPath: Path, options: String? = null) {
+ useVM {
+ it.loadAgent(jarPath.absolutePathString(), options)
+ }
+ }
+
+}
diff --git a/src/main/kotlin/util/MC.kt b/src/main/kotlin/util/MC.kt
index f7c81da..a60d5c4 100644
--- a/src/main/kotlin/util/MC.kt
+++ b/src/main/kotlin/util/MC.kt
@@ -105,7 +105,7 @@ object MC {
inline val currentRegistries: RegistryWrapper.WrapperLookup? get() = world?.registryManager
val defaultRegistries: RegistryWrapper.WrapperLookup by lazy { BuiltinRegistries.createWrapperLookup() }
inline val currentOrDefaultRegistries get() = currentRegistries ?: defaultRegistries
- val defaultItems: RegistryWrapper.Impl<Item> = defaultRegistries.getOrThrow(RegistryKeys.ITEM)
+ val defaultItems: RegistryWrapper.Impl<Item> by lazy { defaultRegistries.getOrThrow(RegistryKeys.ITEM) }
var lastWorld: World? = null
get() {
field = world ?: field
diff --git a/src/main/kotlin/util/TestUtil.kt b/src/main/kotlin/util/TestUtil.kt
index 68a406f..2d38f35 100644
--- a/src/main/kotlin/util/TestUtil.kt
+++ b/src/main/kotlin/util/TestUtil.kt
@@ -1,5 +1,8 @@
package moe.nea.firmament.util
object TestUtil {
- val isInTest = Thread.currentThread().stackTrace.any { it.className.startsWith("org.junit.") }
+ val isInTest =
+ Thread.currentThread().stackTrace.any {
+ it.className.startsWith("org.junit.") || it.className.startsWith("io.kotest.")
+ }
}
diff --git a/src/test/kotlin/testutil/KotestPlugin.kt b/src/test/kotlin/testutil/KotestPlugin.kt
new file mode 100644
index 0000000..6db50fb
--- /dev/null
+++ b/src/test/kotlin/testutil/KotestPlugin.kt
@@ -0,0 +1,16 @@
+package moe.nea.firmament.test.testutil
+
+import io.kotest.core.config.AbstractProjectConfig
+import io.kotest.core.extensions.Extension
+import moe.nea.firmament.test.FirmTestBootstrap
+
+class KotestPlugin : AbstractProjectConfig() {
+ override fun extensions(): List<Extension> {
+ return listOf()
+ }
+
+ override suspend fun beforeProject() {
+ FirmTestBootstrap.bootstrapMinecraft()
+ super.beforeProject()
+ }
+}
diff --git a/src/test/kotlin/util/ColorCodeTest.kt b/src/test/kotlin/util/ColorCodeTest.kt
index d9de36a..949749e 100644
--- a/src/test/kotlin/util/ColorCodeTest.kt
+++ b/src/test/kotlin/util/ColorCodeTest.kt
@@ -1,25 +1,23 @@
package moe.nea.firmament.test.util
+import io.kotest.core.spec.style.AnnotationSpec
import org.junit.jupiter.api.Assertions
-import org.junit.jupiter.api.Test
-import net.minecraft.Bootstrap
-import net.minecraft.SharedConstants
import moe.nea.firmament.util.removeColorCodes
-class ColorCodeTest {
+class ColorCodeTest : AnnotationSpec() {
@Test
fun testWhatever() {
- Assertions.assertEquals("", "".removeColorCodes().toString())
- Assertions.assertEquals("", "§".removeColorCodes().toString())
- Assertions.assertEquals("", "§a".removeColorCodes().toString())
- Assertions.assertEquals("ab", "a§ab".removeColorCodes().toString())
- Assertions.assertEquals("ab", "a§ab§§".removeColorCodes().toString())
- Assertions.assertEquals("abc", "a§ab§§c".removeColorCodes().toString())
- Assertions.assertEquals("bc", "§ab§§c".removeColorCodes().toString())
- Assertions.assertEquals("b§lc", "§ab§l§§c".removeColorCodes(true).toString())
- Assertions.assertEquals("b§lc§l", "§ab§l§§c§l".removeColorCodes(true).toString())
- Assertions.assertEquals("§lb§lc", "§l§ab§l§§c".removeColorCodes(true).toString())
+ Assertions.assertEquals("", "".removeColorCodes())
+ Assertions.assertEquals("", "§".removeColorCodes())
+ Assertions.assertEquals("", "§a".removeColorCodes())
+ Assertions.assertEquals("ab", "a§ab".removeColorCodes())
+ Assertions.assertEquals("ab", "a§ab§§".removeColorCodes())
+ Assertions.assertEquals("abc", "a§ab§§c".removeColorCodes())
+ Assertions.assertEquals("bc", "§ab§§c".removeColorCodes())
+ Assertions.assertEquals("b§lc", "§ab§l§§c".removeColorCodes(true))
+ Assertions.assertEquals("b§lc§l", "§ab§l§§c§l".removeColorCodes(true))
+ Assertions.assertEquals("§lb§lc", "§l§ab§l§§c".removeColorCodes(true))
}
@Test
diff --git a/src/test/kotlin/util/TextUtilText.kt b/src/test/kotlin/util/TextUtilText.kt
index 7091f4e..e676d63 100644
--- a/src/test/kotlin/util/TextUtilText.kt
+++ b/src/test/kotlin/util/TextUtilText.kt
@@ -1,15 +1,17 @@
package moe.nea.firmament.test.util
+import io.kotest.core.spec.style.AnnotationSpec
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
import moe.nea.firmament.test.testutil.ItemResources
import moe.nea.firmament.util.getLegacyFormatString
-class TextUtilText {
+class TextUtilText : AnnotationSpec() {
@Test
fun testThing() {
// TODO: add more tests that are directly validated with 1.8.9 code
val text = ItemResources.loadText("all-chat")
- Assertions.assertEquals("§r§r§8[§r§9302§r§8] §r§6♫ §r§b[MVP§r§d+§r§b] lrg89§r§f: test§r", text.getLegacyFormatString())
+ Assertions.assertEquals("§r§r§8[§r§9302§r§8] §r§6♫ §r§b[MVP§r§d+§r§b] lrg89§r§f: test§r",
+ text.getLegacyFormatString())
}
}
diff --git a/src/test/kotlin/util/skyblock/AbilityUtilsTest.kt b/src/test/kotlin/util/skyblock/AbilityUtilsTest.kt
index abe739d..dbce762 100644
--- a/src/test/kotlin/util/skyblock/AbilityUtilsTest.kt
+++ b/src/test/kotlin/util/skyblock/AbilityUtilsTest.kt
@@ -1,5 +1,6 @@
package moe.nea.firmament.test.util.skyblock
+import io.kotest.core.spec.style.AnnotationSpec
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
import kotlin.time.Duration.Companion.minutes
@@ -9,7 +10,7 @@ import moe.nea.firmament.test.testutil.ItemResources
import moe.nea.firmament.util.skyblock.AbilityUtils
import moe.nea.firmament.util.unformattedString
-class AbilityUtilsTest {
+class AbilityUtilsTest : AnnotationSpec() {
fun List<AbilityUtils.ItemAbility>.stripDescriptions() = map {
it.copy(descriptionLines = it.descriptionLines.map { Text.literal(it.unformattedString) })
diff --git a/src/test/kotlin/util/skyblock/SackUtilTest.kt b/src/test/kotlin/util/skyblock/SackUtilTest.kt
index e0e3e63..e1b106e 100644
--- a/src/test/kotlin/util/skyblock/SackUtilTest.kt
+++ b/src/test/kotlin/util/skyblock/SackUtilTest.kt
@@ -1,12 +1,13 @@
package moe.nea.firmament.test.util.skyblock
+import io.kotest.core.spec.style.AnnotationSpec
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
import moe.nea.firmament.test.testutil.ItemResources
import moe.nea.firmament.util.skyblock.SackUtil
import moe.nea.firmament.util.skyblock.SkyBlockItems
-class SackUtilTest {
+class SackUtilTest : AnnotationSpec() {
@Test
fun testOneRottenFlesh() {
Assertions.assertEquals(
diff --git a/src/test/resources/testdata/items/gemstone-gauntlet.snbt b/src/test/resources/testdata/items/gemstone-gauntlet.snbt
new file mode 100644
index 0000000..92ce739
--- /dev/null
+++ b/src/test/resources/testdata/items/gemstone-gauntlet.snbt
@@ -0,0 +1,103 @@
+{
+ components: {
+ "minecraft:attribute_modifiers": {
+ modifiers: [
+ ],
+ show_in_tooltip: 0b
+ },
+ "minecraft:custom_data": {
+ compact_blocks: 287507,
+ donated_museum: 1b,
+ enchantments: {
+ compact: 8,
+ critical: 5,
+ efficiency: 5,
+ experience: 3,
+ first_strike: 4,
+ fortune: 4,
+ giant_killer: 5,
+ pristine: 3,
+ scavenger: 3,
+ sharpness: 5,
+ telekinesis: 1
+ },
+ gems: {
+ AMBER_0: "FINE",
+ AMETHYST_0: "FINE",
+ JADE_0: "FINE",
+ SAPPHIRE_0: "FINE",
+ TOPAZ_0: "FINE"
+ },
+ id: "GEMSTONE_GAUNTLET",
+ modifier: "auspicious",
+ originTag: "QUICK_CRAFTING",
+ timestamp: 1642718160000L,
+ uuid: "af56dd7b-c4b1-4e26-8d09-1854680a93c3"
+ },
+ "minecraft:custom_name": '{"extra":[{"color":"gold","text":"Auspicious Gemstone Gauntlet"}],"italic":false,"text":""}',
+ "minecraft:enchantments": {
+ levels: {
+ "minecraft:efficiency": 5
+ }
+ },
+ "minecraft:hide_additional_tooltip": {
+ },
+ "minecraft:lore": [
+ '{"extra":[{"color":"dark_gray","text":"Breaking Power 8"}],"italic":false,"text":""}',
+ '{"italic":false,"text":""}',
+ '{"extra":[{"color":"gray","text":"Damage: "},{"color":"red","text":"+300"}],"italic":false,"text":""}',
+ '{"extra":[{"color":"gray","text":"Strength: "},{"color":"red","text":"+50"}],"italic":false,"text":""}',
+ '{"extra":[{"color":"gray","text":"Crit Damage: "},{"color":"red","text":"+50%"}],"italic":false,"text":""}',
+ '{"extra":[{"color":"gray","text":"Defense: "},{"color":"green","text":"+10 "},{"color":"light_purple","text":"(+10)"}],"italic":false,"text":""}',
+ '{"extra":[{"color":"gray","text":"Intelligence: "},{"color":"green","text":"+11 "},{"color":"light_purple","text":"(+11)"}],"italic":false,"text":""}',
+ '{"extra":[{"color":"gray","text":"Mining Speed: "},{"color":"green","text":"+886 "},{"color":"blue","text":"(+50) "},{"color":"light_purple","text":"(+36)"}],"italic":false,"text":""}',
+ '{"extra":[{"color":"gray","text":"Pristine: "},{"color":"green","text":"+2.7 "},{"color":"light_purple","text":"(+1.2)"}],"italic":false,"text":""}',
+ '{"extra":[{"color":"gray","text":"Mining Fortune: "},{"color":"green","text":"+81 "},{"color":"blue","text":"(+16) "},{"color":"light_purple","text":"(+20)"}],"italic":false,"text":""}',
+ '{"extra":[{"color":"gray","text":"Mining Wisdom: "},{"color":"green","text":"+8"}],"italic":false,"text":""}',
+ '{"extra":[" ",{"color":"blue","text":"["},{"color":"green","text":"☘"},{"color":"blue","text":"] "},{"color":"blue","text":"["},{"color":"gold","text":"⸕"},{"color":"blue","text":"] "},{"color":"blue","text":"["},{"color":"yellow","text":"✧"},{"color":"blue","text":"] "},{"color":"blue","text":"["},{"color":"aqua","text":"✎"},{"color":"blue","text":"] "},{"color":"blue","text":"["},{"color":"dark_purple","text":"❈"},{"color":"blue","text":"]"}],"italic":false,"text":""}',
+ '{"italic":false,"text":""}',
+ '{"extra":[{"color":"blue","text":"Compact VIII"},{"color":"blue","text":", "},{"color":"blue","text":"Critical V"},{"color":"blue","text":", "},{"color":"blue","text":"Efficiency V"}],"italic":false,"text":""}',
+ '{"extra":[{"color":"blue","text":"Experience III"},{"color":"blue","text":", "},{"color":"blue","text":"First Strike IV"},{"color":"blue","text":", "},{"color":"blue","text":"Fortune IV"}],"italic":false,"text":""}',
+ '{"extra":[{"color":"blue","text":"Giant Killer V"},{"color":"blue","text":", "},{"color":"blue","text":"Prismatic III"},{"color":"blue","text":", "},{"color":"blue","text":"Scavenger III"}],"italic":false,"text":""}',
+ '{"extra":[{"color":"blue","text":"Sharpness V"}],"italic":false,"text":""}',
+ '{"italic":false,"text":""}',
+ '{"extra":[{"color":"gray","text":""},{"color":"gold","text":"Ability: Reduced To Atoms"}],"italic":false,"text":""}',
+ '{"extra":[{"color":"gray","text":"Mobs killed on "},{"color":"aqua","text":"Mining Islands "},{"color":"gray","text":"drop the same"}],"italic":false,"text":""}',
+ '{"extra":[{"color":"gray","text":""},{"color":"light_purple","text":"Gemstones "},{"color":"gray","text":"as your filled Gemstone Slots."}],"italic":false,"text":""}',
+ '{"extra":[{"color":"gray","text":""},{"color":"dark_gray","text":"(2s cooldown)"}],"italic":false,"text":""}',
+ '{"extra":[{"color":"gray","text":""}],"italic":false,"text":""}',
+ '{"extra":[{"color":"gray","text":""},{"color":"gold","text":"Ability: Kinetic"}],"italic":false,"text":""}',
+ '{"extra":[{"color":"gray","text":"Killing mobs on "},{"color":"aqua","text":"Mining Islands "},{"color":"gray","text":"reduces your"}],"italic":false,"text":""}',
+ '{"extra":[{"color":"gray","text":""},{"color":"gold","text":"Forge Timers "},{"color":"gray","text":"by "},{"color":"green","text":"0s"},{"color":"gray","text":"."}],"italic":false,"text":""}',
+ '{"extra":[{"color":"gray","text":""},{"color":"dark_gray","text":"(+0.5s per Perfect Gemstone)"}],"italic":false,"text":""}',
+ '{"italic":false,"text":""}',
+ '{"extra":[{"color":"gold","text":"Ability: Mining Speed Boost "},{"bold":true,"color":"yellow","text":"RIGHT CLICK"}],"italic":false,"text":""}',
+ '{"extra":[{"color":"gray","text":"Grants "},{"color":"gold","text":"+200% "},{"color":"gold","text":"⸕ Mining Speed "},{"color":"gray","text":"for"}],"italic":false,"text":""}',
+ '{"extra":[{"color":"gray","text":""},{"color":"green","text":"10s"},{"color":"gray","text":"."}],"italic":false,"text":""}',
+ '{"extra":[{"color":"dark_gray","text":"Cooldown: "},{"color":"green","text":"120s"}],"italic":false,"text":""}',
+ '{"italic":false,"text":""}',
+ '{"extra":[{"color":"blue","text":"Auspicious Bonus"}],"italic":false,"text":""}',
+ '{"extra":[{"color":"gray","text":"Grants "},{"color":"gold","text":"+0.8% "},{"color":"gold","text":"☘ Mining Fortune"},{"color":"gray","text":"."}],"italic":false,"text":""}',
+ '{"italic":false,"text":""}',
+ '{"extra":[{"bold":true,"color":"dark_gray","text":"* "},{"color":"dark_gray","text":"Co-op Soulbound "},{"bold":true,"color":"dark_gray","text":"*"}],"italic":false,"text":""}',
+ '{"extra":[{"bold":true,"color":"gold","text":"LEGENDARY GAUNTLET"}],"italic":false,"text":""}'
+ ],
+ "minecraft:profile": {
+ id: [I;
+ -861744046,
+ -959235637,
+ -1231724855,
+ 724395817
+ ],
+ properties: [
+ {
+ name: "textures",
+ signature: "",
+ value: "ewogICJ0aW1lc3RhbXAiIDogMTYxODUyMTY2MzY1NCwKICAicHJvZmlsZUlkIiA6ICIxZDUyMzNkMzg4NjI0YmFmYjAwZTMxNTBhN2FhM2E4OSIsCiAgInByb2ZpbGVOYW1lIiA6ICIwMDAwMDAwMDAwMDAwMDBKIiwKICAic2lnbmF0dXJlUmVxdWlyZWQiIDogdHJ1ZSwKICAidGV4dHVyZXMiIDogewogICAgIlNLSU4iIDogewogICAgICAidXJsIiA6ICJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzdiZjAxYzE5OGY2ZTE2OTY1ZTIzMDIzNWNkMjJhNWE5ZjRhNDBlNDA5NDEyMzQ0Nzg5NDhmZjlhNTZlNTE3NzUiLAogICAgICAibWV0YWRhdGEiIDogewogICAgICAgICJtb2RlbCIgOiAic2xpbSIKICAgICAgfQogICAgfQogIH0KfQ=="
+ }
+ ]
+ }
+ },
+ count: 1,
+ id: "minecraft:player_head"
+}
diff --git a/src/test/resources/testdata/items/pets/lion-item.snbt b/src/test/resources/testdata/items/pets/lion-item.snbt
new file mode 100644
index 0000000..6e92685
--- /dev/null
+++ b/src/test/resources/testdata/items/pets/lion-item.snbt
@@ -0,0 +1,62 @@
+{
+ components: {
+ "minecraft:attribute_modifiers": {
+ modifiers: [
+ ],
+ show_in_tooltip: 0b
+ },
+ "minecraft:custom_data": {
+ id: "PET",
+ petInfo: '{"type":"LION","active":false,"exp":0.0,"tier":"LEGENDARY","hideInfo":false,"candyUsed":0,"uuid":"c7f57149-458e-4fde-a9bc-fcc14932310a","uniqueId":"d668f085-26a6-48fe-b75b-c7b8227b5ac8","hideRightClick":false,"noMove":false}',
+ timestamp: 1732719293542L,
+ uuid: "c7f57149-458e-4fde-a9bc-fcc14932310a"
+ },
+ "minecraft:custom_name": '{"extra":[{"color":"gray","text":"[Lvl 1] "},{"color":"gold","text":"Lion"}],"italic":false,"text":""}',
+ "minecraft:hide_additional_tooltip": {
+ },
+ "minecraft:lore": [
+ '{"extra":[{"color":"dark_gray","text":"Foraging Pet"}],"italic":false,"text":""}',
+ '{"italic":false,"text":""}',
+ '{"extra":[{"color":"gray","text":"Speed: "},{"color":"green","text":"+0.25"}],"italic":false,"text":""}',
+ '{"extra":[{"color":"gray","text":"Strength: "},{"color":"red","text":"+0.5"}],"italic":false,"text":""}',
+ '{"extra":[{"color":"gray","text":"Ferocity: "},{"color":"green","text":"+0.05"}],"italic":false,"text":""}',
+ '{"italic":false,"text":""}',
+ '{"extra":[{"color":"gold","text":"Primal Force"}],"italic":false,"text":""}',
+ '{"extra":[{"color":"gray","text":""},{"color":"gray","text":"Adds "},{"color":"red","text":"+0.2 "},{"color":"red","text":"❁ Damage "},{"color":"gray","text":"and "},{"color":"red","text":"+0.2 "},{"color":"red","text":"❁"}],"italic":false,"text":""}',
+ '{"extra":[{"color":"red","text":"Strength "},{"color":"gray","text":"to your weapons."}],"italic":false,"text":""}',
+ '{"italic":false,"text":""}',
+ '{"extra":[{"color":"gold","text":"First Pounce"}],"italic":false,"text":""}',
+ '{"extra":[{"color":"gray","text":""},{"color":"gray","text":"First Strike"},{"color":"gray","text":", Triple-Strike"},{"color":"gray","text":", and"}],"italic":false,"text":""}',
+ '{"extra":[{"color":"gray","text":""},{"bold":true,"color":"light_purple","text":"Combo "},{"color":"gray","text":"are "},{"color":"green","text":"1% "},{"color":"gray","text":"more effective."}],"italic":false,"text":""}',
+ '{"italic":false,"text":""}',
+ '{"extra":[{"color":"gold","text":"King of the Jungle"}],"italic":false,"text":""}',
+ '{"extra":[{"color":"gray","text":""},{"color":"gray","text":"Deal "},{"color":"red","text":"+1.5% "},{"color":"red","text":"❁ Damage "},{"color":"gray","text":"against mobs"}],"italic":false,"text":""}',
+ '{"extra":[{"color":"gray","text":"that have attacked you."}],"italic":false,"text":""}',
+ '{"italic":false,"text":""}',
+ '{"extra":[{"color":"gray","text":"Progress to Level 2: "},{"color":"yellow","text":"0%"}],"italic":false,"text":""}',
+ '{"extra":[{"bold":true,"color":"white","strikethrough":true,"text":" "},"",{"bold":false,"extra":[" "],"italic":false,"obfuscated":false,"strikethrough":false,"text":"","underlined":false},{"color":"yellow","text":"0"},{"color":"gold","text":"/"},{"color":"yellow","text":"660"}],"italic":false,"text":""}',
+ '{"italic":false,"text":""}',
+ '{"extra":[{"color":"gray","text":""},{"color":"yellow","text":"Right-click to add this pet to your"}],"italic":false,"text":""}',
+ '{"extra":[{"color":"yellow","text":"pet menu!"}],"italic":false,"text":""}',
+ '{"italic":false,"text":""}',
+ '{"extra":[{"bold":true,"color":"gold","text":"LEGENDARY"}],"italic":false,"text":""}'
+ ],
+ "minecraft:profile": {
+ id: [I;
+ 100496274,
+ -783272221,
+ -1215808471,
+ -1437268588
+ ],
+ properties: [
+ {
+ name: "textures",
+ signature: "",
+ value: "eyJ0aW1lc3RhbXAiOjE1MDMzMTY0Njg1ODAsInByb2ZpbGVJZCI6ImUzYjQ0NWM4NDdmNTQ4ZmI4YzhmYTNmMWY3ZWZiYThlIiwicHJvZmlsZU5hbWUiOiJNaW5pRGlnZ2VyVGVzdCIsInNpZ25hdHVyZVJlcXVpcmVkIjp0cnVlLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMzhmZjQ3M2JkNTJiNGRiMmMwNmYxYWM4N2ZlMTM2N2JjZTc1NzRmYWMzMzBmZmFjNzk1NjIyOWY4MmVmYmExIn19fQ=="
+ }
+ ]
+ }
+ },
+ count: 1,
+ id: "minecraft:player_head"
+}
diff --git a/src/test/resources/testdata/items/pets/mithril-golem-not-selected.snbt b/src/test/resources/testdata/items/pets/mithril-golem-not-selected.snbt
new file mode 100644
index 0000000..c0ef585
--- /dev/null
+++ b/src/test/resources/testdata/items/pets/mithril-golem-not-selected.snbt
@@ -0,0 +1,52 @@
+{
+ components: {
+ "minecraft:custom_data": {
+ id: "PET",
+ petInfo: '{"type":"MITHRIL_GOLEM","active":false,"exp":9232689.767527012,"tier":"LEGENDARY","hideInfo":false,"candyUsed":0,"uuid":"2ebbdaff-c9b6-4fe1-8b87-44905eb5867d","uniqueId":"26be73f1-2955-4003-9e6a-72848cea8e08","hideRightClick":false,"noMove":false}',
+ uuid: "2ebbdaff-c9b6-4fe1-8b87-44905eb5867d"
+ },
+ "minecraft:custom_name": '{"extra":[{"color":"gray","text":"[Lvl 86] "},{"color":"gold","text":"Mithril Golem"}],"italic":false,"text":""}',
+ "minecraft:lore": [
+ '{"extra":[{"color":"dark_gray","text":"Mining Pet"}],"italic":false,"text":""}',
+ '{"italic":false,"text":""}',
+ '{"extra":[{"color":"gray","text":"True Defense: "},{"color":"green","text":"+43"}],"italic":false,"text":""}',
+ '{"extra":[{"color":"gray","text":"Mining Fortune: "},{"color":"green","text":"+21.5"}],"italic":false,"text":""}',
+ '{"italic":false,"text":""}',
+ '{"extra":[{"color":"gold","text":"Mithril Affinity"}],"italic":false,"text":""}',
+ '{"extra":[{"color":"gray","text":""},{"color":"gray","text":"Grants "},{"color":"gold","text":"+172⸕ Mining Speed "},{"color":"gray","text":"when"}],"italic":false,"text":""}',
+ '{"extra":[{"color":"gray","text":"mining "},{"color":"dark_green","text":"Mithril"},{"color":"gray","text":"."}],"italic":false,"text":""}',
+ '{"italic":false,"text":""}',
+ '{"extra":[{"color":"gold","text":"Subterranean Battler"}],"italic":false,"text":""}',
+ '{"extra":[{"color":"gray","text":""},{"color":"gray","text":"Grants "},{"color":"green","text":"+17.2% "},{"color":"gray","text":"of most combat stats"}],"italic":false,"text":""}',
+ '{"extra":[{"color":"gray","text":"while on "},{"color":"aqua","text":"Mining Islands"},{"color":"gray","text":"."}],"italic":false,"text":""}',
+ '{"italic":false,"text":""}',
+ '{"extra":[{"color":"gold","text":"The Smell Of Powder"}],"italic":false,"text":""}',
+ '{"extra":[{"color":"gray","text":""},{"color":"gray","text":"Grants "},{"color":"dark_green","text":"+17.2% ᠅ Mithril Powder "},{"color":"gray","text":"from"}],"italic":false,"text":""}',
+ '{"extra":[{"color":"gray","text":"all sources."}],"italic":false,"text":""}',
+ '{"italic":false,"text":""}',
+ '{"extra":[{"color":"gray","text":"Progress to Level 87: "},{"color":"yellow","text":"89%"}],"italic":false,"text":""}',
+ '{"extra":[{"bold":true,"color":"dark_green","strikethrough":true,"text":" "},{"bold":true,"color":"white","strikethrough":true,"text":" "},"",{"bold":false,"extra":[" "],"italic":false,"obfuscated":false,"strikethrough":false,"text":"","underlined":false},{"color":"yellow","text":"593,259.8"},{"color":"gold","text":"/"},{"color":"yellow","text":"666.7k"}],"italic":false,"text":""}',
+ '{"italic":false,"text":""}',
+ '{"extra":[{"color":"gray","text":""},{"color":"yellow","text":"Left-click to summon!"}],"italic":false,"text":""}',
+ '{"extra":[{"color":"gray","text":""},{"color":"yellow","text":"Shift Left-click to toggle as favorite!"}],"italic":false,"text":""}',
+ '{"extra":[{"color":"yellow","text":"Right-click to convert to an item!"}],"italic":false,"text":""}'
+ ],
+ "minecraft:profile": {
+ id: [I;
+ 972784821,
+ 1926443553,
+ -1284265423,
+ 1586851459
+ ],
+ properties: [
+ {
+ name: "textures",
+ signature: "",
+ value: "ewogICJ0aW1lc3RhbXAiIDogMTYxMDY0OTEwODI4NCwKICAicHJvZmlsZUlkIiA6ICI2ZmU4OTUxZDVhY2M0NDc3OWI2ZmYxMmU3YzFlOTQ2MyIsCiAgInByb2ZpbGVOYW1lIiA6ICJlcGhlbXJhIiwKICAic2lnbmF0dXJlUmVxdWlyZWQiIDogdHJ1ZSwKICAidGV4dHVyZXMiIDogewogICAgIlNLSU4iIDogewogICAgICAidXJsIiA6ICJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2MxYjJkZmU4ZWQ1ZGZmYzViMTY4N2JjMWMyNDljMzlkZTJkOGE2YzNkOTAzMDVjOTVmNmQxYTFhMzMwYTBiMSIKICAgIH0KICB9Cn0="
+ }
+ ]
+ }
+ },
+ count: 1,
+ id: "minecraft:player_head"
+}
diff --git a/src/test/resources/testdata/items/pets/rabbit-selected.snbt b/src/test/resources/testdata/items/pets/rabbit-selected.snbt
new file mode 100644
index 0000000..48a6f6f
--- /dev/null
+++ b/src/test/resources/testdata/items/pets/rabbit-selected.snbt
@@ -0,0 +1,60 @@
+{
+ components: {
+ "minecraft:custom_data": {
+ id: "PET",
+ petInfo: '{"type":"RABBIT","active":true,"exp":3.429132435816353E7,"tier":"MYTHIC","hideInfo":false,"heldItem":"YELLOW_BANDANA","candyUsed":0,"uuid":"30a05aae-2ccd-41c0-a686-5bce0df15e2d","uniqueId":"71a8949b-7444-4ead-9464-999fe549e703","hideRightClick":false,"noMove":false}',
+ uuid: "30a05aae-2ccd-41c0-a686-5bce0df15e2d"
+ },
+ "minecraft:custom_name": '{"extra":[{"color":"gray","text":"[Lvl 100] "},{"color":"light_purple","text":"Rabbit"}],"italic":false,"text":""}',
+ "minecraft:lore": [
+ '{"extra":[{"color":"dark_gray","text":"Farming Pet"}],"italic":false,"text":""}',
+ '{"italic":false,"text":""}',
+ '{"extra":[{"color":"gray","text":"Health: "},{"color":"green","text":"+100"}],"italic":false,"text":""}',
+ '{"extra":[{"color":"gray","text":"Speed: "},{"color":"green","text":"+20"}],"italic":false,"text":""}',
+ '{"extra":[{"color":"gray","text":"Farming Fortune: "},{"color":"green","text":"+30"}],"italic":false,"text":""}',
+ '{"italic":false,"text":""}',
+ '{"extra":[{"color":"gold","text":"Happy Feet"}],"italic":false,"text":""}',
+ '{"extra":[{"color":"gray","text":""},{"color":"gray","text":"Jump potions also give "},{"color":"green","text":"+50 "},{"color":"gray","text":"speed"}],"italic":false,"text":""}',
+ '{"italic":false,"text":""}',
+ '{"extra":[{"color":"gold","text":"Farming Wisdom Boost"}],"italic":false,"text":""}',
+ '{"extra":[{"color":"gray","text":""},{"color":"gray","text":""},{"color":"gray","text":"Grants "},{"color":"dark_aqua","text":"+30☯ Farming Wisdom"},{"color":"gray","text":"."}],"italic":false,"text":""}',
+ '{"italic":false,"text":""}',
+ '{"extra":[{"color":"gold","text":"Efficient Farming"}],"italic":false,"text":""}',
+ '{"extra":[{"color":"gray","text":""},{"color":"gray","text":"Farming minions work "},{"color":"green","text":"30% "},{"color":"gray","text":"faster"}],"italic":false,"text":""}',
+ '{"extra":[{"color":"gray","text":"while on your island"}],"italic":false,"text":""}',
+ '{"italic":false,"text":""}',
+ '{"extra":[{"color":"gold","text":"Chocolate Injections"}],"italic":false,"text":""}',
+ '{"extra":[{"color":"gray","text":""},{"color":"gray","text":"Increases "},{"color":"gold","text":"Chocolate Factory"}],"italic":false,"text":""}',
+ '{"extra":[{"color":"gold","text":""},{"color":"gray","text":"production by "},{"color":"green","text":"+0.05x"},{"color":"gray","text":". Duplicate"}],"italic":false,"text":""}',
+ '{"extra":[{"color":"gray","text":""},{"color":"green","text":"Chocolate Rabbits "},{"color":"gray","text":"that you find"}],"italic":false,"text":""}',
+ '{"extra":[{"color":"gray","text":"grant "},{"color":"gold","text":"+33% Chocolate"},{"color":"gray","text":"."}],"italic":false,"text":""}',
+ '{"italic":false,"text":""}',
+ '{"extra":[{"color":"gold","text":"Held Item: "},{"color":"blue","text":"Yellow Bandana"}],"italic":false,"text":""}',
+ '{"extra":[{"color":"gray","text":"Grants "},{"color":"gold","text":"+30☘ Farming Fortune"},{"color":"gray","text":"."}],"italic":false,"text":""}',
+ '{"italic":false,"text":""}',
+ '{"extra":[{"bold":true,"color":"aqua","text":"MAX LEVEL"}],"italic":false,"text":""}',
+ '{"extra":[{"color":"dark_gray","text":"▸ 34,291,324 XP"}],"italic":false,"text":""}',
+ '{"italic":false,"text":""}',
+ '{"extra":[{"color":"gray","text":""},{"color":"red","text":"Click to despawn!"}],"italic":false,"text":""}',
+ '{"extra":[{"color":"gray","text":""},{"color":"yellow","text":"Shift Left-click to toggle as favorite!"}],"italic":false,"text":""}',
+ '{"extra":[{"color":"yellow","text":"Right-click to convert to an item!"}],"italic":false,"text":""}'
+ ],
+ "minecraft:profile": {
+ id: [I;
+ -363097213,
+ -1822870885,
+ -1670199288,
+ -1615169037
+ ],
+ properties: [
+ {
+ name: "textures",
+ signature: "",
+ value: "ewogICJ0aW1lc3RhbXAiIDogMTYwNDU4NjI3ODg1NywKICAicHJvZmlsZUlkIiA6ICI0ZTMwZjUwZTdiYWU0M2YzYWZkMmE3NDUyY2ViZTI5YyIsCiAgInByb2ZpbGVOYW1lIiA6ICJfdG9tYXRvel8iLAogICJzaWduYXR1cmVSZXF1aXJlZCIgOiB0cnVlLAogICJ0ZXh0dXJlcyIgOiB7CiAgICAiU0tJTiIgOiB7CiAgICAgICJ1cmwiIDogImh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNjM0Mzg1NTVlODk5YmQ5YTA1MWE5NWRiZWE0OWViMmVjZmE1MmE2OWRiYmE4OTk4ZjM2NzM4MTllMjc3ZmRmNSIKICAgIH0KICB9Cn0="
+ }
+ ]
+ }
+ },
+ count: 1,
+ id: "minecraft:player_head"
+}