33 private int $nameIndex,
35 private float $temperature,
36 private float $downfall,
37 private float $foliageSnow,
40 private Color $mapWaterColor,
42 private ?array $tagIndexes,
46 public function getNameIndex() : int{ return $this->nameIndex; }
48 public function getId() : int{ return $this->id; }
50 public function getTemperature() : float{ return $this->temperature; }
52 public function getDownfall() : float{ return $this->downfall; }
54 public function getFoliageSnow() : float{ return $this->foliageSnow; }
56 public function getDepth() : float{ return $this->depth; }
58 public function getScale() : float{ return $this->scale; }
60 public function getMapWaterColor() : Color{ return $this->mapWaterColor; }
62 public function hasRain() : bool{ return $this->rain; }
72 public static function read(ByteBufferReader $in) : self{
73 $nameIndex = LE::readUnsignedShort($in);
74 $id = LE::readUnsignedShort($in);
75 $temperature = LE::readFloat($in);
76 $downfall = LE::readFloat($in);
77 $foliageSnow = LE::readFloat($in);
78 $depth = LE::readFloat($in);
79 $scale = LE::readFloat($in);
80 $mapWaterColor = Color::fromARGB(LE::readUnsignedInt($in));
81 $rain = CommonTypes::getBool($in);
82 $tags = CommonTypes::readOptional($in,
function() use ($in) : array{
85 for($i = 0, $count = VarInt::readUnsignedInt($in); $i < $count; ++$i){
86 $tagIndexes[] = LE::readUnsignedShort($in);
91 $chunkGenData = CommonTypes::readOptional($in, fn() => BiomeDefinitionChunkGenData::read($in));
108 public function write(ByteBufferWriter $out) : void{
109 LE::writeUnsignedShort($out, $this->nameIndex);
110 LE::writeUnsignedShort($out, $this->
id);
111 LE::writeFloat($out, $this->temperature);
112 LE::writeFloat($out, $this->downfall);
113 LE::writeFloat($out, $this->foliageSnow);
114 LE::writeFloat($out, $this->depth);
115 LE::writeFloat($out, $this->scale);
116 LE::writeUnsignedInt($out, $this->mapWaterColor->toARGB());
117 CommonTypes::putBool($out, $this->rain);
118 CommonTypes::writeOptional($out, $this->tagIndexes,
function(ByteBufferWriter $out, array $tagIndexes) :
void{
119 VarInt::writeUnsignedInt($out, count($tagIndexes));
120 foreach($tagIndexes as $tag){
121 LE::writeUnsignedShort($out, $tag);
124 CommonTypes::writeOptional($out, $this->chunkGenData, fn(ByteBufferWriter $out, BiomeDefinitionChunkGenData $v) => $v->write($out));
__construct(private int $nameIndex, private int $id, private float $temperature, private float $downfall, private float $foliageSnow, private float $depth, private float $scale, private Color $mapWaterColor, private bool $rain, private ?array $tagIndexes, private ?BiomeDefinitionChunkGenData $chunkGenData=null)