PocketMine-MP 5.44.4 git-6a7cc02e9dff59b69241aa0bcffdb9903ce86beb
Loading...
Searching...
No Matches
BiomeNoiseBlockSpecifier.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;
21
23
24 public function __construct(
25 private string $noise,
26 private float $threshold,
27 private float $min,
28 private float $max,
29 private int $block,
30 ){}
31
32 public function getNoise() : string{ return $this->noise; }
33
34 public function getThreshold() : float{ return $this->threshold; }
35
36 public function getMin() : float{ return $this->min; }
37
38 public function getMax() : float{ return $this->max; }
39
40 public function getBlock() : int{ return $this->block; }
41
42 public static function read(ByteBufferReader $in) : self{
43 $noise = CommonTypes::getString($in);
44 $threshold = LE::readFloat($in);
45 $min = LE::readFloat($in);
46 $max = LE::readFloat($in);
47 $block = LE::readUnsignedInt($in);
48
49 return new self(
50 $noise,
51 $threshold,
52 $min,
53 $max,
54 $block
55 );
56 }
57
58 public function write(ByteBufferWriter $out) : void{
59 CommonTypes::putString($out, $this->noise);
60 LE::writeFloat($out, $this->threshold);
61 LE::writeFloat($out, $this->min);
62 LE::writeFloat($out, $this->max);
63 LE::writeUnsignedInt($out, $this->block);
64 }
65}