diff --git a/src/pocketmine/block/BlockFactory.php b/src/pocketmine/block/BlockFactory.php index 62e05fed2..5040a5244 100644 --- a/src/pocketmine/block/BlockFactory.php +++ b/src/pocketmine/block/BlockFactory.php @@ -277,11 +277,16 @@ class BlockFactory{ self::registerBlock(new TallGrass(Block::TALL_GRASS, 1, "Tall Grass")); self::registerBlock(new TallGrass(Block::TALL_GRASS, 2, "Fern")); self::registerBlock(new TallGrass(Block::TALL_GRASS, 3, "Fern")); - self::registerBlock(new Torch()); + self::registerBlock(new Torch(Block::COLORED_TORCH_BP, 0, "Blue Torch")); + self::registerBlock(new Torch(Block::COLORED_TORCH_BP, 8, "Purple Torch")); + self::registerBlock(new Torch(Block::COLORED_TORCH_RG, 0, "Red Torch")); + self::registerBlock(new Torch(Block::COLORED_TORCH_RG, 8, "Green Torch")); + self::registerBlock(new Torch(Block::TORCH, 0, "Torch")); self::registerBlock(new Trapdoor()); self::registerBlock(new TrappedChest()); self::registerBlock(new Tripwire()); self::registerBlock(new TripwireHook()); + self::registerBlock(new UnderwaterTorch(Block::UNDERWATER_TORCH, 0, "Underwater Torch")); self::registerBlock(new Vine()); self::registerBlock(new WallBanner()); self::registerBlock(new WallSign()); @@ -416,8 +421,6 @@ class BlockFactory{ //TODO: minecraft:chemistry_table //TODO: minecraft:chorus_flower //TODO: minecraft:chorus_plant - //TODO: minecraft:colored_torch_bp - //TODO: minecraft:colored_torch_rg //TODO: minecraft:command_block //TODO: minecraft:conduit //TODO: minecraft:coral @@ -502,7 +505,6 @@ class BlockFactory{ //TODO: minecraft:stripped_spruce_log //TODO: minecraft:structure_block //TODO: minecraft:turtle_egg - //TODO: minecraft:underwater_torch //TODO: minecraft:undyed_shulker_box //TODO: minecraft:unpowered_comparator } diff --git a/src/pocketmine/block/RedstoneTorch.php b/src/pocketmine/block/RedstoneTorch.php index 51b03843f..b9956e37c 100644 --- a/src/pocketmine/block/RedstoneTorch.php +++ b/src/pocketmine/block/RedstoneTorch.php @@ -30,6 +30,10 @@ class RedstoneTorch extends Torch{ /** @var bool */ protected $lit = true; + public function __construct(){ + parent::__construct(self::REDSTONE_TORCH, 0, "Redstone Torch", self::REDSTONE_TORCH); + } + public function getId() : int{ return $this->lit ? self::REDSTONE_TORCH : self::UNLIT_REDSTONE_TORCH; } diff --git a/src/pocketmine/block/Torch.php b/src/pocketmine/block/Torch.php index b50ceee6f..2055f95a2 100644 --- a/src/pocketmine/block/Torch.php +++ b/src/pocketmine/block/Torch.php @@ -31,15 +31,9 @@ use pocketmine\Player; class Torch extends Flowable{ - protected $id = self::TORCH; - /** @var int */ protected $facing = Facing::UP; - public function __construct(){ - - } - protected function writeStateToMeta() : int{ return 6 - $this->facing; } @@ -56,10 +50,6 @@ class Torch extends Flowable{ return 14; } - public function getName() : string{ - return "Torch"; - } - public function onNearbyBlockChange() : void{ $below = $this->getSide(Facing::DOWN); $face = Facing::opposite($this->facing); diff --git a/src/pocketmine/block/UnderwaterTorch.php b/src/pocketmine/block/UnderwaterTorch.php new file mode 100644 index 000000000..a83a7c44a --- /dev/null +++ b/src/pocketmine/block/UnderwaterTorch.php @@ -0,0 +1,31 @@ +