- 1,218
- 27
- 174
Код:
package net.anti344.cbs
import java.io.{DataOutputStream, ByteArrayOutputStream}
import net.anti344.scalanbt._
class Schematic
extends NBTWriter{
var width, height, lenght : Int = 0
private val blocks, metas : Seq[Byte] = Seq()
private val tiles: Seq[NBTTagCompound] = Seq()
def compile(): Array[Byte] = {
val nbt = comp(
"Width" -> width,
"Height" -> height,
"Lenght" -> lenght,
"Blocks" -> blocks.toArray,
"Data" -> metas.toArray,
"TileEntities" -> list(tiles:_*)
)
val out = new ByteArrayOutputStream()
NBT.write(new DataOutputStream(out), nbt, "Schematic")
out.toByteArray
}
}