mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-04 08:56:15 +00:00
Protocol changes for 1.21.80 (#6687)
* Bedrock 1.21.80 support * Update bedrock-data * Add required tags to models * Fixed biome data loading * Support newest world format apparently I messed up the blockstate data version last time around... it hasn't changed since 1.21.60 * always CS has to complain... * Sync with release versions * Ready 5.28.0 release * this might help... --------- Co-authored-by: Dylan T. <dktapps@pmmp.io>
This commit is contained in:
@ -54,7 +54,6 @@ use pocketmine\network\mcpe\protocol\PacketPool;
|
||||
use pocketmine\network\mcpe\protocol\serializer\ItemTypeDictionary;
|
||||
use pocketmine\network\mcpe\protocol\serializer\PacketSerializer;
|
||||
use pocketmine\network\mcpe\protocol\StartGamePacket;
|
||||
use pocketmine\network\mcpe\protocol\types\CacheableNbt;
|
||||
use pocketmine\network\mcpe\protocol\types\inventory\CreativeGroupEntry;
|
||||
use pocketmine\network\mcpe\protocol\types\inventory\ItemStack;
|
||||
use pocketmine\network\mcpe\protocol\types\inventory\ItemStackExtraData;
|
||||
@ -76,6 +75,8 @@ use pocketmine\network\PacketHandlingException;
|
||||
use pocketmine\utils\AssumptionFailedError;
|
||||
use pocketmine\utils\Filesystem;
|
||||
use pocketmine\utils\Utils;
|
||||
use pocketmine\world\biome\model\BiomeDefinitionEntryData;
|
||||
use pocketmine\world\biome\model\ColorData;
|
||||
use pocketmine\world\format\io\GlobalBlockStateHandlers;
|
||||
use Ramsey\Uuid\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\Filesystem\Path;
|
||||
@ -100,6 +101,7 @@ use function json_encode;
|
||||
use function ksort;
|
||||
use function mkdir;
|
||||
use function ord;
|
||||
use function round;
|
||||
use function strlen;
|
||||
use const FILE_IGNORE_NEW_LINES;
|
||||
use const JSON_PRETTY_PRINT;
|
||||
@ -572,34 +574,34 @@ class ParserPacketHandler extends PacketHandler{
|
||||
public function handleBiomeDefinitionList(BiomeDefinitionListPacket $packet) : bool{
|
||||
echo "storing biome definitions" . PHP_EOL;
|
||||
|
||||
file_put_contents($this->bedrockDataPath . '/biome_definitions_full.nbt', $packet->definitions->getEncodedNbt());
|
||||
$definitions = [];
|
||||
foreach($packet->buildDefinitionsFromData() as $entry){
|
||||
$mapWaterColor = new ColorData();
|
||||
$mapWaterColor->r = $entry->getMapWaterColor()->getR();
|
||||
$mapWaterColor->g = $entry->getMapWaterColor()->getG();
|
||||
$mapWaterColor->b = $entry->getMapWaterColor()->getB();
|
||||
$mapWaterColor->a = $entry->getMapWaterColor()->getA();
|
||||
|
||||
$nbt = $packet->definitions->getRoot();
|
||||
if(!$nbt instanceof CompoundTag){
|
||||
throw new AssumptionFailedError();
|
||||
}
|
||||
$strippedNbt = clone $nbt;
|
||||
foreach($strippedNbt as $compound){
|
||||
if($compound instanceof CompoundTag){
|
||||
foreach([
|
||||
"minecraft:capped_surface",
|
||||
"minecraft:consolidated_features",
|
||||
"minecraft:frozen_ocean_surface",
|
||||
"minecraft:legacy_world_generation_rules",
|
||||
"minecraft:mesa_surface",
|
||||
"minecraft:mountain_parameters",
|
||||
"minecraft:multinoise_generation_rules",
|
||||
"minecraft:overworld_generation_rules",
|
||||
"minecraft:surface_material_adjustments",
|
||||
"minecraft:surface_parameters",
|
||||
"minecraft:swamp_surface",
|
||||
] as $remove){
|
||||
$compound->removeTag($remove);
|
||||
}
|
||||
}
|
||||
$data = new BiomeDefinitionEntryData();
|
||||
$data->id = $entry->getId();
|
||||
$data->temperature = round($entry->getTemperature(), 3);
|
||||
$data->downfall = round($entry->getDownfall(), 3);
|
||||
$data->redSporeDensity = round($entry->getRedSporeDensity(), 3);
|
||||
$data->blueSporeDensity = round($entry->getBlueSporeDensity(), 3);
|
||||
$data->ashDensity = round($entry->getAshDensity(), 3);
|
||||
$data->whiteAshDensity = round($entry->getWhiteAshDensity(), 3);
|
||||
$data->depth = round($entry->getDepth(), 3);
|
||||
$data->scale = round($entry->getScale(), 3);
|
||||
$data->mapWaterColour = $mapWaterColor;
|
||||
$data->rain = $entry->hasRain();
|
||||
$data->tags = $entry->getTags() ?? [];
|
||||
|
||||
$definitions[$entry->getBiomeName()] = self::objectToOrderedArray($data);
|
||||
}
|
||||
|
||||
file_put_contents($this->bedrockDataPath . '/biome_definitions.nbt', (new CacheableNbt($strippedNbt))->getEncodedNbt());
|
||||
ksort($definitions, SORT_STRING);
|
||||
|
||||
file_put_contents($this->bedrockDataPath . '/biome_definitions.json', json_encode($definitions, JSON_PRETTY_PRINT) . "\n");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user