PocketMine-MP 5.28.1 git-88cdc2eb67c40075559c3ef51418b418cd5488e9
Loading...
Searching...
No Matches
BiomeScatterParamData.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
18use function count;
19
21
25 public function __construct(
26 private array $coordinates,
27 private int $evalOrder,
28 private int $chancePercentType,
29 private int $chancePercent,
30 private int $chanceNumerator,
31 private int $chanceDenominator,
32 private int $iterationsType,
33 private int $iterations,
34 ){}
35
39 public function getCoordinates() : array{ return $this->coordinates; }
40
41 public function getEvalOrder() : int{ return $this->evalOrder; }
42
43 public function getChancePercentType() : int{ return $this->chancePercentType; }
44
45 public function getChancePercent() : int{ return $this->chancePercent; }
46
47 public function getChanceNumerator() : int{ return $this->chanceNumerator; }
48
49 public function getChanceDenominator() : int{ return $this->chanceDenominator; }
50
51 public function getIterationsType() : int{ return $this->iterationsType; }
52
53 public function getIterations() : int{ return $this->iterations; }
54
55 public static function read(PacketSerializer $in) : self{
56 $coordinates = [];
57 for($i = 0, $count = $in->getUnsignedVarInt(); $i < $count; ++$i){
58 $coordinates[] = BiomeCoordinateData::read($in);
59 }
60 $evalOrder = $in->getVarInt();
61 $chancePercentType = $in->getVarInt();
62 $chancePercent = $in->getLShort();
63 $chanceNumerator = $in->getLInt();
64 $chanceDenominator = $in->getLInt();
65 $iterationsType = $in->getVarInt();
66 $iterations = $in->getLShort();
67
68 return new self(
69 $coordinates,
70 $evalOrder,
71 $chancePercentType,
72 $chancePercent,
73 $chanceNumerator,
74 $chanceDenominator,
75 $iterationsType,
76 $iterations
77 );
78 }
79
80 public function write(PacketSerializer $out) : void{
81 $out->putUnsignedVarInt(count($this->coordinates));
82 foreach($this->coordinates as $coordinate){
83 $coordinate->write($out);
84 }
85 $out->putVarInt($this->evalOrder);
86 $out->putVarInt($this->chancePercentType);
87 $out->putLShort($this->chancePercent);
88 $out->putLInt($this->chanceNumerator);
89 $out->putLInt($this->chanceDenominator);
90 $out->putVarInt($this->iterationsType);
91 $out->putLShort($this->iterations);
92 }
93}
__construct(private array $coordinates, private int $evalOrder, private int $chancePercentType, private int $chancePercent, private int $chanceNumerator, private int $chanceDenominator, private int $iterationsType, private int $iterations,)