diff options
author | Linnea Gräf <nea@nea.moe> | 2024-10-24 14:49:21 +0200 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2024-10-24 14:49:21 +0200 |
commit | 0357245e88be4b8cd3d0681340d9a7065361ea74 (patch) | |
tree | cb52c479bc029295075ceeaa04251fae63ec5e50 /src/test/kotlin/testutil | |
parent | 6100b8c9a0fe42be52a759b429f532c12cc72a32 (diff) | |
download | Firmament-0357245e88be4b8cd3d0681340d9a7065361ea74.tar.gz Firmament-0357245e88be4b8cd3d0681340d9a7065361ea74.tar.bz2 Firmament-0357245e88be4b8cd3d0681340d9a7065361ea74.zip |
Add getLegacyFormatString method
[no changelog]
Diffstat (limited to 'src/test/kotlin/testutil')
-rw-r--r-- | src/test/kotlin/testutil/ItemResources.kt | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/test/kotlin/testutil/ItemResources.kt b/src/test/kotlin/testutil/ItemResources.kt index bd3c438..ee2a322 100644 --- a/src/test/kotlin/testutil/ItemResources.kt +++ b/src/test/kotlin/testutil/ItemResources.kt @@ -4,6 +4,8 @@ import net.minecraft.item.ItemStack import net.minecraft.nbt.NbtCompound import net.minecraft.nbt.NbtOps import net.minecraft.nbt.StringNbtReader +import net.minecraft.text.Text +import net.minecraft.text.TextCodecs import moe.nea.firmament.test.FirmTestBootstrap object ItemResources { @@ -22,6 +24,11 @@ object ItemResources { return StringNbtReader.parse(loadString(path)) } + fun loadText(name: String): Text { + return TextCodecs.CODEC.parse(NbtOps.INSTANCE, loadSNbt("testdata/chat/$name.snbt")) + .getOrThrow { IllegalStateException("Could not load test chat '$name': $it") } + } + fun loadItem(name: String): ItemStack { // TODO: make the load work with enchantments return ItemStack.CODEC.parse(NbtOps.INSTANCE, loadSNbt("testdata/items/$name.snbt")) |