PocketMine-MP 5.28.1 git-88cdc2eb67c40075559c3ef51418b418cd5488e9
Loading...
Searching...
No Matches
BiomeClimateData.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
18
19final class BiomeClimateData{
20
21 public function __construct(
22 private float $temperature,
23 private float $downfall,
24 private float $redSporeDensity,
25 private float $blueSporeDensity,
26 private float $ashDensity,
27 private float $whiteAshDensity,
28 private float $snowAccumulationMin,
29 private float $snowAccumulationMax,
30 ){}
31
32 public function getTemperature() : float{ return $this->temperature; }
33
34 public function getDownfall() : float{ return $this->downfall; }
35
36 public function getRedSporeDensity() : float{ return $this->redSporeDensity; }
37
38 public function getBlueSporeDensity() : float{ return $this->blueSporeDensity; }
39
40 public function getAshDensity() : float{ return $this->ashDensity; }
41
42 public function getWhiteAshDensity() : float{ return $this->whiteAshDensity; }
43
44 public function getSnowAccumulationMin() : float{ return $this->snowAccumulationMin; }
45
46 public function getSnowAccumulationMax() : float{ return $this->snowAccumulationMax; }
47
48 public static function read(PacketSerializer $in) : self{
49 $temperature = $in->getLFloat();
50 $downfall = $in->getLFloat();
51 $redSporeDensity = $in->getLFloat();
52 $blueSporeDensity = $in->getLFloat();
53 $ashDensity = $in->getLFloat();
54 $whiteAshDensity = $in->getLFloat();
55 $snowAccumulationMin = $in->getLFloat();
56 $snowAccumulationMax = $in->getLFloat();
57
58 return new self(
59 $temperature,
60 $downfall,
61 $redSporeDensity,
62 $blueSporeDensity,
63 $ashDensity,
64 $whiteAshDensity,
65 $snowAccumulationMin,
66 $snowAccumulationMax
67 );
68 }
69
70 public function write(PacketSerializer $out) : void{
71 $out->putLFloat($this->temperature);
72 $out->putLFloat($this->downfall);
73 $out->putLFloat($this->redSporeDensity);
74 $out->putLFloat($this->blueSporeDensity);
75 $out->putLFloat($this->ashDensity);
76 $out->putLFloat($this->whiteAshDensity);
77 $out->putLFloat($this->snowAccumulationMin);
78 $out->putFloat($this->snowAccumulationMax);
79 }
80}