feat: Add pickobulus blocker on private island

This commit is contained in:
Linnea Gräf
2024-11-27 17:26:42 +01:00
parent ccb5c556de
commit 8df225399f
23 changed files with 609 additions and 250 deletions

View File

@@ -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") }
}
}

View File

@@ -2,7 +2,6 @@ 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

View File

@@ -2,7 +2,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
import kotlin.time.Duration.Companion.seconds
import net.minecraft.text.Text

View File

@@ -1,53 +1,26 @@
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 io.kotest.core.spec.style.ShouldSpec
import io.kotest.matchers.shouldBe
import moe.nea.firmament.test.testutil.ItemResources
import moe.nea.firmament.util.skyblock.ItemType
class ItemTypeTest : AnnotationSpec() {
@Test
fun testPetItem() {
Assertions.assertEquals(
ItemType.PET,
ItemType.fromItemStack(ItemResources.loadItem("pets/lion-item"))
)
}
@Test
fun testPetInUI() {
Assertions.assertEquals(
ItemType.PET,
ItemType.fromItemStack(ItemResources.loadItem("pets/rabbit-selected"))
)
Assertions.assertEquals(
ItemType.PET,
ItemType.fromItemStack(ItemResources.loadItem("pets/mithril-golem-not-selected"))
)
}
@Test
fun testAOTV() {
Assertions.assertEquals(
ItemType.SWORD,
ItemType.fromItemStack(ItemResources.loadItem("aspect-of-the-void"))
)
}
@Test
fun testDrill() {
Assertions.assertEquals(
ItemType.DRILL,
ItemType.fromItemStack(ItemResources.loadItem("titanium-drill"))
)
}
@Test
fun testPickaxe() {
Assertions.assertEquals(
ItemType.PICKAXE,
ItemType.fromItemStack(ItemResources.loadItem("diamond-pickaxe"))
)
}
}
class ItemTypeTest
: ShouldSpec(
{
context("ItemType.fromItemstack") {
listOf(
"pets/lion-item" to ItemType.PET,
"pets/rabbit-selected" to ItemType.PET,
"pets/mithril-golem-not-selected" to ItemType.PET,
"aspect-of-the-void" to ItemType.SWORD,
"titanium-drill" to ItemType.DRILL,
"diamond-pickaxe" to ItemType.PICKAXE,
"gemstone-gauntlet" to ItemType.GAUNTLET,
).forEach { (name, typ) ->
should("return $typ for $name") {
ItemType.fromItemStack(ItemResources.loadItem(name)) shouldBe typ
}
}
}
})

View File

@@ -2,7 +2,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 moe.nea.firmament.test.testutil.ItemResources
import moe.nea.firmament.util.skyblock.SackUtil
import moe.nea.firmament.util.skyblock.SkyBlockItems