added missing DaylightSensor tile

This commit is contained in:
Dylan K. Taylor 2019-05-30 19:00:38 +01:00
parent f18da8d879
commit 1bf5c74053
3 changed files with 51 additions and 2 deletions

View File

@ -31,6 +31,7 @@ use pocketmine\block\tile\Banner as TileBanner;
use pocketmine\block\tile\Bed as TileBed; use pocketmine\block\tile\Bed as TileBed;
use pocketmine\block\tile\Chest as TileChest; use pocketmine\block\tile\Chest as TileChest;
use pocketmine\block\tile\Comparator as TileComparator; use pocketmine\block\tile\Comparator as TileComparator;
use pocketmine\block\tile\DaylightSensor as TileDaylightSensor;
use pocketmine\block\tile\EnchantTable as TileEnchantingTable; use pocketmine\block\tile\EnchantTable as TileEnchantingTable;
use pocketmine\block\tile\EnderChest as TileEnderChest; use pocketmine\block\tile\EnderChest as TileEnderChest;
use pocketmine\block\tile\FlowerPot as TileFlowerPot; use pocketmine\block\tile\FlowerPot as TileFlowerPot;
@ -120,7 +121,7 @@ class BlockFactory{
self::register(new Cobweb(new BID(Ids::COBWEB), "Cobweb")); self::register(new Cobweb(new BID(Ids::COBWEB), "Cobweb"));
self::register(new CocoaBlock(new BID(Ids::COCOA), "Cocoa Block")); self::register(new CocoaBlock(new BID(Ids::COCOA), "Cocoa Block"));
self::register(new CraftingTable(new BID(Ids::CRAFTING_TABLE), "Crafting Table")); self::register(new CraftingTable(new BID(Ids::CRAFTING_TABLE), "Crafting Table"));
self::register(new DaylightSensor(new BIDFlattened(Ids::DAYLIGHT_DETECTOR, Ids::DAYLIGHT_DETECTOR_INVERTED), "Daylight Sensor")); self::register(new DaylightSensor(new BIDFlattened(Ids::DAYLIGHT_DETECTOR, Ids::DAYLIGHT_DETECTOR_INVERTED, 0, null, TileDaylightSensor::class), "Daylight Sensor"));
self::register(new DeadBush(new BID(Ids::DEADBUSH), "Dead Bush")); self::register(new DeadBush(new BID(Ids::DEADBUSH), "Dead Bush"));
self::register(new DetectorRail(new BID(Ids::DETECTOR_RAIL), "Detector Rail")); self::register(new DetectorRail(new BID(Ids::DETECTOR_RAIL), "Detector Rail"));

View File

@ -0,0 +1,48 @@
<?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\tile;
use pocketmine\nbt\tag\CompoundTag;
/**
* @deprecated
* As per the wiki, this is an old hack to force daylight sensors to get updated every game tick. This is necessary to
* ensure that the daylight sensor's power output is always up to date with the current world time.
* It's theoretically possible to implement this without a blockentity, but this is here to ensure that vanilla can
* understand daylight sensors in worlds created by PM.
*/
class DaylightSensor extends Tile{
public function readSaveData(CompoundTag $nbt) : void{
}
protected function writeSaveData(CompoundTag $nbt) : void{
}
public function onUpdate() : bool{
return false; //TODO: we'll need this for implementing daylight sensor until https://github.com/pmmp/PocketMine-MP/issues/2099 is fixed
}
}

View File

@ -50,6 +50,7 @@ final class TileFactory{
self::register(Bed::class, ["Bed", "minecraft:bed"]); self::register(Bed::class, ["Bed", "minecraft:bed"]);
self::register(Chest::class, ["Chest", "minecraft:chest"]); self::register(Chest::class, ["Chest", "minecraft:chest"]);
self::register(Comparator::class, ["Comparator", "minecraft:comparator"]); self::register(Comparator::class, ["Comparator", "minecraft:comparator"]);
self::register(DaylightSensor::class, ["DaylightDetector", "minecraft:daylight_detector"]);
self::register(EnchantTable::class, ["EnchantTable", "minecraft:enchanting_table"]); self::register(EnchantTable::class, ["EnchantTable", "minecraft:enchanting_table"]);
self::register(EnderChest::class, ["EnderChest", "minecraft:ender_chest"]); self::register(EnderChest::class, ["EnderChest", "minecraft:ender_chest"]);
self::register(FlowerPot::class, ["FlowerPot", "minecraft:flower_pot"]); self::register(FlowerPot::class, ["FlowerPot", "minecraft:flower_pot"]);
@ -70,7 +71,6 @@ final class TileFactory{
//TODO: ChemistryTable //TODO: ChemistryTable
//TODO: CommandBlock //TODO: CommandBlock
//TODO: Conduit //TODO: Conduit
//TODO: DaylightDetector
//TODO: Dispenser //TODO: Dispenser
//TODO: Dropper //TODO: Dropper
//TODO: EndGateway //TODO: EndGateway