PocketMine-MP 5.35.1 git-e32e836dad793a3a3c8ddd8927c00e112b1e576a
Loading...
Searching...
No Matches
BiomeMountainParamsData.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 int $steepBlock,
26 private bool $northSlopes,
27 private bool $southSlopes,
28 private bool $westSlopes,
29 private bool $eastSlopes,
30 private bool $topSlideEnabled,
31 ){}
32
33 public function getSteepBlock() : int{ return $this->steepBlock; }
34
35 public function hasNorthSlopes() : bool{ return $this->northSlopes; }
36
37 public function hasSouthSlopes() : bool{ return $this->southSlopes; }
38
39 public function hasWestSlopes() : bool{ return $this->westSlopes; }
40
41 public function hasEastSlopes() : bool{ return $this->eastSlopes; }
42
43 public function hasTopSlideEnabled() : bool{ return $this->topSlideEnabled; }
44
45 public static function read(ByteBufferReader $in) : self{
46 $steepBlock = LE::readUnsignedInt($in);
47 $northSlopes = CommonTypes::getBool($in);
48 $southSlopes = CommonTypes::getBool($in);
49 $westSlopes = CommonTypes::getBool($in);
50 $eastSlopes = CommonTypes::getBool($in);
51 $topSlideEnabled = CommonTypes::getBool($in);
52
53 return new self(
54 $steepBlock,
55 $northSlopes,
56 $southSlopes,
57 $westSlopes,
58 $eastSlopes,
59 $topSlideEnabled
60 );
61 }
62
63 public function write(ByteBufferWriter $out) : void{
64 LE::writeUnsignedInt($out, $this->steepBlock);
65 CommonTypes::putBool($out, $this->northSlopes);
66 CommonTypes::putBool($out, $this->southSlopes);
67 CommonTypes::putBool($out, $this->westSlopes);
68 CommonTypes::putBool($out, $this->eastSlopes);
69 CommonTypes::putBool($out, $this->topSlideEnabled);
70 }
71}