31 public int $generator = GeneratorType::OVERWORLD;
32 public int $worldGamemode;
33 public bool $hardcore =
false;
34 public int $difficulty;
36 public bool $hasAchievementsDisabled =
true;
37 public int $editorWorldType = EditorWorldType::NON_EDITOR;
38 public bool $createdInEditorMode =
false;
39 public bool $exportedFromEditorMode =
false;
40 public int $time = -1;
41 public int $eduEditionOffer = EducationEditionOffer::NONE;
42 public bool $hasEduFeaturesEnabled =
false;
43 public string $eduProductUUID =
"";
44 public float $rainLevel;
45 public float $lightningLevel;
46 public bool $hasConfirmedPlatformLockedContent =
false;
47 public bool $isMultiplayerGame =
true;
48 public bool $hasLANBroadcast =
true;
49 public int $xboxLiveBroadcastMode = MultiplayerGameVisibility::PUBLIC;
50 public int $platformBroadcastMode = MultiplayerGameVisibility::PUBLIC;
51 public bool $commandsEnabled;
52 public bool $isTexturePacksRequired =
true;
57 public array $gameRules = [];
59 public bool $hasBonusChestEnabled =
false;
60 public bool $hasStartWithMapEnabled =
false;
61 public int $defaultPlayerPermission = PlayerPermissions::MEMBER;
63 public int $serverChunkTickRadius = 4;
65 public bool $hasLockedBehaviorPack =
false;
66 public bool $hasLockedResourcePack =
false;
67 public bool $isFromLockedWorldTemplate =
false;
68 public bool $useMsaGamertagsOnly =
false;
69 public bool $isFromWorldTemplate =
false;
70 public bool $isWorldTemplateOptionLocked =
false;
71 public bool $onlySpawnV1Villagers =
false;
72 public bool $disablePersona =
false;
73 public bool $disableCustomSkins =
false;
74 public bool $muteEmoteAnnouncements =
false;
76 public int $limitedWorldWidth = 0;
77 public int $limitedWorldLength = 0;
78 public bool $isNewNether =
true;
80 public ?
bool $experimentalGameplayOverride =
null;
81 public int $chatRestrictionLevel = ChatRestrictionLevel::NONE;
82 public bool $disablePlayerInteractions =
false;
84 public string $serverIdentifier =
"";
85 public string $worldIdentifier =
"";
86 public string $scenarioIdentifier =
"";
87 public string $ownerIdentifier =
"";
93 public static function read(ByteBufferReader $in) : self{
97 $result->internalRead($in);
105 private function internalRead(ByteBufferReader $in) : void{
106 $this->seed = LE::readUnsignedLong($in);
107 $this->spawnSettings = SpawnSettings::read($in);
108 $this->generator = VarInt::readSignedInt($in);
109 $this->worldGamemode = VarInt::readSignedInt($in);
110 $this->hardcore = CommonTypes::getBool($in);
111 $this->difficulty = VarInt::readSignedInt($in);
112 $this->spawnPosition = CommonTypes::getBlockPosition($in);
113 $this->hasAchievementsDisabled = CommonTypes::getBool($in);
114 $this->editorWorldType = VarInt::readSignedInt($in);
115 $this->createdInEditorMode = CommonTypes::getBool($in);
116 $this->exportedFromEditorMode = CommonTypes::getBool($in);
117 $this->time = VarInt::readSignedInt($in);
118 $this->eduEditionOffer = VarInt::readSignedInt($in);
119 $this->hasEduFeaturesEnabled = CommonTypes::getBool($in);
120 $this->eduProductUUID = CommonTypes::getString($in);
121 $this->rainLevel = LE::readFloat($in);
122 $this->lightningLevel = LE::readFloat($in);
123 $this->hasConfirmedPlatformLockedContent = CommonTypes::getBool($in);
124 $this->isMultiplayerGame = CommonTypes::getBool($in);
125 $this->hasLANBroadcast = CommonTypes::getBool($in);
126 $this->xboxLiveBroadcastMode = VarInt::readSignedInt($in);
127 $this->platformBroadcastMode = VarInt::readSignedInt($in);
128 $this->commandsEnabled = CommonTypes::getBool($in);
129 $this->isTexturePacksRequired = CommonTypes::getBool($in);
130 $this->gameRules = CommonTypes::getGameRules($in,
true);
131 $this->experiments = Experiments::read($in);
132 $this->hasBonusChestEnabled = CommonTypes::getBool($in);
133 $this->hasStartWithMapEnabled = CommonTypes::getBool($in);
134 $this->defaultPlayerPermission = VarInt::readSignedInt($in);
135 $this->serverChunkTickRadius = LE::readSignedInt($in);
136 $this->hasLockedBehaviorPack = CommonTypes::getBool($in);
137 $this->hasLockedResourcePack = CommonTypes::getBool($in);
138 $this->isFromLockedWorldTemplate = CommonTypes::getBool($in);
139 $this->useMsaGamertagsOnly = CommonTypes::getBool($in);
140 $this->isFromWorldTemplate = CommonTypes::getBool($in);
141 $this->isWorldTemplateOptionLocked = CommonTypes::getBool($in);
142 $this->onlySpawnV1Villagers = CommonTypes::getBool($in);
143 $this->disablePersona = CommonTypes::getBool($in);
144 $this->disableCustomSkins = CommonTypes::getBool($in);
145 $this->muteEmoteAnnouncements = CommonTypes::getBool($in);
146 $this->vanillaVersion = CommonTypes::getString($in);
147 $this->limitedWorldWidth = LE::readSignedInt($in);
148 $this->limitedWorldLength = LE::readSignedInt($in);
149 $this->isNewNether = CommonTypes::getBool($in);
150 $this->eduSharedUriResource = EducationUriResource::read($in);
151 $this->experimentalGameplayOverride = CommonTypes::readOptional($in, CommonTypes::getBool(...));
152 $this->chatRestrictionLevel = Byte::readUnsigned($in);
153 $this->disablePlayerInteractions = CommonTypes::getBool($in);
154 $this->serverIdentifier = CommonTypes::getString($in);
155 $this->worldIdentifier = CommonTypes::getString($in);
156 $this->scenarioIdentifier = CommonTypes::getString($in);
157 $this->ownerIdentifier = CommonTypes::getString($in);
160 public function write(ByteBufferWriter $out) : void{
161 LE::writeUnsignedLong($out, $this->seed);
162 $this->spawnSettings->write($out);
163 VarInt::writeSignedInt($out, $this->generator);
164 VarInt::writeSignedInt($out, $this->worldGamemode);
165 CommonTypes::putBool($out, $this->hardcore);
166 VarInt::writeSignedInt($out, $this->difficulty);
167 CommonTypes::putBlockPosition($out, $this->spawnPosition);
168 CommonTypes::putBool($out, $this->hasAchievementsDisabled);
169 VarInt::writeSignedInt($out, $this->editorWorldType);
170 CommonTypes::putBool($out, $this->createdInEditorMode);
171 CommonTypes::putBool($out, $this->exportedFromEditorMode);
172 VarInt::writeSignedInt($out, $this->time);
173 VarInt::writeSignedInt($out, $this->eduEditionOffer);
174 CommonTypes::putBool($out, $this->hasEduFeaturesEnabled);
175 CommonTypes::putString($out, $this->eduProductUUID);
176 LE::writeFloat($out, $this->rainLevel);
177 LE::writeFloat($out, $this->lightningLevel);
178 CommonTypes::putBool($out, $this->hasConfirmedPlatformLockedContent);
179 CommonTypes::putBool($out, $this->isMultiplayerGame);
180 CommonTypes::putBool($out, $this->hasLANBroadcast);
181 VarInt::writeSignedInt($out, $this->xboxLiveBroadcastMode);
182 VarInt::writeSignedInt($out, $this->platformBroadcastMode);
183 CommonTypes::putBool($out, $this->commandsEnabled);
184 CommonTypes::putBool($out, $this->isTexturePacksRequired);
185 CommonTypes::putGameRules($out, $this->gameRules,
true);
186 $this->experiments->write($out);
187 CommonTypes::putBool($out, $this->hasBonusChestEnabled);
188 CommonTypes::putBool($out, $this->hasStartWithMapEnabled);
189 VarInt::writeSignedInt($out, $this->defaultPlayerPermission);
190 LE::writeSignedInt($out, $this->serverChunkTickRadius);
191 CommonTypes::putBool($out, $this->hasLockedBehaviorPack);
192 CommonTypes::putBool($out, $this->hasLockedResourcePack);
193 CommonTypes::putBool($out, $this->isFromLockedWorldTemplate);
194 CommonTypes::putBool($out, $this->useMsaGamertagsOnly);
195 CommonTypes::putBool($out, $this->isFromWorldTemplate);
196 CommonTypes::putBool($out, $this->isWorldTemplateOptionLocked);
197 CommonTypes::putBool($out, $this->onlySpawnV1Villagers);
198 CommonTypes::putBool($out, $this->disablePersona);
199 CommonTypes::putBool($out, $this->disableCustomSkins);
200 CommonTypes::putBool($out, $this->muteEmoteAnnouncements);
201 CommonTypes::putString($out, $this->vanillaVersion);
202 LE::writeSignedInt($out, $this->limitedWorldWidth);
203 LE::writeSignedInt($out, $this->limitedWorldLength);
204 CommonTypes::putBool($out, $this->isNewNether);
206 CommonTypes::writeOptional($out, $this->experimentalGameplayOverride, CommonTypes::putBool(...));
207 Byte::writeUnsigned($out, $this->chatRestrictionLevel);
208 CommonTypes::putBool($out, $this->disablePlayerInteractions);
209 CommonTypes::putString($out, $this->serverIdentifier);
210 CommonTypes::putString($out, $this->worldIdentifier);
211 CommonTypes::putString($out, $this->scenarioIdentifier);
212 CommonTypes::putString($out, $this->ownerIdentifier);