diff options
author | Linnea Gräf <nea@nea.moe> | 2024-11-27 17:26:42 +0100 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2024-11-27 17:26:42 +0100 |
commit | 8df225399f1932b8824d2fc44f4c964bc47fc6aa (patch) | |
tree | a2f1d7f64f68242aaaa5b97df2c15665eb7d12ce /src/test/kotlin/testutil/ItemResources.kt | |
parent | ccb5c556def69ea16a52c00b3fbfe3a224f51ac2 (diff) | |
download | Firmament-8df225399f1932b8824d2fc44f4c964bc47fc6aa.tar.gz Firmament-8df225399f1932b8824d2fc44f4c964bc47fc6aa.tar.bz2 Firmament-8df225399f1932b8824d2fc44f4c964bc47fc6aa.zip |
feat: Add pickobulus blocker on private island
Diffstat (limited to 'src/test/kotlin/testutil/ItemResources.kt')
-rw-r--r-- | src/test/kotlin/testutil/ItemResources.kt | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/test/kotlin/testutil/ItemResources.kt b/src/test/kotlin/testutil/ItemResources.kt index ee2a322..107b565 100644 --- a/src/test/kotlin/testutil/ItemResources.kt +++ b/src/test/kotlin/testutil/ItemResources.kt @@ -2,11 +2,14 @@ package moe.nea.firmament.test.testutil import net.minecraft.item.ItemStack import net.minecraft.nbt.NbtCompound +import net.minecraft.nbt.NbtElement import net.minecraft.nbt.NbtOps import net.minecraft.nbt.StringNbtReader +import net.minecraft.registry.RegistryOps import net.minecraft.text.Text import net.minecraft.text.TextCodecs import moe.nea.firmament.test.FirmTestBootstrap +import moe.nea.firmament.util.MC object ItemResources { init { @@ -23,15 +26,16 @@ object ItemResources { fun loadSNbt(path: String): NbtCompound { return StringNbtReader.parse(loadString(path)) } + fun getNbtOps(): RegistryOps<NbtElement> = MC.currentOrDefaultRegistries.getOps(NbtOps.INSTANCE) fun loadText(name: String): Text { - return TextCodecs.CODEC.parse(NbtOps.INSTANCE, loadSNbt("testdata/chat/$name.snbt")) + return TextCodecs.CODEC.parse(getNbtOps(), 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")) + return ItemStack.CODEC.parse(getNbtOps(), loadSNbt("testdata/items/$name.snbt")) .getOrThrow { IllegalStateException("Could not load test item '$name': $it") } } } |