Update formatting
This commit is contained in:
@@ -61,4 +61,4 @@ class NBTData {
|
||||
companion object {
|
||||
fun deserialize(nbtString: String) = NBTData(nbtString)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -24,4 +24,4 @@ val ItemStack.nbtData: NBTData
|
||||
CraftItemStack.asNMSCopy(this).let {
|
||||
return if (it.hasTag()) NBTData(it.tag) else NBTData()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -9,27 +9,50 @@ interface NBTDataType<T> {
|
||||
fun writeToCompound(key: String, data: T, compound: NBTTagCompound)
|
||||
|
||||
companion object {
|
||||
val COMPOUND = nbtDataType<NBTData, NBTTagCompound>({ NBTData(it) },
|
||||
{ key, data, compound -> compound.set(key, data.nbtTagCompound) })
|
||||
val BYTE =
|
||||
nbtDataType<Byte, NBTTagByte>({ it.asByte() }, { key, data, compound -> compound.setByte(key, data) })
|
||||
val BYTE_ARRAY = nbtDataType<ByteArray, NBTTagByteArray>({ it.bytes },
|
||||
{ key, data, compound -> compound.setByteArray(key, data) })
|
||||
val DOUBLE = nbtDataType<Double, NBTTagDouble>({ it.asDouble() },
|
||||
{ key, data, compound -> compound.setDouble(key, data) })
|
||||
val FLOAT =
|
||||
nbtDataType<Float, NBTTagFloat>({ it.asFloat() }, { key, data, compound -> compound.setFloat(key, data) })
|
||||
val INT = nbtDataType<Int, NBTTagInt>({ it.asInt() }, { key, data, compound -> compound.setInt(key, data) })
|
||||
val INT_ARRAY = nbtDataType<IntArray, NBTTagIntArray>({ it.ints },
|
||||
{ key, data, compound -> compound.setIntArray(key, data) })
|
||||
val LONG =
|
||||
nbtDataType<Long, NBTTagLong>({ it.asLong() }, { key, data, compound -> compound.setLong(key, data) })
|
||||
val LONG_ARRAY = nbtDataType<LongArray, NBTTagLongArray>({ it.longs },
|
||||
{ key, data, compound -> compound.set(key, NBTTagLongArray(data)) })
|
||||
val SHORT =
|
||||
nbtDataType<Short, NBTTagShort>({ it.asShort() }, { key, data, compound -> compound.setShort(key, data) })
|
||||
val STRING = nbtDataType<String, NBTTagString>({ it.asString() },
|
||||
{ key, data, compound -> compound.setString(key, data) })
|
||||
val COMPOUND = nbtDataType<NBTData, NBTTagCompound>(
|
||||
{ NBTData(it) },
|
||||
{ key, data, compound -> compound.set(key, data.nbtTagCompound) }
|
||||
)
|
||||
val BYTE = nbtDataType<Byte, NBTTagByte>(
|
||||
{ it.asByte() },
|
||||
{ key, data, compound -> compound.setByte(key, data) }
|
||||
)
|
||||
val BYTE_ARRAY = nbtDataType<ByteArray, NBTTagByteArray>(
|
||||
{ it.bytes },
|
||||
{ key, data, compound -> compound.setByteArray(key, data) }
|
||||
)
|
||||
val DOUBLE = nbtDataType<Double, NBTTagDouble>(
|
||||
{ it.asDouble() },
|
||||
{ key, data, compound -> compound.setDouble(key, data) }
|
||||
)
|
||||
val FLOAT = nbtDataType<Float, NBTTagFloat>(
|
||||
{ it.asFloat() },
|
||||
{ key, data, compound -> compound.setFloat(key, data) }
|
||||
)
|
||||
val INT = nbtDataType<Int, NBTTagInt>(
|
||||
{ it.asInt() },
|
||||
{ key, data, compound -> compound.setInt(key, data) }
|
||||
)
|
||||
val INT_ARRAY = nbtDataType<IntArray, NBTTagIntArray>(
|
||||
{ it.ints },
|
||||
{ key, data, compound -> compound.setIntArray(key, data) }
|
||||
)
|
||||
val LONG = nbtDataType<Long, NBTTagLong>(
|
||||
{ it.asLong() },
|
||||
{ key, data, compound -> compound.setLong(key, data) }
|
||||
)
|
||||
val LONG_ARRAY = nbtDataType<LongArray, NBTTagLongArray>(
|
||||
{ it.longs },
|
||||
{ key, data, compound -> compound.set(key, NBTTagLongArray(data)) }
|
||||
)
|
||||
val SHORT = nbtDataType<Short, NBTTagShort>(
|
||||
{ it.asShort() },
|
||||
{ key, data, compound -> compound.setShort(key, data) }
|
||||
)
|
||||
val STRING = nbtDataType<String, NBTTagString>(
|
||||
{ it.asString() },
|
||||
{ key, data, compound -> compound.setString(key, data) }
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,4 +69,4 @@ private inline fun <T, reified E> nbtDataType(
|
||||
override fun writeToCompound(key: String, data: T, compound: NBTTagCompound) =
|
||||
writeToCompound.invoke(key, data, compound)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user