mirror of
https://github.com/GTNewHorizons/bdlib.git
synced 2026-11-13 00:37:59 +00:00
Added human readable errors to NBTTypes
This commit is contained in:
1 parent
61ba86d451
commit
28de3620a2
1 file changed
+4
@@ -11,9 +11,12 @@ package net.bdew.lib.nbt
|
||||
|
||||
import net.minecraft.nbt._
|
||||
|
||||
import scala.annotation.implicitNotFound
|
||||
|
||||
object NBTTypes {
|
||||
var map = Map.empty[Int, Type[_, _]]
|
||||
|
||||
@implicitNotFound("Type ${R} is not supported by NBT")
|
||||
abstract class Type[T <: NBTBase, R](val id: Int, val cls: Class[T], val valueClass: Class[R]) {
|
||||
map += id -> this
|
||||
def toVal(p: T): R
|
||||
@@ -25,6 +28,7 @@ object NBTTypes {
|
||||
override def toNBT(p: T): T = p
|
||||
}
|
||||
|
||||
@implicitNotFound("Type ${R} can't currently be retrieved from NBT lists")
|
||||
case class TypeInList[T <: NBTBase, R](definition: Type[T, R], fromList: (NBTTagList, Int) => R)
|
||||
|
||||
implicit object TByte extends Type(1, classOf[NBTTagByte], classOf[Byte]) {
|
||||
|
||||
Reference in new issue
Block a user