48 public static function create(array $shapes, array $nameMap,
int $customShapeCount) : self{
50 $result->shapes = $shapes;
51 $result->nameMap = $nameMap;
52 $result->customShapeCount = $customShapeCount;
72 for($i = 0, $shapesCount = VarInt::readUnsignedInt($in); $i < $shapesCount; ++$i){
73 $this->shapes[] = SerializableVoxelShape::read($in);
77 for($i = 0, $namesCount = VarInt::readUnsignedInt($in); $i < $namesCount; ++$i){
78 $name = CommonTypes::getString($in);
79 $id = LE::readUnsignedShort($in);
80 $this->nameMap[$name] = $id;
83 $this->customShapeCount = LE::readUnsignedShort($in);
87 VarInt::writeUnsignedInt($out, count($this->shapes));
88 foreach($this->shapes as $shape){
92 VarInt::writeUnsignedInt($out, count($this->nameMap));
93 foreach($this->nameMap as $name => $id){
94 CommonTypes::putString($out, $name);
95 LE::writeUnsignedShort($out, $id);
98 LE::writeUnsignedShort($out, $this->customShapeCount);