mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 00:33:59 +00:00
Block: move all legacy metadata constants into a dedicated class
this makes it easier to see what is using metadata (and makes it easier to get rid of later).
This commit is contained in:
parent
1898db840d
commit
dd914e0752
@ -38,10 +38,6 @@ use pocketmine\Player;
|
||||
class Anvil extends Transparent implements Fallable{
|
||||
use FallableTrait;
|
||||
|
||||
public const TYPE_NORMAL = 0;
|
||||
public const TYPE_SLIGHTLY_DAMAGED = 4;
|
||||
public const TYPE_VERY_DAMAGED = 8;
|
||||
|
||||
/** @var int */
|
||||
protected $facing = Facing::NORTH;
|
||||
|
||||
|
@ -38,40 +38,33 @@ use function in_array;
|
||||
|
||||
abstract class BaseRail extends Flowable{
|
||||
|
||||
public const STRAIGHT_NORTH_SOUTH = 0;
|
||||
public const STRAIGHT_EAST_WEST = 1;
|
||||
public const ASCENDING_EAST = 2;
|
||||
public const ASCENDING_WEST = 3;
|
||||
public const ASCENDING_NORTH = 4;
|
||||
public const ASCENDING_SOUTH = 5;
|
||||
|
||||
protected const FLAG_ASCEND = 1 << 24; //used to indicate direction-up
|
||||
|
||||
protected const CONNECTIONS = [
|
||||
//straights
|
||||
self::STRAIGHT_NORTH_SOUTH => [
|
||||
BlockLegacyMetadata::RAIL_STRAIGHT_NORTH_SOUTH => [
|
||||
Facing::NORTH,
|
||||
Facing::SOUTH
|
||||
],
|
||||
self::STRAIGHT_EAST_WEST => [
|
||||
BlockLegacyMetadata::RAIL_STRAIGHT_EAST_WEST => [
|
||||
Facing::EAST,
|
||||
Facing::WEST
|
||||
],
|
||||
|
||||
//ascending
|
||||
self::ASCENDING_EAST => [
|
||||
BlockLegacyMetadata::RAIL_ASCENDING_EAST => [
|
||||
Facing::WEST,
|
||||
Facing::EAST | self::FLAG_ASCEND
|
||||
],
|
||||
self::ASCENDING_WEST => [
|
||||
BlockLegacyMetadata::RAIL_ASCENDING_WEST => [
|
||||
Facing::EAST,
|
||||
Facing::WEST | self::FLAG_ASCEND
|
||||
],
|
||||
self::ASCENDING_NORTH => [
|
||||
BlockLegacyMetadata::RAIL_ASCENDING_NORTH => [
|
||||
Facing::SOUTH,
|
||||
Facing::NORTH | self::FLAG_ASCEND
|
||||
],
|
||||
self::ASCENDING_SOUTH => [
|
||||
BlockLegacyMetadata::RAIL_ASCENDING_SOUTH => [
|
||||
Facing::NORTH,
|
||||
Facing::SOUTH | self::FLAG_ASCEND
|
||||
]
|
||||
@ -86,7 +79,7 @@ abstract class BaseRail extends Flowable{
|
||||
|
||||
protected function writeStateToMeta() : int{
|
||||
if(empty($this->connections)){
|
||||
return self::STRAIGHT_NORTH_SOUTH;
|
||||
return BlockLegacyMetadata::RAIL_STRAIGHT_NORTH_SOUTH;
|
||||
}
|
||||
return $this->getMetaForState($this->connections);
|
||||
}
|
||||
|
@ -39,8 +39,6 @@ use pocketmine\utils\TextFormat;
|
||||
use pocketmine\world\World;
|
||||
|
||||
class Bed extends Transparent{
|
||||
private const BITFLAG_OCCUPIED = 0x04;
|
||||
private const BITFLAG_HEAD = 0x08;
|
||||
|
||||
/** @var int */
|
||||
protected $facing = Facing::NORTH;
|
||||
@ -58,14 +56,14 @@ class Bed extends Transparent{
|
||||
|
||||
protected function writeStateToMeta() : int{
|
||||
return Bearing::fromFacing($this->facing) |
|
||||
($this->occupied ? self::BITFLAG_OCCUPIED : 0) |
|
||||
($this->head ? self::BITFLAG_HEAD : 0);
|
||||
($this->occupied ? BlockLegacyMetadata::BED_FLAG_OCCUPIED : 0) |
|
||||
($this->head ? BlockLegacyMetadata::BED_FLAG_HEAD : 0);
|
||||
}
|
||||
|
||||
public function readStateFromData(int $id, int $stateMeta) : void{
|
||||
$this->facing = BlockDataValidator::readLegacyHorizontalFacing($stateMeta & 0x03);
|
||||
$this->occupied = ($stateMeta & self::BITFLAG_OCCUPIED) !== 0;
|
||||
$this->head = ($stateMeta & self::BITFLAG_HEAD) !== 0;
|
||||
$this->occupied = ($stateMeta & BlockLegacyMetadata::BED_FLAG_OCCUPIED) !== 0;
|
||||
$this->head = ($stateMeta & BlockLegacyMetadata::BED_FLAG_HEAD) !== 0;
|
||||
}
|
||||
|
||||
public function getStateBitmask() : int{
|
||||
|
@ -33,11 +33,11 @@ class Bedrock extends Solid{
|
||||
}
|
||||
|
||||
public function readStateFromData(int $id, int $stateMeta) : void{
|
||||
$this->burnsForever = $stateMeta !== 0;
|
||||
$this->burnsForever = ($stateMeta & BlockLegacyMetadata::BEDROCK_FLAG_INFINIBURN) !== 0;
|
||||
}
|
||||
|
||||
protected function writeStateToMeta() : int{
|
||||
return $this->burnsForever ? 1 : 0;
|
||||
return $this->burnsForever ? BlockLegacyMetadata::BEDROCK_FLAG_INFINIBURN : 0;
|
||||
}
|
||||
|
||||
public function getStateBitmask() : int{
|
||||
|
@ -63,11 +63,11 @@ class BlockFactory{
|
||||
self::$diffusesSkyLight = \SplFixedArray::fromArray(array_fill(0, 8192, false));
|
||||
self::$blastResistance = \SplFixedArray::fromArray(array_fill(0, 8192, 0));
|
||||
|
||||
self::register(new ActivatorRail(new BID(BlockLegacyIds::ACTIVATOR_RAIL, BaseRail::STRAIGHT_NORTH_SOUTH), "Activator Rail"));
|
||||
self::register(new ActivatorRail(new BID(BlockLegacyIds::ACTIVATOR_RAIL), "Activator Rail"));
|
||||
self::register(new Air(new BID(BlockLegacyIds::AIR), "Air"));
|
||||
self::register(new Anvil(new BID(BlockLegacyIds::ANVIL, Anvil::TYPE_NORMAL), "Anvil"));
|
||||
self::register(new Anvil(new BID(BlockLegacyIds::ANVIL, Anvil::TYPE_SLIGHTLY_DAMAGED), "Slightly Damaged Anvil"));
|
||||
self::register(new Anvil(new BID(BlockLegacyIds::ANVIL, Anvil::TYPE_VERY_DAMAGED), "Very Damaged Anvil"));
|
||||
self::register(new Anvil(new BID(BlockLegacyIds::ANVIL, BlockLegacyMetadata::ANVIL_NORMAL), "Anvil"));
|
||||
self::register(new Anvil(new BID(BlockLegacyIds::ANVIL, BlockLegacyMetadata::ANVIL_SLIGHTLY_DAMAGED), "Slightly Damaged Anvil"));
|
||||
self::register(new Anvil(new BID(BlockLegacyIds::ANVIL, BlockLegacyMetadata::ANVIL_VERY_DAMAGED), "Very Damaged Anvil"));
|
||||
self::register(new Banner(new BlockIdentifierFlattened(BlockLegacyIds::STANDING_BANNER, BlockLegacyIds::WALL_BANNER, 0, ItemIds::BANNER, \pocketmine\tile\Banner::class), "Banner"));
|
||||
self::register(new Barrier(new BID(BlockLegacyIds::BARRIER), "Barrier"));
|
||||
self::register(new Bed(new BID(BlockLegacyIds::BED_BLOCK, 0, ItemIds::BED, \pocketmine\tile\Bed::class), "Bed Block"));
|
||||
@ -88,7 +88,7 @@ class BlockFactory{
|
||||
self::register(new Clay(new BID(BlockLegacyIds::CLAY_BLOCK), "Clay Block"));
|
||||
self::register(new Coal(new BID(BlockLegacyIds::COAL_BLOCK), "Coal Block"));
|
||||
self::register(new CoalOre(new BID(BlockLegacyIds::COAL_ORE), "Coal Ore"));
|
||||
self::register(new CoarseDirt(new BID(BlockLegacyIds::DIRT, Dirt::COARSE), "Coarse Dirt"));
|
||||
self::register(new CoarseDirt(new BID(BlockLegacyIds::DIRT, BlockLegacyMetadata::DIRT_COARSE), "Coarse Dirt"));
|
||||
self::register(new Cobblestone(new BID(BlockLegacyIds::COBBLESTONE), "Cobblestone"));
|
||||
self::register(new Cobblestone(new BID(BlockLegacyIds::MOSSY_COBBLESTONE), "Moss Stone"));
|
||||
self::register(new CobblestoneStairs(new BID(BlockLegacyIds::COBBLESTONE_STAIRS), "Cobblestone Stairs"));
|
||||
@ -100,13 +100,13 @@ class BlockFactory{
|
||||
self::register(new DetectorRail(new BID(BlockLegacyIds::DETECTOR_RAIL), "Detector Rail"));
|
||||
self::register(new Diamond(new BID(BlockLegacyIds::DIAMOND_BLOCK), "Diamond Block"));
|
||||
self::register(new DiamondOre(new BID(BlockLegacyIds::DIAMOND_ORE), "Diamond Ore"));
|
||||
self::register(new Dirt(new BID(BlockLegacyIds::DIRT, Dirt::NORMAL), "Dirt"));
|
||||
self::register(new DoublePlant(new BID(BlockLegacyIds::DOUBLE_PLANT, 0), "Sunflower"));
|
||||
self::register(new DoublePlant(new BID(BlockLegacyIds::DOUBLE_PLANT, 1), "Lilac"));
|
||||
self::register(new DoublePlant(new BID(BlockLegacyIds::DOUBLE_PLANT, 4), "Rose Bush"));
|
||||
self::register(new DoublePlant(new BID(BlockLegacyIds::DOUBLE_PLANT, 5), "Peony"));
|
||||
self::register(new DoubleTallGrass(new BID(BlockLegacyIds::DOUBLE_PLANT, 2), "Double Tallgrass"));
|
||||
self::register(new DoubleTallGrass(new BID(BlockLegacyIds::DOUBLE_PLANT, 3), "Large Fern"));
|
||||
self::register(new Dirt(new BID(BlockLegacyIds::DIRT, BlockLegacyMetadata::DIRT_NORMAL), "Dirt"));
|
||||
self::register(new DoublePlant(new BID(BlockLegacyIds::DOUBLE_PLANT, BlockLegacyMetadata::DOUBLE_PLANT_SUNFLOWER), "Sunflower"));
|
||||
self::register(new DoublePlant(new BID(BlockLegacyIds::DOUBLE_PLANT, BlockLegacyMetadata::DOUBLE_PLANT_LILAC), "Lilac"));
|
||||
self::register(new DoublePlant(new BID(BlockLegacyIds::DOUBLE_PLANT, BlockLegacyMetadata::DOUBLE_PLANT_ROSE_BUSH), "Rose Bush"));
|
||||
self::register(new DoublePlant(new BID(BlockLegacyIds::DOUBLE_PLANT, BlockLegacyMetadata::DOUBLE_PLANT_PEONY), "Peony"));
|
||||
self::register(new DoubleTallGrass(new BID(BlockLegacyIds::DOUBLE_PLANT, BlockLegacyMetadata::DOUBLE_PLANT_TALLGRASS), "Double Tallgrass"));
|
||||
self::register(new DoubleTallGrass(new BID(BlockLegacyIds::DOUBLE_PLANT, BlockLegacyMetadata::DOUBLE_PLANT_LARGE_FERN), "Large Fern"));
|
||||
self::register(new DragonEgg(new BID(BlockLegacyIds::DRAGON_EGG), "Dragon Egg"));
|
||||
self::register(new Emerald(new BID(BlockLegacyIds::EMERALD_BLOCK), "Emerald Block"));
|
||||
self::register(new EmeraldOre(new BID(BlockLegacyIds::EMERALD_ORE), "Emerald Ore"));
|
||||
@ -119,17 +119,17 @@ class BlockFactory{
|
||||
self::register(new Farmland(new BID(BlockLegacyIds::FARMLAND), "Farmland"));
|
||||
self::register(new Fire(new BID(BlockLegacyIds::FIRE), "Fire Block"));
|
||||
self::register(new Flower(new BID(BlockLegacyIds::DANDELION), "Dandelion"));
|
||||
self::register(new Flower(new BID(BlockLegacyIds::RED_FLOWER, Flower::TYPE_ALLIUM), "Allium"));
|
||||
self::register(new Flower(new BID(BlockLegacyIds::RED_FLOWER, Flower::TYPE_AZURE_BLUET), "Azure Bluet"));
|
||||
self::register(new Flower(new BID(BlockLegacyIds::RED_FLOWER, Flower::TYPE_BLUE_ORCHID), "Blue Orchid"));
|
||||
self::register(new Flower(new BID(BlockLegacyIds::RED_FLOWER, Flower::TYPE_CORNFLOWER), "Cornflower"));
|
||||
self::register(new Flower(new BID(BlockLegacyIds::RED_FLOWER, Flower::TYPE_LILY_OF_THE_VALLEY), "Lily of the Valley"));
|
||||
self::register(new Flower(new BID(BlockLegacyIds::RED_FLOWER, Flower::TYPE_ORANGE_TULIP), "Orange Tulip"));
|
||||
self::register(new Flower(new BID(BlockLegacyIds::RED_FLOWER, Flower::TYPE_OXEYE_DAISY), "Oxeye Daisy"));
|
||||
self::register(new Flower(new BID(BlockLegacyIds::RED_FLOWER, Flower::TYPE_PINK_TULIP), "Pink Tulip"));
|
||||
self::register(new Flower(new BID(BlockLegacyIds::RED_FLOWER, Flower::TYPE_POPPY), "Poppy"));
|
||||
self::register(new Flower(new BID(BlockLegacyIds::RED_FLOWER, Flower::TYPE_RED_TULIP), "Red Tulip"));
|
||||
self::register(new Flower(new BID(BlockLegacyIds::RED_FLOWER, Flower::TYPE_WHITE_TULIP), "White Tulip"));
|
||||
self::register(new Flower(new BID(BlockLegacyIds::RED_FLOWER, BlockLegacyMetadata::FLOWER_ALLIUM), "Allium"));
|
||||
self::register(new Flower(new BID(BlockLegacyIds::RED_FLOWER, BlockLegacyMetadata::FLOWER_AZURE_BLUET), "Azure Bluet"));
|
||||
self::register(new Flower(new BID(BlockLegacyIds::RED_FLOWER, BlockLegacyMetadata::FLOWER_BLUE_ORCHID), "Blue Orchid"));
|
||||
self::register(new Flower(new BID(BlockLegacyIds::RED_FLOWER, BlockLegacyMetadata::FLOWER_CORNFLOWER), "Cornflower"));
|
||||
self::register(new Flower(new BID(BlockLegacyIds::RED_FLOWER, BlockLegacyMetadata::FLOWER_LILY_OF_THE_VALLEY), "Lily of the Valley"));
|
||||
self::register(new Flower(new BID(BlockLegacyIds::RED_FLOWER, BlockLegacyMetadata::FLOWER_ORANGE_TULIP), "Orange Tulip"));
|
||||
self::register(new Flower(new BID(BlockLegacyIds::RED_FLOWER, BlockLegacyMetadata::FLOWER_OXEYE_DAISY), "Oxeye Daisy"));
|
||||
self::register(new Flower(new BID(BlockLegacyIds::RED_FLOWER, BlockLegacyMetadata::FLOWER_PINK_TULIP), "Pink Tulip"));
|
||||
self::register(new Flower(new BID(BlockLegacyIds::RED_FLOWER, BlockLegacyMetadata::FLOWER_POPPY), "Poppy"));
|
||||
self::register(new Flower(new BID(BlockLegacyIds::RED_FLOWER, BlockLegacyMetadata::FLOWER_RED_TULIP), "Red Tulip"));
|
||||
self::register(new Flower(new BID(BlockLegacyIds::RED_FLOWER, BlockLegacyMetadata::FLOWER_WHITE_TULIP), "White Tulip"));
|
||||
self::register(new FlowerPot(new BID(BlockLegacyIds::FLOWER_POT_BLOCK, 0, ItemIds::FLOWER_POT, \pocketmine\tile\FlowerPot::class), "Flower Pot"));
|
||||
self::register(new FrostedIce(new BID(BlockLegacyIds::FROSTED_ICE), "Frosted Ice"));
|
||||
self::register(new Furnace(new BlockIdentifierFlattened(BlockLegacyIds::FURNACE, BlockLegacyIds::LIT_FURNACE, 0, null, \pocketmine\tile\Furnace::class), "Furnace"));
|
||||
@ -147,34 +147,34 @@ class BlockFactory{
|
||||
self::register(new HardenedGlassPane(new BID(BlockLegacyIds::HARD_GLASS_PANE), "Hardened Glass Pane"));
|
||||
self::register(new HayBale(new BID(BlockLegacyIds::HAY_BALE), "Hay Bale"));
|
||||
self::register(new Ice(new BID(BlockLegacyIds::ICE), "Ice"));
|
||||
self::register(new class(new BID(BlockLegacyIds::MONSTER_EGG), "Infested Stone") extends InfestedStone{
|
||||
self::register(new class(new BID(BlockLegacyIds::MONSTER_EGG, BlockLegacyMetadata::INFESTED_STONE), "Infested Stone") extends InfestedStone{
|
||||
public function getSilkTouchDrops(Item $item) : array{
|
||||
return [ItemFactory::get(ItemIds::STONE)];
|
||||
}
|
||||
});
|
||||
self::register(new class(new BID(BlockLegacyIds::MONSTER_EGG, 1), "Infested Cobblestone") extends InfestedStone{
|
||||
self::register(new class(new BID(BlockLegacyIds::MONSTER_EGG, BlockLegacyMetadata::INFESTED_COBBLESTONE), "Infested Cobblestone") extends InfestedStone{
|
||||
public function getSilkTouchDrops(Item $item) : array{
|
||||
return [ItemFactory::get(ItemIds::COBBLESTONE)];
|
||||
}
|
||||
});
|
||||
self::register(new class(new BID(BlockLegacyIds::MONSTER_EGG, 2), "Infested Stone Brick") extends InfestedStone{
|
||||
self::register(new class(new BID(BlockLegacyIds::MONSTER_EGG, BlockLegacyMetadata::INFESTED_STONE_BRICK), "Infested Stone Brick") extends InfestedStone{
|
||||
public function getSilkTouchDrops(Item $item) : array{
|
||||
return [ItemFactory::get(ItemIds::STONE_BRICK)];
|
||||
}
|
||||
});
|
||||
self::register(new class(new BID(BlockLegacyIds::MONSTER_EGG, 3), "Infested Mossy Stone Brick") extends InfestedStone{
|
||||
self::register(new class(new BID(BlockLegacyIds::MONSTER_EGG, BlockLegacyMetadata::INFESTED_STONE_BRICK_MOSSY), "Infested Mossy Stone Brick") extends InfestedStone{
|
||||
public function getSilkTouchDrops(Item $item) : array{
|
||||
return [ItemFactory::get(ItemIds::STONE_BRICK, StoneBricks::MOSSY)];
|
||||
return [ItemFactory::get(ItemIds::STONE_BRICK, BlockLegacyMetadata::STONE_BRICK_MOSSY)];
|
||||
}
|
||||
});
|
||||
self::register(new class(new BID(BlockLegacyIds::MONSTER_EGG, 4), "Infested Cracked Stone Brick") extends InfestedStone{
|
||||
self::register(new class(new BID(BlockLegacyIds::MONSTER_EGG, BlockLegacyMetadata::INFESTED_STONE_BRICK_CRACKED), "Infested Cracked Stone Brick") extends InfestedStone{
|
||||
public function getSilkTouchDrops(Item $item) : array{
|
||||
return [ItemFactory::get(ItemIds::STONE_BRICK, StoneBricks::CRACKED)];
|
||||
return [ItemFactory::get(ItemIds::STONE_BRICK, BlockLegacyMetadata::STONE_BRICK_CRACKED)];
|
||||
}
|
||||
});
|
||||
self::register(new class(new BID(BlockLegacyIds::MONSTER_EGG, 5), "Infested Chiseled Stone Brick") extends InfestedStone{
|
||||
self::register(new class(new BID(BlockLegacyIds::MONSTER_EGG, BlockLegacyMetadata::INFESTED_STONE_BRICK_CHISELED), "Infested Chiseled Stone Brick") extends InfestedStone{
|
||||
public function getSilkTouchDrops(Item $item) : array{
|
||||
return [ItemFactory::get(ItemIds::STONE_BRICK, StoneBricks::CHISELED)];
|
||||
return [ItemFactory::get(ItemIds::STONE_BRICK, BlockLegacyMetadata::STONE_BRICK_CHISELED)];
|
||||
}
|
||||
});
|
||||
self::register(new InfoUpdate(new BID(BlockLegacyIds::INFO_UPDATE), "update!"));
|
||||
@ -212,25 +212,25 @@ class BlockFactory{
|
||||
self::register(new PackedIce(new BID(BlockLegacyIds::PACKED_ICE), "Packed Ice"));
|
||||
self::register(new Podzol(new BID(BlockLegacyIds::PODZOL), "Podzol"));
|
||||
self::register(new Potato(new BID(BlockLegacyIds::POTATOES), "Potato Block"));
|
||||
self::register(new PoweredRail(new BID(BlockLegacyIds::GOLDEN_RAIL, BaseRail::STRAIGHT_NORTH_SOUTH), "Powered Rail"));
|
||||
self::register(new Prismarine(new BID(BlockLegacyIds::PRISMARINE, Prismarine::BRICKS), "Prismarine Bricks"));
|
||||
self::register(new Prismarine(new BID(BlockLegacyIds::PRISMARINE, Prismarine::DARK), "Dark Prismarine"));
|
||||
self::register(new Prismarine(new BID(BlockLegacyIds::PRISMARINE, Prismarine::NORMAL), "Prismarine"));
|
||||
self::register(new PoweredRail(new BID(BlockLegacyIds::GOLDEN_RAIL, BlockLegacyMetadata::RAIL_STRAIGHT_NORTH_SOUTH), "Powered Rail"));
|
||||
self::register(new Prismarine(new BID(BlockLegacyIds::PRISMARINE, BlockLegacyMetadata::PRISMARINE_BRICKS), "Prismarine Bricks"));
|
||||
self::register(new Prismarine(new BID(BlockLegacyIds::PRISMARINE, BlockLegacyMetadata::PRISMARINE_DARK), "Dark Prismarine"));
|
||||
self::register(new Prismarine(new BID(BlockLegacyIds::PRISMARINE, BlockLegacyMetadata::PRISMARINE_NORMAL), "Prismarine"));
|
||||
self::register(new Pumpkin(new BID(BlockLegacyIds::PUMPKIN), "Pumpkin"));
|
||||
self::register(new PumpkinStem(new BID(BlockLegacyIds::PUMPKIN_STEM, 0, ItemIds::PUMPKIN_SEEDS), "Pumpkin Stem"));
|
||||
self::register(new Purpur(new BID(BlockLegacyIds::PURPUR_BLOCK), "Purpur Block"));
|
||||
self::register(new class(new BID(BlockLegacyIds::PURPUR_BLOCK, 2), "Purpur Pillar") extends Purpur{
|
||||
self::register(new Purpur(new BID(BlockLegacyIds::PURPUR_BLOCK, BlockLegacyMetadata::PURPUR_NORMAL), "Purpur Block"));
|
||||
self::register(new class(new BID(BlockLegacyIds::PURPUR_BLOCK, BlockLegacyMetadata::PURPUR_PILLAR), "Purpur Pillar") extends Purpur{
|
||||
use PillarRotationTrait;
|
||||
});
|
||||
self::register(new PurpurStairs(new BID(BlockLegacyIds::PURPUR_STAIRS), "Purpur Stairs"));
|
||||
self::register(new Quartz(new BID(BlockLegacyIds::QUARTZ_BLOCK, Quartz::NORMAL), "Quartz Block"));
|
||||
self::register(new class(new BID(BlockLegacyIds::QUARTZ_BLOCK, Quartz::CHISELED), "Chiseled Quartz Block") extends Quartz{
|
||||
self::register(new Quartz(new BID(BlockLegacyIds::QUARTZ_BLOCK, BlockLegacyMetadata::QUARTZ_NORMAL), "Quartz Block"));
|
||||
self::register(new class(new BID(BlockLegacyIds::QUARTZ_BLOCK, BlockLegacyMetadata::QUARTZ_CHISELED), "Chiseled Quartz Block") extends Quartz{
|
||||
use PillarRotationTrait;
|
||||
});
|
||||
self::register(new class(new BID(BlockLegacyIds::QUARTZ_BLOCK, Quartz::PILLAR), "Quartz Pillar") extends Quartz{
|
||||
self::register(new class(new BID(BlockLegacyIds::QUARTZ_BLOCK, BlockLegacyMetadata::QUARTZ_PILLAR), "Quartz Pillar") extends Quartz{
|
||||
use PillarRotationTrait;
|
||||
});
|
||||
self::register(new Quartz(new BID(BlockLegacyIds::QUARTZ_BLOCK, Quartz::SMOOTH), "Smooth Quartz Block")); //TODO: this has axis rotation in 1.9, unsure if a bug (https://bugs.mojang.com/browse/MCPE-39074)
|
||||
self::register(new Quartz(new BID(BlockLegacyIds::QUARTZ_BLOCK, BlockLegacyMetadata::QUARTZ_SMOOTH), "Smooth Quartz Block")); //TODO: this has axis rotation in 1.9, unsure if a bug (https://bugs.mojang.com/browse/MCPE-39074)
|
||||
self::register(new QuartzStairs(new BID(BlockLegacyIds::QUARTZ_STAIRS), "Quartz Stairs"));
|
||||
self::register(new Rail(new BID(BlockLegacyIds::RAIL), "Rail"));
|
||||
self::register(new RedMushroom(new BID(BlockLegacyIds::RED_MUSHROOM), "Red Mushroom"));
|
||||
@ -250,60 +250,60 @@ class BlockFactory{
|
||||
self::register(new SeaLantern(new BID(BlockLegacyIds::SEALANTERN), "Sea Lantern"));
|
||||
self::register(new SeaPickle(new BID(BlockLegacyIds::SEA_PICKLE), "Sea Pickle"));
|
||||
self::register(new Skull(new BID(BlockLegacyIds::MOB_HEAD_BLOCK, 0, null, \pocketmine\tile\Skull::class), "Mob Head"));
|
||||
self::register(new SmoothStone(new BID(BlockLegacyIds::STONE, Stone::NORMAL), "Stone"));
|
||||
self::register(new SmoothStone(new BID(BlockLegacyIds::STONE, BlockLegacyMetadata::STONE_NORMAL), "Stone"));
|
||||
self::register(new Snow(new BID(BlockLegacyIds::SNOW), "Snow Block"));
|
||||
self::register(new SnowLayer(new BID(BlockLegacyIds::SNOW_LAYER), "Snow Layer"));
|
||||
self::register(new SoulSand(new BID(BlockLegacyIds::SOUL_SAND), "Soul Sand"));
|
||||
self::register(new Sponge(new BID(BlockLegacyIds::SPONGE), "Sponge"));
|
||||
self::register(new Stone(new BID(BlockLegacyIds::STONE, Stone::ANDESITE), "Andesite"));
|
||||
self::register(new Stone(new BID(BlockLegacyIds::STONE, Stone::DIORITE), "Diorite"));
|
||||
self::register(new Stone(new BID(BlockLegacyIds::STONE, Stone::GRANITE), "Granite"));
|
||||
self::register(new Stone(new BID(BlockLegacyIds::STONE, Stone::POLISHED_ANDESITE), "Polished Andesite"));
|
||||
self::register(new Stone(new BID(BlockLegacyIds::STONE, Stone::POLISHED_DIORITE), "Polished Diorite"));
|
||||
self::register(new Stone(new BID(BlockLegacyIds::STONE, Stone::POLISHED_GRANITE), "Polished Granite"));
|
||||
self::register(new Stone(new BID(BlockLegacyIds::STONE, BlockLegacyMetadata::STONE_ANDESITE), "Andesite"));
|
||||
self::register(new Stone(new BID(BlockLegacyIds::STONE, BlockLegacyMetadata::STONE_DIORITE), "Diorite"));
|
||||
self::register(new Stone(new BID(BlockLegacyIds::STONE, BlockLegacyMetadata::STONE_GRANITE), "Granite"));
|
||||
self::register(new Stone(new BID(BlockLegacyIds::STONE, BlockLegacyMetadata::STONE_POLISHED_ANDESITE), "Polished Andesite"));
|
||||
self::register(new Stone(new BID(BlockLegacyIds::STONE, BlockLegacyMetadata::STONE_POLISHED_DIORITE), "Polished Diorite"));
|
||||
self::register(new Stone(new BID(BlockLegacyIds::STONE, BlockLegacyMetadata::STONE_POLISHED_GRANITE), "Polished Granite"));
|
||||
self::register(new StoneBrickStairs(new BID(BlockLegacyIds::STONE_BRICK_STAIRS), "Stone Brick Stairs"));
|
||||
self::register(new StoneBricks(new BID(BlockLegacyIds::STONEBRICK, StoneBricks::CHISELED), "Chiseled Stone Bricks"));
|
||||
self::register(new StoneBricks(new BID(BlockLegacyIds::STONEBRICK, StoneBricks::CRACKED), "Cracked Stone Bricks"));
|
||||
self::register(new StoneBricks(new BID(BlockLegacyIds::STONEBRICK, StoneBricks::MOSSY), "Mossy Stone Bricks"));
|
||||
self::register(new StoneBricks(new BID(BlockLegacyIds::STONEBRICK, StoneBricks::NORMAL), "Stone Bricks"));
|
||||
self::register(new StoneBricks(new BID(BlockLegacyIds::STONEBRICK, BlockLegacyMetadata::STONE_BRICK_CHISELED), "Chiseled Stone Bricks"));
|
||||
self::register(new StoneBricks(new BID(BlockLegacyIds::STONEBRICK, BlockLegacyMetadata::STONE_BRICK_CRACKED), "Cracked Stone Bricks"));
|
||||
self::register(new StoneBricks(new BID(BlockLegacyIds::STONEBRICK, BlockLegacyMetadata::STONE_BRICK_MOSSY), "Mossy Stone Bricks"));
|
||||
self::register(new StoneBricks(new BID(BlockLegacyIds::STONEBRICK, BlockLegacyMetadata::STONE_BRICK_NORMAL), "Stone Bricks"));
|
||||
self::register(new StoneButton(new BID(BlockLegacyIds::STONE_BUTTON), "Stone Button"));
|
||||
self::register(new StonePressurePlate(new BID(BlockLegacyIds::STONE_PRESSURE_PLATE), "Stone Pressure Plate"));
|
||||
self::register(new StoneSlab(new BlockIdentifierFlattened(BlockLegacyIds::STONE_SLAB, BlockLegacyIds::DOUBLE_STONE_SLAB, 0), "Smooth Stone"));
|
||||
self::register(new StoneSlab(new BlockIdentifierFlattened(BlockLegacyIds::STONE_SLAB, BlockLegacyIds::DOUBLE_STONE_SLAB, 1), "Sandstone"));
|
||||
self::register(new StoneSlab(new BlockIdentifierFlattened(BlockLegacyIds::STONE_SLAB, BlockLegacyIds::DOUBLE_STONE_SLAB, 2), "Fake Wooden"));
|
||||
self::register(new StoneSlab(new BlockIdentifierFlattened(BlockLegacyIds::STONE_SLAB, BlockLegacyIds::DOUBLE_STONE_SLAB, 3), "Cobblestone"));
|
||||
self::register(new StoneSlab(new BlockIdentifierFlattened(BlockLegacyIds::STONE_SLAB, BlockLegacyIds::DOUBLE_STONE_SLAB, 4), "Brick"));
|
||||
self::register(new StoneSlab(new BlockIdentifierFlattened(BlockLegacyIds::STONE_SLAB, BlockLegacyIds::DOUBLE_STONE_SLAB, 5), "Stone Brick"));
|
||||
self::register(new StoneSlab(new BlockIdentifierFlattened(BlockLegacyIds::STONE_SLAB, BlockLegacyIds::DOUBLE_STONE_SLAB, 6), "Quartz"));
|
||||
self::register(new StoneSlab(new BlockIdentifierFlattened(BlockLegacyIds::STONE_SLAB, BlockLegacyIds::DOUBLE_STONE_SLAB, 7), "Nether Brick"));
|
||||
self::register(new StoneSlab(new BlockIdentifierFlattened(BlockLegacyIds::STONE_SLAB2, BlockLegacyIds::DOUBLE_STONE_SLAB2, 0), "Red Sandstone"));
|
||||
self::register(new StoneSlab(new BlockIdentifierFlattened(BlockLegacyIds::STONE_SLAB2, BlockLegacyIds::DOUBLE_STONE_SLAB2, 1), "Purpur"));
|
||||
self::register(new StoneSlab(new BlockIdentifierFlattened(BlockLegacyIds::STONE_SLAB2, BlockLegacyIds::DOUBLE_STONE_SLAB2, 2), "Prismarine"));
|
||||
self::register(new StoneSlab(new BlockIdentifierFlattened(BlockLegacyIds::STONE_SLAB2, BlockLegacyIds::DOUBLE_STONE_SLAB2, 3), "Dark Prismarine"));
|
||||
self::register(new StoneSlab(new BlockIdentifierFlattened(BlockLegacyIds::STONE_SLAB2, BlockLegacyIds::DOUBLE_STONE_SLAB2, 4), "Prismarine Bricks"));
|
||||
self::register(new StoneSlab(new BlockIdentifierFlattened(BlockLegacyIds::STONE_SLAB2, BlockLegacyIds::DOUBLE_STONE_SLAB2, 5), "Mossy Cobblestone"));
|
||||
self::register(new StoneSlab(new BlockIdentifierFlattened(BlockLegacyIds::STONE_SLAB2, BlockLegacyIds::DOUBLE_STONE_SLAB2, 6), "Smooth Sandstone"));
|
||||
self::register(new StoneSlab(new BlockIdentifierFlattened(BlockLegacyIds::STONE_SLAB2, BlockLegacyIds::DOUBLE_STONE_SLAB2, 7), "Red Nether Brick"));
|
||||
self::register(new StoneSlab(new BlockIdentifierFlattened(BlockLegacyIds::STONE_SLAB3, BlockLegacyIds::DOUBLE_STONE_SLAB3, 0), "End Stone Brick"));
|
||||
self::register(new StoneSlab(new BlockIdentifierFlattened(BlockLegacyIds::STONE_SLAB3, BlockLegacyIds::DOUBLE_STONE_SLAB3, 1), "Smooth Red Sandstone"));
|
||||
self::register(new StoneSlab(new BlockIdentifierFlattened(BlockLegacyIds::STONE_SLAB3, BlockLegacyIds::DOUBLE_STONE_SLAB3, 2), "Polished Andesite"));
|
||||
self::register(new StoneSlab(new BlockIdentifierFlattened(BlockLegacyIds::STONE_SLAB3, BlockLegacyIds::DOUBLE_STONE_SLAB3, 3), "Andesite"));
|
||||
self::register(new StoneSlab(new BlockIdentifierFlattened(BlockLegacyIds::STONE_SLAB3, BlockLegacyIds::DOUBLE_STONE_SLAB3, 4), "Diorite"));
|
||||
self::register(new StoneSlab(new BlockIdentifierFlattened(BlockLegacyIds::STONE_SLAB3, BlockLegacyIds::DOUBLE_STONE_SLAB3, 5), "Polished Diorite"));
|
||||
self::register(new StoneSlab(new BlockIdentifierFlattened(BlockLegacyIds::STONE_SLAB3, BlockLegacyIds::DOUBLE_STONE_SLAB3, 6), "Granite"));
|
||||
self::register(new StoneSlab(new BlockIdentifierFlattened(BlockLegacyIds::STONE_SLAB3, BlockLegacyIds::DOUBLE_STONE_SLAB3, 7), "Polished Granite"));
|
||||
self::register(new StoneSlab(new BlockIdentifierFlattened(BlockLegacyIds::STONE_SLAB4, BlockLegacyIds::DOUBLE_STONE_SLAB4, 0), "Mossy Stone Brick"));
|
||||
self::register(new StoneSlab(new BlockIdentifierFlattened(BlockLegacyIds::STONE_SLAB4, BlockLegacyIds::DOUBLE_STONE_SLAB4, 1), "Smooth Quartz"));
|
||||
self::register(new StoneSlab(new BlockIdentifierFlattened(BlockLegacyIds::STONE_SLAB4, BlockLegacyIds::DOUBLE_STONE_SLAB4, 2), "Stone"));
|
||||
self::register(new StoneSlab(new BlockIdentifierFlattened(BlockLegacyIds::STONE_SLAB4, BlockLegacyIds::DOUBLE_STONE_SLAB4, 3), "Cut Sandstone"));
|
||||
self::register(new StoneSlab(new BlockIdentifierFlattened(BlockLegacyIds::STONE_SLAB4, BlockLegacyIds::DOUBLE_STONE_SLAB4, 4), "Cut Red Sandstone"));
|
||||
self::register(new StoneSlab(new BlockIdentifierFlattened(BlockLegacyIds::STONE_SLAB, BlockLegacyIds::DOUBLE_STONE_SLAB, BlockLegacyMetadata::STONE_SLAB_BRICK), "Brick"));
|
||||
self::register(new StoneSlab(new BlockIdentifierFlattened(BlockLegacyIds::STONE_SLAB, BlockLegacyIds::DOUBLE_STONE_SLAB, BlockLegacyMetadata::STONE_SLAB_COBBLESTONE), "Cobblestone"));
|
||||
self::register(new StoneSlab(new BlockIdentifierFlattened(BlockLegacyIds::STONE_SLAB, BlockLegacyIds::DOUBLE_STONE_SLAB, BlockLegacyMetadata::STONE_SLAB_FAKE_WOODEN), "Fake Wooden"));
|
||||
self::register(new StoneSlab(new BlockIdentifierFlattened(BlockLegacyIds::STONE_SLAB, BlockLegacyIds::DOUBLE_STONE_SLAB, BlockLegacyMetadata::STONE_SLAB_NETHER_BRICK), "Nether Brick"));
|
||||
self::register(new StoneSlab(new BlockIdentifierFlattened(BlockLegacyIds::STONE_SLAB, BlockLegacyIds::DOUBLE_STONE_SLAB, BlockLegacyMetadata::STONE_SLAB_QUARTZ), "Quartz"));
|
||||
self::register(new StoneSlab(new BlockIdentifierFlattened(BlockLegacyIds::STONE_SLAB, BlockLegacyIds::DOUBLE_STONE_SLAB, BlockLegacyMetadata::STONE_SLAB_SANDSTONE), "Sandstone"));
|
||||
self::register(new StoneSlab(new BlockIdentifierFlattened(BlockLegacyIds::STONE_SLAB, BlockLegacyIds::DOUBLE_STONE_SLAB, BlockLegacyMetadata::STONE_SLAB_SMOOTH_STONE), "Smooth Stone"));
|
||||
self::register(new StoneSlab(new BlockIdentifierFlattened(BlockLegacyIds::STONE_SLAB, BlockLegacyIds::DOUBLE_STONE_SLAB, BlockLegacyMetadata::STONE_SLAB_STONE_BRICK), "Stone Brick"));
|
||||
self::register(new StoneSlab(new BlockIdentifierFlattened(BlockLegacyIds::STONE_SLAB2, BlockLegacyIds::DOUBLE_STONE_SLAB2, BlockLegacyMetadata::STONE_SLAB2_DARK_PRISMARINE), "Dark Prismarine"));
|
||||
self::register(new StoneSlab(new BlockIdentifierFlattened(BlockLegacyIds::STONE_SLAB2, BlockLegacyIds::DOUBLE_STONE_SLAB2, BlockLegacyMetadata::STONE_SLAB2_MOSSY_COBBLESTONE), "Mossy Cobblestone"));
|
||||
self::register(new StoneSlab(new BlockIdentifierFlattened(BlockLegacyIds::STONE_SLAB2, BlockLegacyIds::DOUBLE_STONE_SLAB2, BlockLegacyMetadata::STONE_SLAB2_PRISMARINE), "Prismarine"));
|
||||
self::register(new StoneSlab(new BlockIdentifierFlattened(BlockLegacyIds::STONE_SLAB2, BlockLegacyIds::DOUBLE_STONE_SLAB2, BlockLegacyMetadata::STONE_SLAB2_PRISMARINE_BRICKS), "Prismarine Bricks"));
|
||||
self::register(new StoneSlab(new BlockIdentifierFlattened(BlockLegacyIds::STONE_SLAB2, BlockLegacyIds::DOUBLE_STONE_SLAB2, BlockLegacyMetadata::STONE_SLAB2_PURPUR), "Purpur"));
|
||||
self::register(new StoneSlab(new BlockIdentifierFlattened(BlockLegacyIds::STONE_SLAB2, BlockLegacyIds::DOUBLE_STONE_SLAB2, BlockLegacyMetadata::STONE_SLAB2_RED_NETHER_BRICK), "Red Nether Brick"));
|
||||
self::register(new StoneSlab(new BlockIdentifierFlattened(BlockLegacyIds::STONE_SLAB2, BlockLegacyIds::DOUBLE_STONE_SLAB2, BlockLegacyMetadata::STONE_SLAB2_RED_SANDSTONE), "Red Sandstone"));
|
||||
self::register(new StoneSlab(new BlockIdentifierFlattened(BlockLegacyIds::STONE_SLAB2, BlockLegacyIds::DOUBLE_STONE_SLAB2, BlockLegacyMetadata::STONE_SLAB2_SMOOTH_SANDSTONE), "Smooth Sandstone"));
|
||||
self::register(new StoneSlab(new BlockIdentifierFlattened(BlockLegacyIds::STONE_SLAB3, BlockLegacyIds::DOUBLE_STONE_SLAB3, BlockLegacyMetadata::STONE_SLAB3_ANDESITE), "Andesite"));
|
||||
self::register(new StoneSlab(new BlockIdentifierFlattened(BlockLegacyIds::STONE_SLAB3, BlockLegacyIds::DOUBLE_STONE_SLAB3, BlockLegacyMetadata::STONE_SLAB3_DIORITE), "Diorite"));
|
||||
self::register(new StoneSlab(new BlockIdentifierFlattened(BlockLegacyIds::STONE_SLAB3, BlockLegacyIds::DOUBLE_STONE_SLAB3, BlockLegacyMetadata::STONE_SLAB3_END_STONE_BRICK), "End Stone Brick"));
|
||||
self::register(new StoneSlab(new BlockIdentifierFlattened(BlockLegacyIds::STONE_SLAB3, BlockLegacyIds::DOUBLE_STONE_SLAB3, BlockLegacyMetadata::STONE_SLAB3_GRANITE), "Granite"));
|
||||
self::register(new StoneSlab(new BlockIdentifierFlattened(BlockLegacyIds::STONE_SLAB3, BlockLegacyIds::DOUBLE_STONE_SLAB3, BlockLegacyMetadata::STONE_SLAB3_POLISHED_ANDESITE), "Polished Andesite"));
|
||||
self::register(new StoneSlab(new BlockIdentifierFlattened(BlockLegacyIds::STONE_SLAB3, BlockLegacyIds::DOUBLE_STONE_SLAB3, BlockLegacyMetadata::STONE_SLAB3_POLISHED_DIORITE), "Polished Diorite"));
|
||||
self::register(new StoneSlab(new BlockIdentifierFlattened(BlockLegacyIds::STONE_SLAB3, BlockLegacyIds::DOUBLE_STONE_SLAB3, BlockLegacyMetadata::STONE_SLAB3_POLISHED_GRANITE), "Polished Granite"));
|
||||
self::register(new StoneSlab(new BlockIdentifierFlattened(BlockLegacyIds::STONE_SLAB3, BlockLegacyIds::DOUBLE_STONE_SLAB3, BlockLegacyMetadata::STONE_SLAB3_SMOOTH_RED_SANDSTONE), "Smooth Red Sandstone"));
|
||||
self::register(new StoneSlab(new BlockIdentifierFlattened(BlockLegacyIds::STONE_SLAB4, BlockLegacyIds::DOUBLE_STONE_SLAB4, BlockLegacyMetadata::STONE_SLAB4_CUT_RED_SANDSTONE), "Cut Red Sandstone"));
|
||||
self::register(new StoneSlab(new BlockIdentifierFlattened(BlockLegacyIds::STONE_SLAB4, BlockLegacyIds::DOUBLE_STONE_SLAB4, BlockLegacyMetadata::STONE_SLAB4_CUT_SANDSTONE), "Cut Sandstone"));
|
||||
self::register(new StoneSlab(new BlockIdentifierFlattened(BlockLegacyIds::STONE_SLAB4, BlockLegacyIds::DOUBLE_STONE_SLAB4, BlockLegacyMetadata::STONE_SLAB4_MOSSY_STONE_BRICK), "Mossy Stone Brick"));
|
||||
self::register(new StoneSlab(new BlockIdentifierFlattened(BlockLegacyIds::STONE_SLAB4, BlockLegacyIds::DOUBLE_STONE_SLAB4, BlockLegacyMetadata::STONE_SLAB4_SMOOTH_QUARTZ), "Smooth Quartz"));
|
||||
self::register(new StoneSlab(new BlockIdentifierFlattened(BlockLegacyIds::STONE_SLAB4, BlockLegacyIds::DOUBLE_STONE_SLAB4, BlockLegacyMetadata::STONE_SLAB4_STONE), "Stone"));
|
||||
self::register(new Stonecutter(new BID(BlockLegacyIds::STONECUTTER), "Stonecutter"));
|
||||
self::register(new Sugarcane(new BID(BlockLegacyIds::REEDS_BLOCK, 0, ItemIds::REEDS), "Sugarcane"));
|
||||
self::register(new TNT(new BID(BlockLegacyIds::TNT), "TNT"));
|
||||
self::register(new TallGrass(new BID(BlockLegacyIds::TALLGRASS), "Fern"));
|
||||
self::register(new TallGrass(new BID(BlockLegacyIds::TALLGRASS, 1), "Tall Grass"));
|
||||
self::register(new TallGrass(new BID(BlockLegacyIds::TALLGRASS, 2), "Fern"));
|
||||
self::register(new TallGrass(new BID(BlockLegacyIds::TALLGRASS, 3), "Fern"));
|
||||
self::register(new TallGrass(new BID(BlockLegacyIds::TALLGRASS), "Fern")); //TODO: remap this to normal fern
|
||||
self::register(new TallGrass(new BID(BlockLegacyIds::TALLGRASS, BlockLegacyMetadata::TALLGRASS_NORMAL), "Tall Grass"));
|
||||
self::register(new TallGrass(new BID(BlockLegacyIds::TALLGRASS, BlockLegacyMetadata::TALLGRASS_FERN), "Fern"));
|
||||
self::register(new TallGrass(new BID(BlockLegacyIds::TALLGRASS, 3), "Fern")); //TODO: remap this to normal fern
|
||||
self::register(new Torch(new BID(BlockLegacyIds::COLORED_TORCH_BP), "Blue Torch"));
|
||||
self::register(new Torch(new BID(BlockLegacyIds::COLORED_TORCH_BP, 8), "Purple Torch"));
|
||||
self::register(new Torch(new BID(BlockLegacyIds::COLORED_TORCH_RG), "Red Torch"));
|
||||
@ -414,10 +414,10 @@ class BlockFactory{
|
||||
}
|
||||
|
||||
static $sandstoneTypes = [
|
||||
Sandstone::NORMAL => "",
|
||||
Sandstone::CHISELED => "Chiseled ",
|
||||
Sandstone::CUT => "Cut ",
|
||||
Sandstone::SMOOTH => "Smooth "
|
||||
BlockLegacyMetadata::SANDSTONE_NORMAL => "",
|
||||
BlockLegacyMetadata::SANDSTONE_CHISELED => "Chiseled ",
|
||||
BlockLegacyMetadata::SANDSTONE_CUT => "Cut ",
|
||||
BlockLegacyMetadata::SANDSTONE_SMOOTH => "Smooth "
|
||||
];
|
||||
foreach($sandstoneTypes as $variant => $prefix){
|
||||
self::register(new Sandstone(new BID(BlockLegacyIds::SANDSTONE, $variant), $prefix . "Sandstone"));
|
||||
@ -459,20 +459,20 @@ class BlockFactory{
|
||||
}
|
||||
|
||||
static $wallTypes = [
|
||||
Wall::ANDESITE_WALL => "Andesite",
|
||||
Wall::BRICK_WALL => "Brick",
|
||||
Wall::DIORITE_WALL => "Diorite",
|
||||
Wall::END_STONE_BRICK_WALL => "End Stone Brick",
|
||||
Wall::GRANITE_WALL => "Granite",
|
||||
Wall::MOSSY_STONE_BRICK_WALL => "Mossy Stone Brick",
|
||||
Wall::MOSSY_WALL => "Mossy Cobblestone",
|
||||
Wall::NETHER_BRICK_WALL => "Nether Brick",
|
||||
Wall::NONE_MOSSY_WALL => "Cobblestone",
|
||||
Wall::PRISMARINE_WALL => "Prismarine",
|
||||
Wall::RED_NETHER_BRICK_WALL => "Red Nether Brick",
|
||||
Wall::RED_SANDSTONE_WALL => "Red Sandstone",
|
||||
Wall::SANDSTONE_WALL => "Sandstone",
|
||||
Wall::STONE_BRICK_WALL => "Stone Brick"
|
||||
BlockLegacyMetadata::WALL_ANDESITE => "Andesite",
|
||||
BlockLegacyMetadata::WALL_BRICK => "Brick",
|
||||
BlockLegacyMetadata::WALL_DIORITE => "Diorite",
|
||||
BlockLegacyMetadata::WALL_END_STONE_BRICK => "End Stone Brick",
|
||||
BlockLegacyMetadata::WALL_GRANITE => "Granite",
|
||||
BlockLegacyMetadata::WALL_MOSSY_STONE_BRICK => "Mossy Stone Brick",
|
||||
BlockLegacyMetadata::WALL_MOSSY_COBBLESTONE => "Mossy Cobblestone",
|
||||
BlockLegacyMetadata::WALL_NETHER_BRICK => "Nether Brick",
|
||||
BlockLegacyMetadata::WALL_COBBLESTONE => "Cobblestone",
|
||||
BlockLegacyMetadata::WALL_PRISMARINE => "Prismarine",
|
||||
BlockLegacyMetadata::WALL_RED_NETHER_BRICK => "Red Nether Brick",
|
||||
BlockLegacyMetadata::WALL_RED_SANDSTONE => "Red Sandstone",
|
||||
BlockLegacyMetadata::WALL_SANDSTONE => "Sandstone",
|
||||
BlockLegacyMetadata::WALL_STONE_BRICK => "Stone Brick"
|
||||
];
|
||||
foreach($wallTypes as $magicNumber => $prefix){
|
||||
self::register(new Wall(new BID(BlockLegacyIds::COBBLESTONE_WALL, $magicNumber), $prefix . " Wall"));
|
||||
|
236
src/pocketmine/block/BlockLegacyMetadata.php
Normal file
236
src/pocketmine/block/BlockLegacyMetadata.php
Normal file
@ -0,0 +1,236 @@
|
||||
<?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\block;
|
||||
|
||||
/**
|
||||
* Constants for legacy metadata for various blocks.
|
||||
*/
|
||||
interface BlockLegacyMetadata{
|
||||
|
||||
public const ANVIL_NORMAL = 0;
|
||||
public const ANVIL_SLIGHTLY_DAMAGED = 4;
|
||||
public const ANVIL_VERY_DAMAGED = 8;
|
||||
|
||||
public const BED_FLAG_HEAD = 0x08;
|
||||
public const BED_FLAG_OCCUPIED = 0x04;
|
||||
|
||||
public const BEDROCK_FLAG_INFINIBURN = 0x01;
|
||||
|
||||
public const BREWING_STAND_FLAG_EAST = 0x01;
|
||||
public const BREWING_STAND_FLAG_SOUTHWEST = 0x02;
|
||||
public const BREWING_STAND_FLAG_NORTHWEST = 0x04;
|
||||
|
||||
public const BUTTON_FLAG_POWERED = 0x08;
|
||||
|
||||
public const COLORED_TORCH_BP_BLUE = 0;
|
||||
public const COLORED_TORCH_BP_PURPLE = 8;
|
||||
public const COLORED_TORCH_RG_RED = 0;
|
||||
public const COLORED_TORCH_RG_GREEN = 8;
|
||||
|
||||
public const DIRT_NORMAL = 0;
|
||||
public const DIRT_COARSE = 1;
|
||||
|
||||
public const DOOR_FLAG_TOP = 0x08;
|
||||
public const DOOR_BOTTOM_FLAG_OPEN = 0x04;
|
||||
public const DOOR_TOP_FLAG_RIGHT = 0x01;
|
||||
public const DOOR_TOP_FLAG_POWERED = 0x02;
|
||||
|
||||
public const DOUBLE_PLANT_SUNFLOWER = 0;
|
||||
public const DOUBLE_PLANT_LILAC = 1;
|
||||
public const DOUBLE_PLANT_TALLGRASS = 2;
|
||||
public const DOUBLE_PLANT_LARGE_FERN = 3;
|
||||
public const DOUBLE_PLANT_ROSE_BUSH = 4;
|
||||
public const DOUBLE_PLANT_PEONY = 5;
|
||||
|
||||
public const DOUBLE_PLANT_FLAG_TOP = 0x08;
|
||||
|
||||
public const END_PORTAL_FRAME_FLAG_EYE = 0x04;
|
||||
|
||||
public const FENCE_GATE_FLAG_OPEN = 0x04;
|
||||
public const FENCE_GATE_FLAG_IN_WALL = 0x08;
|
||||
|
||||
public const FLOWER_POPPY = 0;
|
||||
public const FLOWER_BLUE_ORCHID = 1;
|
||||
public const FLOWER_ALLIUM = 2;
|
||||
public const FLOWER_AZURE_BLUET = 3;
|
||||
public const FLOWER_RED_TULIP = 4;
|
||||
public const FLOWER_ORANGE_TULIP = 5;
|
||||
public const FLOWER_WHITE_TULIP = 6;
|
||||
public const FLOWER_PINK_TULIP = 7;
|
||||
public const FLOWER_OXEYE_DAISY = 8;
|
||||
public const FLOWER_CORNFLOWER = 9;
|
||||
public const FLOWER_LILY_OF_THE_VALLEY = 10;
|
||||
|
||||
public const FLOWER_POT_FLAG_OCCUPIED = 0x01;
|
||||
|
||||
public const INFESTED_STONE = 0;
|
||||
public const INFESTED_COBBLESTONE = 1;
|
||||
public const INFESTED_STONE_BRICK = 2;
|
||||
public const INFESTED_STONE_BRICK_MOSSY = 3;
|
||||
public const INFESTED_STONE_BRICK_CRACKED = 4;
|
||||
public const INFESTED_STONE_BRICK_CHISELED = 5;
|
||||
|
||||
public const ITEM_FRAME_FLAG_HAS_MAP = 0x04;
|
||||
|
||||
public const LEAVES_FLAG_NO_DECAY = 0x04;
|
||||
public const LEAVES_FLAG_CHECK_DECAY = 0x08;
|
||||
|
||||
public const LEVER_FLAG_POWERED = 0x08;
|
||||
|
||||
public const LIQUID_FLAG_FALLING = 0x08;
|
||||
|
||||
public const NETHER_PORTAL_AXIS_X = 1;
|
||||
public const NETHER_PORTAL_AXIS_Z = 2;
|
||||
|
||||
public const NETHER_REACTOR_INACTIVE = 0;
|
||||
public const NETHER_REACTOR_ACTIVE = 1;
|
||||
public const NETHER_REACTOR_USED = 2;
|
||||
|
||||
public const PRESSURE_PLATE_FLAG_POWERED = 0x01;
|
||||
|
||||
public const PRISMARINE_NORMAL = 0;
|
||||
public const PRISMARINE_DARK = 1;
|
||||
public const PRISMARINE_BRICKS = 2;
|
||||
|
||||
public const PURPUR_NORMAL = 0;
|
||||
public const PURPUR_PILLAR = 2;
|
||||
|
||||
public const QUARTZ_NORMAL = 0;
|
||||
public const QUARTZ_CHISELED = 1;
|
||||
public const QUARTZ_PILLAR = 2;
|
||||
public const QUARTZ_SMOOTH = 3;
|
||||
|
||||
public const RAIL_STRAIGHT_NORTH_SOUTH = 0;
|
||||
public const RAIL_STRAIGHT_EAST_WEST = 1;
|
||||
public const RAIL_ASCENDING_EAST = 2;
|
||||
public const RAIL_ASCENDING_WEST = 3;
|
||||
public const RAIL_ASCENDING_NORTH = 4;
|
||||
public const RAIL_ASCENDING_SOUTH = 5;
|
||||
public const RAIL_CURVE_SOUTHEAST = 6;
|
||||
public const RAIL_CURVE_SOUTHWEST = 7;
|
||||
public const RAIL_CURVE_NORTHWEST = 8;
|
||||
public const RAIL_CURVE_NORTHEAST = 9;
|
||||
|
||||
public const REDSTONE_COMPARATOR_FLAG_SUBTRACT = 0x04;
|
||||
public const REDSTONE_COMPARATOR_FLAG_POWERED = 0x08;
|
||||
|
||||
public const REDSTONE_RAIL_FLAG_POWERED = 0x08;
|
||||
|
||||
public const SANDSTONE_NORMAL = 0;
|
||||
public const SANDSTONE_CHISELED = 1;
|
||||
public const SANDSTONE_CUT = 2;
|
||||
public const SANDSTONE_SMOOTH = 3;
|
||||
|
||||
public const SAPLING_FLAG_READY = 0x08;
|
||||
|
||||
public const SEA_PICKLE_FLAG_NOT_UNDERWATER = 0x04;
|
||||
|
||||
public const SLAB_FLAG_UPPER = 0x08;
|
||||
|
||||
public const SPONGE_FLAG_WET = 0x01;
|
||||
|
||||
public const STAIR_FLAG_UPSIDE_DOWN = 0x04;
|
||||
|
||||
public const STONE_NORMAL = 0;
|
||||
public const STONE_GRANITE = 1;
|
||||
public const STONE_POLISHED_GRANITE = 2;
|
||||
public const STONE_DIORITE = 3;
|
||||
public const STONE_POLISHED_DIORITE = 4;
|
||||
public const STONE_ANDESITE = 5;
|
||||
public const STONE_POLISHED_ANDESITE = 6;
|
||||
|
||||
public const STONE_BRICK_NORMAL = 0;
|
||||
public const STONE_BRICK_MOSSY = 1;
|
||||
public const STONE_BRICK_CRACKED = 2;
|
||||
public const STONE_BRICK_CHISELED = 3;
|
||||
|
||||
public const STONE_SLAB_SMOOTH_STONE = 0;
|
||||
public const STONE_SLAB_SANDSTONE = 1;
|
||||
public const STONE_SLAB_FAKE_WOODEN = 2;
|
||||
public const STONE_SLAB_COBBLESTONE = 3;
|
||||
public const STONE_SLAB_BRICK = 4;
|
||||
public const STONE_SLAB_STONE_BRICK = 5;
|
||||
public const STONE_SLAB_QUARTZ = 6;
|
||||
public const STONE_SLAB_NETHER_BRICK = 7;
|
||||
public const STONE_SLAB2_RED_SANDSTONE = 0;
|
||||
public const STONE_SLAB2_PURPUR = 1;
|
||||
public const STONE_SLAB2_PRISMARINE = 2;
|
||||
public const STONE_SLAB2_DARK_PRISMARINE = 3;
|
||||
public const STONE_SLAB2_PRISMARINE_BRICKS = 4;
|
||||
public const STONE_SLAB2_MOSSY_COBBLESTONE = 5;
|
||||
public const STONE_SLAB2_SMOOTH_SANDSTONE = 6;
|
||||
public const STONE_SLAB2_RED_NETHER_BRICK = 7;
|
||||
public const STONE_SLAB3_END_STONE_BRICK = 0;
|
||||
public const STONE_SLAB3_SMOOTH_RED_SANDSTONE = 1;
|
||||
public const STONE_SLAB3_POLISHED_ANDESITE = 2;
|
||||
public const STONE_SLAB3_ANDESITE = 3;
|
||||
public const STONE_SLAB3_DIORITE = 4;
|
||||
public const STONE_SLAB3_POLISHED_DIORITE = 5;
|
||||
public const STONE_SLAB3_GRANITE = 6;
|
||||
public const STONE_SLAB3_POLISHED_GRANITE = 7;
|
||||
public const STONE_SLAB4_MOSSY_STONE_BRICK = 0;
|
||||
public const STONE_SLAB4_SMOOTH_QUARTZ = 1;
|
||||
public const STONE_SLAB4_STONE = 2;
|
||||
public const STONE_SLAB4_CUT_SANDSTONE = 3;
|
||||
public const STONE_SLAB4_CUT_RED_SANDSTONE = 4;
|
||||
|
||||
public const TALLGRASS_NORMAL = 1;
|
||||
public const TALLGRASS_FERN = 2;
|
||||
|
||||
public const TNT_NORMAL = 0;
|
||||
public const TNT_UNDERWATER = 2;
|
||||
|
||||
public const TNT_FLAG_UNSTABLE = 0x01;
|
||||
|
||||
public const TRAPDOOR_FLAG_UPPER = 0x04;
|
||||
public const TRAPDOOR_FLAG_OPEN = 0x08;
|
||||
|
||||
public const TRIPWIRE_FLAG_TRIGGERED = 0x01;
|
||||
public const TRIPWIRE_FLAG_SUSPENDED = 0x02;
|
||||
public const TRIPWIRE_FLAG_CONNECTED = 0x04;
|
||||
public const TRIPWIRE_FLAG_DISARMED = 0x08;
|
||||
|
||||
public const TRIPWIRE_HOOK_FLAG_CONNECTED = 0x04;
|
||||
public const TRIPWIRE_HOOK_FLAG_POWERED = 0x08;
|
||||
|
||||
public const VINE_FLAG_SOUTH = 0x01;
|
||||
public const VINE_FLAG_WEST = 0x02;
|
||||
public const VINE_FLAG_NORTH = 0x04;
|
||||
public const VINE_FLAG_EAST = 0x08;
|
||||
|
||||
public const WALL_COBBLESTONE = 0;
|
||||
public const WALL_MOSSY_COBBLESTONE = 1;
|
||||
public const WALL_GRANITE = 2;
|
||||
public const WALL_DIORITE = 3;
|
||||
public const WALL_ANDESITE = 4;
|
||||
public const WALL_SANDSTONE = 5;
|
||||
public const WALL_BRICK = 6;
|
||||
public const WALL_STONE_BRICK = 7;
|
||||
public const WALL_MOSSY_STONE_BRICK = 8;
|
||||
public const WALL_NETHER_BRICK = 9;
|
||||
public const WALL_END_STONE_BRICK = 10;
|
||||
public const WALL_PRISMARINE = 11;
|
||||
public const WALL_RED_SANDSTONE = 12;
|
||||
public const WALL_RED_NETHER_BRICK = 13;
|
||||
}
|
@ -39,13 +39,15 @@ class BrewingStand extends Transparent{
|
||||
}
|
||||
|
||||
protected function writeStateToMeta() : int{
|
||||
return ($this->eastSlot ? 0x01 : 0) | ($this->southwestSlot ? 0x02 : 0) | ($this->northwestSlot ? 0x04 : 0);
|
||||
return ($this->eastSlot ? BlockLegacyMetadata::BREWING_STAND_FLAG_EAST : 0) |
|
||||
($this->southwestSlot ? BlockLegacyMetadata::BREWING_STAND_FLAG_SOUTHWEST : 0) |
|
||||
($this->northwestSlot ? BlockLegacyMetadata::BREWING_STAND_FLAG_NORTHWEST : 0);
|
||||
}
|
||||
|
||||
public function readStateFromData(int $id, int $stateMeta) : void{
|
||||
$this->eastSlot = ($stateMeta & 0x01) !== 0;
|
||||
$this->southwestSlot = ($stateMeta & 0x02) !== 0;
|
||||
$this->northwestSlot = ($stateMeta & 0x04) !== 0;
|
||||
$this->eastSlot = ($stateMeta & BlockLegacyMetadata::BREWING_STAND_FLAG_EAST) !== 0;
|
||||
$this->southwestSlot = ($stateMeta & BlockLegacyMetadata::BREWING_STAND_FLAG_SOUTHWEST) !== 0;
|
||||
$this->northwestSlot = ($stateMeta & BlockLegacyMetadata::BREWING_STAND_FLAG_NORTHWEST) !== 0;
|
||||
}
|
||||
|
||||
public function getStateBitmask() : int{
|
||||
|
@ -39,13 +39,13 @@ abstract class Button extends Flowable{
|
||||
protected $powered = false;
|
||||
|
||||
protected function writeStateToMeta() : int{
|
||||
return $this->facing | ($this->powered ? 0x08 : 0);
|
||||
return $this->facing | ($this->powered ? BlockLegacyMetadata::BUTTON_FLAG_POWERED : 0);
|
||||
}
|
||||
|
||||
public function readStateFromData(int $id, int $stateMeta) : void{
|
||||
//TODO: in PC it's (6 - facing) for every meta except 0 (down)
|
||||
$this->facing = BlockDataValidator::readFacing($stateMeta & 0x07);
|
||||
$this->powered = ($stateMeta & 0x08) !== 0;
|
||||
$this->powered = ($stateMeta & BlockLegacyMetadata::BUTTON_FLAG_POWERED) !== 0;
|
||||
}
|
||||
|
||||
public function getStateBitmask() : int{
|
||||
|
@ -30,8 +30,6 @@ use pocketmine\math\Vector3;
|
||||
use pocketmine\Player;
|
||||
|
||||
class Dirt extends Solid{
|
||||
public const NORMAL = 0;
|
||||
public const COARSE = 1;
|
||||
|
||||
public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){
|
||||
parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(0.5, BlockToolType::TYPE_SHOVEL));
|
||||
|
@ -50,20 +50,22 @@ abstract class Door extends Transparent{
|
||||
|
||||
protected function writeStateToMeta() : int{
|
||||
if($this->top){
|
||||
return 0x08 | ($this->hingeRight ? 0x01 : 0) | ($this->powered ? 0x02 : 0);
|
||||
return BlockLegacyMetadata::DOOR_FLAG_TOP |
|
||||
($this->hingeRight ? BlockLegacyMetadata::DOOR_TOP_FLAG_RIGHT : 0) |
|
||||
($this->powered ? BlockLegacyMetadata::DOOR_TOP_FLAG_POWERED : 0);
|
||||
}
|
||||
|
||||
return Bearing::fromFacing(Facing::rotateY($this->facing, true)) | ($this->open ? 0x04 : 0);
|
||||
return Bearing::fromFacing(Facing::rotateY($this->facing, true)) | ($this->open ? BlockLegacyMetadata::DOOR_BOTTOM_FLAG_OPEN : 0);
|
||||
}
|
||||
|
||||
public function readStateFromData(int $id, int $stateMeta) : void{
|
||||
$this->top = $stateMeta & 0x08;
|
||||
$this->top = $stateMeta & BlockLegacyMetadata::DOOR_FLAG_TOP;
|
||||
if($this->top){
|
||||
$this->hingeRight = ($stateMeta & 0x01) !== 0;
|
||||
$this->powered = ($stateMeta & 0x02) !== 0;
|
||||
$this->hingeRight = ($stateMeta & BlockLegacyMetadata::DOOR_TOP_FLAG_RIGHT) !== 0;
|
||||
$this->powered = ($stateMeta & BlockLegacyMetadata::DOOR_TOP_FLAG_POWERED) !== 0;
|
||||
}else{
|
||||
$this->facing = Facing::rotateY(BlockDataValidator::readLegacyHorizontalFacing($stateMeta & 0x03), false);
|
||||
$this->open = ($stateMeta & 0x04) !== 0;
|
||||
$this->open = ($stateMeta & BlockLegacyMetadata::DOOR_BOTTOM_FLAG_OPEN) !== 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,6 @@ use pocketmine\Player;
|
||||
use pocketmine\world\BlockTransaction;
|
||||
|
||||
class DoublePlant extends Flowable{
|
||||
private const BITFLAG_TOP = 0x08;
|
||||
|
||||
/** @var bool */
|
||||
protected $top = false;
|
||||
@ -40,11 +39,11 @@ class DoublePlant extends Flowable{
|
||||
}
|
||||
|
||||
protected function writeStateToMeta() : int{
|
||||
return ($this->top ? self::BITFLAG_TOP : 0);
|
||||
return ($this->top ? BlockLegacyMetadata::DOUBLE_PLANT_FLAG_TOP : 0);
|
||||
}
|
||||
|
||||
public function readStateFromData(int $id, int $stateMeta) : void{
|
||||
$this->top = ($stateMeta & self::BITFLAG_TOP) !== 0;
|
||||
$this->top = ($stateMeta & BlockLegacyMetadata::DOUBLE_PLANT_FLAG_TOP) !== 0;
|
||||
}
|
||||
|
||||
public function getStateBitmask() : int{
|
||||
|
@ -43,12 +43,12 @@ class EndPortalFrame extends Solid{
|
||||
}
|
||||
|
||||
protected function writeStateToMeta() : int{
|
||||
return Bearing::fromFacing($this->facing) | ($this->eye ? 0x04 : 0);
|
||||
return Bearing::fromFacing($this->facing) | ($this->eye ? BlockLegacyMetadata::END_PORTAL_FRAME_FLAG_EYE : 0);
|
||||
}
|
||||
|
||||
public function readStateFromData(int $id, int $stateMeta) : void{
|
||||
$this->facing = BlockDataValidator::readLegacyHorizontalFacing($stateMeta & 0x03);
|
||||
$this->eye = ($stateMeta & 0x04) !== 0;
|
||||
$this->eye = ($stateMeta & BlockLegacyMetadata::END_PORTAL_FRAME_FLAG_EYE) !== 0;
|
||||
}
|
||||
|
||||
public function getStateBitmask() : int{
|
||||
|
@ -45,13 +45,15 @@ class FenceGate extends Transparent{
|
||||
}
|
||||
|
||||
protected function writeStateToMeta() : int{
|
||||
return Bearing::fromFacing($this->facing) | ($this->open ? 0x04 : 0) | ($this->inWall ? 0x08 : 0);
|
||||
return Bearing::fromFacing($this->facing) |
|
||||
($this->open ? BlockLegacyMetadata::FENCE_GATE_FLAG_OPEN : 0) |
|
||||
($this->inWall ? BlockLegacyMetadata::FENCE_GATE_FLAG_IN_WALL : 0);
|
||||
}
|
||||
|
||||
public function readStateFromData(int $id, int $stateMeta) : void{
|
||||
$this->facing = BlockDataValidator::readLegacyHorizontalFacing($stateMeta & 0x03);
|
||||
$this->open = ($stateMeta & 0x04) !== 0;
|
||||
$this->inWall = ($stateMeta & 0x08) !== 0;
|
||||
$this->open = ($stateMeta & BlockLegacyMetadata::FENCE_GATE_FLAG_OPEN) !== 0;
|
||||
$this->inWall = ($stateMeta & BlockLegacyMetadata::FENCE_GATE_FLAG_IN_WALL) !== 0;
|
||||
}
|
||||
|
||||
public function getStateBitmask() : int{
|
||||
|
@ -29,17 +29,6 @@ use pocketmine\math\Vector3;
|
||||
use pocketmine\Player;
|
||||
|
||||
class Flower extends Flowable{
|
||||
public const TYPE_POPPY = 0;
|
||||
public const TYPE_BLUE_ORCHID = 1;
|
||||
public const TYPE_ALLIUM = 2;
|
||||
public const TYPE_AZURE_BLUET = 3;
|
||||
public const TYPE_RED_TULIP = 4;
|
||||
public const TYPE_ORANGE_TULIP = 5;
|
||||
public const TYPE_WHITE_TULIP = 6;
|
||||
public const TYPE_PINK_TULIP = 7;
|
||||
public const TYPE_OXEYE_DAISY = 8;
|
||||
public const TYPE_CORNFLOWER = 9;
|
||||
public const TYPE_LILY_OF_THE_VALLEY = 10;
|
||||
|
||||
public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){
|
||||
parent::__construct($idInfo, $name, $breakInfo ?? BlockBreakInfo::instant());
|
||||
|
@ -47,11 +47,11 @@ class FlowerPot extends Flowable{
|
||||
}
|
||||
|
||||
protected function writeStateToMeta() : int{
|
||||
return $this->occupied ? 1 : 0;
|
||||
return $this->occupied ? BlockLegacyMetadata::FLOWER_POT_FLAG_OCCUPIED : 0;
|
||||
}
|
||||
|
||||
public function readStateFromData(int $id, int $stateMeta) : void{
|
||||
$this->occupied = $stateMeta !== 0;
|
||||
$this->occupied = ($stateMeta & BlockLegacyMetadata::FLOWER_POT_FLAG_OCCUPIED) !== 0;
|
||||
}
|
||||
|
||||
public function getStateBitmask() : int{
|
||||
@ -106,7 +106,7 @@ class FlowerPot extends Flowable{
|
||||
$block instanceof Flower or
|
||||
$block instanceof RedMushroom or
|
||||
$block instanceof Sapling or
|
||||
($block instanceof TallGrass and $block->getIdInfo()->getVariant() === 2); //fern - TODO: clean up
|
||||
($block instanceof TallGrass and $block->getIdInfo()->getVariant() === BlockLegacyMetadata::TALLGRASS_FERN); //TODO: clean up
|
||||
//TODO: bamboo
|
||||
}
|
||||
|
||||
|
@ -50,12 +50,12 @@ class ItemFrame extends Flowable{
|
||||
}
|
||||
|
||||
protected function writeStateToMeta() : int{
|
||||
return (5 - $this->facing) | ($this->hasMap ? 0x04 : 0);
|
||||
return (5 - $this->facing) | ($this->hasMap ? BlockLegacyMetadata::ITEM_FRAME_FLAG_HAS_MAP : 0);
|
||||
}
|
||||
|
||||
public function readStateFromData(int $id, int $stateMeta) : void{
|
||||
$this->facing = BlockDataValidator::readHorizontalFacing(5 - ($stateMeta & 0x03));
|
||||
$this->hasMap = ($stateMeta & 0x04) !== 0;
|
||||
$this->hasMap = ($stateMeta & BlockLegacyMetadata::ITEM_FRAME_FLAG_HAS_MAP) !== 0;
|
||||
}
|
||||
|
||||
public function readStateFromWorld() : void{
|
||||
|
@ -48,12 +48,12 @@ class Leaves extends Transparent{
|
||||
}
|
||||
|
||||
protected function writeStateToMeta() : int{
|
||||
return ($this->noDecay ? 0x04 : 0) | ($this->checkDecay ? 0x08 : 0);
|
||||
return ($this->noDecay ? BlockLegacyMetadata::LEAVES_FLAG_NO_DECAY : 0) | ($this->checkDecay ? BlockLegacyMetadata::LEAVES_FLAG_CHECK_DECAY : 0);
|
||||
}
|
||||
|
||||
public function readStateFromData(int $id, int $stateMeta) : void{
|
||||
$this->noDecay = ($stateMeta & 0x04) !== 0;
|
||||
$this->checkDecay = ($stateMeta & 0x08) !== 0;
|
||||
$this->noDecay = ($stateMeta & BlockLegacyMetadata::LEAVES_FLAG_NO_DECAY) !== 0;
|
||||
$this->checkDecay = ($stateMeta & BlockLegacyMetadata::LEAVES_FLAG_CHECK_DECAY) !== 0;
|
||||
}
|
||||
|
||||
public function getStateBitmask() : int{
|
||||
|
@ -55,7 +55,7 @@ class Lever extends Flowable{
|
||||
}else{
|
||||
$rotationMeta = 6 - $this->facing;
|
||||
}
|
||||
return $rotationMeta | ($this->powered ? 0x08 : 0);
|
||||
return $rotationMeta | ($this->powered ? BlockLegacyMetadata::LEVER_FLAG_POWERED : 0);
|
||||
}
|
||||
|
||||
public function readStateFromData(int $id, int $stateMeta) : void{
|
||||
@ -71,7 +71,7 @@ class Lever extends Flowable{
|
||||
$this->facing = BlockDataValidator::readHorizontalFacing(6 - $rotationMeta);
|
||||
}
|
||||
|
||||
$this->powered = ($stateMeta & 0x08) !== 0;
|
||||
$this->powered = ($stateMeta & BlockLegacyMetadata::LEVER_FLAG_POWERED) !== 0;
|
||||
}
|
||||
|
||||
public function getStateBitmask() : int{
|
||||
|
@ -69,12 +69,12 @@ abstract class Liquid extends Transparent{
|
||||
}
|
||||
|
||||
protected function writeStateToMeta() : int{
|
||||
return $this->decay | ($this->falling ? 0x08 : 0);
|
||||
return $this->decay | ($this->falling ? BlockLegacyMetadata::LIQUID_FLAG_FALLING : 0);
|
||||
}
|
||||
|
||||
public function readStateFromData(int $id, int $stateMeta) : void{
|
||||
$this->decay = BlockDataValidator::readBoundedInt("decay", $stateMeta & 0x07, 0, 7);
|
||||
$this->falling = ($stateMeta & 0x08) !== 0;
|
||||
$this->falling = ($stateMeta & BlockLegacyMetadata::LIQUID_FLAG_FALLING) !== 0;
|
||||
$this->still = $id === $this->idInfo->getSecondId();
|
||||
}
|
||||
|
||||
|
@ -37,11 +37,11 @@ class NetherPortal extends Transparent{
|
||||
}
|
||||
|
||||
public function readStateFromData(int $id, int $stateMeta) : void{
|
||||
$this->axis = $stateMeta === 2 ? Facing::AXIS_Z : Facing::AXIS_X; //mojang u dumb
|
||||
$this->axis = $stateMeta === BlockLegacyMetadata::NETHER_PORTAL_AXIS_Z ? Facing::AXIS_Z : Facing::AXIS_X; //mojang u dumb
|
||||
}
|
||||
|
||||
protected function writeStateToMeta() : int{
|
||||
return $this->axis === Facing::AXIS_Z ? 2 : 1;
|
||||
return $this->axis === Facing::AXIS_Z ? BlockLegacyMetadata::NETHER_PORTAL_AXIS_Z : BlockLegacyMetadata::NETHER_PORTAL_AXIS_X;
|
||||
}
|
||||
|
||||
public function getStateBitmask() : int{
|
||||
|
@ -29,12 +29,9 @@ use pocketmine\item\ItemFactory;
|
||||
use pocketmine\item\TieredTool;
|
||||
|
||||
class NetherReactor extends Solid{
|
||||
protected const STATE_INACTIVE = 0;
|
||||
protected const STATE_ACTIVE = 1;
|
||||
protected const STATE_USED = 2;
|
||||
|
||||
/** @var int */
|
||||
protected $state = self::STATE_INACTIVE;
|
||||
protected $state = BlockLegacyMetadata::NETHER_REACTOR_INACTIVE;
|
||||
|
||||
public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){
|
||||
parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(3.0, BlockToolType::TYPE_PICKAXE, TieredTool::TIER_WOODEN));
|
||||
|
@ -27,10 +27,6 @@ use pocketmine\item\TieredTool;
|
||||
|
||||
class Prismarine extends Solid{
|
||||
|
||||
public const NORMAL = 0;
|
||||
public const DARK = 1;
|
||||
public const BRICKS = 2;
|
||||
|
||||
public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){
|
||||
parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(1.5, BlockToolType::TYPE_PICKAXE, TieredTool::TIER_WOODEN, 30.0));
|
||||
}
|
||||
|
@ -27,11 +27,6 @@ use pocketmine\item\TieredTool;
|
||||
|
||||
class Quartz extends Solid{
|
||||
|
||||
public const NORMAL = 0;
|
||||
public const CHISELED = 1;
|
||||
public const PILLAR = 2;
|
||||
public const SMOOTH = 3;
|
||||
|
||||
public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){
|
||||
parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(0.8, BlockToolType::TYPE_PICKAXE, TieredTool::TIER_WOODEN));
|
||||
}
|
||||
|
@ -28,25 +28,21 @@ use pocketmine\math\Facing;
|
||||
class Rail extends BaseRail{
|
||||
|
||||
/* extended meta values for regular rails, to allow curving */
|
||||
public const CURVE_SOUTHEAST = 6;
|
||||
public const CURVE_SOUTHWEST = 7;
|
||||
public const CURVE_NORTHWEST = 8;
|
||||
public const CURVE_NORTHEAST = 9;
|
||||
|
||||
private const CURVE_CONNECTIONS = [
|
||||
self::CURVE_SOUTHEAST => [
|
||||
BlockLegacyMetadata::RAIL_CURVE_SOUTHEAST => [
|
||||
Facing::SOUTH,
|
||||
Facing::EAST
|
||||
],
|
||||
self::CURVE_SOUTHWEST => [
|
||||
BlockLegacyMetadata::RAIL_CURVE_SOUTHWEST => [
|
||||
Facing::SOUTH,
|
||||
Facing::WEST
|
||||
],
|
||||
self::CURVE_NORTHWEST => [
|
||||
BlockLegacyMetadata::RAIL_CURVE_NORTHWEST => [
|
||||
Facing::NORTH,
|
||||
Facing::WEST
|
||||
],
|
||||
self::CURVE_NORTHEAST => [
|
||||
BlockLegacyMetadata::RAIL_CURVE_NORTHEAST => [
|
||||
Facing::NORTH,
|
||||
Facing::EAST
|
||||
]
|
||||
|
@ -56,12 +56,14 @@ class RedstoneComparator extends Flowable{
|
||||
|
||||
public function readStateFromData(int $id, int $stateMeta) : void{
|
||||
$this->facing = BlockDataValidator::readLegacyHorizontalFacing($stateMeta & 0x03);
|
||||
$this->isSubtractMode = ($stateMeta & 0x04) !== 0;
|
||||
$this->powered = ($id === $this->idInfo->getSecondId() or ($stateMeta & 0x08) !== 0);
|
||||
$this->isSubtractMode = ($stateMeta & BlockLegacyMetadata::REDSTONE_COMPARATOR_FLAG_SUBTRACT) !== 0;
|
||||
$this->powered = ($id === $this->idInfo->getSecondId() or ($stateMeta & BlockLegacyMetadata::REDSTONE_COMPARATOR_FLAG_POWERED) !== 0);
|
||||
}
|
||||
|
||||
public function writeStateToMeta() : int{
|
||||
return Bearing::fromFacing($this->facing) | ($this->isSubtractMode ? 0x04 : 0) | ($this->powered ? 0x08 : 0);
|
||||
return Bearing::fromFacing($this->facing) |
|
||||
($this->isSubtractMode ? BlockLegacyMetadata::REDSTONE_COMPARATOR_FLAG_SUBTRACT : 0) |
|
||||
($this->powered ? BlockLegacyMetadata::REDSTONE_COMPARATOR_FLAG_POWERED : 0);
|
||||
}
|
||||
|
||||
public function getStateBitmask() : int{
|
||||
|
@ -24,21 +24,20 @@ declare(strict_types=1);
|
||||
namespace pocketmine\block;
|
||||
|
||||
abstract class RedstoneRail extends BaseRail{
|
||||
protected const FLAG_POWERED = 0x08;
|
||||
|
||||
/** @var bool */
|
||||
protected $powered = false;
|
||||
|
||||
protected function writeStateToMeta() : int{
|
||||
return parent::writeStateToMeta() | ($this->powered ? self::FLAG_POWERED : 0);
|
||||
return parent::writeStateToMeta() | ($this->powered ? BlockLegacyMetadata::REDSTONE_RAIL_FLAG_POWERED : 0);
|
||||
}
|
||||
|
||||
public function readStateFromData(int $id, int $stateMeta) : void{
|
||||
parent::readStateFromData($id, $stateMeta);
|
||||
$this->powered = ($stateMeta & self::FLAG_POWERED) !== 0;
|
||||
$this->powered = ($stateMeta & BlockLegacyMetadata::REDSTONE_RAIL_FLAG_POWERED) !== 0;
|
||||
}
|
||||
|
||||
protected function getConnectionsFromMeta(int $meta) : ?array{
|
||||
return self::CONNECTIONS[$meta & ~self::FLAG_POWERED] ?? null;
|
||||
return self::CONNECTIONS[$meta & ~BlockLegacyMetadata::REDSTONE_RAIL_FLAG_POWERED] ?? null;
|
||||
}
|
||||
}
|
||||
|
@ -27,11 +27,6 @@ use pocketmine\item\TieredTool;
|
||||
|
||||
class Sandstone extends Solid{
|
||||
|
||||
public const NORMAL = 0;
|
||||
public const CHISELED = 1;
|
||||
public const CUT = 2;
|
||||
public const SMOOTH = 3;
|
||||
|
||||
public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){
|
||||
parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(0.8, BlockToolType::TYPE_PICKAXE, TieredTool::TIER_WOODEN));
|
||||
}
|
||||
|
@ -46,11 +46,11 @@ class Sapling extends Flowable{
|
||||
}
|
||||
|
||||
protected function writeStateToMeta() : int{
|
||||
return ($this->ready ? 0x08 : 0);
|
||||
return ($this->ready ? BlockLegacyMetadata::SAPLING_FLAG_READY : 0);
|
||||
}
|
||||
|
||||
public function readStateFromData(int $id, int $stateMeta) : void{
|
||||
$this->ready = ($stateMeta & 0x08) !== 0;
|
||||
$this->ready = ($stateMeta & BlockLegacyMetadata::SAPLING_FLAG_READY) !== 0;
|
||||
}
|
||||
|
||||
public function getStateBitmask() : int{
|
||||
|
@ -40,11 +40,11 @@ class SeaPickle extends Transparent{
|
||||
|
||||
public function readStateFromData(int $id, int $stateMeta) : void{
|
||||
$this->count = ($stateMeta & 0x03) + 1;
|
||||
$this->underwater = ($stateMeta & 0x04) === 0;
|
||||
$this->underwater = ($stateMeta & BlockLegacyMetadata::SEA_PICKLE_FLAG_NOT_UNDERWATER) === 0;
|
||||
}
|
||||
|
||||
protected function writeStateToMeta() : int{
|
||||
return ($this->count - 1) | ($this->underwater ? 0 : 0x04);
|
||||
return ($this->count - 1) | ($this->underwater ? 0 : BlockLegacyMetadata::SEA_PICKLE_FLAG_NOT_UNDERWATER);
|
||||
}
|
||||
|
||||
public function getStateBitmask() : int{
|
||||
|
@ -29,11 +29,11 @@ abstract class SimplePressurePlate extends PressurePlate{
|
||||
protected $powered = false;
|
||||
|
||||
protected function writeStateToMeta() : int{
|
||||
return $this->powered ? 1 : 0;
|
||||
return $this->powered ? BlockLegacyMetadata::PRESSURE_PLATE_FLAG_POWERED : 0;
|
||||
}
|
||||
|
||||
public function readStateFromData(int $id, int $stateMeta) : void{
|
||||
$this->powered = $stateMeta !== 0;
|
||||
$this->powered = ($stateMeta & BlockLegacyMetadata::PRESSURE_PLATE_FLAG_POWERED) !== 0;
|
||||
}
|
||||
|
||||
public function getStateBitmask() : int{
|
||||
|
@ -48,7 +48,7 @@ abstract class Slab extends Transparent{
|
||||
|
||||
protected function writeStateToMeta() : int{
|
||||
if($this->slabType !== SlabType::DOUBLE()){
|
||||
return ($this->slabType === SlabType::TOP() ? 0x08 : 0);
|
||||
return ($this->slabType === SlabType::TOP() ? BlockLegacyMetadata::SLAB_FLAG_UPPER : 0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -57,7 +57,7 @@ abstract class Slab extends Transparent{
|
||||
if($id === $this->idInfo->getSecondId()){
|
||||
$this->slabType = SlabType::DOUBLE();
|
||||
}else{
|
||||
$this->slabType = ($stateMeta & 0x08) !== 0 ? SlabType::TOP() : SlabType::BOTTOM();
|
||||
$this->slabType = ($stateMeta & BlockLegacyMetadata::SLAB_FLAG_UPPER) !== 0 ? SlabType::TOP() : SlabType::BOTTOM();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -34,11 +34,11 @@ class Sponge extends Solid{
|
||||
}
|
||||
|
||||
protected function writeStateToMeta() : int{
|
||||
return $this->wet ? 1 : 0;
|
||||
return $this->wet ? BlockLegacyMetadata::SPONGE_FLAG_WET : 0;
|
||||
}
|
||||
|
||||
public function readStateFromData(int $id, int $stateMeta) : void{
|
||||
$this->wet = $stateMeta !== 0;
|
||||
$this->wet = ($stateMeta & BlockLegacyMetadata::SPONGE_FLAG_WET) !== 0;
|
||||
}
|
||||
|
||||
public function getStateBitmask() : int{
|
||||
|
@ -45,12 +45,12 @@ abstract class Stair extends Transparent{
|
||||
protected $shape = self::SHAPE_STRAIGHT;
|
||||
|
||||
protected function writeStateToMeta() : int{
|
||||
return (5 - $this->facing) | ($this->upsideDown ? 0x04 : 0);
|
||||
return (5 - $this->facing) | ($this->upsideDown ? BlockLegacyMetadata::STAIR_FLAG_UPSIDE_DOWN : 0);
|
||||
}
|
||||
|
||||
public function readStateFromData(int $id, int $stateMeta) : void{
|
||||
$this->facing = BlockDataValidator::readHorizontalFacing(5 - ($stateMeta & 0x03));
|
||||
$this->upsideDown = ($stateMeta & 0x04) !== 0;
|
||||
$this->upsideDown = ($stateMeta & BlockLegacyMetadata::STAIR_FLAG_UPSIDE_DOWN) !== 0;
|
||||
}
|
||||
|
||||
public function getStateBitmask() : int{
|
||||
|
@ -26,13 +26,6 @@ namespace pocketmine\block;
|
||||
use pocketmine\item\TieredTool;
|
||||
|
||||
class Stone extends Solid{
|
||||
public const NORMAL = 0;
|
||||
public const GRANITE = 1;
|
||||
public const POLISHED_GRANITE = 2;
|
||||
public const DIORITE = 3;
|
||||
public const POLISHED_DIORITE = 4;
|
||||
public const ANDESITE = 5;
|
||||
public const POLISHED_ANDESITE = 6;
|
||||
|
||||
public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){
|
||||
parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(1.5, BlockToolType::TYPE_PICKAXE, TieredTool::TIER_WOODEN, 30.0));
|
||||
|
@ -26,10 +26,6 @@ namespace pocketmine\block;
|
||||
use pocketmine\item\TieredTool;
|
||||
|
||||
class StoneBricks extends Solid{
|
||||
public const NORMAL = 0;
|
||||
public const MOSSY = 1;
|
||||
public const CRACKED = 2;
|
||||
public const CHISELED = 3;
|
||||
|
||||
public function __construct(BlockIdentifier $idInfo, string $name, ?BlockBreakInfo $breakInfo = null){
|
||||
parent::__construct($idInfo, $name, $breakInfo ?? new BlockBreakInfo(1.5, BlockToolType::TYPE_PICKAXE, TieredTool::TIER_WOODEN, 30.0));
|
||||
|
@ -48,11 +48,11 @@ class TNT extends Solid{
|
||||
}
|
||||
|
||||
public function readStateFromData(int $id, int $stateMeta) : void{
|
||||
$this->unstable = $stateMeta !== 0;
|
||||
$this->unstable = ($stateMeta & BlockLegacyMetadata::TNT_FLAG_UNSTABLE) !== 0;
|
||||
}
|
||||
|
||||
protected function writeStateToMeta() : int{
|
||||
return $this->unstable ? 1 : 0;
|
||||
return $this->unstable ? BlockLegacyMetadata::TNT_FLAG_UNSTABLE : 0;
|
||||
}
|
||||
|
||||
public function getStateBitmask() : int{
|
||||
|
@ -32,8 +32,6 @@ use pocketmine\Player;
|
||||
use pocketmine\world\sound\DoorSound;
|
||||
|
||||
abstract class Trapdoor extends Transparent{
|
||||
private const MASK_UPPER = 0x04;
|
||||
private const MASK_OPENED = 0x08;
|
||||
|
||||
/** @var int */
|
||||
protected $facing = Facing::NORTH;
|
||||
@ -43,15 +41,15 @@ abstract class Trapdoor extends Transparent{
|
||||
protected $top = false;
|
||||
|
||||
protected function writeStateToMeta() : int{
|
||||
return (5 - $this->facing) | ($this->top ? self::MASK_UPPER : 0) | ($this->open ? self::MASK_OPENED : 0);
|
||||
return (5 - $this->facing) | ($this->top ? BlockLegacyMetadata::TRAPDOOR_FLAG_UPPER : 0) | ($this->open ? BlockLegacyMetadata::TRAPDOOR_FLAG_OPEN : 0);
|
||||
}
|
||||
|
||||
public function readStateFromData(int $id, int $stateMeta) : void{
|
||||
//TODO: in PC the values are reversed (facing - 2)
|
||||
|
||||
$this->facing = BlockDataValidator::readHorizontalFacing(5 - ($stateMeta & 0x03));
|
||||
$this->top = ($stateMeta & self::MASK_UPPER) !== 0;
|
||||
$this->open = ($stateMeta & self::MASK_OPENED) !== 0;
|
||||
$this->top = ($stateMeta & BlockLegacyMetadata::TRAPDOOR_FLAG_UPPER) !== 0;
|
||||
$this->open = ($stateMeta & BlockLegacyMetadata::TRAPDOOR_FLAG_OPEN) !== 0;
|
||||
}
|
||||
|
||||
public function getStateBitmask() : int{
|
||||
|
@ -39,14 +39,17 @@ class Tripwire extends Flowable{
|
||||
}
|
||||
|
||||
protected function writeStateToMeta() : int{
|
||||
return ($this->triggered ? 0x01 : 0) | ($this->suspended ? 0x02 : 0) | ($this->connected ? 0x04 : 0) | ($this->disarmed ? 0x08 : 0);
|
||||
return ($this->triggered ? BlockLegacyMetadata::TRIPWIRE_FLAG_TRIGGERED : 0) |
|
||||
($this->suspended ? BlockLegacyMetadata::TRIPWIRE_FLAG_SUSPENDED : 0) |
|
||||
($this->connected ? BlockLegacyMetadata::TRIPWIRE_FLAG_CONNECTED : 0) |
|
||||
($this->disarmed ? BlockLegacyMetadata::TRIPWIRE_FLAG_DISARMED : 0);
|
||||
}
|
||||
|
||||
public function readStateFromData(int $id, int $stateMeta) : void{
|
||||
$this->triggered = ($stateMeta & 0x01) !== 0;
|
||||
$this->suspended = ($stateMeta & 0x02) !== 0;
|
||||
$this->connected = ($stateMeta & 0x04) !== 0;
|
||||
$this->disarmed = ($stateMeta & 0x08) !== 0;
|
||||
$this->triggered = ($stateMeta & BlockLegacyMetadata::TRIPWIRE_FLAG_TRIGGERED) !== 0;
|
||||
$this->suspended = ($stateMeta & BlockLegacyMetadata::TRIPWIRE_FLAG_SUSPENDED) !== 0;
|
||||
$this->connected = ($stateMeta & BlockLegacyMetadata::TRIPWIRE_FLAG_CONNECTED) !== 0;
|
||||
$this->disarmed = ($stateMeta & BlockLegacyMetadata::TRIPWIRE_FLAG_DISARMED) !== 0;
|
||||
}
|
||||
|
||||
public function getStateBitmask() : int{
|
||||
|
@ -44,13 +44,15 @@ class TripwireHook extends Flowable{
|
||||
}
|
||||
|
||||
protected function writeStateToMeta() : int{
|
||||
return Bearing::fromFacing($this->facing) | ($this->connected ? 0x04 : 0) | ($this->powered ? 0x08 : 0);
|
||||
return Bearing::fromFacing($this->facing) |
|
||||
($this->connected ? BlockLegacyMetadata::TRIPWIRE_HOOK_FLAG_CONNECTED : 0) |
|
||||
($this->powered ? BlockLegacyMetadata::TRIPWIRE_HOOK_FLAG_POWERED : 0);
|
||||
}
|
||||
|
||||
public function readStateFromData(int $id, int $stateMeta) : void{
|
||||
$this->facing = BlockDataValidator::readLegacyHorizontalFacing($stateMeta & 0x03);
|
||||
$this->connected = ($stateMeta & 0x04) !== 0;
|
||||
$this->powered = ($stateMeta & 0x08) !== 0;
|
||||
$this->connected = ($stateMeta & BlockLegacyMetadata::TRIPWIRE_HOOK_FLAG_CONNECTED) !== 0;
|
||||
$this->powered = ($stateMeta & BlockLegacyMetadata::TRIPWIRE_HOOK_FLAG_POWERED) !== 0;
|
||||
}
|
||||
|
||||
public function getStateBitmask() : int{
|
||||
|
@ -34,10 +34,6 @@ use function array_keys;
|
||||
use function count;
|
||||
|
||||
class Vine extends Flowable{
|
||||
private const FLAG_SOUTH = 0x01;
|
||||
private const FLAG_WEST = 0x02;
|
||||
private const FLAG_NORTH = 0x04;
|
||||
private const FLAG_EAST = 0x08;
|
||||
|
||||
/** @var bool[] */
|
||||
protected $faces = [];
|
||||
@ -48,17 +44,17 @@ class Vine extends Flowable{
|
||||
|
||||
protected function writeStateToMeta() : int{
|
||||
return
|
||||
(isset($this->faces[Facing::SOUTH]) ? self::FLAG_SOUTH : 0) |
|
||||
(isset($this->faces[Facing::WEST]) ? self::FLAG_WEST : 0) |
|
||||
(isset($this->faces[Facing::NORTH]) ? self::FLAG_NORTH : 0) |
|
||||
(isset($this->faces[Facing::EAST]) ? self::FLAG_EAST : 0);
|
||||
(isset($this->faces[Facing::SOUTH]) ? BlockLegacyMetadata::VINE_FLAG_SOUTH : 0) |
|
||||
(isset($this->faces[Facing::WEST]) ? BlockLegacyMetadata::VINE_FLAG_WEST : 0) |
|
||||
(isset($this->faces[Facing::NORTH]) ? BlockLegacyMetadata::VINE_FLAG_NORTH : 0) |
|
||||
(isset($this->faces[Facing::EAST]) ? BlockLegacyMetadata::VINE_FLAG_EAST : 0);
|
||||
}
|
||||
|
||||
public function readStateFromData(int $id, int $stateMeta) : void{
|
||||
$this->setFaceFromMeta($stateMeta, self::FLAG_SOUTH, Facing::SOUTH);
|
||||
$this->setFaceFromMeta($stateMeta, self::FLAG_WEST, Facing::WEST);
|
||||
$this->setFaceFromMeta($stateMeta, self::FLAG_NORTH, Facing::NORTH);
|
||||
$this->setFaceFromMeta($stateMeta, self::FLAG_EAST, Facing::EAST);
|
||||
$this->setFaceFromMeta($stateMeta, BlockLegacyMetadata::VINE_FLAG_SOUTH, Facing::SOUTH);
|
||||
$this->setFaceFromMeta($stateMeta, BlockLegacyMetadata::VINE_FLAG_WEST, Facing::WEST);
|
||||
$this->setFaceFromMeta($stateMeta, BlockLegacyMetadata::VINE_FLAG_NORTH, Facing::NORTH);
|
||||
$this->setFaceFromMeta($stateMeta, BlockLegacyMetadata::VINE_FLAG_EAST, Facing::EAST);
|
||||
}
|
||||
|
||||
public function getStateBitmask() : int{
|
||||
|
@ -28,20 +28,6 @@ use pocketmine\math\AxisAlignedBB;
|
||||
use pocketmine\math\Facing;
|
||||
|
||||
class Wall extends Transparent{
|
||||
public const NONE_MOSSY_WALL = 0;
|
||||
public const MOSSY_WALL = 1;
|
||||
public const GRANITE_WALL = 2;
|
||||
public const DIORITE_WALL = 3;
|
||||
public const ANDESITE_WALL = 4;
|
||||
public const SANDSTONE_WALL = 5;
|
||||
public const BRICK_WALL = 6;
|
||||
public const STONE_BRICK_WALL = 7;
|
||||
public const MOSSY_STONE_BRICK_WALL = 8;
|
||||
public const NETHER_BRICK_WALL = 9;
|
||||
public const END_STONE_BRICK_WALL = 10;
|
||||
public const PRISMARINE_WALL = 11;
|
||||
public const RED_SANDSTONE_WALL = 12;
|
||||
public const RED_NETHER_BRICK_WALL = 13;
|
||||
|
||||
/** @var bool[] facing => dummy */
|
||||
protected $connections = [];
|
||||
|
@ -1,38 +0,0 @@
|
||||
<?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\world\format\io;
|
||||
|
||||
use pocketmine\world\format\PalettedBlockArray;
|
||||
|
||||
die("This is a stub file for code completion purposes");
|
||||
|
||||
//TODO: this can't be moved right now because of compatibility issues with the extension
|
||||
class SubChunkConverter{
|
||||
public static function convertSubChunkXZY(string $idArray, string $metaArray) : PalettedBlockArray{}
|
||||
|
||||
public static function convertSubChunkYZX(string $idArray, string $metaArray) : PalettedBlockArray{}
|
||||
|
||||
public static function convertSubChunkFromLegacyColumn(string $idArray, string $metaArray, int $yOffset) : PalettedBlockArray{}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user