aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/util/mc/NbtUtil.kt
blob: 5c47c2886eaef3394692ed062f06d666ff19f894 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
package moe.nea.firmament.util.mc

import net.minecraft.component.type.NbtComponent
import net.minecraft.nbt.NbtElement
import net.minecraft.nbt.NbtList
import moe.nea.firmament.mixins.accessor.AccessorNbtComponent

fun Iterable<NbtElement>.toNbtList() = NbtList().also {
	for (element in this) {
		it.add(element)
	}
}

@Suppress("CAST_NEVER_SUCCEEDS")
val NbtComponent.unsafeNbt get() = (this as AccessorNbtComponent).unsafeNbt_firmament