mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-12 16:59:44 +00:00
edu: implement coloured and underwater torches
This commit is contained in:
parent
cd733c658b
commit
b8adfd6948
@ -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
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
31
src/pocketmine/block/UnderwaterTorch.php
Normal file
31
src/pocketmine/block/UnderwaterTorch.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?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;
|
||||
|
||||
class UnderwaterTorch extends Torch{
|
||||
|
||||
public function canBeFlowedInto() : bool{
|
||||
return false;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user