PocketMine-MP 5.23.3 git-f7687af337d001ddbcc47b8e773f014a33faa662
Loading...
Searching...
No Matches
SpawnSettings.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;
16
18
19final class SpawnSettings{
20 public const BIOME_TYPE_DEFAULT = 0;
21 public const BIOME_TYPE_USER_DEFINED = 1;
22
23 public function __construct(
24 private int $biomeType,
25 private string $biomeName,
26 private int $dimension
27 ){}
28
29 public function getBiomeType() : int{
30 return $this->biomeType;
31 }
32
33 public function getBiomeName() : string{
34 return $this->biomeName;
35 }
36
40 public function getDimension() : int{
41 return $this->dimension;
42 }
43
44 public static function read(PacketSerializer $in) : self{
45 $biomeType = $in->getLShort();
46 $biomeName = $in->getString();
47 $dimension = $in->getVarInt();
48
49 return new self($biomeType, $biomeName, $dimension);
50 }
51
52 public function write(PacketSerializer $out) : void{
53 $out->putLShort($this->biomeType);
54 $out->putString($this->biomeName);
55 $out->putVarInt($this->dimension);
56 }
57}