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;
88 public static function read(ByteBufferReader $in) : self{
92 $result->internalRead($in);
100 private function internalRead(ByteBufferReader $in) : void{
101 $this->seed = LE::readUnsignedLong($in);
102 $this->spawnSettings = SpawnSettings::read($in);
103 $this->generator = VarInt::readSignedInt($in);
104 $this->worldGamemode = VarInt::readSignedInt($in);
105 $this->hardcore = CommonTypes::getBool($in);
106 $this->difficulty = VarInt::readSignedInt($in);
107 $this->spawnPosition = CommonTypes::getBlockPosition($in);
108 $this->hasAchievementsDisabled = CommonTypes::getBool($in);
109 $this->editorWorldType = VarInt::readSignedInt($in);
110 $this->createdInEditorMode = CommonTypes::getBool($in);
111 $this->exportedFromEditorMode = CommonTypes::getBool($in);
112 $this->time = VarInt::readSignedInt($in);
113 $this->eduEditionOffer = VarInt::readSignedInt($in);
114 $this->hasEduFeaturesEnabled = CommonTypes::getBool($in);
115 $this->eduProductUUID = CommonTypes::getString($in);
116 $this->rainLevel = LE::readFloat($in);
117 $this->lightningLevel = LE::readFloat($in);
118 $this->hasConfirmedPlatformLockedContent = CommonTypes::getBool($in);
119 $this->isMultiplayerGame = CommonTypes::getBool($in);
120 $this->hasLANBroadcast = CommonTypes::getBool($in);
121 $this->xboxLiveBroadcastMode = VarInt::readSignedInt($in);
122 $this->platformBroadcastMode = VarInt::readSignedInt($in);
123 $this->commandsEnabled = CommonTypes::getBool($in);
124 $this->isTexturePacksRequired = CommonTypes::getBool($in);
125 $this->gameRules = CommonTypes::getGameRules($in,
true);
126 $this->experiments = Experiments::read($in);
127 $this->hasBonusChestEnabled = CommonTypes::getBool($in);
128 $this->hasStartWithMapEnabled = CommonTypes::getBool($in);
129 $this->defaultPlayerPermission = VarInt::readSignedInt($in);
130 $this->serverChunkTickRadius = LE::readSignedInt($in);
131 $this->hasLockedBehaviorPack = CommonTypes::getBool($in);
132 $this->hasLockedResourcePack = CommonTypes::getBool($in);
133 $this->isFromLockedWorldTemplate = CommonTypes::getBool($in);
134 $this->useMsaGamertagsOnly = CommonTypes::getBool($in);
135 $this->isFromWorldTemplate = CommonTypes::getBool($in);
136 $this->isWorldTemplateOptionLocked = CommonTypes::getBool($in);
137 $this->onlySpawnV1Villagers = CommonTypes::getBool($in);
138 $this->disablePersona = CommonTypes::getBool($in);
139 $this->disableCustomSkins = CommonTypes::getBool($in);
140 $this->muteEmoteAnnouncements = CommonTypes::getBool($in);
141 $this->vanillaVersion = CommonTypes::getString($in);
142 $this->limitedWorldWidth = LE::readSignedInt($in);
143 $this->limitedWorldLength = LE::readSignedInt($in);
144 $this->isNewNether = CommonTypes::getBool($in);
145 $this->eduSharedUriResource = EducationUriResource::read($in);
146 $this->experimentalGameplayOverride = CommonTypes::readOptional($in, CommonTypes::getBool(...));
147 $this->chatRestrictionLevel = Byte::readUnsigned($in);
148 $this->disablePlayerInteractions = CommonTypes::getBool($in);
151 public function write(ByteBufferWriter $out) : void{
152 LE::writeUnsignedLong($out, $this->seed);
153 $this->spawnSettings->write($out);
154 VarInt::writeSignedInt($out, $this->generator);
155 VarInt::writeSignedInt($out, $this->worldGamemode);
156 CommonTypes::putBool($out, $this->hardcore);
157 VarInt::writeSignedInt($out, $this->difficulty);
158 CommonTypes::putBlockPosition($out, $this->spawnPosition);
159 CommonTypes::putBool($out, $this->hasAchievementsDisabled);
160 VarInt::writeSignedInt($out, $this->editorWorldType);
161 CommonTypes::putBool($out, $this->createdInEditorMode);
162 CommonTypes::putBool($out, $this->exportedFromEditorMode);
163 VarInt::writeSignedInt($out, $this->time);
164 VarInt::writeSignedInt($out, $this->eduEditionOffer);
165 CommonTypes::putBool($out, $this->hasEduFeaturesEnabled);
166 CommonTypes::putString($out, $this->eduProductUUID);
167 LE::writeFloat($out, $this->rainLevel);
168 LE::writeFloat($out, $this->lightningLevel);
169 CommonTypes::putBool($out, $this->hasConfirmedPlatformLockedContent);
170 CommonTypes::putBool($out, $this->isMultiplayerGame);
171 CommonTypes::putBool($out, $this->hasLANBroadcast);
172 VarInt::writeSignedInt($out, $this->xboxLiveBroadcastMode);
173 VarInt::writeSignedInt($out, $this->platformBroadcastMode);
174 CommonTypes::putBool($out, $this->commandsEnabled);
175 CommonTypes::putBool($out, $this->isTexturePacksRequired);
176 CommonTypes::putGameRules($out, $this->gameRules,
true);
177 $this->experiments->write($out);
178 CommonTypes::putBool($out, $this->hasBonusChestEnabled);
179 CommonTypes::putBool($out, $this->hasStartWithMapEnabled);
180 VarInt::writeSignedInt($out, $this->defaultPlayerPermission);
181 LE::writeSignedInt($out, $this->serverChunkTickRadius);
182 CommonTypes::putBool($out, $this->hasLockedBehaviorPack);
183 CommonTypes::putBool($out, $this->hasLockedResourcePack);
184 CommonTypes::putBool($out, $this->isFromLockedWorldTemplate);
185 CommonTypes::putBool($out, $this->useMsaGamertagsOnly);
186 CommonTypes::putBool($out, $this->isFromWorldTemplate);
187 CommonTypes::putBool($out, $this->isWorldTemplateOptionLocked);
188 CommonTypes::putBool($out, $this->onlySpawnV1Villagers);
189 CommonTypes::putBool($out, $this->disablePersona);
190 CommonTypes::putBool($out, $this->disableCustomSkins);
191 CommonTypes::putBool($out, $this->muteEmoteAnnouncements);
192 CommonTypes::putString($out, $this->vanillaVersion);
193 LE::writeSignedInt($out, $this->limitedWorldWidth);
194 LE::writeSignedInt($out, $this->limitedWorldLength);
195 CommonTypes::putBool($out, $this->isNewNether);
197 CommonTypes::writeOptional($out, $this->experimentalGameplayOverride, CommonTypes::putBool(...));
198 Byte::writeUnsigned($out, $this->chatRestrictionLevel);
199 CommonTypes::putBool($out, $this->disablePlayerInteractions);