mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-14 15:35:31 +00:00
Merge branch 'master' into mcpe-1.2
This commit is contained in:
commit
4f1302adf2
@ -35,7 +35,7 @@ interface IPlayer extends ServerOperator{
|
|||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getName();
|
public function getName() : string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
@ -63,12 +63,12 @@ interface IPlayer extends ServerOperator{
|
|||||||
public function getPlayer();
|
public function getPlayer();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return int|double
|
* @return int|null
|
||||||
*/
|
*/
|
||||||
public function getFirstPlayed();
|
public function getFirstPlayed();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return int|double
|
* @return int|null
|
||||||
*/
|
*/
|
||||||
public function getLastPlayed();
|
public function getLastPlayed();
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ class OfflinePlayer implements IPlayer, Metadatable{
|
|||||||
return $this->getPlayer() !== null;
|
return $this->getPlayer() !== null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return $this->name;
|
return $this->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -247,9 +247,9 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
protected $ip;
|
protected $ip;
|
||||||
protected $removeFormat = true;
|
protected $removeFormat = true;
|
||||||
protected $port;
|
protected $port;
|
||||||
protected $username;
|
protected $username = "";
|
||||||
protected $iusername;
|
protected $iusername = "";
|
||||||
protected $displayName;
|
protected $displayName = "";
|
||||||
protected $startAction = -1;
|
protected $startAction = -1;
|
||||||
/** @var Vector3|null */
|
/** @var Vector3|null */
|
||||||
protected $sleeping = null;
|
protected $sleeping = null;
|
||||||
@ -267,7 +267,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
/** @var Player[] */
|
/** @var Player[] */
|
||||||
protected $hiddenPlayers = [];
|
protected $hiddenPlayers = [];
|
||||||
|
|
||||||
/** @var Vector3 */
|
/** @var Vector3|null */
|
||||||
protected $newPosition;
|
protected $newPosition;
|
||||||
|
|
||||||
/** @var bool */
|
/** @var bool */
|
||||||
@ -388,12 +388,12 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
return $this->flying;
|
return $this->flying;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setAutoJump($value){
|
public function setAutoJump(bool $value){
|
||||||
$this->autoJump = $value;
|
$this->autoJump = $value;
|
||||||
$this->sendSettings();
|
$this->sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function hasAutoJump(){
|
public function hasAutoJump() : bool{
|
||||||
return $this->autoJump;
|
return $this->autoJump;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -439,8 +439,8 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
/**
|
/**
|
||||||
* @param bool $remove
|
* @param bool $remove
|
||||||
*/
|
*/
|
||||||
public function setRemoveFormat($remove = true){
|
public function setRemoveFormat(bool $remove = true){
|
||||||
$this->removeFormat = (bool) $remove;
|
$this->removeFormat = $remove;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getScreenLineHeight() : int{
|
public function getScreenLineHeight() : int{
|
||||||
@ -487,7 +487,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function canCollideWith(Entity $entity){
|
public function canCollideWith(Entity $entity) : bool{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -639,7 +639,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
* @param string $ip
|
* @param string $ip
|
||||||
* @param int $port
|
* @param int $port
|
||||||
*/
|
*/
|
||||||
public function __construct(SourceInterface $interface, $clientID, $ip, $port){
|
public function __construct(SourceInterface $interface, $clientID, string $ip, int $port){
|
||||||
$this->interface = $interface;
|
$this->interface = $interface;
|
||||||
$this->windows = new \SplObjectStorage();
|
$this->windows = new \SplObjectStorage();
|
||||||
$this->perm = new PermissibleBase($this);
|
$this->perm = new PermissibleBase($this);
|
||||||
@ -671,7 +671,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
/**
|
/**
|
||||||
* @param string $achievementId
|
* @param string $achievementId
|
||||||
*/
|
*/
|
||||||
public function removeAchievement($achievementId){
|
public function removeAchievement(string $achievementId){
|
||||||
if($this->hasAchievement($achievementId)){
|
if($this->hasAchievement($achievementId)){
|
||||||
$this->achievements[$achievementId] = false;
|
$this->achievements[$achievementId] = false;
|
||||||
}
|
}
|
||||||
@ -709,14 +709,14 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
/**
|
/**
|
||||||
* @param string $name
|
* @param string $name
|
||||||
*/
|
*/
|
||||||
public function setDisplayName($name){
|
public function setDisplayName(string $name){
|
||||||
$this->displayName = $name;
|
$this->displayName = $name;
|
||||||
if($this->spawned){
|
if($this->spawned){
|
||||||
$this->server->updatePlayerListData($this->getUniqueId(), $this->getId(), $this->getDisplayName(), $this->getSkinId(), $this->getSkinData());
|
$this->server->updatePlayerListData($this->getUniqueId(), $this->getId(), $this->getDisplayName(), $this->getSkinId(), $this->getSkinData());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setSkin($str, $skinId){
|
public function setSkin(string $str, string $skinId){
|
||||||
parent::setSkin($str, $skinId);
|
parent::setSkin($str, $skinId);
|
||||||
if($this->spawned){
|
if($this->spawned){
|
||||||
$this->server->updatePlayerListData($this->getUniqueId(), $this->getId(), $this->getDisplayName(), $skinId, $str);
|
$this->server->updatePlayerListData($this->getUniqueId(), $this->getId(), $this->getDisplayName(), $skinId, $str);
|
||||||
@ -744,8 +744,11 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
return $this->port;
|
return $this->port;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getNextPosition(){
|
/**
|
||||||
return $this->newPosition !== null ? new Position($this->newPosition->x, $this->newPosition->y, $this->newPosition->z, $this->level) : $this->getPosition();
|
* @return Position
|
||||||
|
*/
|
||||||
|
public function getNextPosition() : Position{
|
||||||
|
return $this->newPosition !== null ? Position::fromObject($this->newPosition, $this->level) : $this->getPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -755,11 +758,11 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
return $this->sleeping !== null;
|
return $this->sleeping !== null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getInAirTicks(){
|
public function getInAirTicks() : int{
|
||||||
return $this->inAirTicks;
|
return $this->inAirTicks;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function switchLevel(Level $targetLevel){
|
protected function switchLevel(Level $targetLevel) : bool{
|
||||||
$oldLevel = $this->level;
|
$oldLevel = $this->level;
|
||||||
if(parent::switchLevel($targetLevel)){
|
if(parent::switchLevel($targetLevel)){
|
||||||
foreach($this->usedChunks as $index => $d){
|
foreach($this->usedChunks as $index => $d){
|
||||||
@ -769,10 +772,14 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
|
|
||||||
$this->usedChunks = [];
|
$this->usedChunks = [];
|
||||||
$this->level->sendTime($this);
|
$this->level->sendTime($this);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function unloadChunk($x, $z, Level $level = null){
|
private function unloadChunk(int $x, int $z, Level $level = null){
|
||||||
$level = $level ?? $this->level;
|
$level = $level ?? $this->level;
|
||||||
$index = Level::chunkHash($x, $z);
|
$index = Level::chunkHash($x, $z);
|
||||||
if(isset($this->usedChunks[$index])){
|
if(isset($this->usedChunks[$index])){
|
||||||
@ -820,7 +827,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
|
|
||||||
if($this->spawned){
|
if($this->spawned){
|
||||||
foreach($this->level->getChunkEntities($x, $z) as $entity){
|
foreach($this->level->getChunkEntities($x, $z) as $entity){
|
||||||
if($entity !== $this and !$entity->closed and $entity->isAlive()){
|
if($entity !== $this and !$entity->isClosed() and $entity->isAlive()){
|
||||||
$entity->spawnTo($this);
|
$entity->spawnTo($this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -899,7 +906,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
foreach($this->usedChunks as $index => $c){
|
foreach($this->usedChunks as $index => $c){
|
||||||
Level::getXZ($index, $chunkX, $chunkZ);
|
Level::getXZ($index, $chunkX, $chunkZ);
|
||||||
foreach($this->level->getChunkEntities($chunkX, $chunkZ) as $entity){
|
foreach($this->level->getChunkEntities($chunkX, $chunkZ) as $entity){
|
||||||
if($entity !== $this and !$entity->closed and $entity->isAlive()){
|
if($entity !== $this and !$entity->isClosed() and $entity->isAlive()){
|
||||||
$entity->spawnTo($this);
|
$entity->spawnTo($this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1047,9 +1054,9 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
* @param DataPacket $packet
|
* @param DataPacket $packet
|
||||||
* @param bool $needACK
|
* @param bool $needACK
|
||||||
*
|
*
|
||||||
* @return int|bool
|
* @return bool|int
|
||||||
*/
|
*/
|
||||||
public function dataPacket(DataPacket $packet, $needACK = false){
|
public function dataPacket(DataPacket $packet, bool $needACK = false){
|
||||||
if(!$this->connected){
|
if(!$this->connected){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1087,7 +1094,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
*
|
*
|
||||||
* @return bool|int
|
* @return bool|int
|
||||||
*/
|
*/
|
||||||
public function directDataPacket(DataPacket $packet, $needACK = false){
|
public function directDataPacket(DataPacket $packet, bool $needACK = false){
|
||||||
if($this->connected === false){
|
if($this->connected === false){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1142,7 +1149,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
$this->sleeping = clone $pos;
|
$this->sleeping = clone $pos;
|
||||||
|
|
||||||
$this->setDataProperty(self::DATA_PLAYER_BED_POSITION, self::DATA_TYPE_POS, [$pos->x, $pos->y, $pos->z]);
|
$this->setDataProperty(self::DATA_PLAYER_BED_POSITION, self::DATA_TYPE_POS, [$pos->x, $pos->y, $pos->z]);
|
||||||
$this->setDataFlag(self::DATA_PLAYER_FLAGS, self::DATA_PLAYER_FLAG_SLEEP, true, self::DATA_TYPE_BYTE);
|
$this->setPlayerFlag(self::DATA_PLAYER_FLAG_SLEEP, true);
|
||||||
|
|
||||||
$this->setSpawn($pos);
|
$this->setSpawn($pos);
|
||||||
|
|
||||||
@ -1183,7 +1190,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
|
|
||||||
$this->sleeping = null;
|
$this->sleeping = null;
|
||||||
$this->setDataProperty(self::DATA_PLAYER_BED_POSITION, self::DATA_TYPE_POS, [0, 0, 0]);
|
$this->setDataProperty(self::DATA_PLAYER_BED_POSITION, self::DATA_TYPE_POS, [0, 0, 0]);
|
||||||
$this->setDataFlag(self::DATA_PLAYER_FLAGS, self::DATA_PLAYER_FLAG_SLEEP, false, self::DATA_TYPE_BYTE);
|
$this->setPlayerFlag(self::DATA_PLAYER_FLAG_SLEEP, false);
|
||||||
|
|
||||||
$this->level->sleepTicks = 0;
|
$this->level->sleepTicks = 0;
|
||||||
|
|
||||||
@ -1404,7 +1411,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function checkGroundState($movX, $movY, $movZ, $dx, $dy, $dz){
|
protected function checkGroundState(float $movX, float $movY, float $movZ, float $dx, float $dy, float $dz){
|
||||||
if(!$this->onGround or $movY != 0){
|
if(!$this->onGround or $movY != 0){
|
||||||
$bb = clone $this->boundingBox;
|
$bb = clone $this->boundingBox;
|
||||||
$bb->minY = $this->y - 0.01;
|
$bb->minY = $this->y - 0.01;
|
||||||
@ -1425,7 +1432,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function checkNearEntities($tickDiff){
|
protected function checkNearEntities(int $tickDiff){
|
||||||
foreach($this->level->getNearbyEntities($this->boundingBox->grow(1, 0.5, 1), $this) as $entity){
|
foreach($this->level->getNearbyEntities($this->boundingBox->grow(1, 0.5, 1), $this) as $entity){
|
||||||
$entity->scheduleUpdate();
|
$entity->scheduleUpdate();
|
||||||
|
|
||||||
@ -1487,7 +1494,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function processMovement($tickDiff){
|
protected function processMovement(int $tickDiff){
|
||||||
if(!$this->isAlive() or !$this->spawned or $this->newPosition === null or $this->isSleeping()){
|
if(!$this->isAlive() or !$this->spawned or $this->newPosition === null or $this->isSleeping()){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1649,7 +1656,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onUpdate($currentTick){
|
public function onUpdate(int $currentTick) : bool{
|
||||||
if(!$this->loggedIn){
|
if(!$this->loggedIn){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1749,7 +1756,16 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function canInteract(Vector3 $pos, $maxDistance, $maxDiff = 0.5){
|
/**
|
||||||
|
* Returns whether the player can interact with the specified position. This checks distance and direction.
|
||||||
|
*
|
||||||
|
* @param Vector3 $pos
|
||||||
|
* @param $maxDistance
|
||||||
|
* @param float $maxDiff
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function canInteract(Vector3 $pos, $maxDistance, float $maxDiff = 0.5) : bool{
|
||||||
$eyePos = $this->getPosition()->add(0, $this->getEyeHeight(), 0);
|
$eyePos = $this->getPosition()->add(0, $this->getEyeHeight(), 0);
|
||||||
if($eyePos->distanceSquared($pos) > $maxDistance ** 2){
|
if($eyePos->distanceSquared($pos) > $maxDistance ** 2){
|
||||||
return false;
|
return false;
|
||||||
@ -2125,7 +2141,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
}
|
}
|
||||||
$this->craftingType = 0;
|
$this->craftingType = 0;
|
||||||
|
|
||||||
$this->setDataFlag(self::DATA_FLAGS, self::DATA_FLAG_ACTION, false); //TODO: check if this should be true
|
$this->setGenericFlag(self::DATA_FLAG_ACTION, false); //TODO: check if this should be true
|
||||||
|
|
||||||
switch($packet->event){
|
switch($packet->event){
|
||||||
case EntityEventPacket::USE_ITEM: //Eating
|
case EntityEventPacket::USE_ITEM: //Eating
|
||||||
@ -2211,7 +2227,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
$type = $packet->transactionData->useItemActionType;
|
$type = $packet->transactionData->useItemActionType;
|
||||||
switch($type){
|
switch($type){
|
||||||
case InventoryTransactionPacket::USE_ITEM_ACTION_CLICK_BLOCK:
|
case InventoryTransactionPacket::USE_ITEM_ACTION_CLICK_BLOCK:
|
||||||
$this->setDataFlag(self::DATA_FLAGS, self::DATA_FLAG_ACTION, false);
|
$this->setGenericFlag(self::DATA_FLAG_ACTION, false);
|
||||||
|
|
||||||
if(!$this->canInteract($blockVector->add(0.5, 0.5, 0.5), 13) or $this->isSpectator()){
|
if(!$this->canInteract($blockVector->add(0.5, 0.5, 0.5), 13) or $this->isSpectator()){
|
||||||
}elseif($this->isCreative()){
|
}elseif($this->isCreative()){
|
||||||
@ -2343,7 +2359,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->setDataFlag(self::DATA_FLAGS, self::DATA_FLAG_ACTION, true);
|
$this->setGenericFlag(self::DATA_FLAG_ACTION, true);
|
||||||
$this->startAction = $this->server->getTick();
|
$this->startAction = $this->server->getTick();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -2517,7 +2533,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
|
|
||||||
$this->inventory->equipItem($packet->hotbarSlot, $packet->inventorySlot);
|
$this->inventory->equipItem($packet->hotbarSlot, $packet->inventorySlot);
|
||||||
|
|
||||||
$this->setDataFlag(self::DATA_FLAGS, self::DATA_FLAG_ACTION, false);
|
$this->setGenericFlag(self::DATA_FLAG_ACTION, false);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -2609,7 +2625,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
$this->level->broadcastLevelEvent($pos, LevelEventPacket::EVENT_BLOCK_STOP_BREAK);
|
$this->level->broadcastLevelEvent($pos, LevelEventPacket::EVENT_BLOCK_STOP_BREAK);
|
||||||
break;
|
break;
|
||||||
case PlayerActionPacket::ACTION_RELEASE_ITEM:
|
case PlayerActionPacket::ACTION_RELEASE_ITEM:
|
||||||
if($this->startAction > -1 and $this->getDataFlag(self::DATA_FLAGS, self::DATA_FLAG_ACTION)){
|
if($this->startAction > -1 and $this->getGenericFlag(self::DATA_FLAG_ACTION)){
|
||||||
if($this->inventory->getItemInHand()->getId() === Item::BOW){
|
if($this->inventory->getItemInHand()->getId() === Item::BOW){
|
||||||
$bow = $this->inventory->getItemInHand();
|
$bow = $this->inventory->getItemInHand();
|
||||||
if($this->isSurvival() and !$this->inventory->contains(Item::get(Item::ARROW, 0, 1))){
|
if($this->isSurvival() and !$this->inventory->contains(Item::get(Item::ARROW, 0, 1))){
|
||||||
@ -2805,7 +2821,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->startAction = -1;
|
$this->startAction = -1;
|
||||||
$this->setDataFlag(self::DATA_FLAGS, self::DATA_FLAG_ACTION, false);
|
$this->setGenericFlag(self::DATA_FLAG_ACTION, false);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -2853,7 +2869,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
|
|
||||||
$this->level->dropItem($this->add(0, 1.3, 0), $item, $motion, 40);
|
$this->level->dropItem($this->add(0, 1.3, 0), $item, $motion, 40);
|
||||||
|
|
||||||
$this->setDataFlag(self::DATA_FLAGS, self::DATA_FLAG_ACTION, false);
|
$this->setGenericFlag(self::DATA_FLAG_ACTION, false);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -3237,11 +3253,11 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
* Kicks a player from the server
|
* Kicks a player from the server
|
||||||
*
|
*
|
||||||
* @param string $reason
|
* @param string $reason
|
||||||
* @param bool $isAdmin
|
* @param bool $isAdmin
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function kick($reason = "", bool $isAdmin = true) : bool{
|
public function kick(string $reason = "", bool $isAdmin = true) : bool{
|
||||||
$this->server->getPluginManager()->callEvent($ev = new PlayerKickEvent($this, $reason, $this->getLeaveMessage()));
|
$this->server->getPluginManager()->callEvent($ev = new PlayerKickEvent($this, $reason, $this->getLeaveMessage()));
|
||||||
if(!$ev->isCancelled()){
|
if(!$ev->isCancelled()){
|
||||||
if($isAdmin){
|
if($isAdmin){
|
||||||
@ -3369,7 +3385,11 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
$this->dataPacket($pk);
|
$this->dataPacket($pk);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function sendTranslation($message, array $parameters = []){
|
/**
|
||||||
|
* @param string $message
|
||||||
|
* @param string[] $parameters
|
||||||
|
*/
|
||||||
|
public function sendTranslation(string $message, array $parameters = []){
|
||||||
$pk = new TextPacket();
|
$pk = new TextPacket();
|
||||||
if(!$this->server->isLanguageForced()){
|
if(!$this->server->isLanguageForced()){
|
||||||
$pk->type = TextPacket::TYPE_TRANSLATION;
|
$pk->type = TextPacket::TYPE_TRANSLATION;
|
||||||
@ -3385,7 +3405,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
$this->dataPacket($pk);
|
$this->dataPacket($pk);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function sendPopup($message, $subtitle = ""){
|
public function sendPopup(string $message, string $subtitle = ""){
|
||||||
$pk = new TextPacket();
|
$pk = new TextPacket();
|
||||||
$pk->type = TextPacket::TYPE_POPUP;
|
$pk->type = TextPacket::TYPE_POPUP;
|
||||||
$pk->source = $message;
|
$pk->source = $message;
|
||||||
@ -3393,7 +3413,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
$this->dataPacket($pk);
|
$this->dataPacket($pk);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function sendTip($message){
|
public function sendTip(string $message){
|
||||||
$pk = new TextPacket();
|
$pk = new TextPacket();
|
||||||
$pk->type = TextPacket::TYPE_TIP;
|
$pk->type = TextPacket::TYPE_TIP;
|
||||||
$pk->message = $message;
|
$pk->message = $message;
|
||||||
@ -3404,7 +3424,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
* @param string $sender
|
* @param string $sender
|
||||||
* @param string $message
|
* @param string $message
|
||||||
*/
|
*/
|
||||||
public function sendWhisper($sender, $message){
|
public function sendWhisper(string $sender, string $message){
|
||||||
$pk = new TextPacket();
|
$pk = new TextPacket();
|
||||||
$pk->type = TextPacket::TYPE_WHISPER;
|
$pk->type = TextPacket::TYPE_WHISPER;
|
||||||
$pk->source = $sender;
|
$pk->source = $sender;
|
||||||
@ -3416,15 +3436,15 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
* Note for plugin developers: use kick() with the isAdmin
|
* Note for plugin developers: use kick() with the isAdmin
|
||||||
* flag set to kick without the "Kicked by admin" part instead of this method.
|
* flag set to kick without the "Kicked by admin" part instead of this method.
|
||||||
*
|
*
|
||||||
* @param string $message Message to be broadcasted
|
* @param TextContainer|string $message Message to be broadcasted
|
||||||
* @param string $reason Reason showed in console
|
* @param string $reason Reason showed in console
|
||||||
* @param bool $notify
|
* @param bool $notify
|
||||||
*/
|
*/
|
||||||
final public function close($message = "", $reason = "generic reason", $notify = true){
|
final public function close($message = "", string $reason = "generic reason", bool $notify = true){
|
||||||
if($this->connected and !$this->closed){
|
if($this->connected and !$this->closed){
|
||||||
|
|
||||||
try{
|
try{
|
||||||
if($notify and strlen((string) $reason) > 0){
|
if($notify and strlen($reason) > 0){
|
||||||
$pk = new DisconnectPacket();
|
$pk = new DisconnectPacket();
|
||||||
$pk->message = $reason;
|
$pk->message = $reason;
|
||||||
$this->directDataPacket($pk);
|
$this->directDataPacket($pk);
|
||||||
@ -3481,7 +3501,9 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
$this->windows = null;
|
$this->windows = null;
|
||||||
$this->windowIndex = [];
|
$this->windowIndex = [];
|
||||||
|
|
||||||
parent::close();
|
if($this->constructed){
|
||||||
|
parent::close();
|
||||||
|
}
|
||||||
$this->spawned = false;
|
$this->spawned = false;
|
||||||
|
|
||||||
if($this->loggedIn){
|
if($this->loggedIn){
|
||||||
@ -3519,8 +3541,10 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
* Handles player data saving
|
* Handles player data saving
|
||||||
*
|
*
|
||||||
* @param bool $async
|
* @param bool $async
|
||||||
|
*
|
||||||
|
* @throws \InvalidStateException if the player is closed
|
||||||
*/
|
*/
|
||||||
public function save($async = false){
|
public function save(bool $async = false){
|
||||||
if($this->closed){
|
if($this->closed){
|
||||||
throw new \InvalidStateException("Tried to save closed player");
|
throw new \InvalidStateException("Tried to save closed player");
|
||||||
}
|
}
|
||||||
@ -3552,10 +3576,9 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the username
|
* Gets the username
|
||||||
*
|
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return $this->username;
|
return $this->username;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -427,7 +427,7 @@ class Server{
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function getGamemodeString(int $mode) : string{
|
public static function getGamemodeString(int $mode) : string{
|
||||||
switch((int) $mode){
|
switch($mode){
|
||||||
case Player::SURVIVAL:
|
case Player::SURVIVAL:
|
||||||
return "%gameMode.survival";
|
return "%gameMode.survival";
|
||||||
case Player::CREATIVE:
|
case Player::CREATIVE:
|
||||||
@ -1208,7 +1208,7 @@ class Server{
|
|||||||
return (int) $v[$variable];
|
return (int) $v[$variable];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->properties->exists($variable) ? (int) $this->properties->get($variable) : (int) $defaultValue;
|
return $this->properties->exists($variable) ? (int) $this->properties->get($variable) : $defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1216,7 +1216,7 @@ class Server{
|
|||||||
* @param int $value
|
* @param int $value
|
||||||
*/
|
*/
|
||||||
public function setConfigInt(string $variable, int $value){
|
public function setConfigInt(string $variable, int $value){
|
||||||
$this->properties->set($variable, (int) $value);
|
$this->properties->set($variable, $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -27,11 +27,7 @@ class ActivatorRail extends Rail{
|
|||||||
|
|
||||||
protected $id = self::ACTIVATOR_RAIL;
|
protected $id = self::ACTIVATOR_RAIL;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function getName() : string{
|
||||||
$this->meta = $meta;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getName(){
|
|
||||||
return "Activator Rail";
|
return "Activator Rail";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,35 +34,35 @@ class Air extends Transparent{
|
|||||||
protected $id = self::AIR;
|
protected $id = self::AIR;
|
||||||
protected $meta = 0;
|
protected $meta = 0;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Air";
|
return "Air";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function canPassThrough(){
|
public function canPassThrough() : bool{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isBreakable(Item $item){
|
public function isBreakable(Item $item) : bool{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function canBeFlowedInto(){
|
public function canBeFlowedInto() : bool{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function canBeReplaced(){
|
public function canBeReplaced() : bool{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function canBePlaced(){
|
public function canBePlaced() : bool{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isSolid(){
|
public function isSolid() : bool{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,11 +70,11 @@ class Air extends Transparent{
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getResistance(){
|
public function getResistance() : float{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,23 +36,23 @@ class Anvil extends Fallable{
|
|||||||
|
|
||||||
protected $id = self::ANVIL;
|
protected $id = self::ANVIL;
|
||||||
|
|
||||||
public function isSolid(){
|
public function isSolid() : bool{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 5;
|
return 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getResistance(){
|
public function getResistance() : float{
|
||||||
return 6000;
|
return 6000;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
static $names = [
|
static $names = [
|
||||||
self::TYPE_NORMAL => "Anvil",
|
self::TYPE_NORMAL => "Anvil",
|
||||||
self::TYPE_SLIGHTLY_DAMAGED => "Slightly Damaged Anvil",
|
self::TYPE_SLIGHTLY_DAMAGED => "Slightly Damaged Anvil",
|
||||||
@ -61,11 +61,11 @@ class Anvil extends Fallable{
|
|||||||
return $names[$this->meta & 0x0c] ?? "Anvil";
|
return $names[$this->meta & 0x0c] ?? "Anvil";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getToolType(){
|
public function getToolType() : int{
|
||||||
return Tool::TYPE_PICKAXE;
|
return Tool::TYPE_PICKAXE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onActivate(Item $item, Player $player = null){
|
public function onActivate(Item $item, Player $player = null) : bool{
|
||||||
if($player instanceof Player){
|
if($player instanceof Player){
|
||||||
$player->addWindow(new AnvilInventory($this));
|
$player->addWindow(new AnvilInventory($this));
|
||||||
}
|
}
|
||||||
@ -73,10 +73,10 @@ class Anvil extends Fallable{
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{
|
||||||
$direction = ($player !== null ? $player->getDirection() : 0) & 0x03;
|
$direction = ($player !== null ? $player->getDirection() : 0) & 0x03;
|
||||||
$this->meta = ($this->meta & 0x0c) | $direction;
|
$this->meta = ($this->meta & 0x0c) | $direction;
|
||||||
$this->getLevel()->setBlock($block, $this, true, true);
|
return $this->getLevel()->setBlock($block, $this, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDrops(Item $item){
|
public function getDrops(Item $item){
|
||||||
|
@ -43,15 +43,15 @@ class Bed extends Transparent{
|
|||||||
|
|
||||||
protected $id = self::BED_BLOCK;
|
protected $id = self::BED_BLOCK;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 0.2;
|
return 0.2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Bed Block";
|
return "Bed Block";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,7 +135,7 @@ class Bed extends Transparent{
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onActivate(Item $item, Player $player = null){
|
public function onActivate(Item $item, Player $player = null) : bool{
|
||||||
if($player !== null){
|
if($player !== null){
|
||||||
$other = $this->getOtherHalf();
|
$other = $this->getOtherHalf();
|
||||||
if($other === null){
|
if($other === null){
|
||||||
@ -172,7 +172,7 @@ class Bed extends Transparent{
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{
|
||||||
$down = $this->getSide(Vector3::SIDE_DOWN);
|
$down = $this->getSide(Vector3::SIDE_DOWN);
|
||||||
if(!$down->isTransparent()){
|
if(!$down->isTransparent()){
|
||||||
$meta = (($player instanceof Player ? $player->getDirection() : 0) - 1) & 0x03;
|
$meta = (($player instanceof Player ? $player->getDirection() : 0) - 1) & 0x03;
|
||||||
@ -203,7 +203,7 @@ class Bed extends Transparent{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onBreak(Item $item){
|
public function onBreak(Item $item) : bool{
|
||||||
$this->getLevel()->setBlock($this, Block::get(Block::AIR), true, true);
|
$this->getLevel()->setBlock($this, Block::get(Block::AIR), true, true);
|
||||||
if(($other = $this->getOtherHalf()) !== null){
|
if(($other = $this->getOtherHalf()) !== null){
|
||||||
$this->getLevel()->useBreakOn($other); //make sure tiles get removed
|
$this->getLevel()->useBreakOn($other); //make sure tiles get removed
|
||||||
|
@ -29,23 +29,23 @@ class Bedrock extends Solid{
|
|||||||
|
|
||||||
protected $id = self::BEDROCK;
|
protected $id = self::BEDROCK;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Bedrock";
|
return "Bedrock";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getResistance(){
|
public function getResistance() : float{
|
||||||
return 18000000;
|
return 18000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isBreakable(Item $item){
|
public function isBreakable(Item $item) : bool{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,11 +29,11 @@ class Beetroot extends Crops{
|
|||||||
|
|
||||||
protected $id = self::BEETROOT_BLOCK;
|
protected $id = self::BEETROOT_BLOCK;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Beetroot Block";
|
return "Beetroot Block";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,17 +99,18 @@ class Block extends Position implements BlockIds, Metadatable{
|
|||||||
self::registerBlock(new Glass());
|
self::registerBlock(new Glass());
|
||||||
self::registerBlock(new LapisOre());
|
self::registerBlock(new LapisOre());
|
||||||
self::registerBlock(new Lapis());
|
self::registerBlock(new Lapis());
|
||||||
|
//TODO: DISPENSER
|
||||||
self::registerBlock(new Sandstone());
|
self::registerBlock(new Sandstone());
|
||||||
self::registerBlock(new NoteBlock());
|
self::registerBlock(new NoteBlock());
|
||||||
self::registerBlock(new Bed());
|
self::registerBlock(new Bed());
|
||||||
self::registerBlock(new PoweredRail());
|
self::registerBlock(new PoweredRail());
|
||||||
self::registerBlock(new DetectorRail());
|
self::registerBlock(new DetectorRail());
|
||||||
|
//TODO: STICKY_PISTON
|
||||||
self::registerBlock(new Cobweb());
|
self::registerBlock(new Cobweb());
|
||||||
self::registerBlock(new TallGrass());
|
self::registerBlock(new TallGrass());
|
||||||
self::registerBlock(new DeadBush());
|
self::registerBlock(new DeadBush());
|
||||||
|
//TODO: PISTON
|
||||||
|
//TODO: PISTONARMCOLLISION
|
||||||
self::registerBlock(new Wool());
|
self::registerBlock(new Wool());
|
||||||
|
|
||||||
self::registerBlock(new Dandelion());
|
self::registerBlock(new Dandelion());
|
||||||
@ -130,7 +131,7 @@ class Block extends Position implements BlockIds, Metadatable{
|
|||||||
self::registerBlock(new MonsterSpawner());
|
self::registerBlock(new MonsterSpawner());
|
||||||
self::registerBlock(new WoodenStairs(Block::OAK_STAIRS, 0, "Oak Stairs"));
|
self::registerBlock(new WoodenStairs(Block::OAK_STAIRS, 0, "Oak Stairs"));
|
||||||
self::registerBlock(new Chest());
|
self::registerBlock(new Chest());
|
||||||
|
//TODO: REDSTONE_WIRE
|
||||||
self::registerBlock(new DiamondOre());
|
self::registerBlock(new DiamondOre());
|
||||||
self::registerBlock(new Diamond());
|
self::registerBlock(new Diamond());
|
||||||
self::registerBlock(new CraftingTable());
|
self::registerBlock(new CraftingTable());
|
||||||
@ -165,14 +166,17 @@ class Block extends Position implements BlockIds, Metadatable{
|
|||||||
self::registerBlock(new Netherrack());
|
self::registerBlock(new Netherrack());
|
||||||
self::registerBlock(new SoulSand());
|
self::registerBlock(new SoulSand());
|
||||||
self::registerBlock(new Glowstone());
|
self::registerBlock(new Glowstone());
|
||||||
|
//TODO: PORTAL
|
||||||
self::registerBlock(new LitPumpkin());
|
self::registerBlock(new LitPumpkin());
|
||||||
self::registerBlock(new Cake());
|
self::registerBlock(new Cake());
|
||||||
|
//TODO: REPEATER_BLOCK
|
||||||
|
//TODO: POWERED_REPEATER
|
||||||
|
//TODO: INVISIBLEBEDROCK
|
||||||
self::registerBlock(new Trapdoor());
|
self::registerBlock(new Trapdoor());
|
||||||
|
//TODO: MONSTER_EGG
|
||||||
self::registerBlock(new StoneBricks());
|
self::registerBlock(new StoneBricks());
|
||||||
|
//TODO: BROWN_MUSHROOM_BLOCK
|
||||||
|
//TODO: RED_MUSHROOM_BLOCK
|
||||||
self::registerBlock(new IronBars());
|
self::registerBlock(new IronBars());
|
||||||
self::registerBlock(new GlassPane());
|
self::registerBlock(new GlassPane());
|
||||||
self::registerBlock(new Melon());
|
self::registerBlock(new Melon());
|
||||||
@ -190,25 +194,27 @@ class Block extends Position implements BlockIds, Metadatable{
|
|||||||
self::registerBlock(new NetherWartPlant());
|
self::registerBlock(new NetherWartPlant());
|
||||||
self::registerBlock(new EnchantingTable());
|
self::registerBlock(new EnchantingTable());
|
||||||
self::registerBlock(new BrewingStand());
|
self::registerBlock(new BrewingStand());
|
||||||
|
//TODO: CAULDRON_BLOCK
|
||||||
|
//TODO: END_PORTAL
|
||||||
self::registerBlock(new EndPortalFrame());
|
self::registerBlock(new EndPortalFrame());
|
||||||
self::registerBlock(new EndStone());
|
self::registerBlock(new EndStone());
|
||||||
|
//TODO: DRAGON_EGG
|
||||||
self::registerBlock(new RedstoneLamp());
|
self::registerBlock(new RedstoneLamp());
|
||||||
self::registerBlock(new LitRedstoneLamp());
|
self::registerBlock(new LitRedstoneLamp());
|
||||||
|
//TODO: DROPPER
|
||||||
self::registerBlock(new ActivatorRail());
|
self::registerBlock(new ActivatorRail());
|
||||||
self::registerBlock(new CocoaBlock());
|
self::registerBlock(new CocoaBlock());
|
||||||
self::registerBlock(new SandstoneStairs());
|
self::registerBlock(new SandstoneStairs());
|
||||||
self::registerBlock(new EmeraldOre());
|
self::registerBlock(new EmeraldOre());
|
||||||
|
//TODO: ENDER_CHEST
|
||||||
self::registerBlock(new TripwireHook());
|
self::registerBlock(new TripwireHook());
|
||||||
self::registerBlock(new Tripwire());
|
self::registerBlock(new Tripwire());
|
||||||
self::registerBlock(new Emerald());
|
self::registerBlock(new Emerald());
|
||||||
self::registerBlock(new WoodenStairs(Block::SPRUCE_STAIRS, 0, "Spruce Stairs"));
|
self::registerBlock(new WoodenStairs(Block::SPRUCE_STAIRS, 0, "Spruce Stairs"));
|
||||||
self::registerBlock(new WoodenStairs(Block::BIRCH_STAIRS, 0, "Birch Stairs"));
|
self::registerBlock(new WoodenStairs(Block::BIRCH_STAIRS, 0, "Birch Stairs"));
|
||||||
self::registerBlock(new WoodenStairs(Block::JUNGLE_STAIRS, 0, "Jungle Stairs"));
|
self::registerBlock(new WoodenStairs(Block::JUNGLE_STAIRS, 0, "Jungle Stairs"));
|
||||||
|
//TODO: COMMAND_BLOCK
|
||||||
|
//TODO: BEACON
|
||||||
self::registerBlock(new CobblestoneWall());
|
self::registerBlock(new CobblestoneWall());
|
||||||
self::registerBlock(new FlowerPot());
|
self::registerBlock(new FlowerPot());
|
||||||
self::registerBlock(new Carrot());
|
self::registerBlock(new Carrot());
|
||||||
@ -219,20 +225,23 @@ class Block extends Position implements BlockIds, Metadatable{
|
|||||||
self::registerBlock(new TrappedChest());
|
self::registerBlock(new TrappedChest());
|
||||||
self::registerBlock(new WeightedPressurePlateLight());
|
self::registerBlock(new WeightedPressurePlateLight());
|
||||||
self::registerBlock(new WeightedPressurePlateHeavy());
|
self::registerBlock(new WeightedPressurePlateHeavy());
|
||||||
|
//TODO: COMPARATOR_BLOCK
|
||||||
|
//TODO: POWERED_COMPARATOR
|
||||||
self::registerBlock(new DaylightSensor());
|
self::registerBlock(new DaylightSensor());
|
||||||
self::registerBlock(new Redstone());
|
self::registerBlock(new Redstone());
|
||||||
|
//TODO: NETHER_QUARTZ_ORE
|
||||||
|
//TODO: HOPPER_BLOCK
|
||||||
self::registerBlock(new Quartz());
|
self::registerBlock(new Quartz());
|
||||||
self::registerBlock(new QuartzStairs());
|
self::registerBlock(new QuartzStairs());
|
||||||
self::registerBlock(new DoubleWoodenSlab());
|
self::registerBlock(new DoubleWoodenSlab());
|
||||||
self::registerBlock(new WoodenSlab());
|
self::registerBlock(new WoodenSlab());
|
||||||
self::registerBlock(new StainedClay());
|
self::registerBlock(new StainedClay());
|
||||||
|
//TODO: STAINED_GLASS_PANE
|
||||||
self::registerBlock(new Leaves2());
|
self::registerBlock(new Leaves2());
|
||||||
self::registerBlock(new Wood2());
|
self::registerBlock(new Wood2());
|
||||||
self::registerBlock(new WoodenStairs(Block::ACACIA_STAIRS, 0, "Acacia Stairs"));
|
self::registerBlock(new WoodenStairs(Block::ACACIA_STAIRS, 0, "Acacia Stairs"));
|
||||||
self::registerBlock(new WoodenStairs(Block::DARK_OAK_STAIRS, 0, "Dark Oak Stairs"));
|
self::registerBlock(new WoodenStairs(Block::DARK_OAK_STAIRS, 0, "Dark Oak Stairs"));
|
||||||
|
//TODO: SLIME
|
||||||
|
|
||||||
self::registerBlock(new IronTrapdoor());
|
self::registerBlock(new IronTrapdoor());
|
||||||
self::registerBlock(new Prismarine());
|
self::registerBlock(new Prismarine());
|
||||||
@ -244,11 +253,18 @@ class Block extends Position implements BlockIds, Metadatable{
|
|||||||
self::registerBlock(new PackedIce());
|
self::registerBlock(new PackedIce());
|
||||||
self::registerBlock(new DoublePlant());
|
self::registerBlock(new DoublePlant());
|
||||||
|
|
||||||
|
//TODO: DAYLIGHT_DETECTOR_INVERTED
|
||||||
|
//TODO: RED_SANDSTONE
|
||||||
|
//TODO: RED_SANDSTONE_STAIRS
|
||||||
|
//TODO: DOUBLE_STONE_SLAB2
|
||||||
|
//TODO: STONE_SLAB2
|
||||||
self::registerBlock(new FenceGate(Block::SPRUCE_FENCE_GATE, 0, "Spruce Fence Gate"));
|
self::registerBlock(new FenceGate(Block::SPRUCE_FENCE_GATE, 0, "Spruce Fence Gate"));
|
||||||
self::registerBlock(new FenceGate(Block::BIRCH_FENCE_GATE, 0, "Birch Fence Gate"));
|
self::registerBlock(new FenceGate(Block::BIRCH_FENCE_GATE, 0, "Birch Fence Gate"));
|
||||||
self::registerBlock(new FenceGate(Block::JUNGLE_FENCE_GATE, 0, "Jungle Fence Gate"));
|
self::registerBlock(new FenceGate(Block::JUNGLE_FENCE_GATE, 0, "Jungle Fence Gate"));
|
||||||
self::registerBlock(new FenceGate(Block::DARK_OAK_FENCE_GATE, 0, "Dark Oak Fence Gate"));
|
self::registerBlock(new FenceGate(Block::DARK_OAK_FENCE_GATE, 0, "Dark Oak Fence Gate"));
|
||||||
self::registerBlock(new FenceGate(Block::ACACIA_FENCE_GATE, 0, "Acacia Fence Gate"));
|
self::registerBlock(new FenceGate(Block::ACACIA_FENCE_GATE, 0, "Acacia Fence Gate"));
|
||||||
|
//TODO: REPEATING_COMMAND_BLOCK
|
||||||
|
//TODO: CHAIN_COMMAND_BLOCK
|
||||||
|
|
||||||
self::registerBlock(new WoodenDoor(Block::SPRUCE_DOOR_BLOCK, 0, "Spruce Door Block", Item::SPRUCE_DOOR));
|
self::registerBlock(new WoodenDoor(Block::SPRUCE_DOOR_BLOCK, 0, "Spruce Door Block", Item::SPRUCE_DOOR));
|
||||||
self::registerBlock(new WoodenDoor(Block::BIRCH_DOOR_BLOCK, 0, "Birch Door Block", Item::BIRCH_DOOR));
|
self::registerBlock(new WoodenDoor(Block::BIRCH_DOOR_BLOCK, 0, "Birch Door Block", Item::BIRCH_DOOR));
|
||||||
@ -257,7 +273,22 @@ class Block extends Position implements BlockIds, Metadatable{
|
|||||||
self::registerBlock(new WoodenDoor(Block::DARK_OAK_DOOR_BLOCK, 0, "Dark Oak Door Block", Item::DARK_OAK_DOOR));
|
self::registerBlock(new WoodenDoor(Block::DARK_OAK_DOOR_BLOCK, 0, "Dark Oak Door Block", Item::DARK_OAK_DOOR));
|
||||||
self::registerBlock(new GrassPath());
|
self::registerBlock(new GrassPath());
|
||||||
self::registerBlock(new ItemFrame());
|
self::registerBlock(new ItemFrame());
|
||||||
|
//TODO: CHORUS_FLOWER
|
||||||
|
//TODO: PURPUR_BLOCK
|
||||||
|
|
||||||
|
//TODO: PURPUR_STAIRS
|
||||||
|
|
||||||
|
//TODO: END_BRICKS
|
||||||
|
//TODO: FROSTED_ICE
|
||||||
|
//TODO: END_ROD
|
||||||
|
//TODO: END_GATEWAY
|
||||||
|
|
||||||
|
//TODO: MAGMA
|
||||||
|
//TODO: NETHER_WART_BLOCK
|
||||||
|
//TODO: RED_NETHER_BRICK
|
||||||
|
//TODO: BONE_BLOCK
|
||||||
|
|
||||||
|
//TODO: SHULKER_BOX
|
||||||
self::registerBlock(new GlazedTerracotta(Block::PURPLE_GLAZED_TERRACOTTA, 0, "Purple Glazed Terracotta"));
|
self::registerBlock(new GlazedTerracotta(Block::PURPLE_GLAZED_TERRACOTTA, 0, "Purple Glazed Terracotta"));
|
||||||
self::registerBlock(new GlazedTerracotta(Block::WHITE_GLAZED_TERRACOTTA, 0, "White Glazed Terracotta"));
|
self::registerBlock(new GlazedTerracotta(Block::WHITE_GLAZED_TERRACOTTA, 0, "White Glazed Terracotta"));
|
||||||
self::registerBlock(new GlazedTerracotta(Block::ORANGE_GLAZED_TERRACOTTA, 0, "Orange Glazed Terracotta"));
|
self::registerBlock(new GlazedTerracotta(Block::ORANGE_GLAZED_TERRACOTTA, 0, "Orange Glazed Terracotta"));
|
||||||
@ -275,11 +306,23 @@ class Block extends Position implements BlockIds, Metadatable{
|
|||||||
self::registerBlock(new GlazedTerracotta(Block::GREEN_GLAZED_TERRACOTTA, 0, "Green Glazed Terracotta"));
|
self::registerBlock(new GlazedTerracotta(Block::GREEN_GLAZED_TERRACOTTA, 0, "Green Glazed Terracotta"));
|
||||||
self::registerBlock(new GlazedTerracotta(Block::RED_GLAZED_TERRACOTTA, 0, "Red Glazed Terracotta"));
|
self::registerBlock(new GlazedTerracotta(Block::RED_GLAZED_TERRACOTTA, 0, "Red Glazed Terracotta"));
|
||||||
self::registerBlock(new GlazedTerracotta(Block::BLACK_GLAZED_TERRACOTTA, 0, "Black Glazed Terracotta"));
|
self::registerBlock(new GlazedTerracotta(Block::BLACK_GLAZED_TERRACOTTA, 0, "Black Glazed Terracotta"));
|
||||||
|
//TODO: CONCRETE
|
||||||
|
//TODO: CONCRETEPOWDER
|
||||||
|
|
||||||
|
//TODO: CHORUS_PLANT
|
||||||
|
//TODO: STAINED_GLASS
|
||||||
|
|
||||||
self::registerBlock(new Podzol());
|
self::registerBlock(new Podzol());
|
||||||
self::registerBlock(new Beetroot());
|
self::registerBlock(new Beetroot());
|
||||||
self::registerBlock(new Stonecutter());
|
self::registerBlock(new Stonecutter());
|
||||||
self::registerBlock(new GlowingObsidian());
|
self::registerBlock(new GlowingObsidian());
|
||||||
|
self::registerBlock(new NetherReactor());
|
||||||
|
//TODO: INFO_UPDATE
|
||||||
|
//TODO: INFO_UPDATE2
|
||||||
|
//TODO: MOVINGBLOCK
|
||||||
|
//TODO: OBSERVER
|
||||||
|
|
||||||
|
//TODO: RESERVED6
|
||||||
|
|
||||||
foreach(self::$list as $id => $block){
|
foreach(self::$list as $id => $block){
|
||||||
if($block === null){
|
if($block === null){
|
||||||
@ -332,7 +375,7 @@ class Block extends Position implements BlockIds, Metadatable{
|
|||||||
*
|
*
|
||||||
* @return Block
|
* @return Block
|
||||||
*/
|
*/
|
||||||
public static function get($id, $meta = 0, Position $pos = null){
|
public static function get(int $id, int $meta = 0, Position $pos = null) : Block{
|
||||||
try{
|
try{
|
||||||
$block = self::$fullList[($id << 4) | $meta];
|
$block = self::$fullList[($id << 4) | $meta];
|
||||||
if($block !== null){
|
if($block !== null){
|
||||||
@ -382,14 +425,14 @@ class Block extends Position implements BlockIds, Metadatable{
|
|||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return $this->fallbackName;
|
return $this->fallbackName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
final public function getId(){
|
final public function getId() : int{
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -406,32 +449,32 @@ class Block extends Position implements BlockIds, Metadatable{
|
|||||||
/**
|
/**
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
final public function getDamage(){
|
final public function getDamage() : int{
|
||||||
return $this->meta;
|
return $this->meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int $meta
|
* @param int $meta
|
||||||
*/
|
*/
|
||||||
final public function setDamage($meta){
|
final public function setDamage(int $meta){
|
||||||
$this->meta = $meta & 0x0f;
|
$this->meta = $meta & 0x0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Places the Block, using block space and block target, and side. Returns if the block has been placed.
|
* Places the Block, using block space and block target, and side. Returns if the block has been placed.
|
||||||
*
|
*
|
||||||
* @param Item $item
|
* @param Item $item
|
||||||
* @param Block $block
|
* @param Block $block
|
||||||
* @param Block $target
|
* @param Block $target
|
||||||
* @param int $face
|
* @param int $face
|
||||||
* @param float $fx
|
* @param float $fx
|
||||||
* @param float $fy
|
* @param float $fy
|
||||||
* @param float $fz
|
* @param float $fz
|
||||||
* @param Player $player = null
|
* @param Player|null $player
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{
|
||||||
return $this->getLevel()->setBlock($this, $this, true, true);
|
return $this->getLevel()->setBlock($this, $this, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -442,7 +485,7 @@ class Block extends Position implements BlockIds, Metadatable{
|
|||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function isBreakable(Item $item){
|
public function isBreakable(Item $item) : bool{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -451,9 +494,9 @@ class Block extends Position implements BlockIds, Metadatable{
|
|||||||
*
|
*
|
||||||
* @param Item $item
|
* @param Item $item
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function onBreak(Item $item){
|
public function onBreak(Item $item) : bool{
|
||||||
return $this->getLevel()->setBlock($this, new Air(), true, true);
|
return $this->getLevel()->setBlock($this, new Air(), true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -462,56 +505,56 @@ class Block extends Position implements BlockIds, Metadatable{
|
|||||||
*
|
*
|
||||||
* @param int $type
|
* @param int $type
|
||||||
*
|
*
|
||||||
* @return int|bool
|
* @return bool|int
|
||||||
*/
|
*/
|
||||||
public function onUpdate($type){
|
public function onUpdate(int $type){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Do actions when activated by Item. Returns if it has done anything
|
* Do actions when activated by Item. Returns if it has done anything
|
||||||
*
|
*
|
||||||
* @param Item $item
|
* @param Item $item
|
||||||
* @param Player $player
|
* @param Player|null $player
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function onActivate(Item $item, Player $player = null){
|
public function onActivate(Item $item, Player $player = null) : bool{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return float
|
* @return float
|
||||||
*/
|
*/
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return float
|
* @return float
|
||||||
*/
|
*/
|
||||||
public function getResistance(){
|
public function getResistance() : float{
|
||||||
return $this->getHardness() * 5;
|
return $this->getHardness() * 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getToolType(){
|
public function getToolType() : int{
|
||||||
return Tool::TYPE_NONE;
|
return Tool::TYPE_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return float
|
* @return float
|
||||||
*/
|
*/
|
||||||
public function getFrictionFactor(){
|
public function getFrictionFactor() : float{
|
||||||
return 0.6;
|
return 0.6;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return int 0-15
|
* @return int 0-15
|
||||||
*/
|
*/
|
||||||
public function getLightLevel(){
|
public function getLightLevel() : int{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -540,45 +583,43 @@ class Block extends Position implements BlockIds, Metadatable{
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* AKA: Block->isPlaceable
|
* AKA: Block->isPlaceable
|
||||||
*
|
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function canBePlaced(){
|
public function canBePlaced() : bool{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function canBeReplaced(){
|
public function canBeReplaced() : bool{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function isTransparent(){
|
public function isTransparent() : bool{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isSolid(){
|
public function isSolid() : bool{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AKA: Block->isFlowable
|
* AKA: Block->isFlowable
|
||||||
*
|
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function canBeFlowedInto(){
|
public function canBeFlowedInto() : bool{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function hasEntityCollision(){
|
public function hasEntityCollision() : bool{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function canPassThrough(){
|
public function canPassThrough() : bool{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -616,13 +657,9 @@ class Block extends Position implements BlockIds, Metadatable{
|
|||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getDrops(Item $item){
|
public function getDrops(Item $item){
|
||||||
if(!isset(self::$list[$this->getId()])){ //Unknown blocks
|
return [
|
||||||
return [];
|
[$this->getItemId(), $this->getDamage(), 1],
|
||||||
}else{
|
];
|
||||||
return [
|
|
||||||
[$this->getItemId(), $this->getDamage(), 1],
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -632,7 +669,7 @@ class Block extends Position implements BlockIds, Metadatable{
|
|||||||
*
|
*
|
||||||
* @return float
|
* @return float
|
||||||
*/
|
*/
|
||||||
public function getBreakTime(Item $item){
|
public function getBreakTime(Item $item) : float{
|
||||||
$base = $this->getHardness() * 1.5;
|
$base = $this->getHardness() * 1.5;
|
||||||
if($this->canBeBrokenWith($item)){
|
if($this->canBeBrokenWith($item)){
|
||||||
if($this->getToolType() === Tool::TYPE_SHEARS and $item->isShears()){
|
if($this->getToolType() === Tool::TYPE_SHEARS and $item->isShears()){
|
||||||
@ -671,10 +708,18 @@ class Block extends Position implements BlockIds, Metadatable{
|
|||||||
return $base;
|
return $base;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function canBeBrokenWith(Item $item){
|
public function canBeBrokenWith(Item $item) : bool{
|
||||||
return $this->getHardness() !== -1;
|
return $this->getHardness() !== -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the time in ticks which the block will fuel a furnace for.
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getFuelTime() : int{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the Block on the side $side, works like Vector3::side()
|
* Returns the Block on the side $side, works like Vector3::side()
|
||||||
*
|
*
|
||||||
@ -705,7 +750,7 @@ class Block extends Position implements BlockIds, Metadatable{
|
|||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function collidesWithBB(AxisAlignedBB $bb){
|
public function collidesWithBB(AxisAlignedBB $bb) : bool{
|
||||||
$bb2 = $this->getBoundingBox();
|
$bb2 = $this->getBoundingBox();
|
||||||
|
|
||||||
return $bb2 !== null and $bb->intersectsWith($bb2);
|
return $bb2 !== null and $bb->intersectsWith($bb2);
|
||||||
|
@ -30,19 +30,19 @@ class Bookshelf extends Solid{
|
|||||||
|
|
||||||
protected $id = self::BOOKSHELF;
|
protected $id = self::BOOKSHELF;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Bookshelf";
|
return "Bookshelf";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 1.5;
|
return 1.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getToolType(){
|
public function getToolType() : int{
|
||||||
return Tool::TYPE_AXE;
|
return Tool::TYPE_AXE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,4 +52,8 @@ class Bookshelf extends Solid{
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getFuelTime() : int{
|
||||||
|
return 300;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -29,19 +29,19 @@ class BrewingStand extends Transparent{
|
|||||||
|
|
||||||
protected $id = self::BREWING_STAND_BLOCK;
|
protected $id = self::BREWING_STAND_BLOCK;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Brewing Stand";
|
return "Brewing Stand";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 0.5;
|
return 0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getToolType(){
|
public function getToolType() : int{
|
||||||
return Tool::TYPE_PICKAXE;
|
return Tool::TYPE_PICKAXE;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -29,23 +29,23 @@ class BrickStairs extends Stair{
|
|||||||
|
|
||||||
protected $id = self::BRICK_STAIRS;
|
protected $id = self::BRICK_STAIRS;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getResistance(){
|
public function getResistance() : float{
|
||||||
return 30;
|
return 30;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getToolType(){
|
public function getToolType() : int{
|
||||||
return Tool::TYPE_PICKAXE;
|
return Tool::TYPE_PICKAXE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Brick Stairs";
|
return "Brick Stairs";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,23 +30,23 @@ class Bricks extends Solid{
|
|||||||
|
|
||||||
protected $id = self::BRICK_BLOCK;
|
protected $id = self::BRICK_BLOCK;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getResistance(){
|
public function getResistance() : float{
|
||||||
return 30;
|
return 30;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getToolType(){
|
public function getToolType() : int{
|
||||||
return Tool::TYPE_PICKAXE;
|
return Tool::TYPE_PICKAXE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Bricks";
|
return "Bricks";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,19 +32,19 @@ class BrownMushroom extends Flowable{
|
|||||||
|
|
||||||
protected $id = self::BROWN_MUSHROOM;
|
protected $id = self::BROWN_MUSHROOM;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Brown Mushroom";
|
return "Brown Mushroom";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLightLevel(){
|
public function getLightLevel() : int{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onUpdate($type){
|
public function onUpdate(int $type){
|
||||||
if($type === Level::BLOCK_UPDATE_NORMAL){
|
if($type === Level::BLOCK_UPDATE_NORMAL){
|
||||||
if($this->getSide(Vector3::SIDE_DOWN)->isTransparent() === true){
|
if($this->getSide(Vector3::SIDE_DOWN)->isTransparent() === true){
|
||||||
$this->getLevel()->useBreakOn($this);
|
$this->getLevel()->useBreakOn($this);
|
||||||
@ -56,7 +56,7 @@ class BrownMushroom extends Flowable{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{
|
||||||
$down = $this->getSide(Vector3::SIDE_DOWN);
|
$down = $this->getSide(Vector3::SIDE_DOWN);
|
||||||
if($down->isTransparent() === false){
|
if($down->isTransparent() === false){
|
||||||
$this->getLevel()->setBlock($block, $this, true, true);
|
$this->getLevel()->setBlock($block, $this, true, true);
|
||||||
|
@ -38,27 +38,27 @@ class BurningFurnace extends Solid{
|
|||||||
|
|
||||||
protected $id = self::BURNING_FURNACE;
|
protected $id = self::BURNING_FURNACE;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Burning Furnace";
|
return "Burning Furnace";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 3.5;
|
return 3.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getToolType(){
|
public function getToolType() : int{
|
||||||
return Tool::TYPE_PICKAXE;
|
return Tool::TYPE_PICKAXE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLightLevel(){
|
public function getLightLevel() : int{
|
||||||
return 13;
|
return 13;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{
|
||||||
$faces = [
|
$faces = [
|
||||||
0 => 4,
|
0 => 4,
|
||||||
1 => 2,
|
1 => 2,
|
||||||
@ -91,7 +91,7 @@ class BurningFurnace extends Solid{
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onActivate(Item $item, Player $player = null){
|
public function onActivate(Item $item, Player $player = null) : bool{
|
||||||
if($player instanceof Player){
|
if($player instanceof Player){
|
||||||
$furnace = $this->getLevel()->getTile($this);
|
$furnace = $this->getLevel()->getTile($this);
|
||||||
if(!($furnace instanceof TileFurnace)){
|
if(!($furnace instanceof TileFurnace)){
|
||||||
|
@ -38,19 +38,19 @@ class Cactus extends Transparent{
|
|||||||
|
|
||||||
protected $id = self::CACTUS;
|
protected $id = self::CACTUS;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 0.4;
|
return 0.4;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function hasEntityCollision(){
|
public function hasEntityCollision() : bool{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Cactus";
|
return "Cactus";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ class Cactus extends Transparent{
|
|||||||
$entity->attack($ev->getFinalDamage(), $ev);
|
$entity->attack($ev->getFinalDamage(), $ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onUpdate($type){
|
public function onUpdate(int $type){
|
||||||
if($type === Level::BLOCK_UPDATE_NORMAL){
|
if($type === Level::BLOCK_UPDATE_NORMAL){
|
||||||
$down = $this->getSide(Vector3::SIDE_DOWN);
|
$down = $this->getSide(Vector3::SIDE_DOWN);
|
||||||
if($down->getId() !== self::SAND and $down->getId() !== self::CACTUS){
|
if($down->getId() !== self::SAND and $down->getId() !== self::CACTUS){
|
||||||
@ -108,7 +108,7 @@ class Cactus extends Transparent{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{
|
||||||
$down = $this->getSide(Vector3::SIDE_DOWN);
|
$down = $this->getSide(Vector3::SIDE_DOWN);
|
||||||
if($down->getId() === self::SAND or $down->getId() === self::CACTUS){
|
if($down->getId() === self::SAND or $down->getId() === self::CACTUS){
|
||||||
$block0 = $this->getSide(Vector3::SIDE_NORTH);
|
$block0 = $this->getSide(Vector3::SIDE_NORTH);
|
||||||
|
@ -36,15 +36,15 @@ class Cake extends Transparent implements FoodSource{
|
|||||||
|
|
||||||
protected $id = self::CAKE_BLOCK;
|
protected $id = self::CAKE_BLOCK;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 0.5;
|
return 0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Cake Block";
|
return "Cake Block";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ class Cake extends Transparent implements FoodSource{
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{
|
||||||
$down = $this->getSide(Vector3::SIDE_DOWN);
|
$down = $this->getSide(Vector3::SIDE_DOWN);
|
||||||
if($down->getId() !== self::AIR){
|
if($down->getId() !== self::AIR){
|
||||||
$this->getLevel()->setBlock($block, $this, true, true);
|
$this->getLevel()->setBlock($block, $this, true, true);
|
||||||
@ -73,7 +73,7 @@ class Cake extends Transparent implements FoodSource{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onUpdate($type){
|
public function onUpdate(int $type){
|
||||||
if($type === Level::BLOCK_UPDATE_NORMAL){
|
if($type === Level::BLOCK_UPDATE_NORMAL){
|
||||||
if($this->getSide(Vector3::SIDE_DOWN)->getId() === self::AIR){ //Replace with common break method
|
if($this->getSide(Vector3::SIDE_DOWN)->getId() === self::AIR){ //Replace with common break method
|
||||||
$this->getLevel()->setBlock($this, new Air(), true);
|
$this->getLevel()->setBlock($this, new Air(), true);
|
||||||
@ -89,7 +89,7 @@ class Cake extends Transparent implements FoodSource{
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onActivate(Item $item, Player $player = null){
|
public function onActivate(Item $item, Player $player = null) : bool{
|
||||||
if($player instanceof Player and $player->getHealth() < $player->getMaxHealth()){
|
if($player instanceof Player and $player->getHealth() < $player->getMaxHealth()){
|
||||||
$ev = new EntityEatBlockEvent($player, $this);
|
$ev = new EntityEatBlockEvent($player, $this);
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace pocketmine\block;
|
namespace pocketmine\block;
|
||||||
|
|
||||||
|
use pocketmine\block\utils\ColorBlockMetaHelper;
|
||||||
use pocketmine\item\Item;
|
use pocketmine\item\Item;
|
||||||
use pocketmine\level\Level;
|
use pocketmine\level\Level;
|
||||||
use pocketmine\math\AxisAlignedBB;
|
use pocketmine\math\AxisAlignedBB;
|
||||||
@ -33,38 +34,20 @@ class Carpet extends Flowable{
|
|||||||
|
|
||||||
protected $id = self::CARPET;
|
protected $id = self::CARPET;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 0.1;
|
return 0.1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isSolid(){
|
public function isSolid() : bool{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
static $names = [
|
return ColorBlockMetaHelper::getColorFromMeta($this->meta) . " Carpet";
|
||||||
0 => "White Carpet",
|
|
||||||
1 => "Orange Carpet",
|
|
||||||
2 => "Magenta Carpet",
|
|
||||||
3 => "Light Blue Carpet",
|
|
||||||
4 => "Yellow Carpet",
|
|
||||||
5 => "Lime Carpet",
|
|
||||||
6 => "Pink Carpet",
|
|
||||||
7 => "Gray Carpet",
|
|
||||||
8 => "Light Gray Carpet",
|
|
||||||
9 => "Cyan Carpet",
|
|
||||||
10 => "Purple Carpet",
|
|
||||||
11 => "Blue Carpet",
|
|
||||||
12 => "Brown Carpet",
|
|
||||||
13 => "Green Carpet",
|
|
||||||
14 => "Red Carpet",
|
|
||||||
15 => "Black Carpet",
|
|
||||||
];
|
|
||||||
return $names[$this->meta & 0x0f];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function recalculateBoundingBox(){
|
protected function recalculateBoundingBox(){
|
||||||
@ -79,7 +62,7 @@ class Carpet extends Flowable{
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{
|
||||||
$down = $this->getSide(Vector3::SIDE_DOWN);
|
$down = $this->getSide(Vector3::SIDE_DOWN);
|
||||||
if($down->getId() !== self::AIR){
|
if($down->getId() !== self::AIR){
|
||||||
$this->getLevel()->setBlock($block, $this, true, true);
|
$this->getLevel()->setBlock($block, $this, true, true);
|
||||||
@ -90,7 +73,7 @@ class Carpet extends Flowable{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onUpdate($type){
|
public function onUpdate(int $type){
|
||||||
if($type === Level::BLOCK_UPDATE_NORMAL){
|
if($type === Level::BLOCK_UPDATE_NORMAL){
|
||||||
if($this->getSide(Vector3::SIDE_DOWN)->getId() === self::AIR){
|
if($this->getSide(Vector3::SIDE_DOWN)->getId() === self::AIR){
|
||||||
$this->getLevel()->useBreakOn($this);
|
$this->getLevel()->useBreakOn($this);
|
||||||
|
@ -29,11 +29,11 @@ class Carrot extends Crops{
|
|||||||
|
|
||||||
protected $id = self::CARROT_BLOCK;
|
protected $id = self::CARROT_BLOCK;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Carrot Block";
|
return "Carrot Block";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,19 +40,19 @@ class Chest extends Transparent{
|
|||||||
|
|
||||||
protected $id = self::CHEST;
|
protected $id = self::CHEST;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 2.5;
|
return 2.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Chest";
|
return "Chest";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getToolType(){
|
public function getToolType() : int{
|
||||||
return Tool::TYPE_AXE;
|
return Tool::TYPE_AXE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,7 +67,7 @@ class Chest extends Transparent{
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{
|
||||||
$faces = [
|
$faces = [
|
||||||
0 => 4,
|
0 => 4,
|
||||||
1 => 2,
|
1 => 2,
|
||||||
@ -124,7 +124,7 @@ class Chest extends Transparent{
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onBreak(Item $item){
|
public function onBreak(Item $item) : bool{
|
||||||
$t = $this->getLevel()->getTile($this);
|
$t = $this->getLevel()->getTile($this);
|
||||||
if($t instanceof TileChest){
|
if($t instanceof TileChest){
|
||||||
$t->unpair();
|
$t->unpair();
|
||||||
@ -134,7 +134,7 @@ class Chest extends Transparent{
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onActivate(Item $item, Player $player = null){
|
public function onActivate(Item $item, Player $player = null) : bool{
|
||||||
if($player instanceof Player){
|
if($player instanceof Player){
|
||||||
$top = $this->getSide(Vector3::SIDE_UP);
|
$top = $this->getSide(Vector3::SIDE_UP);
|
||||||
if($top->isTransparent() !== true){
|
if($top->isTransparent() !== true){
|
||||||
@ -174,4 +174,8 @@ class Chest extends Transparent{
|
|||||||
[$this->id, 0, 1],
|
[$this->id, 0, 1],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getFuelTime() : int{
|
||||||
|
return 300;
|
||||||
|
}
|
||||||
}
|
}
|
@ -30,19 +30,19 @@ class Clay extends Solid{
|
|||||||
|
|
||||||
protected $id = self::CLAY_BLOCK;
|
protected $id = self::CLAY_BLOCK;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 0.6;
|
return 0.6;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getToolType(){
|
public function getToolType() : int{
|
||||||
return Tool::TYPE_SHOVEL;
|
return Tool::TYPE_SHOVEL;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Clay Block";
|
return "Clay Block";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,19 +30,19 @@ class Coal extends Solid{
|
|||||||
|
|
||||||
protected $id = self::COAL_BLOCK;
|
protected $id = self::COAL_BLOCK;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 5;
|
return 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getToolType(){
|
public function getToolType() : int{
|
||||||
return Tool::TYPE_PICKAXE;
|
return Tool::TYPE_PICKAXE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Coal Block";
|
return "Coal Block";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,4 +55,8 @@ class Coal extends Solid{
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getFuelTime() : int{
|
||||||
|
return 16000;
|
||||||
|
}
|
||||||
}
|
}
|
@ -30,19 +30,19 @@ class CoalOre extends Solid{
|
|||||||
|
|
||||||
protected $id = self::COAL_ORE;
|
protected $id = self::COAL_ORE;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getToolType(){
|
public function getToolType() : int{
|
||||||
return Tool::TYPE_PICKAXE;
|
return Tool::TYPE_PICKAXE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Coal Ore";
|
return "Coal Ore";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,19 +30,19 @@ class Cobblestone extends Solid{
|
|||||||
|
|
||||||
protected $id = self::COBBLESTONE;
|
protected $id = self::COBBLESTONE;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getToolType(){
|
public function getToolType() : int{
|
||||||
return Tool::TYPE_PICKAXE;
|
return Tool::TYPE_PICKAXE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Cobblestone";
|
return "Cobblestone";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,19 +29,19 @@ class CobblestoneStairs extends Stair{
|
|||||||
|
|
||||||
protected $id = self::COBBLESTONE_STAIRS;
|
protected $id = self::COBBLESTONE_STAIRS;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getToolType(){
|
public function getToolType() : int{
|
||||||
return Tool::TYPE_PICKAXE;
|
return Tool::TYPE_PICKAXE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Cobblestone Stairs";
|
return "Cobblestone Stairs";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,23 +33,23 @@ class CobblestoneWall extends Transparent{
|
|||||||
|
|
||||||
protected $id = self::COBBLESTONE_WALL;
|
protected $id = self::COBBLESTONE_WALL;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isSolid(){
|
public function isSolid() : bool{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getToolType(){
|
public function getToolType() : int{
|
||||||
return Tool::TYPE_PICKAXE;
|
return Tool::TYPE_PICKAXE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
if($this->meta === 0x01){
|
if($this->meta === 0x01){
|
||||||
return "Mossy Cobblestone Wall";
|
return "Mossy Cobblestone Wall";
|
||||||
}
|
}
|
||||||
|
@ -31,23 +31,23 @@ class Cobweb extends Flowable{
|
|||||||
|
|
||||||
protected $id = self::COBWEB;
|
protected $id = self::COBWEB;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function hasEntityCollision(){
|
public function hasEntityCollision() : bool{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Cobweb";
|
return "Cobweb";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getToolType(){
|
public function getToolType() : int{
|
||||||
return Tool::TYPE_SWORD;
|
return Tool::TYPE_SWORD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,11 +27,11 @@ class CocoaBlock extends Solid{
|
|||||||
|
|
||||||
protected $id = self::COCOA_BLOCK;
|
protected $id = self::COCOA_BLOCK;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Cocoa Block";
|
return "Cocoa Block";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,23 +31,23 @@ class CraftingTable extends Solid{
|
|||||||
|
|
||||||
protected $id = self::CRAFTING_TABLE;
|
protected $id = self::CRAFTING_TABLE;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 2.5;
|
return 2.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Crafting Table";
|
return "Crafting Table";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getToolType(){
|
public function getToolType() : int{
|
||||||
return Tool::TYPE_AXE;
|
return Tool::TYPE_AXE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onActivate(Item $item, Player $player = null){
|
public function onActivate(Item $item, Player $player = null) : bool{
|
||||||
if($player instanceof Player){
|
if($player instanceof Player){
|
||||||
$player->craftingType = 1;
|
$player->craftingType = 1;
|
||||||
}
|
}
|
||||||
@ -60,4 +60,8 @@ class CraftingTable extends Solid{
|
|||||||
[$this->id, 0, 1],
|
[$this->id, 0, 1],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getFuelTime() : int{
|
||||||
|
return 300;
|
||||||
|
}
|
||||||
}
|
}
|
@ -32,7 +32,7 @@ use pocketmine\Server;
|
|||||||
|
|
||||||
abstract class Crops extends Flowable{
|
abstract class Crops extends Flowable{
|
||||||
|
|
||||||
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{
|
||||||
if($block->getSide(Vector3::SIDE_DOWN)->getId() === Block::FARMLAND){
|
if($block->getSide(Vector3::SIDE_DOWN)->getId() === Block::FARMLAND){
|
||||||
$this->getLevel()->setBlock($block, $this, true, true);
|
$this->getLevel()->setBlock($block, $this, true, true);
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ abstract class Crops extends Flowable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function onActivate(Item $item, Player $player = null){
|
public function onActivate(Item $item, Player $player = null) : bool{
|
||||||
if($item->getId() === Item::DYE and $item->getDamage() === 0x0F){ //Bonemeal
|
if($item->getId() === Item::DYE and $item->getDamage() === 0x0F){ //Bonemeal
|
||||||
$block = clone $this;
|
$block = clone $this;
|
||||||
$block->meta += mt_rand(2, 5);
|
$block->meta += mt_rand(2, 5);
|
||||||
@ -65,7 +65,7 @@ abstract class Crops extends Flowable{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onUpdate($type){
|
public function onUpdate(int $type){
|
||||||
if($type === Level::BLOCK_UPDATE_NORMAL){
|
if($type === Level::BLOCK_UPDATE_NORMAL){
|
||||||
if($this->getSide(Vector3::SIDE_DOWN)->getId() !== Block::FARMLAND){
|
if($this->getSide(Vector3::SIDE_DOWN)->getId() !== Block::FARMLAND){
|
||||||
$this->getLevel()->useBreakOn($this);
|
$this->getLevel()->useBreakOn($this);
|
||||||
|
@ -32,16 +32,16 @@ class Dandelion extends Flowable{
|
|||||||
|
|
||||||
protected $id = self::DANDELION;
|
protected $id = self::DANDELION;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Dandelion";
|
return "Dandelion";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{
|
||||||
$down = $this->getSide(Vector3::SIDE_DOWN);
|
$down = $this->getSide(Vector3::SIDE_DOWN);
|
||||||
if($down->getId() === 2 or $down->getId() === 3 or $down->getId() === 60){
|
if($down->getId() === 2 or $down->getId() === 3 or $down->getId() === 60){
|
||||||
$this->getLevel()->setBlock($block, $this, true, true);
|
$this->getLevel()->setBlock($block, $this, true, true);
|
||||||
@ -52,7 +52,7 @@ class Dandelion extends Flowable{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onUpdate($type){
|
public function onUpdate(int $type){
|
||||||
if($type === Level::BLOCK_UPDATE_NORMAL){
|
if($type === Level::BLOCK_UPDATE_NORMAL){
|
||||||
if($this->getSide(Vector3::SIDE_DOWN)->isTransparent() === true){
|
if($this->getSide(Vector3::SIDE_DOWN)->isTransparent() === true){
|
||||||
$this->getLevel()->useBreakOn($this);
|
$this->getLevel()->useBreakOn($this);
|
||||||
|
@ -27,15 +27,19 @@ class DaylightSensor extends Transparent{
|
|||||||
|
|
||||||
protected $id = self::DAYLIGHT_SENSOR;
|
protected $id = self::DAYLIGHT_SENSOR;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Daylight Sensor";
|
return "Daylight Sensor";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 0.2;
|
return 0.2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getFuelTime() : int{
|
||||||
|
return 300;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,16 +30,16 @@ class DeadBush extends Flowable{
|
|||||||
|
|
||||||
protected $id = self::DEAD_BUSH;
|
protected $id = self::DEAD_BUSH;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Dead Bush";
|
return "Dead Bush";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function onUpdate($type){
|
public function onUpdate(int $type){
|
||||||
if($type === Level::BLOCK_UPDATE_NORMAL){
|
if($type === Level::BLOCK_UPDATE_NORMAL){
|
||||||
if($this->getSide(Vector3::SIDE_DOWN)->isTransparent() === true){
|
if($this->getSide(Vector3::SIDE_DOWN)->isTransparent() === true){
|
||||||
$this->getLevel()->useBreakOn($this);
|
$this->getLevel()->useBreakOn($this);
|
||||||
|
@ -27,11 +27,7 @@ class DetectorRail extends Rail{
|
|||||||
|
|
||||||
protected $id = self::DETECTOR_RAIL;
|
protected $id = self::DETECTOR_RAIL;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function getName() : string{
|
||||||
$this->meta = $meta;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getName(){
|
|
||||||
return "Detector Rail";
|
return "Detector Rail";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,19 +30,19 @@ class Diamond extends Solid{
|
|||||||
|
|
||||||
protected $id = self::DIAMOND_BLOCK;
|
protected $id = self::DIAMOND_BLOCK;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 5;
|
return 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Diamond Block";
|
return "Diamond Block";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getToolType(){
|
public function getToolType() : int{
|
||||||
return Tool::TYPE_PICKAXE;
|
return Tool::TYPE_PICKAXE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,19 +30,19 @@ class DiamondOre extends Solid{
|
|||||||
|
|
||||||
protected $id = self::DIAMOND_ORE;
|
protected $id = self::DIAMOND_ORE;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Diamond Ore";
|
return "Diamond Ore";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getToolType(){
|
public function getToolType() : int{
|
||||||
return Tool::TYPE_PICKAXE;
|
return Tool::TYPE_PICKAXE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,23 +31,23 @@ class Dirt extends Solid{
|
|||||||
|
|
||||||
protected $id = self::DIRT;
|
protected $id = self::DIRT;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 0.5;
|
return 0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getToolType(){
|
public function getToolType() : int{
|
||||||
return Tool::TYPE_SHOVEL;
|
return Tool::TYPE_SHOVEL;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Dirt";
|
return "Dirt";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onActivate(Item $item, Player $player = null){
|
public function onActivate(Item $item, Player $player = null) : bool{
|
||||||
if($item->isHoe()){
|
if($item->isHoe()){
|
||||||
$item->useOn($this);
|
$item->useOn($this);
|
||||||
$this->getLevel()->setBlock($this, Block::get(Block::FARMLAND, 0), true);
|
$this->getLevel()->setBlock($this, Block::get(Block::FARMLAND, 0), true);
|
||||||
|
@ -33,7 +33,7 @@ use pocketmine\Player;
|
|||||||
|
|
||||||
abstract class Door extends Transparent{
|
abstract class Door extends Transparent{
|
||||||
|
|
||||||
public function isSolid(){
|
public function isSolid() : bool{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,7 +201,7 @@ abstract class Door extends Transparent{
|
|||||||
return $bb;
|
return $bb;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onUpdate($type){
|
public function onUpdate(int $type){
|
||||||
if($type === Level::BLOCK_UPDATE_NORMAL){
|
if($type === Level::BLOCK_UPDATE_NORMAL){
|
||||||
if($this->getSide(Vector3::SIDE_DOWN)->getId() === self::AIR){ //Replace with common break method
|
if($this->getSide(Vector3::SIDE_DOWN)->getId() === self::AIR){ //Replace with common break method
|
||||||
$this->getLevel()->setBlock($this, new Air(), false);
|
$this->getLevel()->setBlock($this, new Air(), false);
|
||||||
@ -216,7 +216,7 @@ abstract class Door extends Transparent{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{
|
||||||
if($face === 1){
|
if($face === 1){
|
||||||
$blockUp = $this->getSide(Vector3::SIDE_UP);
|
$blockUp = $this->getSide(Vector3::SIDE_UP);
|
||||||
$blockDown = $this->getSide(Vector3::SIDE_DOWN);
|
$blockDown = $this->getSide(Vector3::SIDE_DOWN);
|
||||||
@ -246,7 +246,7 @@ abstract class Door extends Transparent{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onBreak(Item $item){
|
public function onBreak(Item $item) : bool{
|
||||||
if(($this->getDamage() & 0x08) === 0x08){
|
if(($this->getDamage() & 0x08) === 0x08){
|
||||||
$down = $this->getSide(Vector3::SIDE_DOWN);
|
$down = $this->getSide(Vector3::SIDE_DOWN);
|
||||||
if($down->getId() === $this->getId()){
|
if($down->getId() === $this->getId()){
|
||||||
@ -263,7 +263,7 @@ abstract class Door extends Transparent{
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onActivate(Item $item, Player $player = null){
|
public function onActivate(Item $item, Player $player = null) : bool{
|
||||||
if(($this->getDamage() & 0x08) === 0x08){ //Top
|
if(($this->getDamage() & 0x08) === 0x08){ //Top
|
||||||
$down = $this->getSide(Vector3::SIDE_DOWN);
|
$down = $this->getSide(Vector3::SIDE_DOWN);
|
||||||
if($down->getId() === $this->getId()){
|
if($down->getId() === $this->getId()){
|
||||||
|
@ -33,15 +33,15 @@ class DoublePlant extends Flowable{
|
|||||||
|
|
||||||
protected $id = self::DOUBLE_PLANT;
|
protected $id = self::DOUBLE_PLANT;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function canBeReplaced(){
|
public function canBeReplaced() : bool{
|
||||||
return $this->meta === 2 or $this->meta === 3; //grass or fern
|
return $this->meta === 2 or $this->meta === 3; //grass or fern
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
static $names = [
|
static $names = [
|
||||||
0 => "Sunflower",
|
0 => "Sunflower",
|
||||||
1 => "Lilac",
|
1 => "Lilac",
|
||||||
@ -53,7 +53,7 @@ class DoublePlant extends Flowable{
|
|||||||
return $names[$this->meta & 0x07] ?? "";
|
return $names[$this->meta & 0x07] ?? "";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{
|
||||||
$id = $block->getSide(Vector3::SIDE_DOWN)->getId();
|
$id = $block->getSide(Vector3::SIDE_DOWN)->getId();
|
||||||
if(($id === Block::GRASS or $id === Block::DIRT) and $block->getSide(Vector3::SIDE_UP)->canBeReplaced()){
|
if(($id === Block::GRASS or $id === Block::DIRT) and $block->getSide(Vector3::SIDE_UP)->canBeReplaced()){
|
||||||
$this->getLevel()->setBlock($block, $this, false, false);
|
$this->getLevel()->setBlock($block, $this, false, false);
|
||||||
@ -83,7 +83,7 @@ class DoublePlant extends Flowable{
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onUpdate($type){
|
public function onUpdate(int $type){
|
||||||
if($type === Level::BLOCK_UPDATE_NORMAL){
|
if($type === Level::BLOCK_UPDATE_NORMAL){
|
||||||
$down = $this->getSide(Vector3::SIDE_DOWN);
|
$down = $this->getSide(Vector3::SIDE_DOWN);
|
||||||
if(!$this->isValidHalfPlant() or (($this->meta & self::BITFLAG_TOP) === 0 and $down->isTransparent())){
|
if(!$this->isValidHalfPlant() or (($this->meta & self::BITFLAG_TOP) === 0 and $down->isTransparent())){
|
||||||
@ -96,7 +96,7 @@ class DoublePlant extends Flowable{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onBreak(Item $item){
|
public function onBreak(Item $item) : bool{
|
||||||
if(parent::onBreak($item) and $this->isValidHalfPlant()){
|
if(parent::onBreak($item) and $this->isValidHalfPlant()){
|
||||||
return $this->getLevel()->setBlock($this->getSide(($this->meta & self::BITFLAG_TOP) !== 0 ? Vector3::SIDE_DOWN : Vector3::SIDE_UP), Block::get(Block::AIR));
|
return $this->getLevel()->setBlock($this->getSide(($this->meta & self::BITFLAG_TOP) !== 0 ? Vector3::SIDE_DOWN : Vector3::SIDE_UP), Block::get(Block::AIR));
|
||||||
}
|
}
|
||||||
|
@ -30,19 +30,19 @@ class DoubleStoneSlab extends Solid{
|
|||||||
|
|
||||||
protected $id = self::DOUBLE_STONE_SLAB;
|
protected $id = self::DOUBLE_STONE_SLAB;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getToolType(){
|
public function getToolType() : int{
|
||||||
return Tool::TYPE_PICKAXE;
|
return Tool::TYPE_PICKAXE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
static $names = [
|
static $names = [
|
||||||
0 => "Stone",
|
0 => "Stone",
|
||||||
1 => "Sandstone",
|
1 => "Sandstone",
|
||||||
|
@ -30,30 +30,28 @@ class DoubleWoodenSlab extends Solid{
|
|||||||
|
|
||||||
protected $id = self::DOUBLE_WOODEN_SLAB;
|
protected $id = self::DOUBLE_WOODEN_SLAB;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getToolType(){
|
public function getToolType() : int{
|
||||||
return Tool::TYPE_AXE;
|
return Tool::TYPE_AXE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
static $names = [
|
static $names = [
|
||||||
0 => "Oak",
|
0 => "Oak",
|
||||||
1 => "Spruce",
|
1 => "Spruce",
|
||||||
2 => "Birch",
|
2 => "Birch",
|
||||||
3 => "Jungle",
|
3 => "Jungle",
|
||||||
4 => "Acacia",
|
4 => "Acacia",
|
||||||
5 => "Dark Oak",
|
5 => "Dark Oak"
|
||||||
6 => "",
|
|
||||||
7 => ""
|
|
||||||
];
|
];
|
||||||
return "Double " . $names[$this->meta & 0x07] . " Wooden Slab";
|
return "Double " . ($names[$this->meta & 0x07] ?? "") . " Wooden Slab";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDrops(Item $item){
|
public function getDrops(Item $item){
|
||||||
|
@ -30,19 +30,19 @@ class Emerald extends Solid{
|
|||||||
|
|
||||||
protected $id = self::EMERALD_BLOCK;
|
protected $id = self::EMERALD_BLOCK;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 5;
|
return 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getToolType(){
|
public function getToolType() : int{
|
||||||
return Tool::TYPE_PICKAXE;
|
return Tool::TYPE_PICKAXE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Emerald Block";
|
return "Emerald Block";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,19 +30,19 @@ class EmeraldOre extends Solid{
|
|||||||
|
|
||||||
protected $id = self::EMERALD_ORE;
|
protected $id = self::EMERALD_ORE;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Emerald Ore";
|
return "Emerald Ore";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getToolType(){
|
public function getToolType() : int{
|
||||||
return Tool::TYPE_PICKAXE;
|
return Tool::TYPE_PICKAXE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,11 +36,11 @@ class EnchantingTable extends Transparent{
|
|||||||
|
|
||||||
protected $id = self::ENCHANTING_TABLE;
|
protected $id = self::ENCHANTING_TABLE;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{
|
||||||
$this->getLevel()->setBlock($block, $this, true, true);
|
$this->getLevel()->setBlock($block, $this, true, true);
|
||||||
$nbt = new CompoundTag("", [
|
$nbt = new CompoundTag("", [
|
||||||
new StringTag("id", Tile::ENCHANT_TABLE),
|
new StringTag("id", Tile::ENCHANT_TABLE),
|
||||||
@ -64,23 +64,23 @@ class EnchantingTable extends Transparent{
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 5;
|
return 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getResistance(){
|
public function getResistance() : float{
|
||||||
return 6000;
|
return 6000;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Enchanting Table";
|
return "Enchanting Table";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getToolType(){
|
public function getToolType() : int{
|
||||||
return Tool::TYPE_PICKAXE;
|
return Tool::TYPE_PICKAXE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onActivate(Item $item, Player $player = null){
|
public function onActivate(Item $item, Player $player = null) : bool{
|
||||||
if($player instanceof Player){
|
if($player instanceof Player){
|
||||||
//TODO lock
|
//TODO lock
|
||||||
|
|
||||||
|
@ -30,27 +30,27 @@ class EndPortalFrame extends Solid{
|
|||||||
|
|
||||||
protected $id = self::END_PORTAL_FRAME;
|
protected $id = self::END_PORTAL_FRAME;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLightLevel(){
|
public function getLightLevel() : int{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "End Portal Frame";
|
return "End Portal Frame";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getResistance(){
|
public function getResistance() : float{
|
||||||
return 18000000;
|
return 18000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isBreakable(Item $item){
|
public function isBreakable(Item $item) : bool{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,19 +29,19 @@ class EndStone extends Solid{
|
|||||||
|
|
||||||
protected $id = self::END_STONE;
|
protected $id = self::END_STONE;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "End Stone";
|
return "End Stone";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getToolType(){
|
public function getToolType() : int{
|
||||||
return Tool::TYPE_PICKAXE;
|
return Tool::TYPE_PICKAXE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -35,7 +35,7 @@ use pocketmine\nbt\tag\ListTag;
|
|||||||
|
|
||||||
abstract class Fallable extends Solid{
|
abstract class Fallable extends Solid{
|
||||||
|
|
||||||
public function onUpdate($type){
|
public function onUpdate(int $type){
|
||||||
if($type === Level::BLOCK_UPDATE_NORMAL){
|
if($type === Level::BLOCK_UPDATE_NORMAL){
|
||||||
$down = $this->getSide(Vector3::SIDE_DOWN);
|
$down = $this->getSide(Vector3::SIDE_DOWN);
|
||||||
if($down->getId() === self::AIR or ($down instanceof Liquid)){
|
if($down->getId() === self::AIR or ($down instanceof Liquid)){
|
||||||
|
@ -31,19 +31,19 @@ class Farmland extends Transparent{
|
|||||||
|
|
||||||
protected $id = self::FARMLAND;
|
protected $id = self::FARMLAND;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Farmland";
|
return "Farmland";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 0.6;
|
return 0.6;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getToolType(){
|
public function getToolType() : int{
|
||||||
return Tool::TYPE_SHOVEL;
|
return Tool::TYPE_SHOVEL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,31 +37,29 @@ class Fence extends Transparent{
|
|||||||
|
|
||||||
protected $id = self::FENCE;
|
protected $id = self::FENCE;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getToolType(){
|
public function getToolType() : int{
|
||||||
return Tool::TYPE_AXE;
|
return Tool::TYPE_AXE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
static $names = [
|
static $names = [
|
||||||
self::FENCE_OAK => "Oak Fence",
|
self::FENCE_OAK => "Oak Fence",
|
||||||
self::FENCE_SPRUCE => "Spruce Fence",
|
self::FENCE_SPRUCE => "Spruce Fence",
|
||||||
self::FENCE_BIRCH => "Birch Fence",
|
self::FENCE_BIRCH => "Birch Fence",
|
||||||
self::FENCE_JUNGLE => "Jungle Fence",
|
self::FENCE_JUNGLE => "Jungle Fence",
|
||||||
self::FENCE_ACACIA => "Acacia Fence",
|
self::FENCE_ACACIA => "Acacia Fence",
|
||||||
self::FENCE_DARKOAK => "Dark Oak Fence",
|
self::FENCE_DARKOAK => "Dark Oak Fence"
|
||||||
"",
|
|
||||||
""
|
|
||||||
];
|
];
|
||||||
return $names[$this->meta & 0x07];
|
return $names[$this->meta & 0x07] ?? "Unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function recalculateBoundingBox(){
|
protected function recalculateBoundingBox(){
|
||||||
@ -90,4 +88,8 @@ class Fence extends Transparent{
|
|||||||
return ($block instanceof Fence or $block instanceof FenceGate) ? true : $block->isSolid() and !$block->isTransparent();
|
return ($block instanceof Fence or $block instanceof FenceGate) ? true : $block->isSolid() and !$block->isTransparent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getFuelTime() : int{
|
||||||
|
return 300;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -31,11 +31,11 @@ use pocketmine\Player;
|
|||||||
|
|
||||||
class FenceGate extends Transparent{
|
class FenceGate extends Transparent{
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getToolType(){
|
public function getToolType() : int{
|
||||||
return Tool::TYPE_AXE;
|
return Tool::TYPE_AXE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ class FenceGate extends Transparent{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{
|
||||||
$this->meta = ($player instanceof Player ? ($player->getDirection() - 1) & 0x03 : 0);
|
$this->meta = ($player instanceof Player ? ($player->getDirection() - 1) & 0x03 : 0);
|
||||||
$this->getLevel()->setBlock($block, $this, true, true);
|
$this->getLevel()->setBlock($block, $this, true, true);
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ class FenceGate extends Transparent{
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onActivate(Item $item, Player $player = null){
|
public function onActivate(Item $item, Player $player = null) : bool{
|
||||||
$this->meta = (($this->meta ^ 0x04) & ~0x02);
|
$this->meta = (($this->meta ^ 0x04) & ~0x02);
|
||||||
|
|
||||||
if($player !== null){
|
if($player !== null){
|
||||||
@ -92,4 +92,8 @@ class FenceGate extends Transparent{
|
|||||||
$this->level->addSound(new DoorSound($this));
|
$this->level->addSound(new DoorSound($this));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getFuelTime() : int{
|
||||||
|
return 300;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,27 +37,27 @@ class Fire extends Flowable{
|
|||||||
|
|
||||||
protected $id = self::FIRE;
|
protected $id = self::FIRE;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function hasEntityCollision(){
|
public function hasEntityCollision() : bool{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Fire Block";
|
return "Fire Block";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLightLevel(){
|
public function getLightLevel() : int{
|
||||||
return 15;
|
return 15;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isBreakable(Item $item){
|
public function isBreakable(Item $item) : bool{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function canBeReplaced(){
|
public function canBeReplaced() : bool{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ class Fire extends Flowable{
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onUpdate($type){
|
public function onUpdate(int $type){
|
||||||
if($type === Level::BLOCK_UPDATE_NORMAL){
|
if($type === Level::BLOCK_UPDATE_NORMAL){
|
||||||
for($s = 0; $s <= 5; ++$s){
|
for($s = 0; $s <= 5; ++$s){
|
||||||
$side = $this->getSide($s);
|
$side = $this->getSide($s);
|
||||||
|
@ -25,19 +25,19 @@ namespace pocketmine\block;
|
|||||||
|
|
||||||
abstract class Flowable extends Transparent{
|
abstract class Flowable extends Transparent{
|
||||||
|
|
||||||
public function canBeFlowedInto(){
|
public function canBeFlowedInto() : bool{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getResistance(){
|
public function getResistance() : float{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isSolid(){
|
public function isSolid() : bool{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,11 +41,11 @@ class Flower extends Flowable{
|
|||||||
|
|
||||||
protected $id = self::RED_FLOWER;
|
protected $id = self::RED_FLOWER;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
static $names = [
|
static $names = [
|
||||||
self::TYPE_POPPY => "Poppy",
|
self::TYPE_POPPY => "Poppy",
|
||||||
self::TYPE_BLUE_ORCHID => "Blue Orchid",
|
self::TYPE_BLUE_ORCHID => "Blue Orchid",
|
||||||
@ -55,20 +55,12 @@ class Flower extends Flowable{
|
|||||||
self::TYPE_ORANGE_TULIP => "Orange Tulip",
|
self::TYPE_ORANGE_TULIP => "Orange Tulip",
|
||||||
self::TYPE_WHITE_TULIP => "White Tulip",
|
self::TYPE_WHITE_TULIP => "White Tulip",
|
||||||
self::TYPE_PINK_TULIP => "Pink Tulip",
|
self::TYPE_PINK_TULIP => "Pink Tulip",
|
||||||
self::TYPE_OXEYE_DAISY => "Oxeye Daisy",
|
self::TYPE_OXEYE_DAISY => "Oxeye Daisy"
|
||||||
9 => "Unknown",
|
|
||||||
10 => "Unknown",
|
|
||||||
11 => "Unknown",
|
|
||||||
12 => "Unknown",
|
|
||||||
13 => "Unknown",
|
|
||||||
14 => "Unknown",
|
|
||||||
15 => "Unknown"
|
|
||||||
];
|
];
|
||||||
return $names[$this->meta];
|
return $names[$this->meta] ?? "Unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{
|
||||||
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
|
||||||
$down = $this->getSide(Vector3::SIDE_DOWN);
|
$down = $this->getSide(Vector3::SIDE_DOWN);
|
||||||
if($down->getId() === Block::GRASS or $down->getId() === Block::DIRT or $down->getId() === Block::FARMLAND){
|
if($down->getId() === Block::GRASS or $down->getId() === Block::DIRT or $down->getId() === Block::FARMLAND){
|
||||||
$this->getLevel()->setBlock($block, $this, true);
|
$this->getLevel()->setBlock($block, $this, true);
|
||||||
@ -79,7 +71,7 @@ class Flower extends Flowable{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onUpdate($type){
|
public function onUpdate(int $type){
|
||||||
if($type === Level::BLOCK_UPDATE_NORMAL){
|
if($type === Level::BLOCK_UPDATE_NORMAL){
|
||||||
if($this->getSide(Vector3::SIDE_DOWN)->isTransparent()){
|
if($this->getSide(Vector3::SIDE_DOWN)->isTransparent()){
|
||||||
$this->getLevel()->useBreakOn($this);
|
$this->getLevel()->useBreakOn($this);
|
||||||
|
@ -42,11 +42,11 @@ class FlowerPot extends Flowable{
|
|||||||
|
|
||||||
protected $id = self::FLOWER_POT_BLOCK;
|
protected $id = self::FLOWER_POT_BLOCK;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Flower Pot Block";
|
return "Flower Pot Block";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ class FlowerPot extends Flowable{
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{
|
||||||
if($this->getSide(Vector3::SIDE_DOWN)->isTransparent()){
|
if($this->getSide(Vector3::SIDE_DOWN)->isTransparent()){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -87,7 +87,7 @@ class FlowerPot extends Flowable{
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onUpdate($type){
|
public function onUpdate(int $type){
|
||||||
if($type === Level::BLOCK_UPDATE_NORMAL){
|
if($type === Level::BLOCK_UPDATE_NORMAL){
|
||||||
if($this->getSide(Vector3::SIDE_DOWN)->isTransparent() === true){
|
if($this->getSide(Vector3::SIDE_DOWN)->isTransparent() === true){
|
||||||
$this->getLevel()->useBreakOn($this);
|
$this->getLevel()->useBreakOn($this);
|
||||||
@ -99,7 +99,7 @@ class FlowerPot extends Flowable{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onActivate(Item $item, Player $player = null){
|
public function onActivate(Item $item, Player $player = null) : bool{
|
||||||
$pot = $this->getLevel()->getTile($this);
|
$pot = $this->getLevel()->getTile($this);
|
||||||
if(!($pot instanceof TileFlowerPot)){
|
if(!($pot instanceof TileFlowerPot)){
|
||||||
return false;
|
return false;
|
||||||
|
@ -28,11 +28,11 @@ class Furnace extends BurningFurnace{
|
|||||||
|
|
||||||
protected $id = self::FURNACE;
|
protected $id = self::FURNACE;
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Furnace";
|
return "Furnace";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLightLevel(){
|
public function getLightLevel() : int{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -29,15 +29,15 @@ class Glass extends Transparent{
|
|||||||
|
|
||||||
protected $id = self::GLASS;
|
protected $id = self::GLASS;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Glass";
|
return "Glass";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 0.3;
|
return 0.3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,15 +29,15 @@ class GlassPane extends Thin{
|
|||||||
|
|
||||||
protected $id = self::GLASS_PANE;
|
protected $id = self::GLASS_PANE;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Glass Pane";
|
return "Glass Pane";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 0.3;
|
return 0.3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,15 +30,15 @@ use pocketmine\Player;
|
|||||||
|
|
||||||
class GlazedTerracotta extends Solid{
|
class GlazedTerracotta extends Solid{
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 1.4;
|
return 1.4;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getToolType(){
|
public function getToolType() : int{
|
||||||
return Tool::TYPE_PICKAXE;
|
return Tool::TYPE_PICKAXE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{
|
||||||
if($player !== null){
|
if($player !== null){
|
||||||
$faces = [
|
$faces = [
|
||||||
0 => 4,
|
0 => 4,
|
||||||
|
@ -28,15 +28,15 @@ class GlowingObsidian extends Solid{
|
|||||||
|
|
||||||
protected $id = self::GLOWING_OBSIDIAN;
|
protected $id = self::GLOWING_OBSIDIAN;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Glowing Obsidian";
|
return "Glowing Obsidian";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLightLevel(){
|
public function getLightLevel() : int{
|
||||||
return 12;
|
return 12;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,15 +29,15 @@ class GlowingRedstoneOre extends RedstoneOre{
|
|||||||
|
|
||||||
protected $id = self::GLOWING_REDSTONE_ORE;
|
protected $id = self::GLOWING_REDSTONE_ORE;
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Glowing Redstone Ore";
|
return "Glowing Redstone Ore";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLightLevel(){
|
public function getLightLevel() : int{
|
||||||
return 9;
|
return 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onUpdate($type){
|
public function onUpdate(int $type){
|
||||||
if($type === Level::BLOCK_UPDATE_SCHEDULED or $type === Level::BLOCK_UPDATE_RANDOM){
|
if($type === Level::BLOCK_UPDATE_SCHEDULED or $type === Level::BLOCK_UPDATE_RANDOM){
|
||||||
$this->getLevel()->setBlock($this, Block::get(Block::REDSTONE_ORE, $this->meta), false, false);
|
$this->getLevel()->setBlock($this, Block::get(Block::REDSTONE_ORE, $this->meta), false, false);
|
||||||
|
|
||||||
|
@ -30,23 +30,23 @@ class Glowstone extends Transparent{
|
|||||||
|
|
||||||
protected $id = self::GLOWSTONE;
|
protected $id = self::GLOWSTONE;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Glowstone";
|
return "Glowstone";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 0.3;
|
return 0.3;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getToolType(){
|
public function getToolType() : int{
|
||||||
return Tool::TYPE_PICKAXE;
|
return Tool::TYPE_PICKAXE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLightLevel(){
|
public function getLightLevel() : int{
|
||||||
return 15;
|
return 15;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,19 +30,19 @@ class Gold extends Solid{
|
|||||||
|
|
||||||
protected $id = self::GOLD_BLOCK;
|
protected $id = self::GOLD_BLOCK;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Gold Block";
|
return "Gold Block";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getToolType(){
|
public function getToolType() : int{
|
||||||
return Tool::TYPE_PICKAXE;
|
return Tool::TYPE_PICKAXE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,19 +30,19 @@ class GoldOre extends Solid{
|
|||||||
|
|
||||||
protected $id = self::GOLD_ORE;
|
protected $id = self::GOLD_ORE;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Gold Ore";
|
return "Gold Ore";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getToolType(){
|
public function getToolType() : int{
|
||||||
return Tool::TYPE_PICKAXE;
|
return Tool::TYPE_PICKAXE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,19 +36,19 @@ class Grass extends Solid{
|
|||||||
|
|
||||||
protected $id = self::GRASS;
|
protected $id = self::GRASS;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Grass";
|
return "Grass";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 0.6;
|
return 0.6;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getToolType(){
|
public function getToolType() : int{
|
||||||
return Tool::TYPE_SHOVEL;
|
return Tool::TYPE_SHOVEL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ class Grass extends Solid{
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onUpdate($type){
|
public function onUpdate(int $type){
|
||||||
if($type === Level::BLOCK_UPDATE_RANDOM){
|
if($type === Level::BLOCK_UPDATE_RANDOM){
|
||||||
$lightAbove = $this->level->getFullLightAt($this->x, $this->y + 1, $this->z);
|
$lightAbove = $this->level->getFullLightAt($this->x, $this->y + 1, $this->z);
|
||||||
if($lightAbove < 4 and Block::$lightFilter[$this->level->getBlockIdAt($this->x, $this->y + 1, $this->z)] >= 3){ //2 plus 1 standard filter amount
|
if($lightAbove < 4 and Block::$lightFilter[$this->level->getBlockIdAt($this->x, $this->y + 1, $this->z)] >= 3){ //2 plus 1 standard filter amount
|
||||||
@ -97,7 +97,7 @@ class Grass extends Solid{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onActivate(Item $item, Player $player = null){
|
public function onActivate(Item $item, Player $player = null) : bool{
|
||||||
if($item->getId() === Item::DYE and $item->getDamage() === 0x0F){
|
if($item->getId() === Item::DYE and $item->getDamage() === 0x0F){
|
||||||
$item->count--;
|
$item->count--;
|
||||||
TallGrassObject::growGrass($this->getLevel(), $this, new Random(mt_rand()), 8, 2);
|
TallGrassObject::growGrass($this->getLevel(), $this, new Random(mt_rand()), 8, 2);
|
||||||
|
@ -31,15 +31,15 @@ class GrassPath extends Transparent{
|
|||||||
|
|
||||||
protected $id = self::GRASS_PATH;
|
protected $id = self::GRASS_PATH;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Grass Path";
|
return "Grass Path";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getToolType(){
|
public function getToolType() : int{
|
||||||
return Tool::TYPE_SHOVEL;
|
return Tool::TYPE_SHOVEL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ class GrassPath extends Transparent{
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 0.6;
|
return 0.6;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,19 +30,19 @@ class Gravel extends Fallable{
|
|||||||
|
|
||||||
protected $id = self::GRAVEL;
|
protected $id = self::GRAVEL;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Gravel";
|
return "Gravel";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 0.6;
|
return 0.6;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getToolType(){
|
public function getToolType() : int{
|
||||||
return Tool::TYPE_SHOVEL;
|
return Tool::TYPE_SHOVEL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,19 +29,19 @@ class HardenedClay extends Solid{
|
|||||||
|
|
||||||
protected $id = self::HARDENED_CLAY;
|
protected $id = self::HARDENED_CLAY;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Hardened Clay";
|
return "Hardened Clay";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getToolType(){
|
public function getToolType() : int{
|
||||||
return Tool::TYPE_PICKAXE;
|
return Tool::TYPE_PICKAXE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 1.25;
|
return 1.25;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -30,19 +30,19 @@ class HayBale extends Solid{
|
|||||||
|
|
||||||
protected $id = self::HAY_BALE;
|
protected $id = self::HAY_BALE;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Hay Bale";
|
return "Hay Bale";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 0.5;
|
return 0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{
|
||||||
$faces = [
|
$faces = [
|
||||||
0 => 0,
|
0 => 0,
|
||||||
1 => 0,
|
1 => 0,
|
||||||
|
@ -31,15 +31,15 @@ class Ice extends Transparent{
|
|||||||
|
|
||||||
protected $id = self::ICE;
|
protected $id = self::ICE;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Ice";
|
return "Ice";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 0.5;
|
return 0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,17 +47,17 @@ class Ice extends Transparent{
|
|||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getToolType(){
|
public function getToolType() : int{
|
||||||
return Tool::TYPE_PICKAXE;
|
return Tool::TYPE_PICKAXE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onBreak(Item $item){
|
public function onBreak(Item $item) : bool{
|
||||||
$this->getLevel()->setBlock($this, new Water(), true);
|
$this->getLevel()->setBlock($this, new Water(), true);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onUpdate($type){
|
public function onUpdate(int $type){
|
||||||
if($type === Level::BLOCK_UPDATE_RANDOM){
|
if($type === Level::BLOCK_UPDATE_RANDOM){
|
||||||
if($this->level->getHighestAdjacentBlockLight($this->x, $this->y, $this->z) >= 12){
|
if($this->level->getHighestAdjacentBlockLight($this->x, $this->y, $this->z) >= 12){
|
||||||
$this->level->useBreakOn($this);
|
$this->level->useBreakOn($this);
|
||||||
|
@ -30,19 +30,19 @@ class Iron extends Solid{
|
|||||||
|
|
||||||
protected $id = self::IRON_BLOCK;
|
protected $id = self::IRON_BLOCK;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Iron Block";
|
return "Iron Block";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getToolType(){
|
public function getToolType() : int{
|
||||||
return Tool::TYPE_PICKAXE;
|
return Tool::TYPE_PICKAXE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 5;
|
return 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,19 +30,19 @@ class IronBars extends Thin{
|
|||||||
|
|
||||||
protected $id = self::IRON_BARS;
|
protected $id = self::IRON_BARS;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Iron Bars";
|
return "Iron Bars";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 5;
|
return 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getToolType(){
|
public function getToolType() : int{
|
||||||
return Tool::TYPE_PICKAXE;
|
return Tool::TYPE_PICKAXE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,19 +30,19 @@ class IronDoor extends Door{
|
|||||||
|
|
||||||
protected $id = self::IRON_DOOR_BLOCK;
|
protected $id = self::IRON_DOOR_BLOCK;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Iron Door Block";
|
return "Iron Door Block";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getToolType(){
|
public function getToolType() : int{
|
||||||
return Tool::TYPE_PICKAXE;
|
return Tool::TYPE_PICKAXE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 5;
|
return 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,19 +30,19 @@ class IronOre extends Solid{
|
|||||||
|
|
||||||
protected $id = self::IRON_ORE;
|
protected $id = self::IRON_ORE;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Iron Ore";
|
return "Iron Ore";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getToolType(){
|
public function getToolType() : int{
|
||||||
return Tool::TYPE_PICKAXE;
|
return Tool::TYPE_PICKAXE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,15 +29,15 @@ class IronTrapdoor extends Trapdoor{
|
|||||||
|
|
||||||
protected $id = self::IRON_TRAPDOOR;
|
protected $id = self::IRON_TRAPDOOR;
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Iron Trapdoor";
|
return "Iron Trapdoor";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 5;
|
return 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getToolType(){
|
public function getToolType() : int{
|
||||||
return Tool::TYPE_PICKAXE;
|
return Tool::TYPE_PICKAXE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,15 +35,15 @@ use pocketmine\tile\Tile;
|
|||||||
class ItemFrame extends Flowable{
|
class ItemFrame extends Flowable{
|
||||||
protected $id = Block::ITEM_FRAME_BLOCK;
|
protected $id = Block::ITEM_FRAME_BLOCK;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Item Frame";
|
return "Item Frame";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onActivate(Item $item, Player $player = null){
|
public function onActivate(Item $item, Player $player = null) : bool{
|
||||||
$tile = $this->level->getTile($this);
|
$tile = $this->level->getTile($this);
|
||||||
if(!($tile instanceof TileItemFrame)){
|
if(!($tile instanceof TileItemFrame)){
|
||||||
$nbt = new CompoundTag("", [
|
$nbt = new CompoundTag("", [
|
||||||
@ -74,7 +74,7 @@ class ItemFrame extends Flowable{
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onBreak(Item $item){
|
public function onBreak(Item $item) : bool{
|
||||||
$tile = $this->level->getTile($this);
|
$tile = $this->level->getTile($this);
|
||||||
if($tile instanceof TileItemFrame){
|
if($tile instanceof TileItemFrame){
|
||||||
//TODO: add events
|
//TODO: add events
|
||||||
@ -85,7 +85,7 @@ class ItemFrame extends Flowable{
|
|||||||
return parent::onBreak($item);
|
return parent::onBreak($item);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onUpdate($type){
|
public function onUpdate(int $type){
|
||||||
if($type === Level::BLOCK_UPDATE_NORMAL){
|
if($type === Level::BLOCK_UPDATE_NORMAL){
|
||||||
$sides = [
|
$sides = [
|
||||||
0 => 4,
|
0 => 4,
|
||||||
@ -101,7 +101,7 @@ class ItemFrame extends Flowable{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{
|
||||||
if($face === 0 or $face === 1){
|
if($face === 0 or $face === 1){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -34,23 +34,23 @@ class Ladder extends Transparent{
|
|||||||
|
|
||||||
protected $id = self::LADDER;
|
protected $id = self::LADDER;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Ladder";
|
return "Ladder";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function hasEntityCollision(){
|
public function hasEntityCollision() : bool{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isSolid(){
|
public function isSolid() : bool{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 0.4;
|
return 0.4;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,7 +109,7 @@ class Ladder extends Transparent{
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{
|
||||||
if($target->isTransparent() === false){
|
if($target->isTransparent() === false){
|
||||||
$faces = [
|
$faces = [
|
||||||
2 => 2,
|
2 => 2,
|
||||||
@ -128,7 +128,7 @@ class Ladder extends Transparent{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onUpdate($type){
|
public function onUpdate(int $type){
|
||||||
if($type === Level::BLOCK_UPDATE_NORMAL){
|
if($type === Level::BLOCK_UPDATE_NORMAL){
|
||||||
$sides = [
|
$sides = [
|
||||||
2 => 3,
|
2 => 3,
|
||||||
@ -145,7 +145,7 @@ class Ladder extends Transparent{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getToolType(){
|
public function getToolType() : int{
|
||||||
return Tool::TYPE_AXE;
|
return Tool::TYPE_AXE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,19 +30,19 @@ class Lapis extends Solid{
|
|||||||
|
|
||||||
protected $id = self::LAPIS_BLOCK;
|
protected $id = self::LAPIS_BLOCK;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Lapis Lazuli Block";
|
return "Lapis Lazuli Block";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getToolType(){
|
public function getToolType() : int{
|
||||||
return Tool::TYPE_PICKAXE;
|
return Tool::TYPE_PICKAXE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,19 +30,19 @@ class LapisOre extends Solid{
|
|||||||
|
|
||||||
protected $id = self::LAPIS_ORE;
|
protected $id = self::LAPIS_ORE;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getToolType(){
|
public function getToolType() : int{
|
||||||
return Tool::TYPE_PICKAXE;
|
return Tool::TYPE_PICKAXE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Lapis Lazuli Ore";
|
return "Lapis Lazuli Ore";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,15 +35,15 @@ class Lava extends Liquid{
|
|||||||
|
|
||||||
protected $id = self::FLOWING_LAVA;
|
protected $id = self::FLOWING_LAVA;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLightLevel(){
|
public function getLightLevel() : int{
|
||||||
return 15;
|
return 15;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Lava";
|
return "Lava";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ class Lava extends Liquid{
|
|||||||
$entity->resetFallDistance();
|
$entity->resetFallDistance();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{
|
||||||
$ret = $this->getLevel()->setBlock($this, $this, true, false);
|
$ret = $this->getLevel()->setBlock($this, $this, true, false);
|
||||||
$this->getLevel()->scheduleDelayedBlockUpdate($this, $this->tickRate());
|
$this->getLevel()->scheduleDelayedBlockUpdate($this, $this->tickRate());
|
||||||
|
|
||||||
|
@ -41,19 +41,19 @@ class Leaves extends Transparent{
|
|||||||
protected $id = self::LEAVES;
|
protected $id = self::LEAVES;
|
||||||
protected $woodType = self::WOOD;
|
protected $woodType = self::WOOD;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 0.2;
|
return 0.2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getToolType(){
|
public function getToolType() : int{
|
||||||
return Tool::TYPE_SHEARS;
|
return Tool::TYPE_SHEARS;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
static $names = [
|
static $names = [
|
||||||
self::OAK => "Oak Leaves",
|
self::OAK => "Oak Leaves",
|
||||||
self::SPRUCE => "Spruce Leaves",
|
self::SPRUCE => "Spruce Leaves",
|
||||||
@ -132,7 +132,7 @@ class Leaves extends Transparent{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onUpdate($type){
|
public function onUpdate(int $type){
|
||||||
if($type === Level::BLOCK_UPDATE_NORMAL){
|
if($type === Level::BLOCK_UPDATE_NORMAL){
|
||||||
if(($this->meta & 0b00001100) === 0){
|
if(($this->meta & 0b00001100) === 0){
|
||||||
$this->meta |= 0x08;
|
$this->meta |= 0x08;
|
||||||
@ -159,9 +159,9 @@ class Leaves extends Transparent{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{
|
||||||
$this->meta |= 0x04;
|
$this->meta |= 0x04;
|
||||||
$this->getLevel()->setBlock($this, $this, true);
|
return $this->getLevel()->setBlock($this, $this, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDrops(Item $item){
|
public function getDrops(Item $item){
|
||||||
|
@ -30,7 +30,7 @@ class Leaves2 extends Leaves{
|
|||||||
protected $id = self::LEAVES2;
|
protected $id = self::LEAVES2;
|
||||||
protected $woodType = self::WOOD2;
|
protected $woodType = self::WOOD2;
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
static $names = [
|
static $names = [
|
||||||
self::ACACIA => "Acacia Leaves",
|
self::ACACIA => "Acacia Leaves",
|
||||||
self::DARK_OAK => "Dark Oak Leaves",
|
self::DARK_OAK => "Dark Oak Leaves",
|
||||||
|
@ -27,11 +27,11 @@ class Lever extends Flowable{
|
|||||||
|
|
||||||
protected $id = self::LEVER;
|
protected $id = self::LEVER;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Lever";
|
return "Lever";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,19 +33,19 @@ abstract class Liquid extends Transparent{
|
|||||||
/** @var Vector3 */
|
/** @var Vector3 */
|
||||||
private $temporalVector = null;
|
private $temporalVector = null;
|
||||||
|
|
||||||
public function hasEntityCollision(){
|
public function hasEntityCollision() : bool{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isBreakable(Item $item){
|
public function isBreakable(Item $item) : bool{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function canBeReplaced(){
|
public function canBeReplaced() : bool{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isSolid(){
|
public function isSolid() : bool{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,7 +188,7 @@ abstract class Liquid extends Transparent{
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onUpdate($type){
|
public function onUpdate(int $type){
|
||||||
if($type === Level::BLOCK_UPDATE_NORMAL){
|
if($type === Level::BLOCK_UPDATE_NORMAL){
|
||||||
$this->checkForHarden();
|
$this->checkForHarden();
|
||||||
$this->getLevel()->scheduleDelayedBlockUpdate($this, $this->tickRate());
|
$this->getLevel()->scheduleDelayedBlockUpdate($this, $this->tickRate());
|
||||||
@ -358,7 +358,7 @@ abstract class Liquid extends Transparent{
|
|||||||
return $cost;
|
return $cost;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 100;
|
return 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,11 +27,11 @@ class LitPumpkin extends Pumpkin{
|
|||||||
|
|
||||||
protected $id = self::LIT_PUMPKIN;
|
protected $id = self::LIT_PUMPKIN;
|
||||||
|
|
||||||
public function getLightLevel(){
|
public function getLightLevel() : int{
|
||||||
return 15;
|
return 15;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Jack o'Lantern";
|
return "Jack o'Lantern";
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -27,11 +27,11 @@ class LitRedstoneLamp extends RedstoneLamp{
|
|||||||
|
|
||||||
protected $id = self::LIT_REDSTONE_LAMP;
|
protected $id = self::LIT_REDSTONE_LAMP;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function getName() : string{
|
||||||
$this->meta = $meta;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getName(){
|
|
||||||
return "Lit Redstone Lamp";
|
return "Lit Redstone Lamp";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getLightLevel() : int{
|
||||||
|
return 15;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,19 +30,19 @@ class Melon extends Transparent{
|
|||||||
|
|
||||||
protected $id = self::MELON_BLOCK;
|
protected $id = self::MELON_BLOCK;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Melon Block";
|
return "Melon Block";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getToolType(){
|
public function getToolType() : int{
|
||||||
return Tool::TYPE_AXE;
|
return Tool::TYPE_AXE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,15 +33,15 @@ class MelonStem extends Crops{
|
|||||||
|
|
||||||
protected $id = self::MELON_STEM;
|
protected $id = self::MELON_STEM;
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Melon Stem";
|
return "Melon Stem";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onUpdate($type){
|
public function onUpdate(int $type){
|
||||||
if($type === Level::BLOCK_UPDATE_NORMAL){
|
if($type === Level::BLOCK_UPDATE_NORMAL){
|
||||||
if($this->getSide(Vector3::SIDE_DOWN)->getId() !== Block::FARMLAND){
|
if($this->getSide(Vector3::SIDE_DOWN)->getId() !== Block::FARMLAND){
|
||||||
$this->getLevel()->useBreakOn($this);
|
$this->getLevel()->useBreakOn($this);
|
||||||
|
@ -30,19 +30,19 @@ class MonsterSpawner extends Solid{
|
|||||||
|
|
||||||
protected $id = self::MONSTER_SPAWNER;
|
protected $id = self::MONSTER_SPAWNER;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 5;
|
return 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getToolType(){
|
public function getToolType() : int{
|
||||||
return Tool::TYPE_PICKAXE;
|
return Tool::TYPE_PICKAXE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Monster Spawner";
|
return "Monster Spawner";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,19 +30,19 @@ class MossyCobblestone extends Solid{
|
|||||||
|
|
||||||
protected $id = self::MOSSY_COBBLESTONE;
|
protected $id = self::MOSSY_COBBLESTONE;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Moss Stone";
|
return "Moss Stone";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getToolType(){
|
public function getToolType() : int{
|
||||||
return Tool::TYPE_PICKAXE;
|
return Tool::TYPE_PICKAXE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,19 +34,19 @@ class Mycelium extends Solid{
|
|||||||
|
|
||||||
protected $id = self::MYCELIUM;
|
protected $id = self::MYCELIUM;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Mycelium";
|
return "Mycelium";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getToolType(){
|
public function getToolType() : int{
|
||||||
return Tool::TYPE_SHOVEL;
|
return Tool::TYPE_SHOVEL;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 0.6;
|
return 0.6;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ class Mycelium extends Solid{
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onUpdate($type){
|
public function onUpdate(int $type){
|
||||||
if($type === Level::BLOCK_UPDATE_RANDOM){
|
if($type === Level::BLOCK_UPDATE_RANDOM){
|
||||||
//TODO: light levels
|
//TODO: light levels
|
||||||
$x = mt_rand($this->x - 1, $this->x + 1);
|
$x = mt_rand($this->x - 1, $this->x + 1);
|
||||||
|
@ -30,19 +30,19 @@ class NetherBrick extends Solid{
|
|||||||
|
|
||||||
protected $id = self::NETHER_BRICK;
|
protected $id = self::NETHER_BRICK;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getToolType(){
|
public function getToolType() : int{
|
||||||
return Tool::TYPE_PICKAXE;
|
return Tool::TYPE_PICKAXE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Nether Bricks";
|
return "Nether Bricks";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,19 +29,19 @@ class NetherBrickFence extends Transparent{
|
|||||||
|
|
||||||
protected $id = self::NETHER_BRICK_FENCE;
|
protected $id = self::NETHER_BRICK_FENCE;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getToolType(){
|
public function getToolType() : int{
|
||||||
return Tool::TYPE_PICKAXE;
|
return Tool::TYPE_PICKAXE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Nether Brick Fence";
|
return "Nether Brick Fence";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,19 +29,19 @@ class NetherBrickStairs extends Stair{
|
|||||||
|
|
||||||
protected $id = self::NETHER_BRICK_STAIRS;
|
protected $id = self::NETHER_BRICK_STAIRS;
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Nether Brick Stairs";
|
return "Nether Brick Stairs";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getToolType(){
|
public function getToolType() : int{
|
||||||
return Tool::TYPE_PICKAXE;
|
return Tool::TYPE_PICKAXE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
64
src/pocketmine/block/NetherReactor.php
Normal file
64
src/pocketmine/block/NetherReactor.php
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
<?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;
|
||||||
|
|
||||||
|
use pocketmine\item\Item;
|
||||||
|
use pocketmine\item\Tool;
|
||||||
|
|
||||||
|
class NetherReactor extends Solid{
|
||||||
|
protected $id = Block::NETHER_REACTOR;
|
||||||
|
|
||||||
|
public function __construct(int $meta = 0){
|
||||||
|
$this->meta = $meta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getName() : string{
|
||||||
|
static $prefixes = [
|
||||||
|
"",
|
||||||
|
"Active ",
|
||||||
|
"Used "
|
||||||
|
];
|
||||||
|
return ($prefixes[$this->meta] ?? "") . "Nether Reactor Core";
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getToolType() : int{
|
||||||
|
return Tool::TYPE_PICKAXE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getHardness() : float{
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDrops(Item $item){
|
||||||
|
if($item->isPickaxe() >= Tool::TIER_WOODEN){
|
||||||
|
return [
|
||||||
|
[Item::IRON_INGOT, 0, 6],
|
||||||
|
[Item::DIAMOND, 0, 3]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -33,11 +33,11 @@ use pocketmine\Player;
|
|||||||
class NetherWartPlant extends Flowable{
|
class NetherWartPlant extends Flowable{
|
||||||
protected $id = Block::NETHER_WART_PLANT;
|
protected $id = Block::NETHER_WART_PLANT;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
public function place(Item $item, Block $block, Block $target, int $face, float $fx, float $fy, float $fz, Player $player = null) : bool{
|
||||||
$down = $this->getSide(Vector3::SIDE_DOWN);
|
$down = $this->getSide(Vector3::SIDE_DOWN);
|
||||||
if($down->getId() === Block::SOUL_SAND){
|
if($down->getId() === Block::SOUL_SAND){
|
||||||
$this->getLevel()->setBlock($block, $this, false, true);
|
$this->getLevel()->setBlock($block, $this, false, true);
|
||||||
@ -48,7 +48,7 @@ class NetherWartPlant extends Flowable{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onUpdate($type){
|
public function onUpdate(int $type){
|
||||||
switch($type){
|
switch($type){
|
||||||
case Level::BLOCK_UPDATE_RANDOM:
|
case Level::BLOCK_UPDATE_RANDOM:
|
||||||
if($this->meta < 3 and mt_rand(0, 10) === 0){ //Still growing
|
if($this->meta < 3 and mt_rand(0, 10) === 0){ //Still growing
|
||||||
|
@ -30,19 +30,19 @@ class Netherrack extends Solid{
|
|||||||
|
|
||||||
protected $id = self::NETHERRACK;
|
protected $id = self::NETHERRACK;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Netherrack";
|
return "Netherrack";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 0.4;
|
return 0.4;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getToolType(){
|
public function getToolType() : int{
|
||||||
return Tool::TYPE_PICKAXE;
|
return Tool::TYPE_PICKAXE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,11 +27,15 @@ class NoteBlock extends Solid{
|
|||||||
|
|
||||||
protected $id = self::NOTE_BLOCK;
|
protected $id = self::NOTE_BLOCK;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Note Block";
|
return "Note Block";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getFuelTime() : int{
|
||||||
|
return 300;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,19 +30,19 @@ class Obsidian extends Solid{
|
|||||||
|
|
||||||
protected $id = self::OBSIDIAN;
|
protected $id = self::OBSIDIAN;
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct(int $meta = 0){
|
||||||
$this->meta = $meta;
|
$this->meta = $meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName() : string{
|
||||||
return "Obsidian";
|
return "Obsidian";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getToolType(){
|
public function getToolType() : int{
|
||||||
return Tool::TYPE_PICKAXE;
|
return Tool::TYPE_PICKAXE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHardness(){
|
public function getHardness() : float{
|
||||||
return 35;
|
return 35;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user