PocketMine-MP 5.35.1 git-e32e836dad793a3a3c8ddd8927c00e112b1e576a
Loading...
Searching...
No Matches
BiomeSurfaceMaterialData.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 int $topBlock,
25 private int $midBlock,
26 private int $seaFloorBlock,
27 private int $foundationBlock,
28 private int $seaBlock,
29 private int $seaFloorDepth
30 ){}
31
32 public function getTopBlock() : int{ return $this->topBlock; }
33
34 public function getMidBlock() : int{ return $this->midBlock; }
35
36 public function getSeaFloorBlock() : int{ return $this->seaFloorBlock; }
37
38 public function getFoundationBlock() : int{ return $this->foundationBlock; }
39
40 public function getSeaBlock() : int{ return $this->seaBlock; }
41
42 public function getSeaFloorDepth() : int{ return $this->seaFloorDepth; }
43
44 public static function read(ByteBufferReader $in) : self{
45 $topBlock = LE::readUnsignedInt($in);
46 $midBlock = LE::readUnsignedInt($in);
47 $seaFloorBlock = LE::readUnsignedInt($in);
48 $foundationBlock = LE::readUnsignedInt($in);
49 $seaBlock = LE::readUnsignedInt($in);
50 $seaFloorDepth = LE::readSignedInt($in);
51
52 return new self(
53 $topBlock,
54 $midBlock,
55 $seaFloorBlock,
56 $foundationBlock,
57 $seaBlock,
58 $seaFloorDepth
59 );
60 }
61
62 public function write(ByteBufferWriter $out) : void{
63 LE::writeUnsignedInt($out, $this->topBlock);
64 LE::writeUnsignedInt($out, $this->midBlock);
65 LE::writeUnsignedInt($out, $this->seaFloorBlock);
66 LE::writeUnsignedInt($out, $this->foundationBlock);
67 LE::writeUnsignedInt($out, $this->seaBlock);
68 LE::writeSignedInt($out, $this->seaFloorDepth);
69 }
70}