PocketMine-MP 5.28.1 git-88cdc2eb67c40075559c3ef51418b418cd5488e9
Loading...
Searching...
No Matches
BiomeConsolidatedFeatureData.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
20
21 public function __construct(
22 private BiomeScatterParamData $scatter,
23 private int $feature,
24 private int $identifier,
25 private int $pass,
26 private bool $useInternal
27 ){}
28
29 public function getScatter() : BiomeScatterParamData{ return $this->scatter; }
30
31 public function getFeature() : int{ return $this->feature; }
32
33 public function getIdentifier() : int{ return $this->identifier; }
34
35 public function getPass() : int{ return $this->pass; }
36
37 public function canUseInternal() : bool{ return $this->useInternal; }
38
39 public static function read(PacketSerializer $in) : self{
40 $scatter = BiomeScatterParamData::read($in);
41 $feature = $in->getLShort();
42 $identifier = $in->getLShort();
43 $pass = $in->getUnsignedVarInt();
44 $useInternal = $in->getBool();
45
46 return new self(
47 $scatter,
48 $feature,
49 $identifier,
50 $pass,
51 $useInternal
52 );
53 }
54
55 public function write(PacketSerializer $out) : void{
56 $this->scatter->write($out);
57 $out->putLShort($this->feature);
58 $out->putLShort($this->identifier);
59 $out->putUnsignedVarInt($this->pass);
60 $out->putBool($this->useInternal);
61 }
62}