mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 08:17:34 +00:00
Added stub classes for Beacon
this doesn't do anything yet, it's intended solely to prevent further loss of data.
This commit is contained in:
parent
7a436dc47c
commit
5807a385cc
33
src/block/Beacon.php
Normal file
33
src/block/Beacon.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?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;
|
||||
|
||||
final class Beacon extends Transparent{
|
||||
|
||||
public function getLightLevel() : int{
|
||||
return 15;
|
||||
}
|
||||
|
||||
//TODO
|
||||
}
|
@ -28,6 +28,7 @@ use pocketmine\block\BlockIdentifierFlattened as BIDFlattened;
|
||||
use pocketmine\block\BlockLegacyIds as Ids;
|
||||
use pocketmine\block\BlockLegacyMetadata as Meta;
|
||||
use pocketmine\block\tile\Banner as TileBanner;
|
||||
use pocketmine\block\tile\Beacon as TileBeacon;
|
||||
use pocketmine\block\tile\Bed as TileBed;
|
||||
use pocketmine\block\tile\BrewingStand as TileBrewingStand;
|
||||
use pocketmine\block\tile\Chest as TileChest;
|
||||
@ -107,6 +108,7 @@ class BlockFactory{
|
||||
$this->register(new BambooSapling(new BID(Ids::BAMBOO_SAPLING), "Bamboo Sapling", BlockBreakInfo::instant()));
|
||||
$this->register(new Banner(new BIDFlattened(Ids::STANDING_BANNER, Ids::WALL_BANNER, 0, ItemIds::BANNER, TileBanner::class), "Banner"));
|
||||
$this->register(new Transparent(new BID(Ids::BARRIER), "Barrier", BlockBreakInfo::indestructible()));
|
||||
$this->register(new Beacon(new BID(Ids::BEACON, 0, null, TileBeacon::class), "Beacon", new BlockBreakInfo(3.0)));
|
||||
$this->register(new Bed(new BID(Ids::BED_BLOCK, 0, ItemIds::BED, TileBed::class), "Bed Block"));
|
||||
$this->register(new Bedrock(new BID(Ids::BEDROCK), "Bedrock"));
|
||||
$this->register(new Beetroot(new BID(Ids::BEETROOT_BLOCK), "Beetroot Block"));
|
||||
|
@ -58,6 +58,7 @@ use function assert;
|
||||
* @method static BambooSapling BAMBOO_SAPLING()
|
||||
* @method static Banner BANNER()
|
||||
* @method static Transparent BARRIER()
|
||||
* @method static Beacon BEACON()
|
||||
* @method static Bed BED()
|
||||
* @method static Bedrock BEDROCK()
|
||||
* @method static Beetroot BEETROOTS()
|
||||
@ -727,6 +728,7 @@ final class VanillaBlocks{
|
||||
self::register("bamboo_sapling", $factory->get(419));
|
||||
self::register("banner", $factory->get(176));
|
||||
self::register("barrier", $factory->get(416));
|
||||
self::register("beacon", $factory->get(138));
|
||||
self::register("bed", $factory->get(26));
|
||||
self::register("bedrock", $factory->get(7));
|
||||
self::register("beetroots", $factory->get(244));
|
||||
|
60
src/block/tile/Beacon.php
Normal file
60
src/block/tile/Beacon.php
Normal file
@ -0,0 +1,60 @@
|
||||
<?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;
|
||||
|
||||
final class Beacon extends Spawnable{
|
||||
private const TAG_PRIMARY = "primary"; //TAG_Int
|
||||
private const TAG_SECONDARY = "secondary"; //TAG_Int
|
||||
|
||||
/** @var int */
|
||||
private $primaryEffect = 0;
|
||||
/** @var int */
|
||||
private $secondaryEffect = 0;
|
||||
|
||||
protected function addAdditionalSpawnData(CompoundTag $nbt) : void{
|
||||
$nbt->setInt(self::TAG_PRIMARY, $this->primaryEffect);
|
||||
$nbt->setInt(self::TAG_SECONDARY, $this->secondaryEffect);
|
||||
}
|
||||
|
||||
public function readSaveData(CompoundTag $nbt) : void{
|
||||
//TODO: PC uses Primary and Secondary (capitalized first letter), we don't read them here because the IDs would be different
|
||||
$this->primaryEffect = $nbt->getInt(self::TAG_PRIMARY);
|
||||
$this->secondaryEffect = $nbt->getInt(self::TAG_SECONDARY);
|
||||
}
|
||||
|
||||
protected function writeSaveData(CompoundTag $nbt) : void{
|
||||
$nbt->setInt(self::TAG_PRIMARY, $this->primaryEffect);
|
||||
$nbt->setInt(self::TAG_SECONDARY, $this->secondaryEffect);
|
||||
}
|
||||
|
||||
public function getPrimaryEffect() : int{ return $this->primaryEffect; }
|
||||
|
||||
public function setPrimaryEffect(int $primaryEffect) : void{ $this->primaryEffect = $primaryEffect; }
|
||||
|
||||
public function getSecondaryEffect() : int{ return $this->secondaryEffect; }
|
||||
|
||||
public function setSecondaryEffect(int $secondaryEffect) : void{ $this->secondaryEffect = $secondaryEffect; }
|
||||
}
|
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user