PocketMine-MP 5.35.1 git-e32e836dad793a3a3c8ddd8927c00e112b1e576a
Loading...
Searching...
No Matches
BiomeMultinoiseGenRulesData.php
1<?php
2
3/*
4 * This file is part of BedrockProtocol.
5 * Copyright (C) 2014-2022 PocketMine Team <https://github.com/pmmp/BedrockProtocol>
6 *
7 * BedrockProtocol is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Lesser General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 */
12
13declare(strict_types=1);
14
15namespace pocketmine\network\mcpe\protocol\types\biome\chunkgen;
16
17use pmmp\encoding\ByteBufferReader;
18use pmmp\encoding\ByteBufferWriter;
19use pmmp\encoding\LE;
20
22
23 public function __construct(
24 private float $temperature,
25 private float $humidity,
26 private float $altitude,
27 private float $weirdness,
28 private float $weight,
29 ){}
30
31 public function getTemperature() : float{ return $this->temperature; }
32
33 public function getHumidity() : float{ return $this->humidity; }
34
35 public function getAltitude() : float{ return $this->altitude; }
36
37 public function getWeirdness() : float{ return $this->weirdness; }
38
39 public function getWeight() : float{ return $this->weight; }
40
41 public static function read(ByteBufferReader $in) : self{
42 $temperature = LE::readFloat($in);
43 $humidity = LE::readFloat($in);
44 $altitude = LE::readFloat($in);
45 $weirdness = LE::readFloat($in);
46 $weight = LE::readFloat($in);
47
48 return new self(
49 $temperature,
50 $humidity,
51 $altitude,
52 $weirdness,
53 $weight
54 );
55 }
56
57 public function write(ByteBufferWriter $out) : void{
58 LE::writeFloat($out, $this->temperature);
59 LE::writeFloat($out, $this->humidity);
60 LE::writeFloat($out, $this->altitude);
61 LE::writeFloat($out, $this->weirdness);
62 LE::writeFloat($out, $this->weight);
63 }
64}