mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 18:32:55 +00:00
Namespace rename
This commit is contained in:
95
src/data/bedrock/block/BlockStateData.php
Normal file
95
src/data/bedrock/block/BlockStateData.php
Normal file
@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\data\bedrock\block;
|
||||
|
||||
use pocketmine\nbt\NbtException;
|
||||
use pocketmine\nbt\tag\CompoundTag;
|
||||
use function array_keys;
|
||||
use function count;
|
||||
use function implode;
|
||||
|
||||
/**
|
||||
* Contains the common information found in a serialized blockstate.
|
||||
*/
|
||||
final class BlockStateData{
|
||||
/**
|
||||
* Bedrock version of the most recent backwards-incompatible change to blockstates.
|
||||
*/
|
||||
public const CURRENT_VERSION =
|
||||
(1 << 24) | //major
|
||||
(18 << 16) | //minor
|
||||
(10 << 8) | //patch
|
||||
(1); //revision
|
||||
|
||||
public const TAG_NAME = "name";
|
||||
public const TAG_STATES = "states";
|
||||
public const TAG_VERSION = "version";
|
||||
|
||||
public function __construct(
|
||||
private string $name,
|
||||
private CompoundTag $states,
|
||||
private int $version
|
||||
){}
|
||||
|
||||
public function getName() : string{ return $this->name; }
|
||||
|
||||
public function getStates() : CompoundTag{ return $this->states; }
|
||||
|
||||
public function getVersion() : int{ return $this->version; }
|
||||
|
||||
/**
|
||||
* @throws BlockStateDeserializeException
|
||||
*/
|
||||
public static function fromNbt(CompoundTag $nbt) : self{
|
||||
try{
|
||||
$name = $nbt->getString(self::TAG_NAME);
|
||||
$states = $nbt->getCompoundTag(self::TAG_STATES) ?? throw new BlockStateDeserializeException("Missing tag \"" . self::TAG_STATES . "\"");
|
||||
$version = $nbt->getInt(self::TAG_VERSION, 0);
|
||||
}catch(NbtException $e){
|
||||
throw new BlockStateDeserializeException($e->getMessage(), 0, $e);
|
||||
}
|
||||
|
||||
$allKeys = $nbt->getValue();
|
||||
unset($allKeys[self::TAG_NAME], $allKeys[self::TAG_STATES], $allKeys[self::TAG_VERSION]);
|
||||
if(count($allKeys) !== 0){
|
||||
throw new BlockStateDeserializeException("Unexpected extra keys: " . implode(", ", array_keys($allKeys)));
|
||||
}
|
||||
|
||||
return new self($name, $states, $version);
|
||||
}
|
||||
|
||||
public function toNbt() : CompoundTag{
|
||||
return CompoundTag::create()
|
||||
->setString(self::TAG_NAME, $this->name)
|
||||
->setInt(self::TAG_VERSION, $this->version)
|
||||
->setTag(self::TAG_STATES, $this->states);
|
||||
}
|
||||
|
||||
public function equals(self $that) : bool{
|
||||
return
|
||||
$this->name === $that->name &&
|
||||
$this->states->equals($that->states) &&
|
||||
$this->version === $that->version;
|
||||
}
|
||||
}
|
28
src/data/bedrock/block/BlockStateDeserializeException.php
Normal file
28
src/data/bedrock/block/BlockStateDeserializeException.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\data\bedrock\block;
|
||||
|
||||
final class BlockStateDeserializeException extends \RuntimeException{
|
||||
|
||||
}
|
40
src/data/bedrock/block/BlockStateDeserializer.php
Normal file
40
src/data/bedrock/block/BlockStateDeserializer.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\data\bedrock\block;
|
||||
|
||||
/**
|
||||
* Implementors of this interface decide how a block should be deserialized and represented at runtime. This is used by
|
||||
* world providers when decoding blockstates into block IDs.
|
||||
*
|
||||
* @phpstan-type BlockStateId int
|
||||
*/
|
||||
interface BlockStateDeserializer{
|
||||
/**
|
||||
* Deserializes blockstate NBT into an implementation-defined blockstate ID, for runtime paletted storage.
|
||||
*
|
||||
* @phpstan-return BlockStateId
|
||||
* @throws BlockStateDeserializeException
|
||||
*/
|
||||
public function deserialize(BlockStateData $stateData) : int;
|
||||
}
|
153
src/data/bedrock/block/BlockStateNames.php
Normal file
153
src/data/bedrock/block/BlockStateNames.php
Normal file
@ -0,0 +1,153 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\data\bedrock\block;
|
||||
|
||||
final class BlockStateNames{
|
||||
|
||||
public const ACTIVE = "active";
|
||||
public const AGE = "age";
|
||||
public const AGE_BIT = "age_bit";
|
||||
public const ALLOW_UNDERWATER_BIT = "allow_underwater_bit";
|
||||
public const ATTACHED_BIT = "attached_bit";
|
||||
public const ATTACHMENT = "attachment";
|
||||
public const BAMBOO_LEAF_SIZE = "bamboo_leaf_size";
|
||||
public const BAMBOO_STALK_THICKNESS = "bamboo_stalk_thickness";
|
||||
public const BIG_DRIPLEAF_HEAD = "big_dripleaf_head";
|
||||
public const BIG_DRIPLEAF_TILT = "big_dripleaf_tilt";
|
||||
public const BITE_COUNTER = "bite_counter";
|
||||
public const BLOCK_LIGHT_LEVEL = "block_light_level";
|
||||
public const BLOOM = "bloom";
|
||||
public const BREWING_STAND_SLOT_A_BIT = "brewing_stand_slot_a_bit";
|
||||
public const BREWING_STAND_SLOT_B_BIT = "brewing_stand_slot_b_bit";
|
||||
public const BREWING_STAND_SLOT_C_BIT = "brewing_stand_slot_c_bit";
|
||||
public const BUTTON_PRESSED_BIT = "button_pressed_bit";
|
||||
public const CAN_SUMMON = "can_summon";
|
||||
public const CANDLES = "candles";
|
||||
public const CAULDRON_LIQUID = "cauldron_liquid";
|
||||
public const CHEMISTRY_TABLE_TYPE = "chemistry_table_type";
|
||||
public const CHISEL_TYPE = "chisel_type";
|
||||
public const CLUSTER_COUNT = "cluster_count";
|
||||
public const COLOR = "color";
|
||||
public const COLOR_BIT = "color_bit";
|
||||
public const COMPOSTER_FILL_LEVEL = "composter_fill_level";
|
||||
public const CONDITIONAL_BIT = "conditional_bit";
|
||||
public const CORAL_COLOR = "coral_color";
|
||||
public const CORAL_DIRECTION = "coral_direction";
|
||||
public const CORAL_FAN_DIRECTION = "coral_fan_direction";
|
||||
public const CORAL_HANG_TYPE_BIT = "coral_hang_type_bit";
|
||||
public const COVERED_BIT = "covered_bit";
|
||||
public const CRACKED_STATE = "cracked_state";
|
||||
public const DAMAGE = "damage";
|
||||
public const DEAD_BIT = "dead_bit";
|
||||
public const DEPRECATED = "deprecated";
|
||||
public const DIRECTION = "direction";
|
||||
public const DIRT_TYPE = "dirt_type";
|
||||
public const DISARMED_BIT = "disarmed_bit";
|
||||
public const DOOR_HINGE_BIT = "door_hinge_bit";
|
||||
public const DOUBLE_PLANT_TYPE = "double_plant_type";
|
||||
public const DRAG_DOWN = "drag_down";
|
||||
public const DRIPSTONE_THICKNESS = "dripstone_thickness";
|
||||
public const END_PORTAL_EYE_BIT = "end_portal_eye_bit";
|
||||
public const EXPLODE_BIT = "explode_bit";
|
||||
public const EXTINGUISHED = "extinguished";
|
||||
public const FACING_DIRECTION = "facing_direction";
|
||||
public const FILL_LEVEL = "fill_level";
|
||||
public const FLOWER_TYPE = "flower_type";
|
||||
public const GROUND_SIGN_DIRECTION = "ground_sign_direction";
|
||||
public const GROWING_PLANT_AGE = "growing_plant_age";
|
||||
public const GROWTH = "growth";
|
||||
public const HANGING = "hanging";
|
||||
public const HEAD_PIECE_BIT = "head_piece_bit";
|
||||
public const HEIGHT = "height";
|
||||
public const HONEY_LEVEL = "honey_level";
|
||||
public const HUGE_MUSHROOM_BITS = "huge_mushroom_bits";
|
||||
public const IN_WALL_BIT = "in_wall_bit";
|
||||
public const INFINIBURN_BIT = "infiniburn_bit";
|
||||
public const ITEM_FRAME_MAP_BIT = "item_frame_map_bit";
|
||||
public const ITEM_FRAME_PHOTO_BIT = "item_frame_photo_bit";
|
||||
public const KELP_AGE = "kelp_age";
|
||||
public const LEVER_DIRECTION = "lever_direction";
|
||||
public const LIQUID_DEPTH = "liquid_depth";
|
||||
public const LIT = "lit";
|
||||
public const MOISTURIZED_AMOUNT = "moisturized_amount";
|
||||
public const MONSTER_EGG_STONE_TYPE = "monster_egg_stone_type";
|
||||
public const MULTI_FACE_DIRECTION_BITS = "multi_face_direction_bits";
|
||||
public const NEW_LEAF_TYPE = "new_leaf_type";
|
||||
public const NEW_LOG_TYPE = "new_log_type";
|
||||
public const OCCUPIED_BIT = "occupied_bit";
|
||||
public const OLD_LEAF_TYPE = "old_leaf_type";
|
||||
public const OLD_LOG_TYPE = "old_log_type";
|
||||
public const OPEN_BIT = "open_bit";
|
||||
public const OUTPUT_LIT_BIT = "output_lit_bit";
|
||||
public const OUTPUT_SUBTRACT_BIT = "output_subtract_bit";
|
||||
public const PERSISTENT_BIT = "persistent_bit";
|
||||
public const PILLAR_AXIS = "pillar_axis";
|
||||
public const PORTAL_AXIS = "portal_axis";
|
||||
public const POWERED_BIT = "powered_bit";
|
||||
public const PRISMARINE_BLOCK_TYPE = "prismarine_block_type";
|
||||
public const PROPAGULE_STAGE = "propagule_stage";
|
||||
public const RAIL_DATA_BIT = "rail_data_bit";
|
||||
public const RAIL_DIRECTION = "rail_direction";
|
||||
public const REDSTONE_SIGNAL = "redstone_signal";
|
||||
public const REPEATER_DELAY = "repeater_delay";
|
||||
public const RESPAWN_ANCHOR_CHARGE = "respawn_anchor_charge";
|
||||
public const ROTATION = "rotation";
|
||||
public const SAND_STONE_TYPE = "sand_stone_type";
|
||||
public const SAND_TYPE = "sand_type";
|
||||
public const SAPLING_TYPE = "sapling_type";
|
||||
public const SEA_GRASS_TYPE = "sea_grass_type";
|
||||
public const SPONGE_TYPE = "sponge_type";
|
||||
public const STABILITY = "stability";
|
||||
public const STABILITY_CHECK = "stability_check";
|
||||
public const STONE_BRICK_TYPE = "stone_brick_type";
|
||||
public const STONE_SLAB_TYPE = "stone_slab_type";
|
||||
public const STONE_SLAB_TYPE_2 = "stone_slab_type_2";
|
||||
public const STONE_SLAB_TYPE_3 = "stone_slab_type_3";
|
||||
public const STONE_SLAB_TYPE_4 = "stone_slab_type_4";
|
||||
public const STONE_TYPE = "stone_type";
|
||||
public const STRIPPED_BIT = "stripped_bit";
|
||||
public const STRUCTURE_BLOCK_TYPE = "structure_block_type";
|
||||
public const STRUCTURE_VOID_TYPE = "structure_void_type";
|
||||
public const SUSPENDED_BIT = "suspended_bit";
|
||||
public const TALL_GRASS_TYPE = "tall_grass_type";
|
||||
public const TOGGLE_BIT = "toggle_bit";
|
||||
public const TOP_SLOT_BIT = "top_slot_bit";
|
||||
public const TORCH_FACING_DIRECTION = "torch_facing_direction";
|
||||
public const TRIGGERED_BIT = "triggered_bit";
|
||||
public const TURTLE_EGG_COUNT = "turtle_egg_count";
|
||||
public const TWISTING_VINES_AGE = "twisting_vines_age";
|
||||
public const UPDATE_BIT = "update_bit";
|
||||
public const UPPER_BLOCK_BIT = "upper_block_bit";
|
||||
public const UPSIDE_DOWN_BIT = "upside_down_bit";
|
||||
public const VINE_DIRECTION_BITS = "vine_direction_bits";
|
||||
public const WALL_BLOCK_TYPE = "wall_block_type";
|
||||
public const WALL_CONNECTION_TYPE_EAST = "wall_connection_type_east";
|
||||
public const WALL_CONNECTION_TYPE_NORTH = "wall_connection_type_north";
|
||||
public const WALL_CONNECTION_TYPE_SOUTH = "wall_connection_type_south";
|
||||
public const WALL_CONNECTION_TYPE_WEST = "wall_connection_type_west";
|
||||
public const WALL_POST_BIT = "wall_post_bit";
|
||||
public const WEEPING_VINES_AGE = "weeping_vines_age";
|
||||
public const WEIRDO_DIRECTION = "weirdo_direction";
|
||||
public const WOOD_TYPE = "wood_type";
|
||||
}
|
28
src/data/bedrock/block/BlockStateSerializeException.php
Normal file
28
src/data/bedrock/block/BlockStateSerializeException.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\data\bedrock\block;
|
||||
|
||||
final class BlockStateSerializeException extends \LogicException{
|
||||
|
||||
}
|
40
src/data/bedrock/block/BlockStateSerializer.php
Normal file
40
src/data/bedrock/block/BlockStateSerializer.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\data\bedrock\block;
|
||||
|
||||
/**
|
||||
* Implementors of this interface decide how blockstate IDs will be represented as NBT.
|
||||
*
|
||||
* @phpstan-type BlockStateId int
|
||||
*/
|
||||
interface BlockStateSerializer{
|
||||
|
||||
/**
|
||||
* Serializes an implementation-defined blockstate ID to NBT for storage.
|
||||
*
|
||||
* @phpstan-param BlockStateId $stateId
|
||||
* @throws BlockStateSerializeException
|
||||
*/
|
||||
public function serialize(int $stateId) : BlockStateData;
|
||||
}
|
297
src/data/bedrock/block/BlockStateStringValues.php
Normal file
297
src/data/bedrock/block/BlockStateStringValues.php
Normal file
@ -0,0 +1,297 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\data\bedrock\block;
|
||||
|
||||
final class BlockStateStringValues{
|
||||
|
||||
public const ATTACHMENT_HANGING = "hanging";
|
||||
public const ATTACHMENT_MULTIPLE = "multiple";
|
||||
public const ATTACHMENT_SIDE = "side";
|
||||
public const ATTACHMENT_STANDING = "standing";
|
||||
|
||||
public const BAMBOO_LEAF_SIZE_LARGE_LEAVES = "large_leaves";
|
||||
public const BAMBOO_LEAF_SIZE_NO_LEAVES = "no_leaves";
|
||||
public const BAMBOO_LEAF_SIZE_SMALL_LEAVES = "small_leaves";
|
||||
|
||||
public const BAMBOO_STALK_THICKNESS_THICK = "thick";
|
||||
public const BAMBOO_STALK_THICKNESS_THIN = "thin";
|
||||
|
||||
public const BIG_DRIPLEAF_TILT_FULL_TILT = "full_tilt";
|
||||
public const BIG_DRIPLEAF_TILT_NONE = "none";
|
||||
public const BIG_DRIPLEAF_TILT_PARTIAL_TILT = "partial_tilt";
|
||||
public const BIG_DRIPLEAF_TILT_UNSTABLE = "unstable";
|
||||
|
||||
public const CAULDRON_LIQUID_LAVA = "lava";
|
||||
public const CAULDRON_LIQUID_POWDER_SNOW = "powder_snow";
|
||||
public const CAULDRON_LIQUID_WATER = "water";
|
||||
|
||||
public const CHEMISTRY_TABLE_TYPE_COMPOUND_CREATOR = "compound_creator";
|
||||
public const CHEMISTRY_TABLE_TYPE_ELEMENT_CONSTRUCTOR = "element_constructor";
|
||||
public const CHEMISTRY_TABLE_TYPE_LAB_TABLE = "lab_table";
|
||||
public const CHEMISTRY_TABLE_TYPE_MATERIAL_REDUCER = "material_reducer";
|
||||
|
||||
public const CHISEL_TYPE_CHISELED = "chiseled";
|
||||
public const CHISEL_TYPE_DEFAULT = "default";
|
||||
public const CHISEL_TYPE_LINES = "lines";
|
||||
public const CHISEL_TYPE_SMOOTH = "smooth";
|
||||
|
||||
public const COLOR_BLACK = "black";
|
||||
public const COLOR_BLUE = "blue";
|
||||
public const COLOR_BROWN = "brown";
|
||||
public const COLOR_CYAN = "cyan";
|
||||
public const COLOR_GRAY = "gray";
|
||||
public const COLOR_GREEN = "green";
|
||||
public const COLOR_LIGHT_BLUE = "light_blue";
|
||||
public const COLOR_LIME = "lime";
|
||||
public const COLOR_MAGENTA = "magenta";
|
||||
public const COLOR_ORANGE = "orange";
|
||||
public const COLOR_PINK = "pink";
|
||||
public const COLOR_PURPLE = "purple";
|
||||
public const COLOR_RED = "red";
|
||||
public const COLOR_SILVER = "silver";
|
||||
public const COLOR_WHITE = "white";
|
||||
public const COLOR_YELLOW = "yellow";
|
||||
|
||||
public const CORAL_COLOR_BLUE = "blue";
|
||||
public const CORAL_COLOR_PINK = "pink";
|
||||
public const CORAL_COLOR_PURPLE = "purple";
|
||||
public const CORAL_COLOR_RED = "red";
|
||||
public const CORAL_COLOR_YELLOW = "yellow";
|
||||
|
||||
public const CRACKED_STATE_CRACKED = "cracked";
|
||||
public const CRACKED_STATE_MAX_CRACKED = "max_cracked";
|
||||
public const CRACKED_STATE_NO_CRACKS = "no_cracks";
|
||||
|
||||
public const DAMAGE_BROKEN = "broken";
|
||||
public const DAMAGE_SLIGHTLY_DAMAGED = "slightly_damaged";
|
||||
public const DAMAGE_UNDAMAGED = "undamaged";
|
||||
public const DAMAGE_VERY_DAMAGED = "very_damaged";
|
||||
|
||||
public const DIRT_TYPE_COARSE = "coarse";
|
||||
public const DIRT_TYPE_NORMAL = "normal";
|
||||
|
||||
public const DOUBLE_PLANT_TYPE_FERN = "fern";
|
||||
public const DOUBLE_PLANT_TYPE_GRASS = "grass";
|
||||
public const DOUBLE_PLANT_TYPE_PAEONIA = "paeonia";
|
||||
public const DOUBLE_PLANT_TYPE_ROSE = "rose";
|
||||
public const DOUBLE_PLANT_TYPE_SUNFLOWER = "sunflower";
|
||||
public const DOUBLE_PLANT_TYPE_SYRINGA = "syringa";
|
||||
|
||||
public const DRIPSTONE_THICKNESS_BASE = "base";
|
||||
public const DRIPSTONE_THICKNESS_FRUSTUM = "frustum";
|
||||
public const DRIPSTONE_THICKNESS_MERGE = "merge";
|
||||
public const DRIPSTONE_THICKNESS_MIDDLE = "middle";
|
||||
public const DRIPSTONE_THICKNESS_TIP = "tip";
|
||||
|
||||
public const FLOWER_TYPE_ALLIUM = "allium";
|
||||
public const FLOWER_TYPE_CORNFLOWER = "cornflower";
|
||||
public const FLOWER_TYPE_HOUSTONIA = "houstonia";
|
||||
public const FLOWER_TYPE_LILY_OF_THE_VALLEY = "lily_of_the_valley";
|
||||
public const FLOWER_TYPE_ORCHID = "orchid";
|
||||
public const FLOWER_TYPE_OXEYE = "oxeye";
|
||||
public const FLOWER_TYPE_POPPY = "poppy";
|
||||
public const FLOWER_TYPE_TULIP_ORANGE = "tulip_orange";
|
||||
public const FLOWER_TYPE_TULIP_PINK = "tulip_pink";
|
||||
public const FLOWER_TYPE_TULIP_RED = "tulip_red";
|
||||
public const FLOWER_TYPE_TULIP_WHITE = "tulip_white";
|
||||
|
||||
public const LEVER_DIRECTION_DOWN_EAST_WEST = "down_east_west";
|
||||
public const LEVER_DIRECTION_DOWN_NORTH_SOUTH = "down_north_south";
|
||||
public const LEVER_DIRECTION_EAST = "east";
|
||||
public const LEVER_DIRECTION_NORTH = "north";
|
||||
public const LEVER_DIRECTION_SOUTH = "south";
|
||||
public const LEVER_DIRECTION_UP_EAST_WEST = "up_east_west";
|
||||
public const LEVER_DIRECTION_UP_NORTH_SOUTH = "up_north_south";
|
||||
public const LEVER_DIRECTION_WEST = "west";
|
||||
|
||||
public const MONSTER_EGG_STONE_TYPE_CHISELED_STONE_BRICK = "chiseled_stone_brick";
|
||||
public const MONSTER_EGG_STONE_TYPE_COBBLESTONE = "cobblestone";
|
||||
public const MONSTER_EGG_STONE_TYPE_CRACKED_STONE_BRICK = "cracked_stone_brick";
|
||||
public const MONSTER_EGG_STONE_TYPE_MOSSY_STONE_BRICK = "mossy_stone_brick";
|
||||
public const MONSTER_EGG_STONE_TYPE_STONE = "stone";
|
||||
public const MONSTER_EGG_STONE_TYPE_STONE_BRICK = "stone_brick";
|
||||
|
||||
public const NEW_LEAF_TYPE_ACACIA = "acacia";
|
||||
public const NEW_LEAF_TYPE_DARK_OAK = "dark_oak";
|
||||
|
||||
public const NEW_LOG_TYPE_ACACIA = "acacia";
|
||||
public const NEW_LOG_TYPE_DARK_OAK = "dark_oak";
|
||||
|
||||
public const OLD_LEAF_TYPE_BIRCH = "birch";
|
||||
public const OLD_LEAF_TYPE_JUNGLE = "jungle";
|
||||
public const OLD_LEAF_TYPE_OAK = "oak";
|
||||
public const OLD_LEAF_TYPE_SPRUCE = "spruce";
|
||||
|
||||
public const OLD_LOG_TYPE_BIRCH = "birch";
|
||||
public const OLD_LOG_TYPE_JUNGLE = "jungle";
|
||||
public const OLD_LOG_TYPE_OAK = "oak";
|
||||
public const OLD_LOG_TYPE_SPRUCE = "spruce";
|
||||
|
||||
public const PILLAR_AXIS_X = "x";
|
||||
public const PILLAR_AXIS_Y = "y";
|
||||
public const PILLAR_AXIS_Z = "z";
|
||||
|
||||
public const PORTAL_AXIS_UNKNOWN = "unknown";
|
||||
public const PORTAL_AXIS_X = "x";
|
||||
public const PORTAL_AXIS_Z = "z";
|
||||
|
||||
public const PRISMARINE_BLOCK_TYPE_BRICKS = "bricks";
|
||||
public const PRISMARINE_BLOCK_TYPE_DARK = "dark";
|
||||
public const PRISMARINE_BLOCK_TYPE_DEFAULT = "default";
|
||||
|
||||
public const SAND_STONE_TYPE_CUT = "cut";
|
||||
public const SAND_STONE_TYPE_DEFAULT = "default";
|
||||
public const SAND_STONE_TYPE_HEIROGLYPHS = "heiroglyphs";
|
||||
public const SAND_STONE_TYPE_SMOOTH = "smooth";
|
||||
|
||||
public const SAND_TYPE_NORMAL = "normal";
|
||||
public const SAND_TYPE_RED = "red";
|
||||
|
||||
public const SAPLING_TYPE_ACACIA = "acacia";
|
||||
public const SAPLING_TYPE_BIRCH = "birch";
|
||||
public const SAPLING_TYPE_DARK_OAK = "dark_oak";
|
||||
public const SAPLING_TYPE_JUNGLE = "jungle";
|
||||
public const SAPLING_TYPE_OAK = "oak";
|
||||
public const SAPLING_TYPE_SPRUCE = "spruce";
|
||||
|
||||
public const SEA_GRASS_TYPE_DEFAULT = "default";
|
||||
public const SEA_GRASS_TYPE_DOUBLE_BOT = "double_bot";
|
||||
public const SEA_GRASS_TYPE_DOUBLE_TOP = "double_top";
|
||||
|
||||
public const SPONGE_TYPE_DRY = "dry";
|
||||
public const SPONGE_TYPE_WET = "wet";
|
||||
|
||||
public const STONE_BRICK_TYPE_CHISELED = "chiseled";
|
||||
public const STONE_BRICK_TYPE_CRACKED = "cracked";
|
||||
public const STONE_BRICK_TYPE_DEFAULT = "default";
|
||||
public const STONE_BRICK_TYPE_MOSSY = "mossy";
|
||||
public const STONE_BRICK_TYPE_SMOOTH = "smooth";
|
||||
|
||||
public const STONE_SLAB_TYPE_BRICK = "brick";
|
||||
public const STONE_SLAB_TYPE_COBBLESTONE = "cobblestone";
|
||||
public const STONE_SLAB_TYPE_NETHER_BRICK = "nether_brick";
|
||||
public const STONE_SLAB_TYPE_QUARTZ = "quartz";
|
||||
public const STONE_SLAB_TYPE_SANDSTONE = "sandstone";
|
||||
public const STONE_SLAB_TYPE_SMOOTH_STONE = "smooth_stone";
|
||||
public const STONE_SLAB_TYPE_STONE_BRICK = "stone_brick";
|
||||
public const STONE_SLAB_TYPE_WOOD = "wood";
|
||||
|
||||
public const STONE_SLAB_TYPE_2_MOSSY_COBBLESTONE = "mossy_cobblestone";
|
||||
public const STONE_SLAB_TYPE_2_PRISMARINE_BRICK = "prismarine_brick";
|
||||
public const STONE_SLAB_TYPE_2_PRISMARINE_DARK = "prismarine_dark";
|
||||
public const STONE_SLAB_TYPE_2_PRISMARINE_ROUGH = "prismarine_rough";
|
||||
public const STONE_SLAB_TYPE_2_PURPUR = "purpur";
|
||||
public const STONE_SLAB_TYPE_2_RED_NETHER_BRICK = "red_nether_brick";
|
||||
public const STONE_SLAB_TYPE_2_RED_SANDSTONE = "red_sandstone";
|
||||
public const STONE_SLAB_TYPE_2_SMOOTH_SANDSTONE = "smooth_sandstone";
|
||||
|
||||
public const STONE_SLAB_TYPE_3_ANDESITE = "andesite";
|
||||
public const STONE_SLAB_TYPE_3_DIORITE = "diorite";
|
||||
public const STONE_SLAB_TYPE_3_END_STONE_BRICK = "end_stone_brick";
|
||||
public const STONE_SLAB_TYPE_3_GRANITE = "granite";
|
||||
public const STONE_SLAB_TYPE_3_POLISHED_ANDESITE = "polished_andesite";
|
||||
public const STONE_SLAB_TYPE_3_POLISHED_DIORITE = "polished_diorite";
|
||||
public const STONE_SLAB_TYPE_3_POLISHED_GRANITE = "polished_granite";
|
||||
public const STONE_SLAB_TYPE_3_SMOOTH_RED_SANDSTONE = "smooth_red_sandstone";
|
||||
|
||||
public const STONE_SLAB_TYPE_4_CUT_RED_SANDSTONE = "cut_red_sandstone";
|
||||
public const STONE_SLAB_TYPE_4_CUT_SANDSTONE = "cut_sandstone";
|
||||
public const STONE_SLAB_TYPE_4_MOSSY_STONE_BRICK = "mossy_stone_brick";
|
||||
public const STONE_SLAB_TYPE_4_SMOOTH_QUARTZ = "smooth_quartz";
|
||||
public const STONE_SLAB_TYPE_4_STONE = "stone";
|
||||
|
||||
public const STONE_TYPE_ANDESITE = "andesite";
|
||||
public const STONE_TYPE_ANDESITE_SMOOTH = "andesite_smooth";
|
||||
public const STONE_TYPE_DIORITE = "diorite";
|
||||
public const STONE_TYPE_DIORITE_SMOOTH = "diorite_smooth";
|
||||
public const STONE_TYPE_GRANITE = "granite";
|
||||
public const STONE_TYPE_GRANITE_SMOOTH = "granite_smooth";
|
||||
public const STONE_TYPE_STONE = "stone";
|
||||
|
||||
public const STRUCTURE_BLOCK_TYPE_CORNER = "corner";
|
||||
public const STRUCTURE_BLOCK_TYPE_DATA = "data";
|
||||
public const STRUCTURE_BLOCK_TYPE_EXPORT = "export";
|
||||
public const STRUCTURE_BLOCK_TYPE_INVALID = "invalid";
|
||||
public const STRUCTURE_BLOCK_TYPE_LOAD = "load";
|
||||
public const STRUCTURE_BLOCK_TYPE_SAVE = "save";
|
||||
|
||||
public const STRUCTURE_VOID_TYPE_AIR = "air";
|
||||
public const STRUCTURE_VOID_TYPE_VOID = "void";
|
||||
|
||||
public const TALL_GRASS_TYPE_DEFAULT = "default";
|
||||
public const TALL_GRASS_TYPE_FERN = "fern";
|
||||
public const TALL_GRASS_TYPE_SNOW = "snow";
|
||||
public const TALL_GRASS_TYPE_TALL = "tall";
|
||||
|
||||
public const TORCH_FACING_DIRECTION_EAST = "east";
|
||||
public const TORCH_FACING_DIRECTION_NORTH = "north";
|
||||
public const TORCH_FACING_DIRECTION_SOUTH = "south";
|
||||
public const TORCH_FACING_DIRECTION_TOP = "top";
|
||||
public const TORCH_FACING_DIRECTION_UNKNOWN = "unknown";
|
||||
public const TORCH_FACING_DIRECTION_WEST = "west";
|
||||
|
||||
public const TURTLE_EGG_COUNT_FOUR_EGG = "four_egg";
|
||||
public const TURTLE_EGG_COUNT_ONE_EGG = "one_egg";
|
||||
public const TURTLE_EGG_COUNT_THREE_EGG = "three_egg";
|
||||
public const TURTLE_EGG_COUNT_TWO_EGG = "two_egg";
|
||||
|
||||
public const WALL_BLOCK_TYPE_ANDESITE = "andesite";
|
||||
public const WALL_BLOCK_TYPE_BRICK = "brick";
|
||||
public const WALL_BLOCK_TYPE_COBBLESTONE = "cobblestone";
|
||||
public const WALL_BLOCK_TYPE_DIORITE = "diorite";
|
||||
public const WALL_BLOCK_TYPE_END_BRICK = "end_brick";
|
||||
public const WALL_BLOCK_TYPE_GRANITE = "granite";
|
||||
public const WALL_BLOCK_TYPE_MOSSY_COBBLESTONE = "mossy_cobblestone";
|
||||
public const WALL_BLOCK_TYPE_MOSSY_STONE_BRICK = "mossy_stone_brick";
|
||||
public const WALL_BLOCK_TYPE_NETHER_BRICK = "nether_brick";
|
||||
public const WALL_BLOCK_TYPE_PRISMARINE = "prismarine";
|
||||
public const WALL_BLOCK_TYPE_RED_NETHER_BRICK = "red_nether_brick";
|
||||
public const WALL_BLOCK_TYPE_RED_SANDSTONE = "red_sandstone";
|
||||
public const WALL_BLOCK_TYPE_SANDSTONE = "sandstone";
|
||||
public const WALL_BLOCK_TYPE_STONE_BRICK = "stone_brick";
|
||||
|
||||
public const WALL_CONNECTION_TYPE_EAST_NONE = "none";
|
||||
public const WALL_CONNECTION_TYPE_EAST_SHORT = "short";
|
||||
public const WALL_CONNECTION_TYPE_EAST_TALL = "tall";
|
||||
|
||||
public const WALL_CONNECTION_TYPE_NORTH_NONE = "none";
|
||||
public const WALL_CONNECTION_TYPE_NORTH_SHORT = "short";
|
||||
public const WALL_CONNECTION_TYPE_NORTH_TALL = "tall";
|
||||
|
||||
public const WALL_CONNECTION_TYPE_SOUTH_NONE = "none";
|
||||
public const WALL_CONNECTION_TYPE_SOUTH_SHORT = "short";
|
||||
public const WALL_CONNECTION_TYPE_SOUTH_TALL = "tall";
|
||||
|
||||
public const WALL_CONNECTION_TYPE_WEST_NONE = "none";
|
||||
public const WALL_CONNECTION_TYPE_WEST_SHORT = "short";
|
||||
public const WALL_CONNECTION_TYPE_WEST_TALL = "tall";
|
||||
|
||||
public const WOOD_TYPE_ACACIA = "acacia";
|
||||
public const WOOD_TYPE_BIRCH = "birch";
|
||||
public const WOOD_TYPE_DARK_OAK = "dark_oak";
|
||||
public const WOOD_TYPE_JUNGLE = "jungle";
|
||||
public const WOOD_TYPE_OAK = "oak";
|
||||
public const WOOD_TYPE_SPRUCE = "spruce";
|
||||
|
||||
}
|
769
src/data/bedrock/block/BlockTypeNames.php
Normal file
769
src/data/bedrock/block/BlockTypeNames.php
Normal file
@ -0,0 +1,769 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\data\bedrock\block;
|
||||
|
||||
/**
|
||||
* This class is generated automatically from the block palette for the current version. Do not edit it manually.
|
||||
*/
|
||||
final class BlockTypeNames{
|
||||
private function __construct(){
|
||||
//NOOP
|
||||
}
|
||||
|
||||
public const ACACIA_BUTTON = "minecraft:acacia_button";
|
||||
public const ACACIA_DOOR = "minecraft:acacia_door";
|
||||
public const ACACIA_FENCE_GATE = "minecraft:acacia_fence_gate";
|
||||
public const ACACIA_PRESSURE_PLATE = "minecraft:acacia_pressure_plate";
|
||||
public const ACACIA_STAIRS = "minecraft:acacia_stairs";
|
||||
public const ACACIA_STANDING_SIGN = "minecraft:acacia_standing_sign";
|
||||
public const ACACIA_TRAPDOOR = "minecraft:acacia_trapdoor";
|
||||
public const ACACIA_WALL_SIGN = "minecraft:acacia_wall_sign";
|
||||
public const ACTIVATOR_RAIL = "minecraft:activator_rail";
|
||||
public const AIR = "minecraft:air";
|
||||
public const ALLOW = "minecraft:allow";
|
||||
public const AMETHYST_BLOCK = "minecraft:amethyst_block";
|
||||
public const AMETHYST_CLUSTER = "minecraft:amethyst_cluster";
|
||||
public const ANCIENT_DEBRIS = "minecraft:ancient_debris";
|
||||
public const ANDESITE_STAIRS = "minecraft:andesite_stairs";
|
||||
public const ANVIL = "minecraft:anvil";
|
||||
public const AZALEA = "minecraft:azalea";
|
||||
public const AZALEA_LEAVES = "minecraft:azalea_leaves";
|
||||
public const AZALEA_LEAVES_FLOWERED = "minecraft:azalea_leaves_flowered";
|
||||
public const BAMBOO = "minecraft:bamboo";
|
||||
public const BAMBOO_SAPLING = "minecraft:bamboo_sapling";
|
||||
public const BARREL = "minecraft:barrel";
|
||||
public const BARRIER = "minecraft:barrier";
|
||||
public const BASALT = "minecraft:basalt";
|
||||
public const BEACON = "minecraft:beacon";
|
||||
public const BED = "minecraft:bed";
|
||||
public const BEDROCK = "minecraft:bedrock";
|
||||
public const BEE_NEST = "minecraft:bee_nest";
|
||||
public const BEEHIVE = "minecraft:beehive";
|
||||
public const BEETROOT = "minecraft:beetroot";
|
||||
public const BELL = "minecraft:bell";
|
||||
public const BIG_DRIPLEAF = "minecraft:big_dripleaf";
|
||||
public const BIRCH_BUTTON = "minecraft:birch_button";
|
||||
public const BIRCH_DOOR = "minecraft:birch_door";
|
||||
public const BIRCH_FENCE_GATE = "minecraft:birch_fence_gate";
|
||||
public const BIRCH_PRESSURE_PLATE = "minecraft:birch_pressure_plate";
|
||||
public const BIRCH_STAIRS = "minecraft:birch_stairs";
|
||||
public const BIRCH_STANDING_SIGN = "minecraft:birch_standing_sign";
|
||||
public const BIRCH_TRAPDOOR = "minecraft:birch_trapdoor";
|
||||
public const BIRCH_WALL_SIGN = "minecraft:birch_wall_sign";
|
||||
public const BLACK_CANDLE = "minecraft:black_candle";
|
||||
public const BLACK_CANDLE_CAKE = "minecraft:black_candle_cake";
|
||||
public const BLACK_GLAZED_TERRACOTTA = "minecraft:black_glazed_terracotta";
|
||||
public const BLACKSTONE = "minecraft:blackstone";
|
||||
public const BLACKSTONE_DOUBLE_SLAB = "minecraft:blackstone_double_slab";
|
||||
public const BLACKSTONE_SLAB = "minecraft:blackstone_slab";
|
||||
public const BLACKSTONE_STAIRS = "minecraft:blackstone_stairs";
|
||||
public const BLACKSTONE_WALL = "minecraft:blackstone_wall";
|
||||
public const BLAST_FURNACE = "minecraft:blast_furnace";
|
||||
public const BLUE_CANDLE = "minecraft:blue_candle";
|
||||
public const BLUE_CANDLE_CAKE = "minecraft:blue_candle_cake";
|
||||
public const BLUE_GLAZED_TERRACOTTA = "minecraft:blue_glazed_terracotta";
|
||||
public const BLUE_ICE = "minecraft:blue_ice";
|
||||
public const BONE_BLOCK = "minecraft:bone_block";
|
||||
public const BOOKSHELF = "minecraft:bookshelf";
|
||||
public const BORDER_BLOCK = "minecraft:border_block";
|
||||
public const BREWING_STAND = "minecraft:brewing_stand";
|
||||
public const BRICK_BLOCK = "minecraft:brick_block";
|
||||
public const BRICK_STAIRS = "minecraft:brick_stairs";
|
||||
public const BROWN_CANDLE = "minecraft:brown_candle";
|
||||
public const BROWN_CANDLE_CAKE = "minecraft:brown_candle_cake";
|
||||
public const BROWN_GLAZED_TERRACOTTA = "minecraft:brown_glazed_terracotta";
|
||||
public const BROWN_MUSHROOM = "minecraft:brown_mushroom";
|
||||
public const BROWN_MUSHROOM_BLOCK = "minecraft:brown_mushroom_block";
|
||||
public const BUBBLE_COLUMN = "minecraft:bubble_column";
|
||||
public const BUDDING_AMETHYST = "minecraft:budding_amethyst";
|
||||
public const CACTUS = "minecraft:cactus";
|
||||
public const CAKE = "minecraft:cake";
|
||||
public const CALCITE = "minecraft:calcite";
|
||||
public const CAMERA = "minecraft:camera";
|
||||
public const CAMPFIRE = "minecraft:campfire";
|
||||
public const CANDLE = "minecraft:candle";
|
||||
public const CANDLE_CAKE = "minecraft:candle_cake";
|
||||
public const CARPET = "minecraft:carpet";
|
||||
public const CARROTS = "minecraft:carrots";
|
||||
public const CARTOGRAPHY_TABLE = "minecraft:cartography_table";
|
||||
public const CARVED_PUMPKIN = "minecraft:carved_pumpkin";
|
||||
public const CAULDRON = "minecraft:cauldron";
|
||||
public const CAVE_VINES = "minecraft:cave_vines";
|
||||
public const CAVE_VINES_BODY_WITH_BERRIES = "minecraft:cave_vines_body_with_berries";
|
||||
public const CAVE_VINES_HEAD_WITH_BERRIES = "minecraft:cave_vines_head_with_berries";
|
||||
public const CHAIN = "minecraft:chain";
|
||||
public const CHAIN_COMMAND_BLOCK = "minecraft:chain_command_block";
|
||||
public const CHEMICAL_HEAT = "minecraft:chemical_heat";
|
||||
public const CHEMISTRY_TABLE = "minecraft:chemistry_table";
|
||||
public const CHEST = "minecraft:chest";
|
||||
public const CHISELED_DEEPSLATE = "minecraft:chiseled_deepslate";
|
||||
public const CHISELED_NETHER_BRICKS = "minecraft:chiseled_nether_bricks";
|
||||
public const CHISELED_POLISHED_BLACKSTONE = "minecraft:chiseled_polished_blackstone";
|
||||
public const CHORUS_FLOWER = "minecraft:chorus_flower";
|
||||
public const CHORUS_PLANT = "minecraft:chorus_plant";
|
||||
public const CLAY = "minecraft:clay";
|
||||
public const CLIENT_REQUEST_PLACEHOLDER_BLOCK = "minecraft:client_request_placeholder_block";
|
||||
public const COAL_BLOCK = "minecraft:coal_block";
|
||||
public const COAL_ORE = "minecraft:coal_ore";
|
||||
public const COBBLED_DEEPSLATE = "minecraft:cobbled_deepslate";
|
||||
public const COBBLED_DEEPSLATE_DOUBLE_SLAB = "minecraft:cobbled_deepslate_double_slab";
|
||||
public const COBBLED_DEEPSLATE_SLAB = "minecraft:cobbled_deepslate_slab";
|
||||
public const COBBLED_DEEPSLATE_STAIRS = "minecraft:cobbled_deepslate_stairs";
|
||||
public const COBBLED_DEEPSLATE_WALL = "minecraft:cobbled_deepslate_wall";
|
||||
public const COBBLESTONE = "minecraft:cobblestone";
|
||||
public const COBBLESTONE_WALL = "minecraft:cobblestone_wall";
|
||||
public const COCOA = "minecraft:cocoa";
|
||||
public const COLORED_TORCH_BP = "minecraft:colored_torch_bp";
|
||||
public const COLORED_TORCH_RG = "minecraft:colored_torch_rg";
|
||||
public const COMMAND_BLOCK = "minecraft:command_block";
|
||||
public const COMPOSTER = "minecraft:composter";
|
||||
public const CONCRETE = "minecraft:concrete";
|
||||
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";
|
||||
public const CORAL = "minecraft:coral";
|
||||
public const CORAL_BLOCK = "minecraft:coral_block";
|
||||
public const CORAL_FAN = "minecraft:coral_fan";
|
||||
public const CORAL_FAN_DEAD = "minecraft:coral_fan_dead";
|
||||
public const CORAL_FAN_HANG = "minecraft:coral_fan_hang";
|
||||
public const CORAL_FAN_HANG2 = "minecraft:coral_fan_hang2";
|
||||
public const CORAL_FAN_HANG3 = "minecraft:coral_fan_hang3";
|
||||
public const CRACKED_DEEPSLATE_BRICKS = "minecraft:cracked_deepslate_bricks";
|
||||
public const CRACKED_DEEPSLATE_TILES = "minecraft:cracked_deepslate_tiles";
|
||||
public const CRACKED_NETHER_BRICKS = "minecraft:cracked_nether_bricks";
|
||||
public const CRACKED_POLISHED_BLACKSTONE_BRICKS = "minecraft:cracked_polished_blackstone_bricks";
|
||||
public const CRAFTING_TABLE = "minecraft:crafting_table";
|
||||
public const CRIMSON_BUTTON = "minecraft:crimson_button";
|
||||
public const CRIMSON_DOOR = "minecraft:crimson_door";
|
||||
public const CRIMSON_DOUBLE_SLAB = "minecraft:crimson_double_slab";
|
||||
public const CRIMSON_FENCE = "minecraft:crimson_fence";
|
||||
public const CRIMSON_FENCE_GATE = "minecraft:crimson_fence_gate";
|
||||
public const CRIMSON_FUNGUS = "minecraft:crimson_fungus";
|
||||
public const CRIMSON_HYPHAE = "minecraft:crimson_hyphae";
|
||||
public const CRIMSON_NYLIUM = "minecraft:crimson_nylium";
|
||||
public const CRIMSON_PLANKS = "minecraft:crimson_planks";
|
||||
public const CRIMSON_PRESSURE_PLATE = "minecraft:crimson_pressure_plate";
|
||||
public const CRIMSON_ROOTS = "minecraft:crimson_roots";
|
||||
public const CRIMSON_SLAB = "minecraft:crimson_slab";
|
||||
public const CRIMSON_STAIRS = "minecraft:crimson_stairs";
|
||||
public const CRIMSON_STANDING_SIGN = "minecraft:crimson_standing_sign";
|
||||
public const CRIMSON_STEM = "minecraft:crimson_stem";
|
||||
public const CRIMSON_TRAPDOOR = "minecraft:crimson_trapdoor";
|
||||
public const CRIMSON_WALL_SIGN = "minecraft:crimson_wall_sign";
|
||||
public const CRYING_OBSIDIAN = "minecraft:crying_obsidian";
|
||||
public const CUT_COPPER = "minecraft:cut_copper";
|
||||
public const CUT_COPPER_SLAB = "minecraft:cut_copper_slab";
|
||||
public const CUT_COPPER_STAIRS = "minecraft:cut_copper_stairs";
|
||||
public const CYAN_CANDLE = "minecraft:cyan_candle";
|
||||
public const CYAN_CANDLE_CAKE = "minecraft:cyan_candle_cake";
|
||||
public const CYAN_GLAZED_TERRACOTTA = "minecraft:cyan_glazed_terracotta";
|
||||
public const DARK_OAK_BUTTON = "minecraft:dark_oak_button";
|
||||
public const DARK_OAK_DOOR = "minecraft:dark_oak_door";
|
||||
public const DARK_OAK_FENCE_GATE = "minecraft:dark_oak_fence_gate";
|
||||
public const DARK_OAK_PRESSURE_PLATE = "minecraft:dark_oak_pressure_plate";
|
||||
public const DARK_OAK_STAIRS = "minecraft:dark_oak_stairs";
|
||||
public const DARK_OAK_TRAPDOOR = "minecraft:dark_oak_trapdoor";
|
||||
public const DARK_PRISMARINE_STAIRS = "minecraft:dark_prismarine_stairs";
|
||||
public const DARKOAK_STANDING_SIGN = "minecraft:darkoak_standing_sign";
|
||||
public const DARKOAK_WALL_SIGN = "minecraft:darkoak_wall_sign";
|
||||
public const DAYLIGHT_DETECTOR = "minecraft:daylight_detector";
|
||||
public const DAYLIGHT_DETECTOR_INVERTED = "minecraft:daylight_detector_inverted";
|
||||
public const DEADBUSH = "minecraft:deadbush";
|
||||
public const DEEPSLATE = "minecraft:deepslate";
|
||||
public const DEEPSLATE_BRICK_DOUBLE_SLAB = "minecraft:deepslate_brick_double_slab";
|
||||
public const DEEPSLATE_BRICK_SLAB = "minecraft:deepslate_brick_slab";
|
||||
public const DEEPSLATE_BRICK_STAIRS = "minecraft:deepslate_brick_stairs";
|
||||
public const DEEPSLATE_BRICK_WALL = "minecraft:deepslate_brick_wall";
|
||||
public const DEEPSLATE_BRICKS = "minecraft:deepslate_bricks";
|
||||
public const DEEPSLATE_COAL_ORE = "minecraft:deepslate_coal_ore";
|
||||
public const DEEPSLATE_COPPER_ORE = "minecraft:deepslate_copper_ore";
|
||||
public const DEEPSLATE_DIAMOND_ORE = "minecraft:deepslate_diamond_ore";
|
||||
public const DEEPSLATE_EMERALD_ORE = "minecraft:deepslate_emerald_ore";
|
||||
public const DEEPSLATE_GOLD_ORE = "minecraft:deepslate_gold_ore";
|
||||
public const DEEPSLATE_IRON_ORE = "minecraft:deepslate_iron_ore";
|
||||
public const DEEPSLATE_LAPIS_ORE = "minecraft:deepslate_lapis_ore";
|
||||
public const DEEPSLATE_REDSTONE_ORE = "minecraft:deepslate_redstone_ore";
|
||||
public const DEEPSLATE_TILE_DOUBLE_SLAB = "minecraft:deepslate_tile_double_slab";
|
||||
public const DEEPSLATE_TILE_SLAB = "minecraft:deepslate_tile_slab";
|
||||
public const DEEPSLATE_TILE_STAIRS = "minecraft:deepslate_tile_stairs";
|
||||
public const DEEPSLATE_TILE_WALL = "minecraft:deepslate_tile_wall";
|
||||
public const DEEPSLATE_TILES = "minecraft:deepslate_tiles";
|
||||
public const DENY = "minecraft:deny";
|
||||
public const DETECTOR_RAIL = "minecraft:detector_rail";
|
||||
public const DIAMOND_BLOCK = "minecraft:diamond_block";
|
||||
public const DIAMOND_ORE = "minecraft:diamond_ore";
|
||||
public const DIORITE_STAIRS = "minecraft:diorite_stairs";
|
||||
public const DIRT = "minecraft:dirt";
|
||||
public const DIRT_WITH_ROOTS = "minecraft:dirt_with_roots";
|
||||
public const DISPENSER = "minecraft:dispenser";
|
||||
public const DOUBLE_CUT_COPPER_SLAB = "minecraft:double_cut_copper_slab";
|
||||
public const DOUBLE_PLANT = "minecraft:double_plant";
|
||||
public const DOUBLE_STONE_BLOCK_SLAB = "minecraft:double_stone_block_slab";
|
||||
public const DOUBLE_STONE_BLOCK_SLAB2 = "minecraft:double_stone_block_slab2";
|
||||
public const DOUBLE_STONE_BLOCK_SLAB3 = "minecraft:double_stone_block_slab3";
|
||||
public const DOUBLE_STONE_BLOCK_SLAB4 = "minecraft:double_stone_block_slab4";
|
||||
public const DOUBLE_WOODEN_SLAB = "minecraft:double_wooden_slab";
|
||||
public const DRAGON_EGG = "minecraft:dragon_egg";
|
||||
public const DRIED_KELP_BLOCK = "minecraft:dried_kelp_block";
|
||||
public const DRIPSTONE_BLOCK = "minecraft:dripstone_block";
|
||||
public const DROPPER = "minecraft:dropper";
|
||||
public const ELEMENT_0 = "minecraft:element_0";
|
||||
public const ELEMENT_1 = "minecraft:element_1";
|
||||
public const ELEMENT_10 = "minecraft:element_10";
|
||||
public const ELEMENT_100 = "minecraft:element_100";
|
||||
public const ELEMENT_101 = "minecraft:element_101";
|
||||
public const ELEMENT_102 = "minecraft:element_102";
|
||||
public const ELEMENT_103 = "minecraft:element_103";
|
||||
public const ELEMENT_104 = "minecraft:element_104";
|
||||
public const ELEMENT_105 = "minecraft:element_105";
|
||||
public const ELEMENT_106 = "minecraft:element_106";
|
||||
public const ELEMENT_107 = "minecraft:element_107";
|
||||
public const ELEMENT_108 = "minecraft:element_108";
|
||||
public const ELEMENT_109 = "minecraft:element_109";
|
||||
public const ELEMENT_11 = "minecraft:element_11";
|
||||
public const ELEMENT_110 = "minecraft:element_110";
|
||||
public const ELEMENT_111 = "minecraft:element_111";
|
||||
public const ELEMENT_112 = "minecraft:element_112";
|
||||
public const ELEMENT_113 = "minecraft:element_113";
|
||||
public const ELEMENT_114 = "minecraft:element_114";
|
||||
public const ELEMENT_115 = "minecraft:element_115";
|
||||
public const ELEMENT_116 = "minecraft:element_116";
|
||||
public const ELEMENT_117 = "minecraft:element_117";
|
||||
public const ELEMENT_118 = "minecraft:element_118";
|
||||
public const ELEMENT_12 = "minecraft:element_12";
|
||||
public const ELEMENT_13 = "minecraft:element_13";
|
||||
public const ELEMENT_14 = "minecraft:element_14";
|
||||
public const ELEMENT_15 = "minecraft:element_15";
|
||||
public const ELEMENT_16 = "minecraft:element_16";
|
||||
public const ELEMENT_17 = "minecraft:element_17";
|
||||
public const ELEMENT_18 = "minecraft:element_18";
|
||||
public const ELEMENT_19 = "minecraft:element_19";
|
||||
public const ELEMENT_2 = "minecraft:element_2";
|
||||
public const ELEMENT_20 = "minecraft:element_20";
|
||||
public const ELEMENT_21 = "minecraft:element_21";
|
||||
public const ELEMENT_22 = "minecraft:element_22";
|
||||
public const ELEMENT_23 = "minecraft:element_23";
|
||||
public const ELEMENT_24 = "minecraft:element_24";
|
||||
public const ELEMENT_25 = "minecraft:element_25";
|
||||
public const ELEMENT_26 = "minecraft:element_26";
|
||||
public const ELEMENT_27 = "minecraft:element_27";
|
||||
public const ELEMENT_28 = "minecraft:element_28";
|
||||
public const ELEMENT_29 = "minecraft:element_29";
|
||||
public const ELEMENT_3 = "minecraft:element_3";
|
||||
public const ELEMENT_30 = "minecraft:element_30";
|
||||
public const ELEMENT_31 = "minecraft:element_31";
|
||||
public const ELEMENT_32 = "minecraft:element_32";
|
||||
public const ELEMENT_33 = "minecraft:element_33";
|
||||
public const ELEMENT_34 = "minecraft:element_34";
|
||||
public const ELEMENT_35 = "minecraft:element_35";
|
||||
public const ELEMENT_36 = "minecraft:element_36";
|
||||
public const ELEMENT_37 = "minecraft:element_37";
|
||||
public const ELEMENT_38 = "minecraft:element_38";
|
||||
public const ELEMENT_39 = "minecraft:element_39";
|
||||
public const ELEMENT_4 = "minecraft:element_4";
|
||||
public const ELEMENT_40 = "minecraft:element_40";
|
||||
public const ELEMENT_41 = "minecraft:element_41";
|
||||
public const ELEMENT_42 = "minecraft:element_42";
|
||||
public const ELEMENT_43 = "minecraft:element_43";
|
||||
public const ELEMENT_44 = "minecraft:element_44";
|
||||
public const ELEMENT_45 = "minecraft:element_45";
|
||||
public const ELEMENT_46 = "minecraft:element_46";
|
||||
public const ELEMENT_47 = "minecraft:element_47";
|
||||
public const ELEMENT_48 = "minecraft:element_48";
|
||||
public const ELEMENT_49 = "minecraft:element_49";
|
||||
public const ELEMENT_5 = "minecraft:element_5";
|
||||
public const ELEMENT_50 = "minecraft:element_50";
|
||||
public const ELEMENT_51 = "minecraft:element_51";
|
||||
public const ELEMENT_52 = "minecraft:element_52";
|
||||
public const ELEMENT_53 = "minecraft:element_53";
|
||||
public const ELEMENT_54 = "minecraft:element_54";
|
||||
public const ELEMENT_55 = "minecraft:element_55";
|
||||
public const ELEMENT_56 = "minecraft:element_56";
|
||||
public const ELEMENT_57 = "minecraft:element_57";
|
||||
public const ELEMENT_58 = "minecraft:element_58";
|
||||
public const ELEMENT_59 = "minecraft:element_59";
|
||||
public const ELEMENT_6 = "minecraft:element_6";
|
||||
public const ELEMENT_60 = "minecraft:element_60";
|
||||
public const ELEMENT_61 = "minecraft:element_61";
|
||||
public const ELEMENT_62 = "minecraft:element_62";
|
||||
public const ELEMENT_63 = "minecraft:element_63";
|
||||
public const ELEMENT_64 = "minecraft:element_64";
|
||||
public const ELEMENT_65 = "minecraft:element_65";
|
||||
public const ELEMENT_66 = "minecraft:element_66";
|
||||
public const ELEMENT_67 = "minecraft:element_67";
|
||||
public const ELEMENT_68 = "minecraft:element_68";
|
||||
public const ELEMENT_69 = "minecraft:element_69";
|
||||
public const ELEMENT_7 = "minecraft:element_7";
|
||||
public const ELEMENT_70 = "minecraft:element_70";
|
||||
public const ELEMENT_71 = "minecraft:element_71";
|
||||
public const ELEMENT_72 = "minecraft:element_72";
|
||||
public const ELEMENT_73 = "minecraft:element_73";
|
||||
public const ELEMENT_74 = "minecraft:element_74";
|
||||
public const ELEMENT_75 = "minecraft:element_75";
|
||||
public const ELEMENT_76 = "minecraft:element_76";
|
||||
public const ELEMENT_77 = "minecraft:element_77";
|
||||
public const ELEMENT_78 = "minecraft:element_78";
|
||||
public const ELEMENT_79 = "minecraft:element_79";
|
||||
public const ELEMENT_8 = "minecraft:element_8";
|
||||
public const ELEMENT_80 = "minecraft:element_80";
|
||||
public const ELEMENT_81 = "minecraft:element_81";
|
||||
public const ELEMENT_82 = "minecraft:element_82";
|
||||
public const ELEMENT_83 = "minecraft:element_83";
|
||||
public const ELEMENT_84 = "minecraft:element_84";
|
||||
public const ELEMENT_85 = "minecraft:element_85";
|
||||
public const ELEMENT_86 = "minecraft:element_86";
|
||||
public const ELEMENT_87 = "minecraft:element_87";
|
||||
public const ELEMENT_88 = "minecraft:element_88";
|
||||
public const ELEMENT_89 = "minecraft:element_89";
|
||||
public const ELEMENT_9 = "minecraft:element_9";
|
||||
public const ELEMENT_90 = "minecraft:element_90";
|
||||
public const ELEMENT_91 = "minecraft:element_91";
|
||||
public const ELEMENT_92 = "minecraft:element_92";
|
||||
public const ELEMENT_93 = "minecraft:element_93";
|
||||
public const ELEMENT_94 = "minecraft:element_94";
|
||||
public const ELEMENT_95 = "minecraft:element_95";
|
||||
public const ELEMENT_96 = "minecraft:element_96";
|
||||
public const ELEMENT_97 = "minecraft:element_97";
|
||||
public const ELEMENT_98 = "minecraft:element_98";
|
||||
public const ELEMENT_99 = "minecraft:element_99";
|
||||
public const EMERALD_BLOCK = "minecraft:emerald_block";
|
||||
public const EMERALD_ORE = "minecraft:emerald_ore";
|
||||
public const ENCHANTING_TABLE = "minecraft:enchanting_table";
|
||||
public const END_BRICK_STAIRS = "minecraft:end_brick_stairs";
|
||||
public const END_BRICKS = "minecraft:end_bricks";
|
||||
public const END_GATEWAY = "minecraft:end_gateway";
|
||||
public const END_PORTAL = "minecraft:end_portal";
|
||||
public const END_PORTAL_FRAME = "minecraft:end_portal_frame";
|
||||
public const END_ROD = "minecraft:end_rod";
|
||||
public const END_STONE = "minecraft:end_stone";
|
||||
public const ENDER_CHEST = "minecraft:ender_chest";
|
||||
public const EXPOSED_COPPER = "minecraft:exposed_copper";
|
||||
public const EXPOSED_CUT_COPPER = "minecraft:exposed_cut_copper";
|
||||
public const EXPOSED_CUT_COPPER_SLAB = "minecraft:exposed_cut_copper_slab";
|
||||
public const EXPOSED_CUT_COPPER_STAIRS = "minecraft:exposed_cut_copper_stairs";
|
||||
public const EXPOSED_DOUBLE_CUT_COPPER_SLAB = "minecraft:exposed_double_cut_copper_slab";
|
||||
public const FARMLAND = "minecraft:farmland";
|
||||
public const FENCE = "minecraft:fence";
|
||||
public const FENCE_GATE = "minecraft:fence_gate";
|
||||
public const FIRE = "minecraft:fire";
|
||||
public const FLETCHING_TABLE = "minecraft:fletching_table";
|
||||
public const FLOWER_POT = "minecraft:flower_pot";
|
||||
public const FLOWERING_AZALEA = "minecraft:flowering_azalea";
|
||||
public const FLOWING_LAVA = "minecraft:flowing_lava";
|
||||
public const FLOWING_WATER = "minecraft:flowing_water";
|
||||
public const FRAME = "minecraft:frame";
|
||||
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";
|
||||
public const GLASS = "minecraft:glass";
|
||||
public const GLASS_PANE = "minecraft:glass_pane";
|
||||
public const GLOW_FRAME = "minecraft:glow_frame";
|
||||
public const GLOW_LICHEN = "minecraft:glow_lichen";
|
||||
public const GLOWINGOBSIDIAN = "minecraft:glowingobsidian";
|
||||
public const GLOWSTONE = "minecraft:glowstone";
|
||||
public const GOLD_BLOCK = "minecraft:gold_block";
|
||||
public const GOLD_ORE = "minecraft:gold_ore";
|
||||
public const GOLDEN_RAIL = "minecraft:golden_rail";
|
||||
public const GRANITE_STAIRS = "minecraft:granite_stairs";
|
||||
public const GRASS = "minecraft:grass";
|
||||
public const GRASS_PATH = "minecraft:grass_path";
|
||||
public const GRAVEL = "minecraft:gravel";
|
||||
public const GRAY_CANDLE = "minecraft:gray_candle";
|
||||
public const GRAY_CANDLE_CAKE = "minecraft:gray_candle_cake";
|
||||
public const GRAY_GLAZED_TERRACOTTA = "minecraft:gray_glazed_terracotta";
|
||||
public const GREEN_CANDLE = "minecraft:green_candle";
|
||||
public const GREEN_CANDLE_CAKE = "minecraft:green_candle_cake";
|
||||
public const GREEN_GLAZED_TERRACOTTA = "minecraft:green_glazed_terracotta";
|
||||
public const GRINDSTONE = "minecraft:grindstone";
|
||||
public const HANGING_ROOTS = "minecraft:hanging_roots";
|
||||
public const HARD_GLASS = "minecraft:hard_glass";
|
||||
public const HARD_GLASS_PANE = "minecraft:hard_glass_pane";
|
||||
public const HARD_STAINED_GLASS = "minecraft:hard_stained_glass";
|
||||
public const HARD_STAINED_GLASS_PANE = "minecraft:hard_stained_glass_pane";
|
||||
public const HARDENED_CLAY = "minecraft:hardened_clay";
|
||||
public const HAY_BLOCK = "minecraft:hay_block";
|
||||
public const HEAVY_WEIGHTED_PRESSURE_PLATE = "minecraft:heavy_weighted_pressure_plate";
|
||||
public const HONEY_BLOCK = "minecraft:honey_block";
|
||||
public const HONEYCOMB_BLOCK = "minecraft:honeycomb_block";
|
||||
public const HOPPER = "minecraft:hopper";
|
||||
public const ICE = "minecraft:ice";
|
||||
public const INFESTED_DEEPSLATE = "minecraft:infested_deepslate";
|
||||
public const INFO_UPDATE = "minecraft:info_update";
|
||||
public const INFO_UPDATE2 = "minecraft:info_update2";
|
||||
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";
|
||||
public const IRON_ORE = "minecraft:iron_ore";
|
||||
public const IRON_TRAPDOOR = "minecraft:iron_trapdoor";
|
||||
public const JIGSAW = "minecraft:jigsaw";
|
||||
public const JUKEBOX = "minecraft:jukebox";
|
||||
public const JUNGLE_BUTTON = "minecraft:jungle_button";
|
||||
public const JUNGLE_DOOR = "minecraft:jungle_door";
|
||||
public const JUNGLE_FENCE_GATE = "minecraft:jungle_fence_gate";
|
||||
public const JUNGLE_PRESSURE_PLATE = "minecraft:jungle_pressure_plate";
|
||||
public const JUNGLE_STAIRS = "minecraft:jungle_stairs";
|
||||
public const JUNGLE_STANDING_SIGN = "minecraft:jungle_standing_sign";
|
||||
public const JUNGLE_TRAPDOOR = "minecraft:jungle_trapdoor";
|
||||
public const JUNGLE_WALL_SIGN = "minecraft:jungle_wall_sign";
|
||||
public const KELP = "minecraft:kelp";
|
||||
public const LADDER = "minecraft:ladder";
|
||||
public const LANTERN = "minecraft:lantern";
|
||||
public const LAPIS_BLOCK = "minecraft:lapis_block";
|
||||
public const LAPIS_ORE = "minecraft:lapis_ore";
|
||||
public const LARGE_AMETHYST_BUD = "minecraft:large_amethyst_bud";
|
||||
public const LAVA = "minecraft:lava";
|
||||
public const LAVA_CAULDRON = "minecraft:lava_cauldron";
|
||||
public const LEAVES = "minecraft:leaves";
|
||||
public const LEAVES2 = "minecraft:leaves2";
|
||||
public const LECTERN = "minecraft:lectern";
|
||||
public const LEVER = "minecraft:lever";
|
||||
public const LIGHT_BLOCK = "minecraft:light_block";
|
||||
public const LIGHT_BLUE_CANDLE = "minecraft:light_blue_candle";
|
||||
public const LIGHT_BLUE_CANDLE_CAKE = "minecraft:light_blue_candle_cake";
|
||||
public const LIGHT_BLUE_GLAZED_TERRACOTTA = "minecraft:light_blue_glazed_terracotta";
|
||||
public const LIGHT_GRAY_CANDLE = "minecraft:light_gray_candle";
|
||||
public const LIGHT_GRAY_CANDLE_CAKE = "minecraft:light_gray_candle_cake";
|
||||
public const LIGHT_WEIGHTED_PRESSURE_PLATE = "minecraft:light_weighted_pressure_plate";
|
||||
public const LIGHTNING_ROD = "minecraft:lightning_rod";
|
||||
public const LIME_CANDLE = "minecraft:lime_candle";
|
||||
public const LIME_CANDLE_CAKE = "minecraft:lime_candle_cake";
|
||||
public const LIME_GLAZED_TERRACOTTA = "minecraft:lime_glazed_terracotta";
|
||||
public const LIT_BLAST_FURNACE = "minecraft:lit_blast_furnace";
|
||||
public const LIT_DEEPSLATE_REDSTONE_ORE = "minecraft:lit_deepslate_redstone_ore";
|
||||
public const LIT_FURNACE = "minecraft:lit_furnace";
|
||||
public const LIT_PUMPKIN = "minecraft:lit_pumpkin";
|
||||
public const LIT_REDSTONE_LAMP = "minecraft:lit_redstone_lamp";
|
||||
public const LIT_REDSTONE_ORE = "minecraft:lit_redstone_ore";
|
||||
public const LIT_SMOKER = "minecraft:lit_smoker";
|
||||
public const LODESTONE = "minecraft:lodestone";
|
||||
public const LOG = "minecraft:log";
|
||||
public const LOG2 = "minecraft:log2";
|
||||
public const LOOM = "minecraft:loom";
|
||||
public const MAGENTA_CANDLE = "minecraft:magenta_candle";
|
||||
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_BUTTON = "minecraft:mangrove_button";
|
||||
public const MANGROVE_DOOR = "minecraft:mangrove_door";
|
||||
public const MANGROVE_DOUBLE_SLAB = "minecraft:mangrove_double_slab";
|
||||
public const MANGROVE_FENCE = "minecraft:mangrove_fence";
|
||||
public const MANGROVE_FENCE_GATE = "minecraft:mangrove_fence_gate";
|
||||
public const MANGROVE_LEAVES = "minecraft:mangrove_leaves";
|
||||
public const MANGROVE_LOG = "minecraft:mangrove_log";
|
||||
public const MANGROVE_PLANKS = "minecraft:mangrove_planks";
|
||||
public const MANGROVE_PRESSURE_PLATE = "minecraft:mangrove_pressure_plate";
|
||||
public const MANGROVE_PROPAGULE = "minecraft:mangrove_propagule";
|
||||
public const MANGROVE_ROOTS = "minecraft:mangrove_roots";
|
||||
public const MANGROVE_SLAB = "minecraft:mangrove_slab";
|
||||
public const MANGROVE_STAIRS = "minecraft:mangrove_stairs";
|
||||
public const MANGROVE_STANDING_SIGN = "minecraft:mangrove_standing_sign";
|
||||
public const MANGROVE_TRAPDOOR = "minecraft:mangrove_trapdoor";
|
||||
public const MANGROVE_WALL_SIGN = "minecraft:mangrove_wall_sign";
|
||||
public const MANGROVE_WOOD = "minecraft:mangrove_wood";
|
||||
public const MEDIUM_AMETHYST_BUD = "minecraft:medium_amethyst_bud";
|
||||
public const MELON_BLOCK = "minecraft:melon_block";
|
||||
public const MELON_STEM = "minecraft:melon_stem";
|
||||
public const MOB_SPAWNER = "minecraft:mob_spawner";
|
||||
public const MONSTER_EGG = "minecraft:monster_egg";
|
||||
public const MOSS_BLOCK = "minecraft:moss_block";
|
||||
public const MOSS_CARPET = "minecraft:moss_carpet";
|
||||
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 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 MUDDY_MANGROVE_ROOTS = "minecraft:muddy_mangrove_roots";
|
||||
public const MYCELIUM = "minecraft:mycelium";
|
||||
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";
|
||||
public const NETHER_GOLD_ORE = "minecraft:nether_gold_ore";
|
||||
public const NETHER_SPROUTS = "minecraft:nether_sprouts";
|
||||
public const NETHER_WART = "minecraft:nether_wart";
|
||||
public const NETHER_WART_BLOCK = "minecraft:nether_wart_block";
|
||||
public const NETHERITE_BLOCK = "minecraft:netherite_block";
|
||||
public const NETHERRACK = "minecraft:netherrack";
|
||||
public const NETHERREACTOR = "minecraft:netherreactor";
|
||||
public const NORMAL_STONE_STAIRS = "minecraft:normal_stone_stairs";
|
||||
public const NOTEBLOCK = "minecraft:noteblock";
|
||||
public const OAK_STAIRS = "minecraft:oak_stairs";
|
||||
public const OBSERVER = "minecraft:observer";
|
||||
public const OBSIDIAN = "minecraft:obsidian";
|
||||
public const OCHRE_FROGLIGHT = "minecraft:ochre_froglight";
|
||||
public const ORANGE_CANDLE = "minecraft:orange_candle";
|
||||
public const ORANGE_CANDLE_CAKE = "minecraft:orange_candle_cake";
|
||||
public const ORANGE_GLAZED_TERRACOTTA = "minecraft:orange_glazed_terracotta";
|
||||
public const OXIDIZED_COPPER = "minecraft:oxidized_copper";
|
||||
public const OXIDIZED_CUT_COPPER = "minecraft:oxidized_cut_copper";
|
||||
public const OXIDIZED_CUT_COPPER_SLAB = "minecraft:oxidized_cut_copper_slab";
|
||||
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 PISTON_ARM_COLLISION = "minecraft:piston_arm_collision";
|
||||
public const PLANKS = "minecraft:planks";
|
||||
public const PODZOL = "minecraft:podzol";
|
||||
public const POINTED_DRIPSTONE = "minecraft:pointed_dripstone";
|
||||
public const POLISHED_ANDESITE_STAIRS = "minecraft:polished_andesite_stairs";
|
||||
public const POLISHED_BASALT = "minecraft:polished_basalt";
|
||||
public const POLISHED_BLACKSTONE = "minecraft:polished_blackstone";
|
||||
public const POLISHED_BLACKSTONE_BRICK_DOUBLE_SLAB = "minecraft:polished_blackstone_brick_double_slab";
|
||||
public const POLISHED_BLACKSTONE_BRICK_SLAB = "minecraft:polished_blackstone_brick_slab";
|
||||
public const POLISHED_BLACKSTONE_BRICK_STAIRS = "minecraft:polished_blackstone_brick_stairs";
|
||||
public const POLISHED_BLACKSTONE_BRICK_WALL = "minecraft:polished_blackstone_brick_wall";
|
||||
public const POLISHED_BLACKSTONE_BRICKS = "minecraft:polished_blackstone_bricks";
|
||||
public const POLISHED_BLACKSTONE_BUTTON = "minecraft:polished_blackstone_button";
|
||||
public const POLISHED_BLACKSTONE_DOUBLE_SLAB = "minecraft:polished_blackstone_double_slab";
|
||||
public const POLISHED_BLACKSTONE_PRESSURE_PLATE = "minecraft:polished_blackstone_pressure_plate";
|
||||
public const POLISHED_BLACKSTONE_SLAB = "minecraft:polished_blackstone_slab";
|
||||
public const POLISHED_BLACKSTONE_STAIRS = "minecraft:polished_blackstone_stairs";
|
||||
public const POLISHED_BLACKSTONE_WALL = "minecraft:polished_blackstone_wall";
|
||||
public const POLISHED_DEEPSLATE = "minecraft:polished_deepslate";
|
||||
public const POLISHED_DEEPSLATE_DOUBLE_SLAB = "minecraft:polished_deepslate_double_slab";
|
||||
public const POLISHED_DEEPSLATE_SLAB = "minecraft:polished_deepslate_slab";
|
||||
public const POLISHED_DEEPSLATE_STAIRS = "minecraft:polished_deepslate_stairs";
|
||||
public const POLISHED_DEEPSLATE_WALL = "minecraft:polished_deepslate_wall";
|
||||
public const POLISHED_DIORITE_STAIRS = "minecraft:polished_diorite_stairs";
|
||||
public const POLISHED_GRANITE_STAIRS = "minecraft:polished_granite_stairs";
|
||||
public const PORTAL = "minecraft:portal";
|
||||
public const POTATOES = "minecraft:potatoes";
|
||||
public const POWDER_SNOW = "minecraft:powder_snow";
|
||||
public const POWERED_COMPARATOR = "minecraft:powered_comparator";
|
||||
public const POWERED_REPEATER = "minecraft:powered_repeater";
|
||||
public const PRISMARINE = "minecraft:prismarine";
|
||||
public const PRISMARINE_BRICKS_STAIRS = "minecraft:prismarine_bricks_stairs";
|
||||
public const PRISMARINE_STAIRS = "minecraft:prismarine_stairs";
|
||||
public const PUMPKIN = "minecraft:pumpkin";
|
||||
public const PUMPKIN_STEM = "minecraft:pumpkin_stem";
|
||||
public const PURPLE_CANDLE = "minecraft:purple_candle";
|
||||
public const PURPLE_CANDLE_CAKE = "minecraft:purple_candle_cake";
|
||||
public const PURPLE_GLAZED_TERRACOTTA = "minecraft:purple_glazed_terracotta";
|
||||
public const PURPUR_BLOCK = "minecraft:purpur_block";
|
||||
public const PURPUR_STAIRS = "minecraft:purpur_stairs";
|
||||
public const QUARTZ_BLOCK = "minecraft:quartz_block";
|
||||
public const QUARTZ_BRICKS = "minecraft:quartz_bricks";
|
||||
public const QUARTZ_ORE = "minecraft:quartz_ore";
|
||||
public const QUARTZ_STAIRS = "minecraft:quartz_stairs";
|
||||
public const RAIL = "minecraft:rail";
|
||||
public const RAW_COPPER_BLOCK = "minecraft:raw_copper_block";
|
||||
public const RAW_GOLD_BLOCK = "minecraft:raw_gold_block";
|
||||
public const RAW_IRON_BLOCK = "minecraft:raw_iron_block";
|
||||
public const RED_CANDLE = "minecraft:red_candle";
|
||||
public const RED_CANDLE_CAKE = "minecraft:red_candle_cake";
|
||||
public const RED_FLOWER = "minecraft:red_flower";
|
||||
public const RED_GLAZED_TERRACOTTA = "minecraft:red_glazed_terracotta";
|
||||
public const RED_MUSHROOM = "minecraft:red_mushroom";
|
||||
public const RED_MUSHROOM_BLOCK = "minecraft:red_mushroom_block";
|
||||
public const RED_NETHER_BRICK = "minecraft:red_nether_brick";
|
||||
public const RED_NETHER_BRICK_STAIRS = "minecraft:red_nether_brick_stairs";
|
||||
public const RED_SANDSTONE = "minecraft:red_sandstone";
|
||||
public const RED_SANDSTONE_STAIRS = "minecraft:red_sandstone_stairs";
|
||||
public const REDSTONE_BLOCK = "minecraft:redstone_block";
|
||||
public const REDSTONE_LAMP = "minecraft:redstone_lamp";
|
||||
public const REDSTONE_ORE = "minecraft:redstone_ore";
|
||||
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";
|
||||
public const SAND = "minecraft:sand";
|
||||
public const SANDSTONE = "minecraft:sandstone";
|
||||
public const SANDSTONE_STAIRS = "minecraft:sandstone_stairs";
|
||||
public const SAPLING = "minecraft:sapling";
|
||||
public const SCAFFOLDING = "minecraft:scaffolding";
|
||||
public const SCULK = "minecraft:sculk";
|
||||
public const SCULK_CATALYST = "minecraft:sculk_catalyst";
|
||||
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 SHROOMLIGHT = "minecraft:shroomlight";
|
||||
public const SHULKER_BOX = "minecraft:shulker_box";
|
||||
public const SILVER_GLAZED_TERRACOTTA = "minecraft:silver_glazed_terracotta";
|
||||
public const SKULL = "minecraft:skull";
|
||||
public const SLIME = "minecraft:slime";
|
||||
public const SMALL_AMETHYST_BUD = "minecraft:small_amethyst_bud";
|
||||
public const SMALL_DRIPLEAF_BLOCK = "minecraft:small_dripleaf_block";
|
||||
public const SMITHING_TABLE = "minecraft:smithing_table";
|
||||
public const SMOKER = "minecraft:smoker";
|
||||
public const SMOOTH_BASALT = "minecraft:smooth_basalt";
|
||||
public const SMOOTH_QUARTZ_STAIRS = "minecraft:smooth_quartz_stairs";
|
||||
public const SMOOTH_RED_SANDSTONE_STAIRS = "minecraft:smooth_red_sandstone_stairs";
|
||||
public const SMOOTH_SANDSTONE_STAIRS = "minecraft:smooth_sandstone_stairs";
|
||||
public const SMOOTH_STONE = "minecraft:smooth_stone";
|
||||
public const SNOW = "minecraft:snow";
|
||||
public const SNOW_LAYER = "minecraft:snow_layer";
|
||||
public const SOUL_CAMPFIRE = "minecraft:soul_campfire";
|
||||
public const SOUL_FIRE = "minecraft:soul_fire";
|
||||
public const SOUL_LANTERN = "minecraft:soul_lantern";
|
||||
public const SOUL_SAND = "minecraft:soul_sand";
|
||||
public const SOUL_SOIL = "minecraft:soul_soil";
|
||||
public const SOUL_TORCH = "minecraft:soul_torch";
|
||||
public const SPONGE = "minecraft:sponge";
|
||||
public const SPORE_BLOSSOM = "minecraft:spore_blossom";
|
||||
public const SPRUCE_BUTTON = "minecraft:spruce_button";
|
||||
public const SPRUCE_DOOR = "minecraft:spruce_door";
|
||||
public const SPRUCE_FENCE_GATE = "minecraft:spruce_fence_gate";
|
||||
public const SPRUCE_PRESSURE_PLATE = "minecraft:spruce_pressure_plate";
|
||||
public const SPRUCE_STAIRS = "minecraft:spruce_stairs";
|
||||
public const SPRUCE_STANDING_SIGN = "minecraft:spruce_standing_sign";
|
||||
public const SPRUCE_TRAPDOOR = "minecraft:spruce_trapdoor";
|
||||
public const SPRUCE_WALL_SIGN = "minecraft:spruce_wall_sign";
|
||||
public const STAINED_GLASS = "minecraft:stained_glass";
|
||||
public const STAINED_GLASS_PANE = "minecraft:stained_glass_pane";
|
||||
public const STAINED_HARDENED_CLAY = "minecraft:stained_hardened_clay";
|
||||
public const STANDING_BANNER = "minecraft:standing_banner";
|
||||
public const STANDING_SIGN = "minecraft:standing_sign";
|
||||
public const STICKY_PISTON = "minecraft:sticky_piston";
|
||||
public const STICKY_PISTON_ARM_COLLISION = "minecraft:sticky_piston_arm_collision";
|
||||
public const STONE = "minecraft:stone";
|
||||
public const STONE_BLOCK_SLAB = "minecraft:stone_block_slab";
|
||||
public const STONE_BLOCK_SLAB2 = "minecraft:stone_block_slab2";
|
||||
public const STONE_BLOCK_SLAB3 = "minecraft:stone_block_slab3";
|
||||
public const STONE_BLOCK_SLAB4 = "minecraft:stone_block_slab4";
|
||||
public const STONE_BRICK_STAIRS = "minecraft:stone_brick_stairs";
|
||||
public const STONE_BUTTON = "minecraft:stone_button";
|
||||
public const STONE_PRESSURE_PLATE = "minecraft:stone_pressure_plate";
|
||||
public const STONE_STAIRS = "minecraft:stone_stairs";
|
||||
public const STONEBRICK = "minecraft:stonebrick";
|
||||
public const STONECUTTER = "minecraft:stonecutter";
|
||||
public const STONECUTTER_BLOCK = "minecraft:stonecutter_block";
|
||||
public const STRIPPED_ACACIA_LOG = "minecraft:stripped_acacia_log";
|
||||
public const STRIPPED_BIRCH_LOG = "minecraft:stripped_birch_log";
|
||||
public const STRIPPED_CRIMSON_HYPHAE = "minecraft:stripped_crimson_hyphae";
|
||||
public const STRIPPED_CRIMSON_STEM = "minecraft:stripped_crimson_stem";
|
||||
public const STRIPPED_DARK_OAK_LOG = "minecraft:stripped_dark_oak_log";
|
||||
public const STRIPPED_JUNGLE_LOG = "minecraft:stripped_jungle_log";
|
||||
public const STRIPPED_MANGROVE_LOG = "minecraft:stripped_mangrove_log";
|
||||
public const STRIPPED_MANGROVE_WOOD = "minecraft:stripped_mangrove_wood";
|
||||
public const STRIPPED_OAK_LOG = "minecraft:stripped_oak_log";
|
||||
public const STRIPPED_SPRUCE_LOG = "minecraft:stripped_spruce_log";
|
||||
public const STRIPPED_WARPED_HYPHAE = "minecraft:stripped_warped_hyphae";
|
||||
public const STRIPPED_WARPED_STEM = "minecraft:stripped_warped_stem";
|
||||
public const STRUCTURE_BLOCK = "minecraft:structure_block";
|
||||
public const STRUCTURE_VOID = "minecraft:structure_void";
|
||||
public const SWEET_BERRY_BUSH = "minecraft:sweet_berry_bush";
|
||||
public const TALLGRASS = "minecraft:tallgrass";
|
||||
public const TARGET = "minecraft:target";
|
||||
public const TINTED_GLASS = "minecraft:tinted_glass";
|
||||
public const TNT = "minecraft:tnt";
|
||||
public const TORCH = "minecraft:torch";
|
||||
public const TRAPDOOR = "minecraft:trapdoor";
|
||||
public const TRAPPED_CHEST = "minecraft:trapped_chest";
|
||||
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";
|
||||
public const TWISTING_VINES = "minecraft:twisting_vines";
|
||||
public const UNDERWATER_TORCH = "minecraft:underwater_torch";
|
||||
public const UNDYED_SHULKER_BOX = "minecraft:undyed_shulker_box";
|
||||
public const UNKNOWN = "minecraft:unknown";
|
||||
public const UNLIT_REDSTONE_TORCH = "minecraft:unlit_redstone_torch";
|
||||
public const UNPOWERED_COMPARATOR = "minecraft:unpowered_comparator";
|
||||
public const UNPOWERED_REPEATER = "minecraft:unpowered_repeater";
|
||||
public const VERDANT_FROGLIGHT = "minecraft:verdant_froglight";
|
||||
public const VINE = "minecraft:vine";
|
||||
public const WALL_BANNER = "minecraft:wall_banner";
|
||||
public const WALL_SIGN = "minecraft:wall_sign";
|
||||
public const WARPED_BUTTON = "minecraft:warped_button";
|
||||
public const WARPED_DOOR = "minecraft:warped_door";
|
||||
public const WARPED_DOUBLE_SLAB = "minecraft:warped_double_slab";
|
||||
public const WARPED_FENCE = "minecraft:warped_fence";
|
||||
public const WARPED_FENCE_GATE = "minecraft:warped_fence_gate";
|
||||
public const WARPED_FUNGUS = "minecraft:warped_fungus";
|
||||
public const WARPED_HYPHAE = "minecraft:warped_hyphae";
|
||||
public const WARPED_NYLIUM = "minecraft:warped_nylium";
|
||||
public const WARPED_PLANKS = "minecraft:warped_planks";
|
||||
public const WARPED_PRESSURE_PLATE = "minecraft:warped_pressure_plate";
|
||||
public const WARPED_ROOTS = "minecraft:warped_roots";
|
||||
public const WARPED_SLAB = "minecraft:warped_slab";
|
||||
public const WARPED_STAIRS = "minecraft:warped_stairs";
|
||||
public const WARPED_STANDING_SIGN = "minecraft:warped_standing_sign";
|
||||
public const WARPED_STEM = "minecraft:warped_stem";
|
||||
public const WARPED_TRAPDOOR = "minecraft:warped_trapdoor";
|
||||
public const WARPED_WALL_SIGN = "minecraft:warped_wall_sign";
|
||||
public const WARPED_WART_BLOCK = "minecraft:warped_wart_block";
|
||||
public const WATER = "minecraft:water";
|
||||
public const WATERLILY = "minecraft:waterlily";
|
||||
public const WAXED_COPPER = "minecraft:waxed_copper";
|
||||
public const WAXED_CUT_COPPER = "minecraft:waxed_cut_copper";
|
||||
public const WAXED_CUT_COPPER_SLAB = "minecraft:waxed_cut_copper_slab";
|
||||
public const WAXED_CUT_COPPER_STAIRS = "minecraft:waxed_cut_copper_stairs";
|
||||
public const WAXED_DOUBLE_CUT_COPPER_SLAB = "minecraft:waxed_double_cut_copper_slab";
|
||||
public const WAXED_EXPOSED_COPPER = "minecraft:waxed_exposed_copper";
|
||||
public const WAXED_EXPOSED_CUT_COPPER = "minecraft:waxed_exposed_cut_copper";
|
||||
public const WAXED_EXPOSED_CUT_COPPER_SLAB = "minecraft:waxed_exposed_cut_copper_slab";
|
||||
public const WAXED_EXPOSED_CUT_COPPER_STAIRS = "minecraft:waxed_exposed_cut_copper_stairs";
|
||||
public const WAXED_EXPOSED_DOUBLE_CUT_COPPER_SLAB = "minecraft:waxed_exposed_double_cut_copper_slab";
|
||||
public const WAXED_OXIDIZED_COPPER = "minecraft:waxed_oxidized_copper";
|
||||
public const WAXED_OXIDIZED_CUT_COPPER = "minecraft:waxed_oxidized_cut_copper";
|
||||
public const WAXED_OXIDIZED_CUT_COPPER_SLAB = "minecraft:waxed_oxidized_cut_copper_slab";
|
||||
public const WAXED_OXIDIZED_CUT_COPPER_STAIRS = "minecraft:waxed_oxidized_cut_copper_stairs";
|
||||
public const WAXED_OXIDIZED_DOUBLE_CUT_COPPER_SLAB = "minecraft:waxed_oxidized_double_cut_copper_slab";
|
||||
public const WAXED_WEATHERED_COPPER = "minecraft:waxed_weathered_copper";
|
||||
public const WAXED_WEATHERED_CUT_COPPER = "minecraft:waxed_weathered_cut_copper";
|
||||
public const WAXED_WEATHERED_CUT_COPPER_SLAB = "minecraft:waxed_weathered_cut_copper_slab";
|
||||
public const WAXED_WEATHERED_CUT_COPPER_STAIRS = "minecraft:waxed_weathered_cut_copper_stairs";
|
||||
public const WAXED_WEATHERED_DOUBLE_CUT_COPPER_SLAB = "minecraft:waxed_weathered_double_cut_copper_slab";
|
||||
public const WEATHERED_COPPER = "minecraft:weathered_copper";
|
||||
public const WEATHERED_CUT_COPPER = "minecraft:weathered_cut_copper";
|
||||
public const WEATHERED_CUT_COPPER_SLAB = "minecraft:weathered_cut_copper_slab";
|
||||
public const WEATHERED_CUT_COPPER_STAIRS = "minecraft:weathered_cut_copper_stairs";
|
||||
public const WEATHERED_DOUBLE_CUT_COPPER_SLAB = "minecraft:weathered_double_cut_copper_slab";
|
||||
public const WEB = "minecraft:web";
|
||||
public const WEEPING_VINES = "minecraft:weeping_vines";
|
||||
public const WHEAT = "minecraft:wheat";
|
||||
public const WHITE_CANDLE = "minecraft:white_candle";
|
||||
public const WHITE_CANDLE_CAKE = "minecraft:white_candle_cake";
|
||||
public const WHITE_GLAZED_TERRACOTTA = "minecraft:white_glazed_terracotta";
|
||||
public const WITHER_ROSE = "minecraft:wither_rose";
|
||||
public const WOOD = "minecraft:wood";
|
||||
public const WOODEN_BUTTON = "minecraft:wooden_button";
|
||||
public const WOODEN_DOOR = "minecraft:wooden_door";
|
||||
public const WOODEN_PRESSURE_PLATE = "minecraft:wooden_pressure_plate";
|
||||
public const WOODEN_SLAB = "minecraft:wooden_slab";
|
||||
public const WOOL = "minecraft:wool";
|
||||
public const YELLOW_CANDLE = "minecraft:yellow_candle";
|
||||
public const YELLOW_CANDLE_CAKE = "minecraft:yellow_candle_cake";
|
||||
public const YELLOW_FLOWER = "minecraft:yellow_flower";
|
||||
public const YELLOW_GLAZED_TERRACOTTA = "minecraft:yellow_glazed_terracotta";
|
||||
|
||||
}
|
49
src/data/bedrock/block/CachingBlockStateDeserializer.php
Normal file
49
src/data/bedrock/block/CachingBlockStateDeserializer.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\data\bedrock\block;
|
||||
|
||||
final class CachingBlockStateDeserializer implements BlockStateDeserializer{
|
||||
|
||||
/**
|
||||
* @var int[]
|
||||
* @phpstan-var array<string, int>
|
||||
*/
|
||||
private array $simpleCache = [];
|
||||
|
||||
public function __construct(
|
||||
private BlockStateDeserializer $realDeserializer
|
||||
){}
|
||||
|
||||
public function deserialize(BlockStateData $stateData) : int{
|
||||
if($stateData->getStates()->count() === 0){
|
||||
//if a block has zero properties, we can keep a map of string ID -> internal blockstate ID
|
||||
return $this->simpleCache[$stateData->getName()] ??= $this->realDeserializer->deserialize($stateData);
|
||||
}
|
||||
|
||||
//we can't cache blocks that have properties - go ahead and deserialize the slow way
|
||||
return $this->realDeserializer->deserialize($stateData);
|
||||
}
|
||||
|
||||
public function getRealDeserializer() : BlockStateDeserializer{ return $this->realDeserializer; }
|
||||
}
|
43
src/data/bedrock/block/CachingBlockStateSerializer.php
Normal file
43
src/data/bedrock/block/CachingBlockStateSerializer.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\data\bedrock\block;
|
||||
|
||||
final class CachingBlockStateSerializer implements BlockStateSerializer{
|
||||
|
||||
/**
|
||||
* @var BlockStateData[]
|
||||
* @phpstan-var array<int, BlockStateData>
|
||||
*/
|
||||
private array $cache = [];
|
||||
|
||||
public function __construct(
|
||||
private BlockStateSerializer $realSerializer
|
||||
){}
|
||||
|
||||
public function serialize(int $stateId) : BlockStateData{
|
||||
return $this->cache[$stateId] ??= $this->realSerializer->serialize($stateId);
|
||||
}
|
||||
|
||||
public function getRealSerializer() : BlockStateSerializer{ return $this->realSerializer; }
|
||||
}
|
40
src/data/bedrock/block/UpgradingBlockStateDeserializer.php
Normal file
40
src/data/bedrock/block/UpgradingBlockStateDeserializer.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\data\bedrock\block;
|
||||
|
||||
use pocketmine\data\bedrock\block\upgrade\BlockStateUpgrader;
|
||||
|
||||
final class UpgradingBlockStateDeserializer implements BlockStateDeserializer{
|
||||
|
||||
public function __construct(
|
||||
private BlockStateUpgrader $blockStateUpgrader,
|
||||
private BlockStateDeserializer $realDeserializer
|
||||
){}
|
||||
|
||||
public function deserialize(BlockStateData $stateData) : int{
|
||||
return $this->realDeserializer->deserialize($this->blockStateUpgrader->upgrade($stateData));
|
||||
}
|
||||
|
||||
public function getRealDeserializer() : BlockStateDeserializer{ return $this->realDeserializer; }
|
||||
}
|
1107
src/data/bedrock/block/convert/BlockObjectToBlockStateSerializer.php
Normal file
1107
src/data/bedrock/block/convert/BlockObjectToBlockStateSerializer.php
Normal file
File diff suppressed because it is too large
Load Diff
322
src/data/bedrock/block/convert/BlockStateDeserializerHelper.php
Normal file
322
src/data/bedrock/block/convert/BlockStateDeserializerHelper.php
Normal file
@ -0,0 +1,322 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\data\bedrock\block\convert;
|
||||
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\block\BlockLegacyMetadata;
|
||||
use pocketmine\block\Button;
|
||||
use pocketmine\block\Crops;
|
||||
use pocketmine\block\DaylightSensor;
|
||||
use pocketmine\block\Door;
|
||||
use pocketmine\block\FenceGate;
|
||||
use pocketmine\block\FloorCoralFan;
|
||||
use pocketmine\block\FloorSign;
|
||||
use pocketmine\block\GlazedTerracotta;
|
||||
use pocketmine\block\Liquid;
|
||||
use pocketmine\block\RedMushroomBlock;
|
||||
use pocketmine\block\RedstoneComparator;
|
||||
use pocketmine\block\RedstoneRepeater;
|
||||
use pocketmine\block\SimplePressurePlate;
|
||||
use pocketmine\block\Slab;
|
||||
use pocketmine\block\Stair;
|
||||
use pocketmine\block\Stem;
|
||||
use pocketmine\block\Trapdoor;
|
||||
use pocketmine\block\VanillaBlocks;
|
||||
use pocketmine\block\Wall;
|
||||
use pocketmine\block\WallCoralFan;
|
||||
use pocketmine\block\WallSign;
|
||||
use pocketmine\block\WeightedPressurePlate;
|
||||
use pocketmine\data\bedrock\block\BlockStateDeserializeException;
|
||||
use pocketmine\data\bedrock\block\BlockStateNames;
|
||||
use pocketmine\data\bedrock\block\BlockStateStringValues as StringValues;
|
||||
use pocketmine\data\bedrock\MushroomBlockTypeIdMap;
|
||||
use pocketmine\math\Axis;
|
||||
use pocketmine\math\Facing;
|
||||
use pocketmine\utils\AssumptionFailedError;
|
||||
|
||||
final class BlockStateDeserializerHelper{
|
||||
|
||||
/** @throws BlockStateDeserializeException */
|
||||
public static function decodeButton(Button $block, BlockStateReader $in) : Button{
|
||||
return $block
|
||||
->setFacing($in->readFacingDirection())
|
||||
->setPressed($in->readBool(BlockStateNames::BUTTON_PRESSED_BIT));
|
||||
}
|
||||
|
||||
/**
|
||||
* @phpstan-template TCrops of Crops
|
||||
* @phpstan-param TCrops $block
|
||||
* @phpstan-return TCrops
|
||||
*
|
||||
* @throws BlockStateDeserializeException
|
||||
*/
|
||||
public static function decodeCrops(Crops $block, BlockStateReader $in) : Crops{
|
||||
return $block->setAge($in->readBoundedInt(BlockStateNames::GROWTH, 0, 7));
|
||||
}
|
||||
|
||||
/** @throws BlockStateDeserializeException */
|
||||
public static function decodeComparator(RedstoneComparator $block, BlockStateReader $in) : RedstoneComparator{
|
||||
return $block
|
||||
->setFacing($in->readLegacyHorizontalFacing())
|
||||
->setPowered($in->readBool(BlockStateNames::OUTPUT_LIT_BIT))
|
||||
->setSubtractMode($in->readBool(BlockStateNames::OUTPUT_SUBTRACT_BIT));
|
||||
}
|
||||
|
||||
/** @throws BlockStateDeserializeException */
|
||||
public static function decodeDaylightSensor(DaylightSensor $block, BlockStateReader $in) : DaylightSensor{
|
||||
return $block
|
||||
->setOutputSignalStrength($in->readBoundedInt(BlockStateNames::REDSTONE_SIGNAL, 0, 15));
|
||||
}
|
||||
|
||||
/** @throws BlockStateDeserializeException */
|
||||
public static function decodeDoor(Door $block, BlockStateReader $in) : Door{
|
||||
//TODO: check if these need any special treatment to get the appropriate data to both halves of the door
|
||||
return $block
|
||||
->setTop($in->readBool(BlockStateNames::UPPER_BLOCK_BIT))
|
||||
->setFacing(Facing::rotateY($in->readLegacyHorizontalFacing(), false))
|
||||
->setHingeRight($in->readBool(BlockStateNames::DOOR_HINGE_BIT))
|
||||
->setOpen($in->readBool(BlockStateNames::OPEN_BIT));
|
||||
}
|
||||
|
||||
/** @throws BlockStateDeserializeException */
|
||||
public static function decodeFenceGate(FenceGate $block, BlockStateReader $in) : FenceGate{
|
||||
return $block
|
||||
->setFacing($in->readLegacyHorizontalFacing())
|
||||
->setInWall($in->readBool(BlockStateNames::IN_WALL_BIT))
|
||||
->setOpen($in->readBool(BlockStateNames::OPEN_BIT));
|
||||
}
|
||||
|
||||
/** @throws BlockStateDeserializeException */
|
||||
public static function decodeFloorCoralFan(FloorCoralFan $block, BlockStateReader $in) : FloorCoralFan{
|
||||
return $block
|
||||
->setCoralType($in->readCoralType())
|
||||
->setAxis(match($in->readBoundedInt(BlockStateNames::CORAL_FAN_DIRECTION, 0, 1)){
|
||||
0 => Axis::X,
|
||||
1 => Axis::Z,
|
||||
default => throw new AssumptionFailedError("readBoundedInt() should have prevented this"),
|
||||
});
|
||||
}
|
||||
|
||||
/** @throws BlockStateDeserializeException */
|
||||
public static function decodeFloorSign(FloorSign $block, BlockStateReader $in) : FloorSign{
|
||||
return $block
|
||||
->setRotation($in->readBoundedInt(BlockStateNames::GROUND_SIGN_DIRECTION, 0, 15));
|
||||
}
|
||||
|
||||
/** @throws BlockStateDeserializeException */
|
||||
public static function decodeGlazedTerracotta(GlazedTerracotta $block, BlockStateReader $in) : GlazedTerracotta{
|
||||
return $block->setFacing($in->readHorizontalFacing());
|
||||
}
|
||||
|
||||
/** @throws BlockStateDeserializeException */
|
||||
public static function decodeLiquid(Liquid $block, BlockStateReader $in, bool $still) : Liquid{
|
||||
$fluidHeightState = $in->readBoundedInt(BlockStateNames::LIQUID_DEPTH, 0, 15);
|
||||
return $block
|
||||
->setDecay($fluidHeightState & 0x7)
|
||||
->setFalling(($fluidHeightState & 0x8) !== 0)
|
||||
->setStill($still);
|
||||
}
|
||||
|
||||
public static function decodeFlowingLiquid(Liquid $block, BlockStateReader $in) : Liquid{
|
||||
return self::decodeLiquid($block, $in, false);
|
||||
}
|
||||
|
||||
public static function decodeStillLiquid(Liquid $block, BlockStateReader $in) : Liquid{
|
||||
return self::decodeLiquid($block, $in, true);
|
||||
}
|
||||
|
||||
/** @throws BlockStateDeserializeException */
|
||||
public static function decodeMushroomBlock(RedMushroomBlock $block, BlockStateReader $in) : Block{
|
||||
switch($type = $in->readBoundedInt(BlockStateNames::HUGE_MUSHROOM_BITS, 0, 15)){
|
||||
case BlockLegacyMetadata::MUSHROOM_BLOCK_ALL_STEM: return VanillaBlocks::ALL_SIDED_MUSHROOM_STEM();
|
||||
case BlockLegacyMetadata::MUSHROOM_BLOCK_STEM: return VanillaBlocks::MUSHROOM_STEM();
|
||||
default:
|
||||
//invalid types get left as default
|
||||
$type = MushroomBlockTypeIdMap::getInstance()->fromId($type);
|
||||
return $type !== null ? $block->setMushroomBlockType($type) : $block;
|
||||
}
|
||||
}
|
||||
|
||||
/** @throws BlockStateDeserializeException */
|
||||
public static function decodeRepeater(RedstoneRepeater $block, BlockStateReader $in) : RedstoneRepeater{
|
||||
return $block
|
||||
->setFacing($in->readLegacyHorizontalFacing())
|
||||
->setDelay($in->readBoundedInt(BlockStateNames::REPEATER_DELAY, 0, 3) + 1);
|
||||
}
|
||||
|
||||
/** @throws BlockStateDeserializeException */
|
||||
public static function decodeSimplePressurePlate(SimplePressurePlate $block, BlockStateReader $in) : SimplePressurePlate{
|
||||
//TODO: not sure what the deal is here ... seems like a mojang bug / artifact of bad implementation?
|
||||
//best to keep this separate from weighted plates anyway...
|
||||
return $block->setPressed($in->readBoundedInt(BlockStateNames::REDSTONE_SIGNAL, 0, 15) !== 0);
|
||||
}
|
||||
|
||||
/** @throws BlockStateDeserializeException */
|
||||
public static function decodeStairs(Stair $block, BlockStateReader $in) : Stair{
|
||||
return $block
|
||||
->setUpsideDown($in->readBool(BlockStateNames::UPSIDE_DOWN_BIT))
|
||||
->setFacing($in->readWeirdoHorizontalFacing());
|
||||
}
|
||||
|
||||
/** @throws BlockStateDeserializeException */
|
||||
public static function decodeStem(Stem $block, BlockStateReader $in) : Stem{
|
||||
//TODO: our stems don't support facings yet (facing_direction)
|
||||
$in->todo(BlockStateNames::FACING_DIRECTION);
|
||||
return self::decodeCrops($block, $in);
|
||||
}
|
||||
|
||||
/** @throws BlockStateDeserializeException */
|
||||
public static function decodeTrapdoor(Trapdoor $block, BlockStateReader $in) : Trapdoor{
|
||||
return $block
|
||||
->setFacing($in->read5MinusHorizontalFacing())
|
||||
->setTop($in->readBool(BlockStateNames::UPSIDE_DOWN_BIT))
|
||||
->setOpen($in->readBool(BlockStateNames::OPEN_BIT));
|
||||
}
|
||||
|
||||
/** @throws BlockStateDeserializeException */
|
||||
public static function decodeWall(Wall $block, BlockStateReader $in) : Wall{
|
||||
//TODO: our walls don't support the full range of needed states yet
|
||||
$in->todo(BlockStateNames::WALL_POST_BIT); //TODO
|
||||
$in->todo(BlockStateNames::WALL_CONNECTION_TYPE_EAST);
|
||||
$in->todo(BlockStateNames::WALL_CONNECTION_TYPE_NORTH);
|
||||
$in->todo(BlockStateNames::WALL_CONNECTION_TYPE_SOUTH);
|
||||
$in->todo(BlockStateNames::WALL_CONNECTION_TYPE_WEST);
|
||||
|
||||
return $block;
|
||||
}
|
||||
|
||||
/** @throws BlockStateDeserializeException */
|
||||
public static function decodeWallCoralFan(WallCoralFan $block, BlockStateReader $in) : WallCoralFan{
|
||||
return $block
|
||||
->setDead($in->readBool(BlockStateNames::DEAD_BIT))
|
||||
->setFacing($in->readCoralFacing());
|
||||
}
|
||||
|
||||
/** @throws BlockStateDeserializeException */
|
||||
public static function decodeWallSign(WallSign $block, BlockStateReader $in) : WallSign{
|
||||
return $block
|
||||
->setFacing($in->readHorizontalFacing());
|
||||
}
|
||||
|
||||
public static function decodeWeightedPressurePlate(WeightedPressurePlate $block, BlockStateReader $in) : WeightedPressurePlate{
|
||||
return $block
|
||||
->setOutputSignalStrength($in->readBoundedInt(BlockStateNames::REDSTONE_SIGNAL, 0, 15));
|
||||
}
|
||||
|
||||
/** @throws BlockStateDeserializeException */
|
||||
public static function mapLegacyWallType(BlockStateReader $in) : Wall{
|
||||
return self::decodeWall(match($type = $in->readString(BlockStateNames::WALL_BLOCK_TYPE)){
|
||||
StringValues::WALL_BLOCK_TYPE_ANDESITE => VanillaBlocks::ANDESITE_WALL(),
|
||||
StringValues::WALL_BLOCK_TYPE_BRICK => VanillaBlocks::BRICK_WALL(),
|
||||
StringValues::WALL_BLOCK_TYPE_COBBLESTONE => VanillaBlocks::COBBLESTONE_WALL(),
|
||||
StringValues::WALL_BLOCK_TYPE_DIORITE => VanillaBlocks::DIORITE_WALL(),
|
||||
StringValues::WALL_BLOCK_TYPE_END_BRICK => VanillaBlocks::END_STONE_BRICK_WALL(),
|
||||
StringValues::WALL_BLOCK_TYPE_GRANITE => VanillaBlocks::GRANITE_WALL(),
|
||||
StringValues::WALL_BLOCK_TYPE_MOSSY_COBBLESTONE => VanillaBlocks::MOSSY_COBBLESTONE_WALL(),
|
||||
StringValues::WALL_BLOCK_TYPE_MOSSY_STONE_BRICK => VanillaBlocks::MOSSY_STONE_BRICK_WALL(),
|
||||
StringValues::WALL_BLOCK_TYPE_NETHER_BRICK => VanillaBlocks::NETHER_BRICK_WALL(),
|
||||
StringValues::WALL_BLOCK_TYPE_PRISMARINE => VanillaBlocks::PRISMARINE_WALL(),
|
||||
StringValues::WALL_BLOCK_TYPE_RED_NETHER_BRICK => VanillaBlocks::RED_NETHER_BRICK_WALL(),
|
||||
StringValues::WALL_BLOCK_TYPE_RED_SANDSTONE => VanillaBlocks::RED_SANDSTONE_WALL(),
|
||||
StringValues::WALL_BLOCK_TYPE_SANDSTONE => VanillaBlocks::SANDSTONE_WALL(),
|
||||
StringValues::WALL_BLOCK_TYPE_STONE_BRICK => VanillaBlocks::STONE_BRICK_WALL(),
|
||||
default => throw $in->badValueException(BlockStateNames::WALL_BLOCK_TYPE, $type),
|
||||
}, $in);
|
||||
}
|
||||
|
||||
/** @throws BlockStateDeserializeException */
|
||||
public static function mapStoneSlab1Type(BlockStateReader $in) : Slab{
|
||||
//* stone_slab_type (StringTag) = brick, cobblestone, nether_brick, quartz, sandstone, smooth_stone, stone_brick, wood
|
||||
return match($type = $in->readString(BlockStateNames::STONE_SLAB_TYPE)){
|
||||
StringValues::STONE_SLAB_TYPE_BRICK => VanillaBlocks::BRICK_SLAB(),
|
||||
StringValues::STONE_SLAB_TYPE_COBBLESTONE => VanillaBlocks::COBBLESTONE_SLAB(),
|
||||
StringValues::STONE_SLAB_TYPE_NETHER_BRICK => VanillaBlocks::NETHER_BRICK_SLAB(),
|
||||
StringValues::STONE_SLAB_TYPE_QUARTZ => VanillaBlocks::QUARTZ_SLAB(),
|
||||
StringValues::STONE_SLAB_TYPE_SANDSTONE => VanillaBlocks::SANDSTONE_SLAB(),
|
||||
StringValues::STONE_SLAB_TYPE_SMOOTH_STONE => VanillaBlocks::SMOOTH_STONE_SLAB(),
|
||||
StringValues::STONE_SLAB_TYPE_STONE_BRICK => VanillaBlocks::STONE_BRICK_SLAB(),
|
||||
StringValues::STONE_SLAB_TYPE_WOOD => VanillaBlocks::FAKE_WOODEN_SLAB(),
|
||||
default => throw $in->badValueException(BlockStateNames::STONE_SLAB_TYPE, $type),
|
||||
};
|
||||
}
|
||||
|
||||
/** @throws BlockStateDeserializeException */
|
||||
public static function mapStoneSlab2Type(BlockStateReader $in) : Slab{
|
||||
// * stone_slab_type_2 (StringTag) = mossy_cobblestone, prismarine_brick, prismarine_dark, prismarine_rough, purpur, red_nether_brick, red_sandstone, smooth_sandstone
|
||||
return match($type = $in->readString(BlockStateNames::STONE_SLAB_TYPE_2)){
|
||||
StringValues::STONE_SLAB_TYPE_2_MOSSY_COBBLESTONE => VanillaBlocks::MOSSY_COBBLESTONE_SLAB(),
|
||||
StringValues::STONE_SLAB_TYPE_2_PRISMARINE_BRICK => VanillaBlocks::PRISMARINE_BRICKS_SLAB(),
|
||||
StringValues::STONE_SLAB_TYPE_2_PRISMARINE_DARK => VanillaBlocks::DARK_PRISMARINE_SLAB(),
|
||||
StringValues::STONE_SLAB_TYPE_2_PRISMARINE_ROUGH => VanillaBlocks::PRISMARINE_SLAB(),
|
||||
StringValues::STONE_SLAB_TYPE_2_PURPUR => VanillaBlocks::PURPUR_SLAB(),
|
||||
StringValues::STONE_SLAB_TYPE_2_RED_NETHER_BRICK => VanillaBlocks::RED_NETHER_BRICK_SLAB(),
|
||||
StringValues::STONE_SLAB_TYPE_2_RED_SANDSTONE => VanillaBlocks::RED_SANDSTONE_SLAB(),
|
||||
StringValues::STONE_SLAB_TYPE_2_SMOOTH_SANDSTONE => VanillaBlocks::SMOOTH_SANDSTONE_SLAB(),
|
||||
default => throw $in->badValueException(BlockStateNames::STONE_SLAB_TYPE_2, $type),
|
||||
};
|
||||
}
|
||||
|
||||
/** @throws BlockStateDeserializeException */
|
||||
public static function mapStoneSlab3Type(BlockStateReader $in) : Slab{
|
||||
// * stone_slab_type_3 (StringTag) = andesite, diorite, end_stone_brick, granite, polished_andesite, polished_diorite, polished_granite, smooth_red_sandstone
|
||||
return match($type = $in->readString(BlockStateNames::STONE_SLAB_TYPE_3)){
|
||||
StringValues::STONE_SLAB_TYPE_3_ANDESITE => VanillaBlocks::ANDESITE_SLAB(),
|
||||
StringValues::STONE_SLAB_TYPE_3_DIORITE => VanillaBlocks::DIORITE_SLAB(),
|
||||
StringValues::STONE_SLAB_TYPE_3_END_STONE_BRICK => VanillaBlocks::END_STONE_BRICK_SLAB(),
|
||||
StringValues::STONE_SLAB_TYPE_3_GRANITE => VanillaBlocks::GRANITE_SLAB(),
|
||||
StringValues::STONE_SLAB_TYPE_3_POLISHED_ANDESITE => VanillaBlocks::POLISHED_ANDESITE_SLAB(),
|
||||
StringValues::STONE_SLAB_TYPE_3_POLISHED_DIORITE => VanillaBlocks::POLISHED_DIORITE_SLAB(),
|
||||
StringValues::STONE_SLAB_TYPE_3_POLISHED_GRANITE => VanillaBlocks::POLISHED_GRANITE_SLAB(),
|
||||
StringValues::STONE_SLAB_TYPE_3_SMOOTH_RED_SANDSTONE => VanillaBlocks::SMOOTH_RED_SANDSTONE_SLAB(),
|
||||
default => throw $in->badValueException(BlockStateNames::STONE_SLAB_TYPE_3, $type),
|
||||
};
|
||||
}
|
||||
|
||||
/** @throws BlockStateDeserializeException */
|
||||
public static function mapStoneSlab4Type(BlockStateReader $in) : Slab{
|
||||
// * stone_slab_type_4 (StringTag) = cut_red_sandstone, cut_sandstone, mossy_stone_brick, smooth_quartz, stone
|
||||
return match($type = $in->readString(BlockStateNames::STONE_SLAB_TYPE_4)){
|
||||
StringValues::STONE_SLAB_TYPE_4_CUT_RED_SANDSTONE => VanillaBlocks::CUT_RED_SANDSTONE_SLAB(),
|
||||
StringValues::STONE_SLAB_TYPE_4_CUT_SANDSTONE => VanillaBlocks::CUT_SANDSTONE_SLAB(),
|
||||
StringValues::STONE_SLAB_TYPE_4_MOSSY_STONE_BRICK => VanillaBlocks::MOSSY_STONE_BRICK_SLAB(),
|
||||
StringValues::STONE_SLAB_TYPE_4_SMOOTH_QUARTZ => VanillaBlocks::SMOOTH_QUARTZ_SLAB(),
|
||||
StringValues::STONE_SLAB_TYPE_4_STONE => VanillaBlocks::STONE_SLAB(),
|
||||
default => throw $in->badValueException(BlockStateNames::STONE_SLAB_TYPE_4, $type),
|
||||
};
|
||||
}
|
||||
|
||||
/** @throws BlockStateDeserializeException */
|
||||
public static function mapWoodenSlabType(BlockStateReader $in) : Slab{
|
||||
// * wood_type (StringTag) = acacia, birch, dark_oak, jungle, oak, spruce
|
||||
return match($type = $in->readString(BlockStateNames::WOOD_TYPE)){
|
||||
StringValues::WOOD_TYPE_ACACIA => VanillaBlocks::ACACIA_SLAB(),
|
||||
StringValues::WOOD_TYPE_BIRCH => VanillaBlocks::BIRCH_SLAB(),
|
||||
StringValues::WOOD_TYPE_DARK_OAK => VanillaBlocks::DARK_OAK_SLAB(),
|
||||
StringValues::WOOD_TYPE_JUNGLE => VanillaBlocks::JUNGLE_SLAB(),
|
||||
StringValues::WOOD_TYPE_OAK => VanillaBlocks::OAK_SLAB(),
|
||||
StringValues::WOOD_TYPE_SPRUCE => VanillaBlocks::SPRUCE_SLAB(),
|
||||
default => throw $in->badValueException(BlockStateNames::WOOD_TYPE, $type),
|
||||
};
|
||||
}
|
||||
}
|
327
src/data/bedrock/block/convert/BlockStateReader.php
Normal file
327
src/data/bedrock/block/convert/BlockStateReader.php
Normal file
@ -0,0 +1,327 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\data\bedrock\block\convert;
|
||||
|
||||
use pocketmine\block\utils\BellAttachmentType;
|
||||
use pocketmine\block\utils\CoralType;
|
||||
use pocketmine\block\utils\DyeColor;
|
||||
use pocketmine\block\utils\SlabType;
|
||||
use pocketmine\data\bedrock\block\BlockStateData;
|
||||
use pocketmine\data\bedrock\block\BlockStateDeserializeException;
|
||||
use pocketmine\data\bedrock\block\BlockStateNames;
|
||||
use pocketmine\data\bedrock\block\BlockStateStringValues as StringValues;
|
||||
use pocketmine\math\Axis;
|
||||
use pocketmine\math\Facing;
|
||||
use pocketmine\nbt\tag\ByteTag;
|
||||
use pocketmine\nbt\tag\IntTag;
|
||||
use pocketmine\nbt\tag\StringTag;
|
||||
use pocketmine\nbt\tag\Tag;
|
||||
use function get_class;
|
||||
|
||||
final class BlockStateReader{
|
||||
|
||||
/**
|
||||
* @var true[]
|
||||
* @phpstan-var array<string, true>
|
||||
*/
|
||||
private array $usedStates = [];
|
||||
|
||||
public function __construct(
|
||||
private BlockStateData $data
|
||||
){}
|
||||
|
||||
public function missingOrWrongTypeException(string $name, ?Tag $tag) : BlockStateDeserializeException{
|
||||
return new BlockStateDeserializeException("Property \"$name\" " . ($tag !== null ? "has unexpected type " . get_class($tag) : "is missing"));
|
||||
}
|
||||
|
||||
public function badValueException(string $name, string $stringifiedValue, ?string $reason = null) : BlockStateDeserializeException{
|
||||
return new BlockStateDeserializeException(
|
||||
"Property \"$name\" has unexpected value \"$stringifiedValue\"" . (
|
||||
$reason !== null ? " ($reason)" : ""
|
||||
));
|
||||
}
|
||||
|
||||
/** @throws BlockStateDeserializeException */
|
||||
public function readBool(string $name) : bool{
|
||||
$this->usedStates[$name] = true;
|
||||
$tag = $this->data->getStates()->getTag($name);
|
||||
if($tag instanceof ByteTag){
|
||||
switch($tag->getValue()){
|
||||
case 0: return false;
|
||||
case 1: return true;
|
||||
default: throw $this->badValueException($name, (string) $tag->getValue());
|
||||
}
|
||||
}
|
||||
throw $this->missingOrWrongTypeException($name, $tag);
|
||||
}
|
||||
|
||||
/** @throws BlockStateDeserializeException */
|
||||
public function readInt(string $name) : int{
|
||||
$this->usedStates[$name] = true;
|
||||
$tag = $this->data->getStates()->getTag($name);
|
||||
if($tag instanceof IntTag){
|
||||
return $tag->getValue();
|
||||
}
|
||||
throw $this->missingOrWrongTypeException($name, $tag);
|
||||
}
|
||||
|
||||
/** @throws BlockStateDeserializeException */
|
||||
public function readBoundedInt(string $name, int $min, int $max) : int{
|
||||
$result = $this->readInt($name);
|
||||
if($result < $min || $result > $max){
|
||||
throw $this->badValueException($name, (string) $result, "Must be inside the range $min ... $max");
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/** @throws BlockStateDeserializeException */
|
||||
public function readString(string $name) : string{
|
||||
$this->usedStates[$name] = true;
|
||||
//TODO: only allow a specific set of values (strings are primarily used for enums)
|
||||
$tag = $this->data->getStates()->getTag($name);
|
||||
if($tag instanceof StringTag){
|
||||
return $tag->getValue();
|
||||
}
|
||||
throw $this->missingOrWrongTypeException($name, $tag);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int[] $mapping
|
||||
* @phpstan-param array<int, int> $mapping
|
||||
* @phpstan-return int
|
||||
* @throws BlockStateDeserializeException
|
||||
*/
|
||||
private function parseFacingValue(int $value, array $mapping) : int{
|
||||
$result = $mapping[$value] ?? null;
|
||||
if($result === null){
|
||||
throw new BlockStateDeserializeException("Unmapped facing value " . $value);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/** @throws BlockStateDeserializeException */
|
||||
public function readFacingDirection() : int{
|
||||
return $this->parseFacingValue($this->readInt(BlockStateNames::FACING_DIRECTION), [
|
||||
0 => Facing::DOWN,
|
||||
1 => Facing::UP,
|
||||
2 => Facing::NORTH,
|
||||
3 => Facing::SOUTH,
|
||||
4 => Facing::WEST,
|
||||
5 => Facing::EAST
|
||||
]);
|
||||
}
|
||||
|
||||
/** @throws BlockStateDeserializeException */
|
||||
public function readEndRodFacingDirection() : int{
|
||||
$result = $this->readFacingDirection();
|
||||
return Facing::axis($result) !== Axis::Y ? Facing::opposite($result) : $result;
|
||||
}
|
||||
|
||||
/** @throws BlockStateDeserializeException */
|
||||
public function readHorizontalFacing() : int{
|
||||
return $this->parseFacingValue($this->readInt(BlockStateNames::FACING_DIRECTION), [
|
||||
0 => Facing::NORTH, //should be illegal, but 1.13 allows it
|
||||
1 => Facing::NORTH, //also should be illegal
|
||||
2 => Facing::NORTH,
|
||||
3 => Facing::SOUTH,
|
||||
4 => Facing::WEST,
|
||||
5 => Facing::EAST
|
||||
]);
|
||||
}
|
||||
|
||||
/** @throws BlockStateDeserializeException */
|
||||
public function readWeirdoHorizontalFacing() : int{
|
||||
return $this->parseFacingValue($this->readInt(BlockStateNames::WEIRDO_DIRECTION), [
|
||||
0 => Facing::EAST,
|
||||
1 => Facing::WEST,
|
||||
2 => Facing::SOUTH,
|
||||
3 => Facing::NORTH
|
||||
]);
|
||||
}
|
||||
|
||||
/** @throws BlockStateDeserializeException */
|
||||
public function readLegacyHorizontalFacing() : int{
|
||||
return $this->parseFacingValue($this->readInt(BlockStateNames::DIRECTION), [
|
||||
0 => Facing::SOUTH,
|
||||
1 => Facing::WEST,
|
||||
2 => Facing::NORTH,
|
||||
3 => Facing::EAST
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* This is for trapdoors, because Mojang botched the conversion in 1.13
|
||||
* @throws BlockStateDeserializeException
|
||||
*/
|
||||
public function read5MinusHorizontalFacing() : int{
|
||||
return $this->parseFacingValue($this->readInt(BlockStateNames::DIRECTION), [
|
||||
0 => Facing::EAST,
|
||||
1 => Facing::WEST,
|
||||
2 => Facing::SOUTH,
|
||||
3 => Facing::NORTH
|
||||
]);
|
||||
}
|
||||
|
||||
/** @throws BlockStateDeserializeException */
|
||||
public function readColor() : DyeColor{
|
||||
// * color (StringTag) = black, blue, brown, cyan, gray, green, light_blue, lime, magenta, orange, pink, purple, red, silver, white, yellow
|
||||
return match($color = $this->readString(BlockStateNames::COLOR)){
|
||||
StringValues::COLOR_BLACK => DyeColor::BLACK(),
|
||||
StringValues::COLOR_BLUE => DyeColor::BLUE(),
|
||||
StringValues::COLOR_BROWN => DyeColor::BROWN(),
|
||||
StringValues::COLOR_CYAN => DyeColor::CYAN(),
|
||||
StringValues::COLOR_GRAY => DyeColor::GRAY(),
|
||||
StringValues::COLOR_GREEN => DyeColor::GREEN(),
|
||||
StringValues::COLOR_LIGHT_BLUE => DyeColor::LIGHT_BLUE(),
|
||||
StringValues::COLOR_LIME => DyeColor::LIME(),
|
||||
StringValues::COLOR_MAGENTA => DyeColor::MAGENTA(),
|
||||
StringValues::COLOR_ORANGE => DyeColor::ORANGE(),
|
||||
StringValues::COLOR_PINK => DyeColor::PINK(),
|
||||
StringValues::COLOR_PURPLE => DyeColor::PURPLE(),
|
||||
StringValues::COLOR_RED => DyeColor::RED(),
|
||||
StringValues::COLOR_SILVER => DyeColor::LIGHT_GRAY(),
|
||||
StringValues::COLOR_WHITE => DyeColor::WHITE(),
|
||||
StringValues::COLOR_YELLOW => DyeColor::YELLOW(),
|
||||
default => throw $this->badValueException(BlockStateNames::COLOR, $color),
|
||||
};
|
||||
}
|
||||
|
||||
/** @throws BlockStateDeserializeException */
|
||||
public function readCoralFacing() : int{
|
||||
return $this->parseFacingValue($this->readInt(BlockStateNames::CORAL_DIRECTION), [
|
||||
0 => Facing::WEST,
|
||||
1 => Facing::EAST,
|
||||
2 => Facing::NORTH,
|
||||
3 => Facing::SOUTH
|
||||
]);
|
||||
}
|
||||
|
||||
/** @throws BlockStateDeserializeException */
|
||||
public function readFacingWithoutDown() : int{
|
||||
$result = $this->readFacingDirection();
|
||||
if($result === Facing::DOWN){ //shouldn't be legal, but 1.13 allows it
|
||||
$result = Facing::UP;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function readFacingWithoutUp() : int{
|
||||
$result = $this->readFacingDirection();
|
||||
if($result === Facing::UP){
|
||||
$result = Facing::DOWN; //shouldn't be legal, but 1.13 allows it
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @phpstan-return Axis::*
|
||||
* @throws BlockStateDeserializeException
|
||||
*/
|
||||
public function readPillarAxis() : int{
|
||||
$rawValue = $this->readString(BlockStateNames::PILLAR_AXIS);
|
||||
$value = [
|
||||
StringValues::PILLAR_AXIS_X => Axis::X,
|
||||
StringValues::PILLAR_AXIS_Y => Axis::Y,
|
||||
StringValues::PILLAR_AXIS_Z => Axis::Z
|
||||
][$rawValue] ?? null;
|
||||
if($value === null){
|
||||
throw $this->badValueException(BlockStateNames::PILLAR_AXIS, $rawValue, "Invalid axis value");
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
/** @throws BlockStateDeserializeException */
|
||||
public function readSlabPosition() : SlabType{
|
||||
return $this->readBool(BlockStateNames::TOP_SLOT_BIT) ? SlabType::TOP() : SlabType::BOTTOM();
|
||||
}
|
||||
|
||||
/**
|
||||
* @phpstan-return Facing::UP|Facing::NORTH|Facing::SOUTH|Facing::WEST|Facing::EAST
|
||||
* @throws BlockStateDeserializeException
|
||||
*/
|
||||
public function readTorchFacing() : int{
|
||||
//TODO: horizontal directions are flipped (MCPE bug: https://bugs.mojang.com/browse/MCPE-152036)
|
||||
return match($rawValue = $this->readString(BlockStateNames::TORCH_FACING_DIRECTION)){
|
||||
StringValues::TORCH_FACING_DIRECTION_EAST => Facing::WEST,
|
||||
StringValues::TORCH_FACING_DIRECTION_NORTH => Facing::SOUTH,
|
||||
StringValues::TORCH_FACING_DIRECTION_SOUTH => Facing::NORTH,
|
||||
StringValues::TORCH_FACING_DIRECTION_TOP => Facing::UP,
|
||||
StringValues::TORCH_FACING_DIRECTION_UNKNOWN => Facing::UP, //should be illegal, but 1.13 allows it
|
||||
StringValues::TORCH_FACING_DIRECTION_WEST => Facing::EAST,
|
||||
default => throw $this->badValueException(BlockStateNames::TORCH_FACING_DIRECTION, $rawValue, "Invalid torch facing"),
|
||||
};
|
||||
}
|
||||
|
||||
/** @throws BlockStateDeserializeException */
|
||||
public function readCoralType() : CoralType{
|
||||
return match($type = $this->readString(BlockStateNames::CORAL_COLOR)){
|
||||
StringValues::CORAL_COLOR_BLUE => CoralType::TUBE(),
|
||||
StringValues::CORAL_COLOR_PINK => CoralType::BRAIN(),
|
||||
StringValues::CORAL_COLOR_PURPLE => CoralType::BUBBLE(),
|
||||
StringValues::CORAL_COLOR_RED => CoralType::FIRE(),
|
||||
StringValues::CORAL_COLOR_YELLOW => CoralType::HORN(),
|
||||
default => throw $this->badValueException(BlockStateNames::CORAL_COLOR, $type),
|
||||
};
|
||||
}
|
||||
|
||||
/** @throws BlockStateDeserializeException */
|
||||
public function readBellAttachmentType() : BellAttachmentType{
|
||||
return match($type = $this->readString(BlockStateNames::ATTACHMENT)){
|
||||
StringValues::ATTACHMENT_HANGING => BellAttachmentType::CEILING(),
|
||||
StringValues::ATTACHMENT_STANDING => BellAttachmentType::FLOOR(),
|
||||
StringValues::ATTACHMENT_SIDE => BellAttachmentType::ONE_WALL(),
|
||||
StringValues::ATTACHMENT_MULTIPLE => BellAttachmentType::TWO_WALLS(),
|
||||
default => throw $this->badValueException(BlockStateNames::ATTACHMENT, $type),
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Explicitly mark a property as unused, so it doesn't get flagged as an error when debug mode is enabled
|
||||
*/
|
||||
public function ignored(string $name) : void{
|
||||
if($this->data->getStates()->getTag($name) !== null){
|
||||
$this->usedStates[$name] = true;
|
||||
}else{
|
||||
throw $this->missingOrWrongTypeException($name, null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to mark unused properties that haven't been implemented yet
|
||||
*/
|
||||
public function todo(string $name) : void{
|
||||
$this->ignored($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws BlockStateDeserializeException
|
||||
*/
|
||||
public function checkUnreadProperties() : void{
|
||||
foreach($this->data->getStates() as $name => $tag){
|
||||
if(!isset($this->usedStates[$name])){
|
||||
throw new BlockStateDeserializeException("Unread property \"$name\"");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
271
src/data/bedrock/block/convert/BlockStateSerializerHelper.php
Normal file
271
src/data/bedrock/block/convert/BlockStateSerializerHelper.php
Normal file
@ -0,0 +1,271 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\data\bedrock\block\convert;
|
||||
|
||||
use pocketmine\block\Button;
|
||||
use pocketmine\block\ChemistryTable;
|
||||
use pocketmine\block\Crops;
|
||||
use pocketmine\block\Door;
|
||||
use pocketmine\block\DoublePlant;
|
||||
use pocketmine\block\FenceGate;
|
||||
use pocketmine\block\FloorSign;
|
||||
use pocketmine\block\Furnace;
|
||||
use pocketmine\block\GlazedTerracotta;
|
||||
use pocketmine\block\Leaves;
|
||||
use pocketmine\block\Liquid;
|
||||
use pocketmine\block\Log;
|
||||
use pocketmine\block\RedMushroomBlock;
|
||||
use pocketmine\block\Sapling;
|
||||
use pocketmine\block\SimplePressurePlate;
|
||||
use pocketmine\block\Slab;
|
||||
use pocketmine\block\Stair;
|
||||
use pocketmine\block\Stem;
|
||||
use pocketmine\block\Torch;
|
||||
use pocketmine\block\Trapdoor;
|
||||
use pocketmine\block\utils\SlabType;
|
||||
use pocketmine\block\Wall;
|
||||
use pocketmine\block\WallSign;
|
||||
use pocketmine\block\Wood;
|
||||
use pocketmine\data\bedrock\block\BlockStateNames;
|
||||
use pocketmine\data\bedrock\block\BlockStateStringValues;
|
||||
use pocketmine\data\bedrock\block\BlockTypeNames as Ids;
|
||||
use pocketmine\data\bedrock\MushroomBlockTypeIdMap;
|
||||
use pocketmine\math\Axis;
|
||||
use pocketmine\math\Facing;
|
||||
|
||||
final class BlockStateSerializerHelper{
|
||||
|
||||
public static function encodeAllSidedLog(Wood $block) : BlockStateWriter{
|
||||
return BlockStateWriter::create(Ids::WOOD)
|
||||
->writeBool(BlockStateNames::STRIPPED_BIT, $block->isStripped())
|
||||
->writePillarAxis(Axis::Y) //TODO: our implementation doesn't support this yet
|
||||
->writeTreeType($block->getTreeType());
|
||||
}
|
||||
|
||||
public static function encodeButton(Button $block, BlockStateWriter $out) : BlockStateWriter{
|
||||
return $out
|
||||
->writeFacingDirection($block->getFacing())
|
||||
->writeBool(BlockStateNames::BUTTON_PRESSED_BIT, $block->isPressed());
|
||||
}
|
||||
|
||||
public static function encodeChemistryTable(ChemistryTable $block, string $chemistryTableType, BlockStateWriter $out) : BlockStateWriter{
|
||||
return $out
|
||||
->writeString(BlockStateNames::CHEMISTRY_TABLE_TYPE, $chemistryTableType)
|
||||
->writeLegacyHorizontalFacing(Facing::opposite($block->getFacing()));
|
||||
}
|
||||
|
||||
public static function encodeCrops(Crops $block, BlockStateWriter $out) : BlockStateWriter{
|
||||
return $out->writeInt(BlockStateNames::GROWTH, $block->getAge());
|
||||
}
|
||||
|
||||
public static function encodeColoredTorch(Torch $block, bool $highBit, BlockStateWriter $out) : BlockStateWriter{
|
||||
return $out
|
||||
->writeBool(BlockStateNames::COLOR_BIT, $highBit)
|
||||
->writeTorchFacing($block->getFacing());
|
||||
}
|
||||
|
||||
public static function encodeDoor(Door $block, BlockStateWriter $out) : BlockStateWriter{
|
||||
return $out
|
||||
->writeBool(BlockStateNames::UPPER_BLOCK_BIT, $block->isTop())
|
||||
->writeLegacyHorizontalFacing(Facing::rotateY($block->getFacing(), true))
|
||||
->writeBool(BlockStateNames::DOOR_HINGE_BIT, $block->isHingeRight())
|
||||
->writeBool(BlockStateNames::OPEN_BIT, $block->isOpen());
|
||||
}
|
||||
|
||||
public static function encodeDoublePlant(DoublePlant $block, string $doublePlantType, BlockStateWriter $out) : BlockStateWriter{
|
||||
return $out
|
||||
->writeBool(BlockStateNames::UPPER_BLOCK_BIT, $block->isTop())
|
||||
->writeString(BlockStateNames::DOUBLE_PLANT_TYPE, $doublePlantType);
|
||||
}
|
||||
|
||||
public static function encodeFenceGate(FenceGate $block, BlockStateWriter $out) : BlockStateWriter{
|
||||
return $out
|
||||
->writeLegacyHorizontalFacing($block->getFacing())
|
||||
->writeBool(BlockStateNames::IN_WALL_BIT, $block->isInWall())
|
||||
->writeBool(BlockStateNames::OPEN_BIT, $block->isOpen());
|
||||
}
|
||||
|
||||
public static function encodeFloorSign(FloorSign $block, BlockStateWriter $out) : BlockStateWriter{
|
||||
return $out
|
||||
->writeInt(BlockStateNames::GROUND_SIGN_DIRECTION, $block->getRotation());
|
||||
}
|
||||
|
||||
public static function encodeFurnace(Furnace $block, string $unlitId, string $litId) : BlockStateWriter{
|
||||
return BlockStateWriter::create($block->isLit() ? $litId : $unlitId)
|
||||
->writeHorizontalFacing($block->getFacing());
|
||||
}
|
||||
public static function encodeGlazedTerracotta(GlazedTerracotta $block, BlockStateWriter $out) : BlockStateWriter{
|
||||
return $out->writeHorizontalFacing($block->getFacing());
|
||||
}
|
||||
|
||||
private static function encodeLeaves(Leaves $block, BlockStateWriter $out) : BlockStateWriter{
|
||||
return $out
|
||||
->writeBool(BlockStateNames::PERSISTENT_BIT, $block->isNoDecay())
|
||||
->writeBool(BlockStateNames::UPDATE_BIT, $block->isCheckDecay());
|
||||
}
|
||||
|
||||
public static function encodeLeaves1(Leaves $block, string $type) : BlockStateWriter{
|
||||
return self::encodeLeaves($block, BlockStateWriter::create(Ids::LEAVES)
|
||||
->writeString(BlockStateNames::OLD_LEAF_TYPE, $type));
|
||||
}
|
||||
|
||||
public static function encodeLeaves2(Leaves $block, string $type) : BlockStateWriter{
|
||||
return self::encodeLeaves($block, BlockStateWriter::create(Ids::LEAVES2)
|
||||
->writeString(BlockStateNames::NEW_LEAF_TYPE, $type));
|
||||
}
|
||||
|
||||
public static function encodeLiquid(Liquid $block, string $stillId, string $flowingId) : BlockStateWriter{
|
||||
return BlockStateWriter::create($block->isStill() ? $stillId : $flowingId)
|
||||
->writeInt(BlockStateNames::LIQUID_DEPTH, $block->getDecay() | ($block->isFalling() ? 0x8 : 0));
|
||||
}
|
||||
|
||||
private static function encodeLog(Log $block, BlockStateWriter $out) : BlockStateWriter{
|
||||
return $out
|
||||
->writePillarAxis($block->getAxis());
|
||||
}
|
||||
|
||||
public static function encodeLog1(Log $block, string $type) : BlockStateWriter{
|
||||
return self::encodeLog($block, BlockStateWriter::create(Ids::LOG)
|
||||
->writeString(BlockStateNames::OLD_LOG_TYPE, $type));
|
||||
}
|
||||
|
||||
public static function encodeLog2(Log $block, string $type) : BlockStateWriter{
|
||||
return self::encodeLog($block, BlockStateWriter::create(Ids::LOG2)
|
||||
->writeString(BlockStateNames::NEW_LOG_TYPE, $type));
|
||||
}
|
||||
|
||||
public static function encodeMushroomBlock(RedMushroomBlock $block, BlockStateWriter $out) : BlockStateWriter{
|
||||
return $out
|
||||
->writeInt(BlockStateNames::HUGE_MUSHROOM_BITS, MushroomBlockTypeIdMap::getInstance()->toId($block->getMushroomBlockType()));
|
||||
}
|
||||
|
||||
public static function encodeQuartz(string $type, int $axis) : BlockStateWriter{
|
||||
return BlockStateWriter::create(Ids::QUARTZ_BLOCK)
|
||||
->writeString(BlockStateNames::CHISEL_TYPE, $type)
|
||||
->writePillarAxis($axis); //this isn't needed for all types, but we have to write it anyway
|
||||
}
|
||||
|
||||
public static function encodeRedFlower(string $type) : BlockStateWriter{
|
||||
return BlockStateWriter::create(Ids::RED_FLOWER)->writeString(BlockStateNames::FLOWER_TYPE, $type);
|
||||
}
|
||||
|
||||
public static function encodeSandstone(string $id, string $type) : BlockStateWriter{
|
||||
return BlockStateWriter::create($id)->writeString(BlockStateNames::SAND_STONE_TYPE, $type);
|
||||
}
|
||||
|
||||
public static function encodeSapling(Sapling $block, string $type) : BlockStateWriter{
|
||||
return BlockStateWriter::create(Ids::SAPLING)
|
||||
->writeBool(BlockStateNames::AGE_BIT, $block->isReady())
|
||||
->writeString(BlockStateNames::SAPLING_TYPE, $type);
|
||||
}
|
||||
|
||||
public static function encodeSimplePressurePlate(SimplePressurePlate $block, BlockStateWriter $out) : BlockStateWriter{
|
||||
//TODO: not sure what the deal is here ... seems like a mojang bug / artifact of bad implementation?
|
||||
//best to keep this separate from weighted plates anyway...
|
||||
return $out
|
||||
->writeInt(BlockStateNames::REDSTONE_SIGNAL, $block->isPressed() ? 15 : 0);
|
||||
}
|
||||
|
||||
private static function encodeSlab(Slab $block, string $singleId, string $doubleId) : BlockStateWriter{
|
||||
$slabType = $block->getSlabType();
|
||||
return BlockStateWriter::create($slabType->equals(SlabType::DOUBLE()) ? $doubleId : $singleId)
|
||||
|
||||
//this is (intentionally) also written for double slabs (as zero) to maintain bug parity with MCPE
|
||||
->writeBool(BlockStateNames::TOP_SLOT_BIT, $slabType->equals(SlabType::TOP()));
|
||||
}
|
||||
|
||||
public static function encodeStairs(Stair $block, BlockStateWriter $out) : BlockStateWriter{
|
||||
return $out
|
||||
->writeBool(BlockStateNames::UPSIDE_DOWN_BIT, $block->isUpsideDown())
|
||||
->writeWeirdoHorizontalFacing($block->getFacing());
|
||||
}
|
||||
|
||||
public static function encodeStem(Stem $block, BlockStateWriter $out) : BlockStateWriter{
|
||||
return self::encodeCrops($block, $out)
|
||||
->writeHorizontalFacing(Facing::NORTH); //TODO: PM impl doesn't support this yet
|
||||
}
|
||||
|
||||
public static function encodeStone(string $type) : BlockStateWriter{
|
||||
return BlockStateWriter::create(Ids::STONE)
|
||||
->writeString(BlockStateNames::STONE_TYPE, $type);
|
||||
}
|
||||
|
||||
public static function encodeStoneBricks(string $type) : BlockStateWriter{
|
||||
return BlockStateWriter::create(Ids::STONEBRICK)
|
||||
->writeString(BlockStateNames::STONE_BRICK_TYPE, $type);
|
||||
}
|
||||
|
||||
private static function encodeStoneSlab(Slab $block, string $singleId, string $doubleId, string $typeKey, string $typeValue) : BlockStateWriter{
|
||||
return self::encodeSlab($block, $singleId, $doubleId)
|
||||
->writeString($typeKey, $typeValue);
|
||||
}
|
||||
|
||||
public static function encodeStoneSlab1(Slab $block, string $typeValue) : BlockStateWriter{
|
||||
return self::encodeStoneSlab($block, Ids::STONE_BLOCK_SLAB, Ids::DOUBLE_STONE_BLOCK_SLAB, BlockStateNames::STONE_SLAB_TYPE, $typeValue);
|
||||
}
|
||||
|
||||
public static function encodeStoneSlab2(Slab $block, string $typeValue) : BlockStateWriter{
|
||||
return self::encodeStoneSlab($block, Ids::STONE_BLOCK_SLAB2, Ids::DOUBLE_STONE_BLOCK_SLAB2, BlockStateNames::STONE_SLAB_TYPE_2, $typeValue);
|
||||
}
|
||||
|
||||
public static function encodeStoneSlab3(Slab $block, string $typeValue) : BlockStateWriter{
|
||||
return self::encodeStoneSlab($block, Ids::STONE_BLOCK_SLAB3, Ids::DOUBLE_STONE_BLOCK_SLAB3, BlockStateNames::STONE_SLAB_TYPE_3, $typeValue);
|
||||
}
|
||||
|
||||
public static function encodeStoneSlab4(Slab $block, string $typeValue) : BlockStateWriter{
|
||||
return self::encodeStoneSlab($block, Ids::STONE_BLOCK_SLAB4, Ids::DOUBLE_STONE_BLOCK_SLAB4, BlockStateNames::STONE_SLAB_TYPE_4, $typeValue);
|
||||
}
|
||||
|
||||
public static function encodeTrapdoor(Trapdoor $block, BlockStateWriter $out) : BlockStateWriter{
|
||||
return $out
|
||||
->write5MinusHorizontalFacing($block->getFacing())
|
||||
->writeBool(BlockStateNames::UPSIDE_DOWN_BIT, $block->isTop())
|
||||
->writeBool(BlockStateNames::OPEN_BIT, $block->isOpen());
|
||||
}
|
||||
|
||||
public static function encodeWall(Wall $block, BlockStateWriter $out) : BlockStateWriter{
|
||||
//TODO: our walls don't support the full range of needed states yet
|
||||
return $out
|
||||
->writeBool(BlockStateNames::WALL_POST_BIT, false)
|
||||
->writeString(BlockStateNames::WALL_CONNECTION_TYPE_EAST, BlockStateStringValues::WALL_CONNECTION_TYPE_EAST_NONE)
|
||||
->writeString(BlockStateNames::WALL_CONNECTION_TYPE_NORTH, BlockStateStringValues::WALL_CONNECTION_TYPE_NORTH_NONE)
|
||||
->writeString(BlockStateNames::WALL_CONNECTION_TYPE_SOUTH, BlockStateStringValues::WALL_CONNECTION_TYPE_SOUTH_NONE)
|
||||
->writeString(BlockStateNames::WALL_CONNECTION_TYPE_WEST, BlockStateStringValues::WALL_CONNECTION_TYPE_WEST_NONE);
|
||||
}
|
||||
|
||||
public static function encodeLegacyWall(Wall $block, string $type) : BlockStateWriter{
|
||||
return self::encodeWall($block, BlockStateWriter::create(Ids::COBBLESTONE_WALL))
|
||||
->writeString(BlockStateNames::WALL_BLOCK_TYPE, $type);
|
||||
}
|
||||
|
||||
public static function encodeWallSign(WallSign $block, BlockStateWriter $out) : BlockStateWriter{
|
||||
return $out
|
||||
->writeHorizontalFacing($block->getFacing());
|
||||
}
|
||||
|
||||
public static function encodeWoodenSlab(Slab $block, string $typeValue) : BlockStateWriter{
|
||||
return self::encodeSlab($block, Ids::WOODEN_SLAB, Ids::DOUBLE_WOODEN_SLAB)
|
||||
->writeString(BlockStateNames::WOOD_TYPE, $typeValue);
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
269
src/data/bedrock/block/convert/BlockStateWriter.php
Normal file
269
src/data/bedrock/block/convert/BlockStateWriter.php
Normal file
@ -0,0 +1,269 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\data\bedrock\block\convert;
|
||||
|
||||
use pocketmine\block\utils\BellAttachmentType;
|
||||
use pocketmine\block\utils\CoralType;
|
||||
use pocketmine\block\utils\DyeColor;
|
||||
use pocketmine\block\utils\SlabType;
|
||||
use pocketmine\block\utils\TreeType;
|
||||
use pocketmine\data\bedrock\block\BlockStateData;
|
||||
use pocketmine\data\bedrock\block\BlockStateNames;
|
||||
use pocketmine\data\bedrock\block\BlockStateSerializeException;
|
||||
use pocketmine\data\bedrock\block\BlockStateStringValues as StringValues;
|
||||
use pocketmine\math\Axis;
|
||||
use pocketmine\math\Facing;
|
||||
use pocketmine\nbt\tag\CompoundTag;
|
||||
|
||||
final class BlockStateWriter{
|
||||
|
||||
private CompoundTag $states;
|
||||
|
||||
public function __construct(
|
||||
private string $id
|
||||
){
|
||||
$this->states = CompoundTag::create();
|
||||
}
|
||||
|
||||
public static function create(string $id) : self{
|
||||
return new self($id);
|
||||
}
|
||||
|
||||
/** @return $this */
|
||||
public function writeBool(string $name, bool $value) : self{
|
||||
$this->states->setByte($name, $value ? 1 : 0);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/** @return $this */
|
||||
public function writeInt(string $name, int $value) : self{
|
||||
$this->states->setInt($name, $value);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/** @return $this */
|
||||
public function writeString(string $name, string $value) : self{
|
||||
$this->states->setString($name, $value);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/** @return $this */
|
||||
public function writeFacingDirection(int $value) : self{
|
||||
$this->writeInt(BlockStateNames::FACING_DIRECTION, match($value){
|
||||
Facing::DOWN => 0,
|
||||
Facing::UP => 1,
|
||||
Facing::NORTH => 2,
|
||||
Facing::SOUTH => 3,
|
||||
Facing::WEST => 4,
|
||||
Facing::EAST => 5,
|
||||
default => throw new BlockStateSerializeException("Invalid Facing $value")
|
||||
});
|
||||
return $this;
|
||||
}
|
||||
|
||||
/** @return $this */
|
||||
public function writeEndRodFacingDirection(int $value) : self{
|
||||
//end rods are stupid in bedrock and have everything except up/down the wrong way round
|
||||
return $this->writeFacingDirection(Facing::axis($value) !== Axis::Y ? Facing::opposite($value) : $value);
|
||||
}
|
||||
|
||||
/** @return $this */
|
||||
public function writeHorizontalFacing(int $value) : self{
|
||||
if($value === Facing::UP || $value === Facing::DOWN){
|
||||
throw new BlockStateSerializeException("Y-axis facing is not allowed");
|
||||
}
|
||||
|
||||
return $this->writeFacingDirection($value);
|
||||
}
|
||||
|
||||
/** @return $this */
|
||||
public function writeWeirdoHorizontalFacing(int $value) : self{
|
||||
$this->writeInt(BlockStateNames::WEIRDO_DIRECTION, match($value){
|
||||
Facing::EAST => 0,
|
||||
Facing::WEST => 1,
|
||||
Facing::SOUTH => 2,
|
||||
Facing::NORTH => 3,
|
||||
default => throw new BlockStateSerializeException("Invalid horizontal facing $value")
|
||||
});
|
||||
return $this;
|
||||
}
|
||||
|
||||
/** @return $this */
|
||||
public function writeLegacyHorizontalFacing(int $value) : self{
|
||||
$this->writeInt(BlockStateNames::DIRECTION, match($value){
|
||||
Facing::SOUTH => 0,
|
||||
Facing::WEST => 1,
|
||||
Facing::NORTH => 2,
|
||||
Facing::EAST => 3,
|
||||
default => throw new BlockStateSerializeException("Invalid horizontal facing $value")
|
||||
});
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is for trapdoors, because Mojang botched the conversion in 1.13
|
||||
* @return $this
|
||||
*/
|
||||
public function write5MinusHorizontalFacing(int $value) : self{
|
||||
return $this->writeInt(BlockStateNames::DIRECTION, match($value){
|
||||
Facing::EAST => 0,
|
||||
Facing::WEST => 1,
|
||||
Facing::SOUTH => 2,
|
||||
Facing::NORTH => 3,
|
||||
default => throw new BlockStateSerializeException("Invalid horizontal facing $value")
|
||||
});
|
||||
}
|
||||
|
||||
/** @return $this */
|
||||
public function writeColor(DyeColor $color) : self{
|
||||
$this->writeString(BlockStateNames::COLOR, match($color->id()){
|
||||
DyeColor::BLACK()->id() => StringValues::COLOR_BLACK,
|
||||
DyeColor::BLUE()->id() => StringValues::COLOR_BLUE,
|
||||
DyeColor::BROWN()->id() => StringValues::COLOR_BROWN,
|
||||
DyeColor::CYAN()->id() => StringValues::COLOR_CYAN,
|
||||
DyeColor::GRAY()->id() => StringValues::COLOR_GRAY,
|
||||
DyeColor::GREEN()->id() => StringValues::COLOR_GREEN,
|
||||
DyeColor::LIGHT_BLUE()->id() => StringValues::COLOR_LIGHT_BLUE,
|
||||
DyeColor::LIGHT_GRAY()->id() => StringValues::COLOR_SILVER,
|
||||
DyeColor::LIME()->id() => StringValues::COLOR_LIME,
|
||||
DyeColor::MAGENTA()->id() => StringValues::COLOR_MAGENTA,
|
||||
DyeColor::ORANGE()->id() => StringValues::COLOR_ORANGE,
|
||||
DyeColor::PINK()->id() => StringValues::COLOR_PINK,
|
||||
DyeColor::PURPLE()->id() => StringValues::COLOR_PURPLE,
|
||||
DyeColor::RED()->id() => StringValues::COLOR_RED,
|
||||
DyeColor::WHITE()->id() => StringValues::COLOR_WHITE,
|
||||
DyeColor::YELLOW()->id() => StringValues::COLOR_YELLOW,
|
||||
default => throw new BlockStateSerializeException("Invalid Color " . $color->name())
|
||||
});
|
||||
return $this;
|
||||
}
|
||||
|
||||
/** @return $this */
|
||||
public function writeCoralFacing(int $value) : self{
|
||||
$this->writeInt(BlockStateNames::CORAL_DIRECTION, match($value){
|
||||
Facing::WEST => 0,
|
||||
Facing::EAST => 1,
|
||||
Facing::NORTH => 2,
|
||||
Facing::SOUTH => 3,
|
||||
default => throw new BlockStateSerializeException("Invalid horizontal facing $value")
|
||||
});
|
||||
return $this;
|
||||
}
|
||||
|
||||
/** @return $this */
|
||||
public function writeFacingWithoutDown(int $value) : self{
|
||||
if($value === Facing::DOWN){
|
||||
throw new BlockStateSerializeException("Invalid facing DOWN");
|
||||
}
|
||||
$this->writeFacingDirection($value);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/** @return $this */
|
||||
public function writeFacingWithoutUp(int $value) : self{
|
||||
if($value === Facing::UP){
|
||||
throw new BlockStateSerializeException("Invalid facing UP");
|
||||
}
|
||||
$this->writeFacingDirection($value);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/** @return $this */
|
||||
public function writePillarAxis(int $axis) : self{
|
||||
$this->writeString(BlockStateNames::PILLAR_AXIS, match($axis){
|
||||
Axis::X => StringValues::PILLAR_AXIS_X,
|
||||
Axis::Y => StringValues::PILLAR_AXIS_Y,
|
||||
Axis::Z => StringValues::PILLAR_AXIS_Z,
|
||||
default => throw new BlockStateSerializeException("Invalid axis $axis")
|
||||
});
|
||||
return $this;
|
||||
}
|
||||
|
||||
/** @return $this */
|
||||
public function writeSlabPosition(SlabType $slabType) : self{
|
||||
$this->writeBool(BlockStateNames::TOP_SLOT_BIT, match($slabType->id()){
|
||||
SlabType::TOP()->id() => true,
|
||||
SlabType::BOTTOM()->id() => false,
|
||||
default => throw new BlockStateSerializeException("Invalid slab type " . $slabType->name())
|
||||
});
|
||||
return $this;
|
||||
}
|
||||
|
||||
/** @return $this */
|
||||
public function writeTorchFacing(int $facing) : self{
|
||||
//TODO: horizontal directions are flipped (MCPE bug: https://bugs.mojang.com/browse/MCPE-152036)
|
||||
$this->writeString(BlockStateNames::TORCH_FACING_DIRECTION, match($facing){
|
||||
Facing::UP => StringValues::TORCH_FACING_DIRECTION_TOP,
|
||||
Facing::SOUTH => StringValues::TORCH_FACING_DIRECTION_NORTH,
|
||||
Facing::NORTH => StringValues::TORCH_FACING_DIRECTION_SOUTH,
|
||||
Facing::EAST => StringValues::TORCH_FACING_DIRECTION_WEST,
|
||||
Facing::WEST => StringValues::TORCH_FACING_DIRECTION_EAST,
|
||||
default => throw new BlockStateSerializeException("Invalid Torch facing $facing")
|
||||
});
|
||||
return $this;
|
||||
}
|
||||
|
||||
/** @return $this */
|
||||
public function writeTreeType(TreeType $treeType) : self{
|
||||
$this->writeString(BlockStateNames::WOOD_TYPE, match($treeType->id()){
|
||||
TreeType::OAK()->id() => StringValues::WOOD_TYPE_OAK,
|
||||
TreeType::SPRUCE()->id() => StringValues::WOOD_TYPE_SPRUCE,
|
||||
TreeType::BIRCH()->id() => StringValues::WOOD_TYPE_BIRCH,
|
||||
TreeType::JUNGLE()->id() => StringValues::WOOD_TYPE_JUNGLE,
|
||||
TreeType::ACACIA()->id() => StringValues::WOOD_TYPE_ACACIA,
|
||||
TreeType::DARK_OAK()->id() => StringValues::WOOD_TYPE_DARK_OAK,
|
||||
default => throw new BlockStateSerializeException("Invalid Tree type " . $treeType->name())
|
||||
});
|
||||
return $this;
|
||||
}
|
||||
|
||||
/** @return $this */
|
||||
public function writeCoralType(CoralType $coralType) : self{
|
||||
$this->writeString(BlockStateNames::CORAL_COLOR, match($coralType->id()){
|
||||
CoralType::TUBE()->id() => StringValues::CORAL_COLOR_BLUE,
|
||||
CoralType::BRAIN()->id() => StringValues::CORAL_COLOR_PINK,
|
||||
CoralType::BUBBLE()->id() => StringValues::CORAL_COLOR_PURPLE,
|
||||
CoralType::FIRE()->id() => StringValues::CORAL_COLOR_RED,
|
||||
CoralType::HORN()->id() => StringValues::CORAL_COLOR_YELLOW,
|
||||
default => throw new BlockStateSerializeException("Invalid Coral type " . $coralType->name())
|
||||
});
|
||||
return $this;
|
||||
}
|
||||
|
||||
/** @return $this */
|
||||
public function writeBellAttachmentType(BellAttachmentType $attachmentType) : self{
|
||||
$this->writeString(BlockStateNames::ATTACHMENT, match($attachmentType->id()){
|
||||
BellAttachmentType::FLOOR()->id() => StringValues::ATTACHMENT_STANDING,
|
||||
BellAttachmentType::CEILING()->id() => StringValues::ATTACHMENT_HANGING,
|
||||
BellAttachmentType::ONE_WALL()->id() => StringValues::ATTACHMENT_SIDE,
|
||||
BellAttachmentType::TWO_WALLS()->id() => StringValues::ATTACHMENT_MULTIPLE,
|
||||
default => throw new BlockStateSerializeException("Invalid Bell attachment type " . $attachmentType->name())
|
||||
});
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getBlockStateData() : BlockStateData{
|
||||
return new BlockStateData($this->id, $this->states, BlockStateData::CURRENT_VERSION);
|
||||
}
|
||||
}
|
97
src/data/bedrock/block/upgrade/BlockStateUpgradeSchema.php
Normal file
97
src/data/bedrock/block/upgrade/BlockStateUpgradeSchema.php
Normal file
@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\data\bedrock\block\upgrade;
|
||||
|
||||
use pocketmine\data\bedrock\block\upgrade\BlockStateUpgradeSchemaValueRemap as ValueRemap;
|
||||
use pocketmine\nbt\tag\Tag;
|
||||
use function count;
|
||||
|
||||
final class BlockStateUpgradeSchema{
|
||||
/**
|
||||
* @var string[]
|
||||
* @phpstan-var array<string, string>
|
||||
*/
|
||||
public array $renamedIds = [];
|
||||
|
||||
/**
|
||||
* @var Tag[][]
|
||||
* @phpstan-var array<string, array<string, Tag>>
|
||||
*/
|
||||
public array $addedProperties = [];
|
||||
|
||||
/**
|
||||
* @var string[][]
|
||||
* @phpstan-var array<string, list<string>>
|
||||
*/
|
||||
public array $removedProperties = [];
|
||||
|
||||
/**
|
||||
* @var string[][]
|
||||
* @phpstan-var array<string, array<string, string>>
|
||||
*/
|
||||
public array $renamedProperties = [];
|
||||
|
||||
/**
|
||||
* @var ValueRemap[][][]
|
||||
* @phpstan-var array<string, array<string, list<ValueRemap>>>
|
||||
*/
|
||||
public array $remappedPropertyValues = [];
|
||||
|
||||
/**
|
||||
* @var BlockStateUpgradeSchemaBlockRemap[][]
|
||||
* @phpstan-var array<string, list<BlockStateUpgradeSchemaBlockRemap>>
|
||||
*/
|
||||
public array $remappedStates = [];
|
||||
|
||||
public function __construct(
|
||||
public int $maxVersionMajor,
|
||||
public int $maxVersionMinor,
|
||||
public int $maxVersionPatch,
|
||||
public int $maxVersionRevision,
|
||||
private int $priority
|
||||
){}
|
||||
|
||||
public function getVersionId() : int{
|
||||
return ($this->maxVersionMajor << 24) | ($this->maxVersionMinor << 16) | ($this->maxVersionPatch << 8) | $this->maxVersionRevision;
|
||||
}
|
||||
|
||||
public function getPriority() : int{ return $this->priority; }
|
||||
|
||||
public function isEmpty() : bool{
|
||||
foreach([
|
||||
$this->renamedIds,
|
||||
$this->addedProperties,
|
||||
$this->removedProperties,
|
||||
$this->renamedProperties,
|
||||
$this->remappedPropertyValues,
|
||||
$this->remappedStates,
|
||||
] as $list){
|
||||
if(count($list) !== 0){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\data\bedrock\block\upgrade;
|
||||
|
||||
use pocketmine\nbt\tag\CompoundTag;
|
||||
use pocketmine\nbt\tag\Tag;
|
||||
use pocketmine\utils\Utils;
|
||||
|
||||
final class BlockStateUpgradeSchemaBlockRemap{
|
||||
|
||||
public CompoundTag $oldState;
|
||||
public CompoundTag $newState;
|
||||
|
||||
/**
|
||||
* @param Tag[] $oldState
|
||||
* @param Tag[] $newState
|
||||
* @phpstan-param array<string, Tag> $oldState
|
||||
* @phpstan-param array<string, Tag> $newState
|
||||
*/
|
||||
public function __construct(
|
||||
array $oldState,
|
||||
public string $newName,
|
||||
array $newState
|
||||
){
|
||||
$this->oldState = CompoundTag::create();
|
||||
$this->newState = CompoundTag::create();
|
||||
foreach(Utils::stringifyKeys($oldState) as $k => $v){
|
||||
$this->oldState->setTag($k, $v);
|
||||
}
|
||||
foreach(Utils::stringifyKeys($newState) as $k => $v){
|
||||
$this->newState->setTag($k, $v);
|
||||
}
|
||||
}
|
||||
}
|
321
src/data/bedrock/block/upgrade/BlockStateUpgradeSchemaUtils.php
Normal file
321
src/data/bedrock/block/upgrade/BlockStateUpgradeSchemaUtils.php
Normal file
@ -0,0 +1,321 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\data\bedrock\block\upgrade;
|
||||
|
||||
use pocketmine\data\bedrock\block\upgrade\model\BlockStateUpgradeSchemaModel;
|
||||
use pocketmine\data\bedrock\block\upgrade\model\BlockStateUpgradeSchemaModelBlockRemap;
|
||||
use pocketmine\data\bedrock\block\upgrade\model\BlockStateUpgradeSchemaModelTag;
|
||||
use pocketmine\data\bedrock\block\upgrade\model\BlockStateUpgradeSchemaModelValueRemap;
|
||||
use pocketmine\errorhandler\ErrorToExceptionHandler;
|
||||
use pocketmine\nbt\tag\ByteTag;
|
||||
use pocketmine\nbt\tag\IntTag;
|
||||
use pocketmine\nbt\tag\StringTag;
|
||||
use pocketmine\nbt\tag\Tag;
|
||||
use pocketmine\utils\Utils;
|
||||
use Webmozart\PathUtil\Path;
|
||||
use function array_map;
|
||||
use function count;
|
||||
use function file_get_contents;
|
||||
use function get_debug_type;
|
||||
use function gettype;
|
||||
use function implode;
|
||||
use function is_object;
|
||||
use function json_decode;
|
||||
use function ksort;
|
||||
use function str_pad;
|
||||
use function strval;
|
||||
use const JSON_THROW_ON_ERROR;
|
||||
use const SORT_NUMERIC;
|
||||
use const STR_PAD_LEFT;
|
||||
|
||||
final class BlockStateUpgradeSchemaUtils{
|
||||
|
||||
public static function describe(BlockStateUpgradeSchema $schema) : string{
|
||||
$lines = [];
|
||||
$lines[] = "Renames:";
|
||||
foreach($schema->renamedIds as $rename){
|
||||
$lines[] = "- $rename";
|
||||
}
|
||||
$lines[] = "Added properties:";
|
||||
foreach(Utils::stringifyKeys($schema->addedProperties) as $blockName => $tags){
|
||||
foreach(Utils::stringifyKeys($tags) as $k => $v){
|
||||
$lines[] = "- $blockName has $k added: $v";
|
||||
}
|
||||
}
|
||||
|
||||
$lines[] = "Removed properties:";
|
||||
foreach(Utils::stringifyKeys($schema->removedProperties) as $blockName => $tagNames){
|
||||
foreach($tagNames as $tagName){
|
||||
$lines[] = "- $blockName has $tagName removed";
|
||||
}
|
||||
}
|
||||
$lines[] = "Renamed properties:";
|
||||
foreach(Utils::stringifyKeys($schema->renamedProperties) as $blockName => $tagNames){
|
||||
foreach(Utils::stringifyKeys($tagNames) as $oldTagName => $newTagName){
|
||||
$lines[] = "- $blockName has $oldTagName renamed to $newTagName";
|
||||
}
|
||||
}
|
||||
$lines[] = "Remapped property values:";
|
||||
foreach(Utils::stringifyKeys($schema->remappedPropertyValues) as $blockName => $remaps){
|
||||
foreach(Utils::stringifyKeys($remaps) as $tagName => $oldNewList){
|
||||
foreach($oldNewList as $oldNew){
|
||||
$lines[] = "- $blockName has $tagName value changed from $oldNew->old to $oldNew->new";
|
||||
}
|
||||
}
|
||||
}
|
||||
return implode("\n", $lines);
|
||||
}
|
||||
|
||||
public static function tagToJsonModel(Tag $tag) : BlockStateUpgradeSchemaModelTag{
|
||||
$model = new BlockStateUpgradeSchemaModelTag();
|
||||
if($tag instanceof IntTag){
|
||||
$model->int = $tag->getValue();
|
||||
}elseif($tag instanceof StringTag){
|
||||
$model->string = $tag->getValue();
|
||||
}elseif($tag instanceof ByteTag){
|
||||
$model->byte = $tag->getValue();
|
||||
}else{
|
||||
throw new \UnexpectedValueException("Unexpected value type " . get_debug_type($tag));
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
|
||||
private static function jsonModelToTag(BlockStateUpgradeSchemaModelTag $model) : Tag{
|
||||
return match(true){
|
||||
isset($model->byte) && !isset($model->int) && !isset($model->string) => new ByteTag($model->byte),
|
||||
!isset($model->byte) && isset($model->int) && !isset($model->string) => new IntTag($model->int),
|
||||
!isset($model->byte) && !isset($model->int) && isset($model->string) => new StringTag($model->string),
|
||||
default => throw new \UnexpectedValueException("Malformed JSON model tag, expected exactly one of 'byte', 'int' or 'string' properties")
|
||||
};
|
||||
}
|
||||
|
||||
public static function fromJsonModel(BlockStateUpgradeSchemaModel $model, int $priority) : BlockStateUpgradeSchema{
|
||||
$result = new BlockStateUpgradeSchema(
|
||||
$model->maxVersionMajor,
|
||||
$model->maxVersionMinor,
|
||||
$model->maxVersionPatch,
|
||||
$model->maxVersionRevision,
|
||||
$priority
|
||||
);
|
||||
$result->renamedIds = $model->renamedIds ?? [];
|
||||
$result->renamedProperties = $model->renamedProperties ?? [];
|
||||
$result->removedProperties = $model->removedProperties ?? [];
|
||||
|
||||
foreach(Utils::stringifyKeys($model->addedProperties ?? []) as $blockName => $properties){
|
||||
foreach(Utils::stringifyKeys($properties) as $propertyName => $propertyValue){
|
||||
$result->addedProperties[$blockName][$propertyName] = self::jsonModelToTag($propertyValue);
|
||||
}
|
||||
}
|
||||
|
||||
$convertedRemappedValuesIndex = [];
|
||||
foreach(Utils::stringifyKeys($model->remappedPropertyValuesIndex ?? []) as $mappingKey => $mappingValues){
|
||||
foreach($mappingValues as $k => $oldNew){
|
||||
$convertedRemappedValuesIndex[$mappingKey][$k] = new BlockStateUpgradeSchemaValueRemap(
|
||||
self::jsonModelToTag($oldNew->old),
|
||||
self::jsonModelToTag($oldNew->new)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
foreach(Utils::stringifyKeys($model->remappedPropertyValues ?? []) as $blockName => $properties){
|
||||
foreach(Utils::stringifyKeys($properties) as $property => $mappedValuesKey){
|
||||
if(!isset($convertedRemappedValuesIndex[$mappedValuesKey])){
|
||||
throw new \UnexpectedValueException("Missing key from schema values index $mappedValuesKey");
|
||||
}
|
||||
$result->remappedPropertyValues[$blockName][$property] = $convertedRemappedValuesIndex[$mappedValuesKey];
|
||||
}
|
||||
}
|
||||
|
||||
foreach(Utils::stringifyKeys($model->remappedStates ?? []) as $oldBlockName => $remaps){
|
||||
foreach($remaps as $remap){
|
||||
$result->remappedStates[$oldBlockName][] = new BlockStateUpgradeSchemaBlockRemap(
|
||||
array_map(fn(BlockStateUpgradeSchemaModelTag $tag) => self::jsonModelToTag($tag), $remap->oldState),
|
||||
$remap->newName,
|
||||
array_map(fn(BlockStateUpgradeSchemaModelTag $tag) => self::jsonModelToTag($tag), $remap->newState),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
private static function buildRemappedValuesIndex(BlockStateUpgradeSchema $schema, BlockStateUpgradeSchemaModel $model) : void{
|
||||
if(count($schema->remappedPropertyValues) === 0){
|
||||
return;
|
||||
}
|
||||
$dedupMapping = [];
|
||||
$dedupTable = [];
|
||||
$dedupTableMap = [];
|
||||
$counter = 0;
|
||||
|
||||
foreach(Utils::stringifyKeys($schema->remappedPropertyValues) as $blockName => $remaps){
|
||||
foreach(Utils::stringifyKeys($remaps) as $propertyName => $remappedValues){
|
||||
$remappedValuesMap = [];
|
||||
foreach($remappedValues as $oldNew){
|
||||
$remappedValuesMap[$oldNew->old->toString()] = $oldNew;
|
||||
}
|
||||
|
||||
foreach(Utils::stringifyKeys($dedupTableMap) as $dedupName => $dedupValuesMap){
|
||||
if(count($remappedValuesMap) !== count($dedupValuesMap)){
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach(Utils::stringifyKeys($remappedValuesMap) as $oldHash => $remappedOldNew){
|
||||
if(
|
||||
!isset($dedupValuesMap[$oldHash]) ||
|
||||
!$remappedOldNew->old->equals($dedupValuesMap[$oldHash]->old) ||
|
||||
!$remappedOldNew->new->equals($dedupValuesMap[$oldHash]->new)
|
||||
){
|
||||
continue 2;
|
||||
}
|
||||
}
|
||||
|
||||
//we found a match
|
||||
$dedupMapping[$blockName][$propertyName] = $dedupName;
|
||||
continue 2;
|
||||
}
|
||||
|
||||
//no match, add the values to the table
|
||||
$newDedupName = $propertyName . "_" . str_pad(strval($counter++), 2, "0", STR_PAD_LEFT);
|
||||
$dedupTableMap[$newDedupName] = $remappedValuesMap;
|
||||
$dedupTable[$newDedupName] = $remappedValues;
|
||||
$dedupMapping[$blockName][$propertyName] = $newDedupName;
|
||||
}
|
||||
}
|
||||
|
||||
$modelTable = [];
|
||||
foreach(Utils::stringifyKeys($dedupTable) as $dedupName => $valuePairs){
|
||||
foreach($valuePairs as $k => $pair){
|
||||
$modelTable[$dedupName][$k] = new BlockStateUpgradeSchemaModelValueRemap(
|
||||
BlockStateUpgradeSchemaUtils::tagToJsonModel($pair->old),
|
||||
BlockStateUpgradeSchemaUtils::tagToJsonModel($pair->new),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$model->remappedPropertyValuesIndex = $modelTable;
|
||||
$model->remappedPropertyValues = $dedupMapping;
|
||||
}
|
||||
|
||||
public static function toJsonModel(BlockStateUpgradeSchema $schema) : BlockStateUpgradeSchemaModel{
|
||||
$result = new BlockStateUpgradeSchemaModel();
|
||||
$result->maxVersionMajor = $schema->maxVersionMajor;
|
||||
$result->maxVersionMinor = $schema->maxVersionMinor;
|
||||
$result->maxVersionPatch = $schema->maxVersionPatch;
|
||||
$result->maxVersionRevision = $schema->maxVersionRevision;
|
||||
$result->renamedIds = $schema->renamedIds;
|
||||
$result->renamedProperties = $schema->renamedProperties;
|
||||
$result->removedProperties = $schema->removedProperties;
|
||||
|
||||
foreach(Utils::stringifyKeys($schema->addedProperties) as $blockName => $properties){
|
||||
foreach(Utils::stringifyKeys($properties) as $propertyName => $propertyValue){
|
||||
$result->addedProperties[$blockName][$propertyName] = self::tagToJsonModel($propertyValue);
|
||||
}
|
||||
}
|
||||
|
||||
self::buildRemappedValuesIndex($schema, $result);
|
||||
|
||||
foreach(Utils::stringifyKeys($schema->remappedStates) as $oldBlockName => $remaps){
|
||||
foreach($remaps as $remap){
|
||||
$result->remappedStates[$oldBlockName][] = new BlockStateUpgradeSchemaModelBlockRemap(
|
||||
array_map(fn(Tag $tag) => self::tagToJsonModel($tag), $remap->oldState->getValue()),
|
||||
$remap->newName,
|
||||
array_map(fn(Tag $tag) => self::tagToJsonModel($tag), $remap->newState->getValue()),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of schemas ordered by priority. Oldest schemas appear first.
|
||||
*
|
||||
* @return BlockStateUpgradeSchema[]
|
||||
*/
|
||||
public static function loadSchemas(string $path, int $currentVersion) : array{
|
||||
$iterator = new \RegexIterator(
|
||||
new \FilesystemIterator(
|
||||
$path,
|
||||
\FilesystemIterator::CURRENT_AS_PATHNAME | \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::UNIX_PATHS
|
||||
),
|
||||
'/\/(\d{4}).*\.json$/',
|
||||
\RegexIterator::GET_MATCH
|
||||
);
|
||||
|
||||
$result = [];
|
||||
|
||||
/** @var string[] $matches */
|
||||
foreach($iterator as $matches){
|
||||
$filename = $matches[0];
|
||||
$priority = (int) $matches[1];
|
||||
|
||||
$fullPath = Path::join($path, $filename);
|
||||
|
||||
try{
|
||||
$raw = ErrorToExceptionHandler::trapAndRemoveFalse(fn() => file_get_contents($fullPath));
|
||||
}catch(\ErrorException $e){
|
||||
throw new \RuntimeException("Loading schema file $fullPath: " . $e->getMessage(), 0, $e);
|
||||
}
|
||||
|
||||
try{
|
||||
$schema = self::loadSchemaFromString($raw, $priority);
|
||||
}catch(\RuntimeException $e){
|
||||
throw new \RuntimeException("Loading schema file $fullPath: " . $e->getMessage(), 0, $e);
|
||||
}
|
||||
|
||||
if($schema->getVersionId() > $currentVersion){
|
||||
//this might be a beta schema which shouldn't be applicable
|
||||
//TODO: why do we load the whole schema just to throw it away if it's too new? ...
|
||||
continue;
|
||||
}
|
||||
|
||||
$result[$priority] = $schema;
|
||||
}
|
||||
|
||||
ksort($result, SORT_NUMERIC);
|
||||
return $result;
|
||||
}
|
||||
|
||||
public static function loadSchemaFromString(string $raw, int $priority) : BlockStateUpgradeSchema{
|
||||
try{
|
||||
$json = json_decode($raw, false, flags: JSON_THROW_ON_ERROR);
|
||||
}catch(\JsonException $e){
|
||||
throw new \RuntimeException($e->getMessage(), 0, $e);
|
||||
}
|
||||
if(!is_object($json)){
|
||||
throw new \RuntimeException("Unexpected root type of schema file " . gettype($json) . ", expected object");
|
||||
}
|
||||
|
||||
$jsonMapper = new \JsonMapper();
|
||||
try{
|
||||
$model = $jsonMapper->map($json, new BlockStateUpgradeSchemaModel());
|
||||
}catch(\JsonMapper_Exception $e){
|
||||
throw new \RuntimeException($e->getMessage(), 0, $e);
|
||||
}
|
||||
|
||||
return self::fromJsonModel($model, $priority);
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\data\bedrock\block\upgrade;
|
||||
|
||||
use pocketmine\nbt\tag\Tag;
|
||||
|
||||
final class BlockStateUpgradeSchemaValueRemap{
|
||||
|
||||
public function __construct(
|
||||
public Tag $old,
|
||||
public Tag $new
|
||||
){}
|
||||
}
|
184
src/data/bedrock/block/upgrade/BlockStateUpgrader.php
Normal file
184
src/data/bedrock/block/upgrade/BlockStateUpgrader.php
Normal file
@ -0,0 +1,184 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\data\bedrock\block\upgrade;
|
||||
|
||||
use pocketmine\data\bedrock\block\BlockStateData;
|
||||
use pocketmine\nbt\tag\CompoundTag;
|
||||
use pocketmine\nbt\tag\Tag;
|
||||
use pocketmine\utils\Utils;
|
||||
use function ksort;
|
||||
use const SORT_NUMERIC;
|
||||
|
||||
final class BlockStateUpgrader{
|
||||
/** @var BlockStateUpgradeSchema[][] */
|
||||
private array $upgradeSchemas = [];
|
||||
|
||||
/**
|
||||
* @param BlockStateUpgradeSchema[] $upgradeSchemas
|
||||
* @phpstan-param array<int, BlockStateUpgradeSchema> $upgradeSchemas
|
||||
*/
|
||||
public function __construct(array $upgradeSchemas){
|
||||
foreach($upgradeSchemas as $schema){
|
||||
$this->addSchema($schema);
|
||||
}
|
||||
}
|
||||
|
||||
public function addSchema(BlockStateUpgradeSchema $schema) : void{
|
||||
$schemaList = $this->upgradeSchemas[$schema->getVersionId()] ?? [];
|
||||
|
||||
$priority = $schema->getPriority();
|
||||
if(isset($schemaList[$priority])){
|
||||
throw new \InvalidArgumentException("Cannot add two schemas to the same version with the same priority");
|
||||
}
|
||||
$schemaList[$priority] = $schema;
|
||||
ksort($schemaList, SORT_NUMERIC);
|
||||
$this->upgradeSchemas[$schema->getVersionId()] = $schemaList;
|
||||
|
||||
ksort($this->upgradeSchemas, SORT_NUMERIC);
|
||||
}
|
||||
|
||||
public function upgrade(BlockStateData $blockStateData) : BlockStateData{
|
||||
$version = $blockStateData->getVersion();
|
||||
foreach($this->upgradeSchemas as $resultVersion => $schemas){
|
||||
if($version > $resultVersion){
|
||||
//even if this is actually the same version, we have to apply it anyway because mojang are dumb and
|
||||
//didn't always bump the blockstate version when changing it :(
|
||||
continue;
|
||||
}
|
||||
foreach($schemas as $schema){
|
||||
$oldName = $blockStateData->getName();
|
||||
if(isset($schema->remappedStates[$oldName])){
|
||||
foreach($schema->remappedStates[$oldName] as $remap){
|
||||
if($blockStateData->getStates()->equals($remap->oldState)){
|
||||
$blockStateData = new BlockStateData($remap->newName, clone $remap->newState, $resultVersion);
|
||||
continue 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
$newName = $schema->renamedIds[$oldName] ?? null;
|
||||
|
||||
$stateChanges = 0;
|
||||
$states = $blockStateData->getStates();
|
||||
|
||||
$states = $this->applyPropertyAdded($schema, $oldName, $states, $stateChanges);
|
||||
$states = $this->applyPropertyRemoved($schema, $oldName, $states, $stateChanges);
|
||||
$states = $this->applyPropertyRenamedOrValueChanged($schema, $oldName, $states, $stateChanges);
|
||||
$states = $this->applyPropertyValueChanged($schema, $oldName, $states, $stateChanges);
|
||||
|
||||
if($newName !== null || $stateChanges > 0){
|
||||
$blockStateData = new BlockStateData($newName ?? $oldName, $states, $resultVersion);
|
||||
//don't break out; we may need to further upgrade the state
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $blockStateData;
|
||||
}
|
||||
|
||||
private function cloneIfNeeded(CompoundTag $states, int &$stateChanges) : CompoundTag{
|
||||
if($stateChanges === 0){
|
||||
$states = clone $states;
|
||||
}
|
||||
$stateChanges++;
|
||||
|
||||
return $states;
|
||||
}
|
||||
|
||||
private function applyPropertyAdded(BlockStateUpgradeSchema $schema, string $oldName, CompoundTag $states, int &$stateChanges) : CompoundTag{
|
||||
$newStates = $states;
|
||||
if(isset($schema->addedProperties[$oldName])){
|
||||
foreach(Utils::stringifyKeys($schema->addedProperties[$oldName]) as $propertyName => $value){
|
||||
$oldValue = $states->getTag($propertyName);
|
||||
if($oldValue === null){
|
||||
$newStates = $this->cloneIfNeeded($newStates, $stateChanges);
|
||||
$newStates->setTag($propertyName, $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $newStates;
|
||||
}
|
||||
|
||||
private function applyPropertyRemoved(BlockStateUpgradeSchema $schema, string $oldName, CompoundTag $states, int &$stateChanges) : CompoundTag{
|
||||
$newStates = $states;
|
||||
if(isset($schema->removedProperties[$oldName])){
|
||||
foreach($schema->removedProperties[$oldName] as $propertyName){
|
||||
if($states->getTag($propertyName) !== null){
|
||||
$newStates = $this->cloneIfNeeded($newStates, $stateChanges);
|
||||
$newStates->removeTag($propertyName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $newStates;
|
||||
}
|
||||
|
||||
private function locateNewPropertyValue(BlockStateUpgradeSchema $schema, string $oldName, string $oldPropertyName, Tag $oldValue) : Tag{
|
||||
if(isset($schema->remappedPropertyValues[$oldName][$oldPropertyName])){
|
||||
foreach($schema->remappedPropertyValues[$oldName][$oldPropertyName] as $mappedPair){
|
||||
if($mappedPair->old->equals($oldValue)){
|
||||
return $mappedPair->new;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $oldValue;
|
||||
}
|
||||
|
||||
private function applyPropertyRenamedOrValueChanged(BlockStateUpgradeSchema $schema, string $oldName, CompoundTag $states, int &$stateChanges) : CompoundTag{
|
||||
if(isset($schema->renamedProperties[$oldName])){
|
||||
foreach(Utils::stringifyKeys($schema->renamedProperties[$oldName]) as $oldPropertyName => $newPropertyName){
|
||||
$oldValue = $states->getTag($oldPropertyName);
|
||||
if($oldValue !== null){
|
||||
$states = $this->cloneIfNeeded($states, $stateChanges);
|
||||
$states->removeTag($oldPropertyName);
|
||||
|
||||
//If a value remap is needed, we need to do it here, since we won't be able to locate the property
|
||||
//after it's been renamed - value remaps are always indexed by old property name for the sake of
|
||||
//being able to do changes in any order.
|
||||
$states->setTag($newPropertyName, $this->locateNewPropertyValue($schema, $oldName, $oldPropertyName, $oldValue));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $states;
|
||||
}
|
||||
|
||||
private function applyPropertyValueChanged(BlockStateUpgradeSchema $schema, string $oldName, CompoundTag $states, int &$stateChanges) : CompoundTag{
|
||||
if(isset($schema->remappedPropertyValues[$oldName])){
|
||||
foreach(Utils::stringifyKeys($schema->remappedPropertyValues[$oldName]) as $oldPropertyName => $remappedValues){
|
||||
$oldValue = $states->getTag($oldPropertyName);
|
||||
if($oldValue !== null){
|
||||
$newValue = $this->locateNewPropertyValue($schema, $oldName, $oldPropertyName, $oldValue);
|
||||
if($newValue !== $oldValue){
|
||||
$states = $this->cloneIfNeeded($states, $stateChanges);
|
||||
$states->setTag($oldPropertyName, $newValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $states;
|
||||
}
|
||||
}
|
73
src/data/bedrock/block/upgrade/LegacyBlockStateMapper.php
Normal file
73
src/data/bedrock/block/upgrade/LegacyBlockStateMapper.php
Normal file
@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\data\bedrock\block\upgrade;
|
||||
|
||||
use pocketmine\data\bedrock\block\BlockStateData;
|
||||
use pocketmine\data\bedrock\LegacyBlockIdToStringIdMap;
|
||||
use pocketmine\network\mcpe\protocol\serializer\NetworkNbtSerializer;
|
||||
use pocketmine\utils\BinaryStream;
|
||||
|
||||
/**
|
||||
* Handles translating legacy 1.12 block ID/meta into modern blockstates.
|
||||
*/
|
||||
final class LegacyBlockStateMapper{
|
||||
/**
|
||||
* @param BlockStateData[][] $mappingTable
|
||||
* @phpstan-param array<string, array<int, BlockStateData>> $mappingTable
|
||||
*/
|
||||
public function __construct(
|
||||
private array $mappingTable,
|
||||
private LegacyBlockIdToStringIdMap $legacyNumericIdMap
|
||||
){}
|
||||
|
||||
public function fromStringIdMeta(string $id, int $meta) : ?BlockStateData{
|
||||
return $this->mappingTable[$id][$meta] ?? $this->mappingTable[$id][0] ?? null;
|
||||
}
|
||||
|
||||
public function fromIntIdMeta(int $id, int $meta) : ?BlockStateData{
|
||||
$stringId = $this->legacyNumericIdMap->legacyToString($id);
|
||||
if($stringId === null){
|
||||
return null;
|
||||
}
|
||||
return $this->fromStringIdMeta($stringId, $meta);
|
||||
}
|
||||
|
||||
public static function loadFromString(string $data, LegacyBlockIdToStringIdMap $idMap) : self{
|
||||
$mappingTable = [];
|
||||
|
||||
$legacyStateMapReader = new BinaryStream($data);
|
||||
$nbtReader = new NetworkNbtSerializer();
|
||||
while(!$legacyStateMapReader->feof()){
|
||||
$id = $legacyStateMapReader->get($legacyStateMapReader->getUnsignedVarInt());
|
||||
$meta = $legacyStateMapReader->getLShort();
|
||||
|
||||
$offset = $legacyStateMapReader->getOffset();
|
||||
$state = $nbtReader->read($legacyStateMapReader->getBuffer(), $offset)->mustGetCompoundTag();
|
||||
$legacyStateMapReader->setOffset($offset);
|
||||
$mappingTable[$id][$meta] = BlockStateData::fromNbt($state);
|
||||
}
|
||||
|
||||
return new self($mappingTable, $idMap);
|
||||
}
|
||||
}
|
@ -0,0 +1,98 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\data\bedrock\block\upgrade\model;
|
||||
|
||||
use function count;
|
||||
use function is_array;
|
||||
|
||||
/**
|
||||
* Model for loading upgrade schema data from JSON.
|
||||
*/
|
||||
final class BlockStateUpgradeSchemaModel implements \JsonSerializable{
|
||||
/** @required */
|
||||
public int $maxVersionMajor;
|
||||
/** @required */
|
||||
public int $maxVersionMinor;
|
||||
/** @required */
|
||||
public int $maxVersionPatch;
|
||||
/** @required */
|
||||
public int $maxVersionRevision;
|
||||
|
||||
/**
|
||||
* @var string[]
|
||||
* @phpstan-var array<string, string>
|
||||
*/
|
||||
public array $renamedIds;
|
||||
|
||||
/**
|
||||
* @var BlockStateUpgradeSchemaModelTag[][]
|
||||
* @phpstan-var array<string, array<string, BlockStateUpgradeSchemaModelTag>>
|
||||
*/
|
||||
public array $addedProperties;
|
||||
|
||||
/**
|
||||
* @var string[][]
|
||||
* @phpstan-var array<string, list<string>>
|
||||
*/
|
||||
public array $removedProperties;
|
||||
|
||||
/**
|
||||
* @var string[][]
|
||||
* @phpstan-var array<string, array<string, string>>
|
||||
*/
|
||||
public array $renamedProperties;
|
||||
|
||||
/**
|
||||
* @var string[][]
|
||||
* @phpstan-var array<string, array<string, string>>
|
||||
*/
|
||||
public array $remappedPropertyValues;
|
||||
|
||||
/**
|
||||
* @var BlockStateUpgradeSchemaModelValueRemap[][]
|
||||
* @phpstan-var array<string, list<BlockStateUpgradeSchemaModelValueRemap>>
|
||||
*/
|
||||
public array $remappedPropertyValuesIndex;
|
||||
|
||||
/**
|
||||
* @var BlockStateUpgradeSchemaModelBlockRemap[][]
|
||||
* @phpstan-var array<string, list<BlockStateUpgradeSchemaModelBlockRemap>>
|
||||
*/
|
||||
public array $remappedStates;
|
||||
|
||||
/**
|
||||
* @return mixed[]
|
||||
*/
|
||||
public function jsonSerialize() : array{
|
||||
$result = (array) $this;
|
||||
|
||||
foreach($result as $k => $v){
|
||||
if(is_array($v) && count($v) === 0){
|
||||
unset($result[$k]);
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\data\bedrock\block\upgrade\model;
|
||||
|
||||
final class BlockStateUpgradeSchemaModelBlockRemap{
|
||||
|
||||
/**
|
||||
* @var BlockStateUpgradeSchemaModelTag[]
|
||||
* @phpstan-var array<string, BlockStateUpgradeSchemaModelTag>
|
||||
* @required
|
||||
*/
|
||||
public array $oldState;
|
||||
|
||||
/** @required */
|
||||
public string $newName;
|
||||
|
||||
/**
|
||||
* @var BlockStateUpgradeSchemaModelTag[]
|
||||
* @phpstan-var array<string, BlockStateUpgradeSchemaModelTag>
|
||||
* @required
|
||||
*/
|
||||
public array $newState;
|
||||
|
||||
/**
|
||||
* @param BlockStateUpgradeSchemaModelTag[] $oldState
|
||||
* @param BlockStateUpgradeSchemaModelTag[] $newState
|
||||
* @phpstan-param array<string, BlockStateUpgradeSchemaModelTag> $oldState
|
||||
* @phpstan-param array<string, BlockStateUpgradeSchemaModelTag> $newState
|
||||
*/
|
||||
public function __construct(array $oldState, string $newName, array $newState){
|
||||
$this->oldState = $oldState;
|
||||
$this->newName = $newName;
|
||||
$this->newState = $newState;
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\data\bedrock\block\upgrade\model;
|
||||
|
||||
final class BlockStateUpgradeSchemaModelTag{
|
||||
public int $byte;
|
||||
public int $int;
|
||||
public string $string;
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\data\bedrock\block\upgrade\model;
|
||||
|
||||
final class BlockStateUpgradeSchemaModelValueRemap{
|
||||
/** @required */
|
||||
public BlockStateUpgradeSchemaModelTag $old;
|
||||
/** @required */
|
||||
public BlockStateUpgradeSchemaModelTag $new;
|
||||
|
||||
public function __construct(BlockStateUpgradeSchemaModelTag $old, BlockStateUpgradeSchemaModelTag $new){
|
||||
$this->old = $old;
|
||||
$this->new = $new;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user