Support 1.18.30 worlds

This commit is contained in:
Dylan K. Taylor 2022-04-20 14:58:32 +01:00
parent e383f6d8f8
commit 43e61336cf
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
6 changed files with 32 additions and 21 deletions

View File

@ -139,7 +139,7 @@ final class BlockTypeNames{
public const COMMAND_BLOCK = "minecraft:command_block";
public const COMPOSTER = "minecraft:composter";
public const CONCRETE = "minecraft:concrete";
public const CONCRETEPOWDER = "minecraft:concretePowder";
public const CONCRETE_POWDER = "minecraft:concrete_powder";
public const CONDUIT = "minecraft:conduit";
public const COPPER_BLOCK = "minecraft:copper_block";
public const COPPER_ORE = "minecraft:copper_ore";
@ -374,7 +374,7 @@ final class BlockTypeNames{
public const FLOWING_LAVA = "minecraft:flowing_lava";
public const FLOWING_WATER = "minecraft:flowing_water";
public const FRAME = "minecraft:frame";
public const FROG_EGG = "minecraft:frog_egg";
public const FROG_SPAWN = "minecraft:frog_spawn";
public const FROSTED_ICE = "minecraft:frosted_ice";
public const FURNACE = "minecraft:furnace";
public const GILDED_BLACKSTONE = "minecraft:gilded_blackstone";
@ -413,7 +413,7 @@ final class BlockTypeNames{
public const INFESTED_DEEPSLATE = "minecraft:infested_deepslate";
public const INFO_UPDATE = "minecraft:info_update";
public const INFO_UPDATE2 = "minecraft:info_update2";
public const INVISIBLEBEDROCK = "minecraft:invisibleBedrock";
public const INVISIBLE_BEDROCK = "minecraft:invisible_bedrock";
public const IRON_BARS = "minecraft:iron_bars";
public const IRON_BLOCK = "minecraft:iron_block";
public const IRON_DOOR = "minecraft:iron_door";
@ -467,6 +467,9 @@ final class BlockTypeNames{
public const MAGENTA_CANDLE_CAKE = "minecraft:magenta_candle_cake";
public const MAGENTA_GLAZED_TERRACOTTA = "minecraft:magenta_glazed_terracotta";
public const MAGMA = "minecraft:magma";
public const MANGROVE_LEAVES = "minecraft:mangrove_leaves";
public const MANGROVE_PROPAGULE = "minecraft:mangrove_propagule";
public const MANGROVE_PROPAGULE_HANGING = "minecraft:mangrove_propagule_hanging";
public const MEDIUM_AMETHYST_BUD = "minecraft:medium_amethyst_bud";
public const MELON_BLOCK = "minecraft:melon_block";
public const MELON_STEM = "minecraft:melon_stem";
@ -477,10 +480,14 @@ final class BlockTypeNames{
public const MOSSY_COBBLESTONE = "minecraft:mossy_cobblestone";
public const MOSSY_COBBLESTONE_STAIRS = "minecraft:mossy_cobblestone_stairs";
public const MOSSY_STONE_BRICK_STAIRS = "minecraft:mossy_stone_brick_stairs";
public const MOVINGBLOCK = "minecraft:movingBlock";
public const MOVING_BLOCK = "minecraft:moving_block";
public const MUD = "minecraft:mud";
public const MUD_BRICK_DOUBLE_SLAB = "minecraft:mud_brick_double_slab";
public const MUD_BRICK_SLAB = "minecraft:mud_brick_slab";
public const MUD_BRICK_STAIRS = "minecraft:mud_brick_stairs";
public const MUD_BRICK_WALL = "minecraft:mud_brick_wall";
public const MUD_BRICKS = "minecraft:mud_bricks";
public const MYCELIUM = "minecraft:mycelium";
public const MYSTERIOUS_FRAME = "minecraft:mysterious_frame";
public const MYSTERIOUS_FRAME_SLOT = "minecraft:mysterious_frame_slot";
public const NETHER_BRICK = "minecraft:nether_brick";
public const NETHER_BRICK_FENCE = "minecraft:nether_brick_fence";
public const NETHER_BRICK_STAIRS = "minecraft:nether_brick_stairs";
@ -506,12 +513,13 @@ final class BlockTypeNames{
public const OXIDIZED_CUT_COPPER_STAIRS = "minecraft:oxidized_cut_copper_stairs";
public const OXIDIZED_DOUBLE_CUT_COPPER_SLAB = "minecraft:oxidized_double_cut_copper_slab";
public const PACKED_ICE = "minecraft:packed_ice";
public const PACKED_MUD = "minecraft:packed_mud";
public const PEARLESCENT_FROGLIGHT = "minecraft:pearlescent_froglight";
public const PINK_CANDLE = "minecraft:pink_candle";
public const PINK_CANDLE_CAKE = "minecraft:pink_candle_cake";
public const PINK_GLAZED_TERRACOTTA = "minecraft:pink_glazed_terracotta";
public const PISTON = "minecraft:piston";
public const PISTONARMCOLLISION = "minecraft:pistonArmCollision";
public const PISTON_ARM_COLLISION = "minecraft:piston_arm_collision";
public const PLANKS = "minecraft:planks";
public const PODZOL = "minecraft:podzol";
public const POINTED_DRIPSTONE = "minecraft:pointed_dripstone";
@ -575,6 +583,7 @@ final class BlockTypeNames{
public const REDSTONE_TORCH = "minecraft:redstone_torch";
public const REDSTONE_WIRE = "minecraft:redstone_wire";
public const REEDS = "minecraft:reeds";
public const REINFORCED_DEEPSLATE = "minecraft:reinforced_deepslate";
public const REPEATING_COMMAND_BLOCK = "minecraft:repeating_command_block";
public const RESERVED6 = "minecraft:reserved6";
public const RESPAWN_ANCHOR = "minecraft:respawn_anchor";
@ -588,9 +597,9 @@ final class BlockTypeNames{
public const SCULK_SENSOR = "minecraft:sculk_sensor";
public const SCULK_SHRIEKER = "minecraft:sculk_shrieker";
public const SCULK_VEIN = "minecraft:sculk_vein";
public const SEA_LANTERN = "minecraft:sea_lantern";
public const SEA_PICKLE = "minecraft:sea_pickle";
public const SEAGRASS = "minecraft:seagrass";
public const SEALANTERN = "minecraft:seaLantern";
public const SHROOMLIGHT = "minecraft:shroomlight";
public const SHULKER_BOX = "minecraft:shulker_box";
public const SILVER_GLAZED_TERRACOTTA = "minecraft:silver_glazed_terracotta";
@ -629,7 +638,7 @@ final class BlockTypeNames{
public const STANDING_BANNER = "minecraft:standing_banner";
public const STANDING_SIGN = "minecraft:standing_sign";
public const STICKY_PISTON = "minecraft:sticky_piston";
public const STICKYPISTONARMCOLLISION = "minecraft:stickyPistonArmCollision";
public const STICKY_PISTON_ARM_COLLISION = "minecraft:sticky_piston_arm_collision";
public const STONE = "minecraft:stone";
public const STONE_BRICK_STAIRS = "minecraft:stone_brick_stairs";
public const STONE_BUTTON = "minecraft:stone_button";
@ -662,7 +671,7 @@ final class BlockTypeNames{
public const TORCH = "minecraft:torch";
public const TRAPDOOR = "minecraft:trapdoor";
public const TRAPPED_CHEST = "minecraft:trapped_chest";
public const TRIPWIRE = "minecraft:tripWire";
public const TRIP_WIRE = "minecraft:trip_wire";
public const TRIPWIRE_HOOK = "minecraft:tripwire_hook";
public const TUFF = "minecraft:tuff";
public const TURTLE_EGG = "minecraft:turtle_egg";

View File

@ -396,7 +396,7 @@ final class BlockObjectToBlockStateSerializer implements BlockStateSerializer{
->writeColor($block->getColor());
});
$this->map(Blocks::CONCRETE_POWDER(), function(ConcretePowder $block) : Writer{
return Writer::create(Ids::CONCRETEPOWDER)
return Writer::create(Ids::CONCRETE_POWDER)
->writeColor($block->getColor());
});
$this->map(Blocks::CORAL(), function(Coral $block) : Writer{
@ -681,7 +681,7 @@ final class BlockObjectToBlockStateSerializer implements BlockStateSerializer{
->writeString(StateNames::MONSTER_EGG_STONE_TYPE, StringValues::MONSTER_EGG_STONE_TYPE_STONE_BRICK));
$this->map(Blocks::INFO_UPDATE(), fn() => new Writer(Ids::INFO_UPDATE));
$this->map(Blocks::INFO_UPDATE2(), fn() => new Writer(Ids::INFO_UPDATE2));
$this->map(Blocks::INVISIBLE_BEDROCK(), fn() => new Writer(Ids::INVISIBLEBEDROCK));
$this->map(Blocks::INVISIBLE_BEDROCK(), fn() => new Writer(Ids::INVISIBLE_BEDROCK));
$this->map(Blocks::IRON(), fn() => new Writer(Ids::IRON_BLOCK));
$this->map(Blocks::IRON_BARS(), fn() => new Writer(Ids::IRON_BARS));
$this->map(Blocks::IRON_DOOR(), fn(Door $block) => Helper::encodeDoor($block, new Writer(Ids::IRON_DOOR)));
@ -925,7 +925,7 @@ final class BlockObjectToBlockStateSerializer implements BlockStateSerializer{
$this->map(Blocks::SANDSTONE_SLAB(), fn(Slab $block) => Helper::encodeStoneSlab1($block, StringValues::STONE_SLAB_TYPE_SANDSTONE));
$this->map(Blocks::SANDSTONE_STAIRS(), fn(Stair $block) => Helper::encodeStairs($block, new Writer(Ids::SANDSTONE_STAIRS)));
$this->map(Blocks::SANDSTONE_WALL(), fn(Wall $block) => Helper::encodeLegacyWall($block, StringValues::WALL_BLOCK_TYPE_SANDSTONE));
$this->map(Blocks::SEA_LANTERN(), fn() => new Writer(Ids::SEALANTERN));
$this->map(Blocks::SEA_LANTERN(), fn() => new Writer(Ids::SEA_LANTERN));
$this->map(Blocks::SEA_PICKLE(), function(SeaPickle $block) : Writer{
return Writer::create(Ids::SEA_PICKLE)
->writeBool(StateNames::DEAD_BIT, !$block->isUnderwater())
@ -1045,7 +1045,7 @@ final class BlockObjectToBlockStateSerializer implements BlockStateSerializer{
->writeHorizontalFacing($block->getFacing());
});
$this->map(Blocks::TRIPWIRE(), function(Tripwire $block) : Writer{
return Writer::create(Ids::TRIPWIRE)
return Writer::create(Ids::TRIP_WIRE)
->writeBool(StateNames::ATTACHED_BIT, $block->isConnected())
->writeBool(StateNames::DISARMED_BIT, $block->isDisarmed())
->writeBool(StateNames::POWERED_BIT, $block->isTriggered())

View File

@ -226,7 +226,7 @@ final class BlockStateToBlockObjectDeserializer implements BlockStateDeserialize
return Blocks::CONCRETE()
->setColor($in->readColor());
});
$this->map(Ids::CONCRETEPOWDER, function(Reader $in) : Block{
$this->map(Ids::CONCRETE_POWDER, function(Reader $in) : Block{
return Blocks::CONCRETE_POWDER()
->setColor($in->readColor());
});
@ -531,7 +531,7 @@ final class BlockStateToBlockObjectDeserializer implements BlockStateDeserialize
$this->map(Ids::ICE, fn() => Blocks::ICE());
$this->map(Ids::INFO_UPDATE, fn() => Blocks::INFO_UPDATE());
$this->map(Ids::INFO_UPDATE2, fn() => Blocks::INFO_UPDATE2());
$this->map(Ids::INVISIBLEBEDROCK, fn() => Blocks::INVISIBLE_BEDROCK());
$this->map(Ids::INVISIBLE_BEDROCK, fn() => Blocks::INVISIBLE_BEDROCK());
$this->map(Ids::IRON_BARS, fn() => Blocks::IRON_BARS());
$this->map(Ids::IRON_BLOCK, fn() => Blocks::IRON());
$this->map(Ids::IRON_DOOR, fn(Reader $in) => Helper::decodeDoor(Blocks::IRON_DOOR(), $in));
@ -838,7 +838,7 @@ final class BlockStateToBlockObjectDeserializer implements BlockStateDeserialize
})
->setReady($in->readBool(StateNames::AGE_BIT));
});
$this->map(Ids::SEALANTERN, fn() => Blocks::SEA_LANTERN());
$this->map(Ids::SEA_LANTERN, fn() => Blocks::SEA_LANTERN());
$this->map(Ids::SEA_PICKLE, function(Reader $in) : Block{
return Blocks::SEA_PICKLE()
->setCount($in->readBoundedInt(StateNames::CLUSTER_COUNT, 0, 3) + 1)
@ -983,7 +983,7 @@ final class BlockStateToBlockObjectDeserializer implements BlockStateDeserialize
return Blocks::TRAPPED_CHEST()
->setFacing($in->readHorizontalFacing());
});
$this->map(Ids::TRIPWIRE, function(Reader $in) : Block{
$this->map(Ids::TRIP_WIRE, function(Reader $in) : Block{
return Blocks::TRIPWIRE()
->setConnected($in->readBool(StateNames::ATTACHED_BIT))
->setDisarmed($in->readBool(StateNames::DISARMED_BIT))

View File

@ -47,13 +47,13 @@ use function time;
class BedrockWorldData extends BaseNbtWorldData{
public const CURRENT_STORAGE_VERSION = 8;
public const CURRENT_STORAGE_VERSION = 9;
/**
* WARNING: In the future, this should be only as high as the newest world format currently supported. We don't
* actually support worlds from 1.18.10 yet, but due to an old stupid bug, all worlds created by PM will report this
* version.
*/
public const CURRENT_STORAGE_NETWORK_VERSION = 486; // 1.18.10
public const CURRENT_STORAGE_NETWORK_VERSION = 503; // 1.18.10
public const GENERATOR_LIMITED = 0;
public const GENERATOR_INFINITE = 1;

View File

@ -70,4 +70,5 @@ final class ChunkVersion{
public const v1_18_0_24_beta = 37;
public const v1_18_0_24_unused = 38;
public const v1_18_0_25_beta = 39;
public const v1_18_30 = 40;
}

View File

@ -78,7 +78,7 @@ class LevelDB extends BaseWorldProvider implements WritableWorldProvider{
protected const ENTRY_FLAT_WORLD_LAYERS = "game_flatworldlayers";
protected const CURRENT_LEVEL_CHUNK_VERSION = ChunkVersion::v1_18_0_25_beta;
protected const CURRENT_LEVEL_CHUNK_VERSION = ChunkVersion::v1_18_30;
protected const CURRENT_LEVEL_SUBCHUNK_VERSION = SubChunkVersion::PALETTED_MULTI;
private const CAVES_CLIFFS_EXPERIMENTAL_SUBCHUNK_KEY_OFFSET = 4;
@ -296,6 +296,7 @@ class LevelDB extends BaseWorldProvider implements WritableWorldProvider{
$subChunkKeyOffset = self::hasOffsetCavesAndCliffsSubChunks($chunkVersion) ? self::CAVES_CLIFFS_EXPERIMENTAL_SUBCHUNK_KEY_OFFSET : 0;
switch($chunkVersion){
case ChunkVersion::v1_18_30:
case ChunkVersion::v1_18_0_25_beta:
case ChunkVersion::v1_18_0_24_unused:
case ChunkVersion::v1_18_0_24_beta: