Merge branch 'master' into mcpe-1.2

This commit is contained in:
Dylan K. Taylor 2017-08-17 17:14:16 +01:00
commit 4f1302adf2
215 changed files with 1482 additions and 1257 deletions

View File

@ -35,7 +35,7 @@ interface IPlayer extends ServerOperator{
/**
* @return string
*/
public function getName();
public function getName() : string;
/**
* @return bool
@ -63,12 +63,12 @@ interface IPlayer extends ServerOperator{
public function getPlayer();
/**
* @return int|double
* @return int|null
*/
public function getFirstPlayed();
/**
* @return int|double
* @return int|null
*/
public function getLastPlayed();

View File

@ -55,7 +55,7 @@ class OfflinePlayer implements IPlayer, Metadatable{
return $this->getPlayer() !== null;
}
public function getName(){
public function getName() : string{
return $this->name;
}

View File

@ -247,9 +247,9 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
protected $ip;
protected $removeFormat = true;
protected $port;
protected $username;
protected $iusername;
protected $displayName;
protected $username = "";
protected $iusername = "";
protected $displayName = "";
protected $startAction = -1;
/** @var Vector3|null */
protected $sleeping = null;
@ -267,7 +267,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
/** @var Player[] */
protected $hiddenPlayers = [];
/** @var Vector3 */
/** @var Vector3|null */
protected $newPosition;
/** @var bool */
@ -388,12 +388,12 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
return $this->flying;
}
public function setAutoJump($value){
public function setAutoJump(bool $value){
$this->autoJump = $value;
$this->sendSettings();
}
public function hasAutoJump(){
public function hasAutoJump() : bool{
return $this->autoJump;
}
@ -439,8 +439,8 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
/**
* @param bool $remove
*/
public function setRemoveFormat($remove = true){
$this->removeFormat = (bool) $remove;
public function setRemoveFormat(bool $remove = true){
$this->removeFormat = $remove;
}
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;
}
@ -639,7 +639,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
* @param string $ip
* @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->windows = new \SplObjectStorage();
$this->perm = new PermissibleBase($this);
@ -671,7 +671,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
/**
* @param string $achievementId
*/
public function removeAchievement($achievementId){
public function removeAchievement(string $achievementId){
if($this->hasAchievement($achievementId)){
$this->achievements[$achievementId] = false;
}
@ -709,14 +709,14 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
/**
* @param string $name
*/
public function setDisplayName($name){
public function setDisplayName(string $name){
$this->displayName = $name;
if($this->spawned){
$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);
if($this->spawned){
$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;
}
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;
}
public function getInAirTicks(){
public function getInAirTicks() : int{
return $this->inAirTicks;
}
protected function switchLevel(Level $targetLevel){
protected function switchLevel(Level $targetLevel) : bool{
$oldLevel = $this->level;
if(parent::switchLevel($targetLevel)){
foreach($this->usedChunks as $index => $d){
@ -769,10 +772,14 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
$this->usedChunks = [];
$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;
$index = Level::chunkHash($x, $z);
if(isset($this->usedChunks[$index])){
@ -820,7 +827,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
if($this->spawned){
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);
}
}
@ -899,7 +906,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
foreach($this->usedChunks as $index => $c){
Level::getXZ($index, $chunkX, $chunkZ);
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);
}
}
@ -1047,9 +1054,9 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
* @param DataPacket $packet
* @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){
return false;
}
@ -1087,7 +1094,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
*
* @return bool|int
*/
public function directDataPacket(DataPacket $packet, $needACK = false){
public function directDataPacket(DataPacket $packet, bool $needACK = false){
if($this->connected === false){
return false;
}
@ -1142,7 +1149,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
$this->sleeping = clone $pos;
$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);
@ -1183,7 +1190,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
$this->sleeping = null;
$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;
@ -1404,7 +1411,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
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){
$bb = clone $this->boundingBox;
$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){
$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()){
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){
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);
if($eyePos->distanceSquared($pos) > $maxDistance ** 2){
return false;
@ -2125,7 +2141,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
}
$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){
case EntityEventPacket::USE_ITEM: //Eating
@ -2211,7 +2227,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
$type = $packet->transactionData->useItemActionType;
switch($type){
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()){
}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();
return true;
@ -2517,7 +2533,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
$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;
}
@ -2609,7 +2625,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
$this->level->broadcastLevelEvent($pos, LevelEventPacket::EVENT_BLOCK_STOP_BREAK);
break;
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){
$bow = $this->inventory->getItemInHand();
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->setDataFlag(self::DATA_FLAGS, self::DATA_FLAG_ACTION, false);
$this->setGenericFlag(self::DATA_FLAG_ACTION, false);
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->setDataFlag(self::DATA_FLAGS, self::DATA_FLAG_ACTION, false);
$this->setGenericFlag(self::DATA_FLAG_ACTION, false);
return true;
}
@ -3237,11 +3253,11 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
* Kicks a player from the server
*
* @param string $reason
* @param bool $isAdmin
* @param bool $isAdmin
*
* @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()));
if(!$ev->isCancelled()){
if($isAdmin){
@ -3369,7 +3385,11 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
$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();
if(!$this->server->isLanguageForced()){
$pk->type = TextPacket::TYPE_TRANSLATION;
@ -3385,7 +3405,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
$this->dataPacket($pk);
}
public function sendPopup($message, $subtitle = ""){
public function sendPopup(string $message, string $subtitle = ""){
$pk = new TextPacket();
$pk->type = TextPacket::TYPE_POPUP;
$pk->source = $message;
@ -3393,7 +3413,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
$this->dataPacket($pk);
}
public function sendTip($message){
public function sendTip(string $message){
$pk = new TextPacket();
$pk->type = TextPacket::TYPE_TIP;
$pk->message = $message;
@ -3404,7 +3424,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
* @param string $sender
* @param string $message
*/
public function sendWhisper($sender, $message){
public function sendWhisper(string $sender, string $message){
$pk = new TextPacket();
$pk->type = TextPacket::TYPE_WHISPER;
$pk->source = $sender;
@ -3416,15 +3436,15 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
* Note for plugin developers: use kick() with the isAdmin
* flag set to kick without the "Kicked by admin" part instead of this method.
*
* @param string $message Message to be broadcasted
* @param string $reason Reason showed in console
* @param bool $notify
* @param TextContainer|string $message Message to be broadcasted
* @param string $reason Reason showed in console
* @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){
try{
if($notify and strlen((string) $reason) > 0){
if($notify and strlen($reason) > 0){
$pk = new DisconnectPacket();
$pk->message = $reason;
$this->directDataPacket($pk);
@ -3481,7 +3501,9 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
$this->windows = null;
$this->windowIndex = [];
parent::close();
if($this->constructed){
parent::close();
}
$this->spawned = false;
if($this->loggedIn){
@ -3519,8 +3541,10 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
* Handles player data saving
*
* @param bool $async
*
* @throws \InvalidStateException if the player is closed
*/
public function save($async = false){
public function save(bool $async = false){
if($this->closed){
throw new \InvalidStateException("Tried to save closed player");
}
@ -3552,10 +3576,9 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
/**
* Gets the username
*
* @return string
*/
public function getName(){
public function getName() : string{
return $this->username;
}

View File

@ -427,7 +427,7 @@ class Server{
* @return string
*/
public static function getGamemodeString(int $mode) : string{
switch((int) $mode){
switch($mode){
case Player::SURVIVAL:
return "%gameMode.survival";
case Player::CREATIVE:
@ -1208,7 +1208,7 @@ class Server{
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
*/
public function setConfigInt(string $variable, int $value){
$this->properties->set($variable, (int) $value);
$this->properties->set($variable, $value);
}
/**

View File

@ -27,11 +27,7 @@ class ActivatorRail extends Rail{
protected $id = self::ACTIVATOR_RAIL;
public function __construct($meta = 0){
$this->meta = $meta;
}
public function getName(){
public function getName() : string{
return "Activator Rail";
}
}

View File

@ -34,35 +34,35 @@ class Air extends Transparent{
protected $id = self::AIR;
protected $meta = 0;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName(){
public function getName() : string{
return "Air";
}
public function canPassThrough(){
public function canPassThrough() : bool{
return true;
}
public function isBreakable(Item $item){
public function isBreakable(Item $item) : bool{
return false;
}
public function canBeFlowedInto(){
public function canBeFlowedInto() : bool{
return true;
}
public function canBeReplaced(){
public function canBeReplaced() : bool{
return true;
}
public function canBePlaced(){
public function canBePlaced() : bool{
return false;
}
public function isSolid(){
public function isSolid() : bool{
return false;
}
@ -70,11 +70,11 @@ class Air extends Transparent{
return null;
}
public function getHardness(){
public function getHardness() : float{
return -1;
}
public function getResistance(){
public function getResistance() : float{
return 0;
}

View File

@ -36,23 +36,23 @@ class Anvil extends Fallable{
protected $id = self::ANVIL;
public function isSolid(){
public function isSolid() : bool{
return false;
}
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getHardness(){
public function getHardness() : float{
return 5;
}
public function getResistance(){
public function getResistance() : float{
return 6000;
}
public function getName(){
public function getName() : string{
static $names = [
self::TYPE_NORMAL => "Anvil",
self::TYPE_SLIGHTLY_DAMAGED => "Slightly Damaged Anvil",
@ -61,11 +61,11 @@ class Anvil extends Fallable{
return $names[$this->meta & 0x0c] ?? "Anvil";
}
public function getToolType(){
public function getToolType() : int{
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){
$player->addWindow(new AnvilInventory($this));
}
@ -73,10 +73,10 @@ class Anvil extends Fallable{
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;
$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){

View File

@ -43,15 +43,15 @@ class Bed extends Transparent{
protected $id = self::BED_BLOCK;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getHardness(){
public function getHardness() : float{
return 0.2;
}
public function getName(){
public function getName() : string{
return "Bed Block";
}
@ -135,7 +135,7 @@ class Bed extends Transparent{
return null;
}
public function onActivate(Item $item, Player $player = null){
public function onActivate(Item $item, Player $player = null) : bool{
if($player !== null){
$other = $this->getOtherHalf();
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);
if(!$down->isTransparent()){
$meta = (($player instanceof Player ? $player->getDirection() : 0) - 1) & 0x03;
@ -203,7 +203,7 @@ class Bed extends Transparent{
return false;
}
public function onBreak(Item $item){
public function onBreak(Item $item) : bool{
$this->getLevel()->setBlock($this, Block::get(Block::AIR), true, true);
if(($other = $this->getOtherHalf()) !== null){
$this->getLevel()->useBreakOn($other); //make sure tiles get removed

View File

@ -29,23 +29,23 @@ class Bedrock extends Solid{
protected $id = self::BEDROCK;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName(){
public function getName() : string{
return "Bedrock";
}
public function getHardness(){
public function getHardness() : float{
return -1;
}
public function getResistance(){
public function getResistance() : float{
return 18000000;
}
public function isBreakable(Item $item){
public function isBreakable(Item $item) : bool{
return false;
}

View File

@ -29,11 +29,11 @@ class Beetroot extends Crops{
protected $id = self::BEETROOT_BLOCK;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName(){
public function getName() : string{
return "Beetroot Block";
}

View File

@ -99,17 +99,18 @@ class Block extends Position implements BlockIds, Metadatable{
self::registerBlock(new Glass());
self::registerBlock(new LapisOre());
self::registerBlock(new Lapis());
//TODO: DISPENSER
self::registerBlock(new Sandstone());
self::registerBlock(new NoteBlock());
self::registerBlock(new Bed());
self::registerBlock(new PoweredRail());
self::registerBlock(new DetectorRail());
//TODO: STICKY_PISTON
self::registerBlock(new Cobweb());
self::registerBlock(new TallGrass());
self::registerBlock(new DeadBush());
//TODO: PISTON
//TODO: PISTONARMCOLLISION
self::registerBlock(new Wool());
self::registerBlock(new Dandelion());
@ -130,7 +131,7 @@ class Block extends Position implements BlockIds, Metadatable{
self::registerBlock(new MonsterSpawner());
self::registerBlock(new WoodenStairs(Block::OAK_STAIRS, 0, "Oak Stairs"));
self::registerBlock(new Chest());
//TODO: REDSTONE_WIRE
self::registerBlock(new DiamondOre());
self::registerBlock(new Diamond());
self::registerBlock(new CraftingTable());
@ -165,14 +166,17 @@ class Block extends Position implements BlockIds, Metadatable{
self::registerBlock(new Netherrack());
self::registerBlock(new SoulSand());
self::registerBlock(new Glowstone());
//TODO: PORTAL
self::registerBlock(new LitPumpkin());
self::registerBlock(new Cake());
//TODO: REPEATER_BLOCK
//TODO: POWERED_REPEATER
//TODO: INVISIBLEBEDROCK
self::registerBlock(new Trapdoor());
//TODO: MONSTER_EGG
self::registerBlock(new StoneBricks());
//TODO: BROWN_MUSHROOM_BLOCK
//TODO: RED_MUSHROOM_BLOCK
self::registerBlock(new IronBars());
self::registerBlock(new GlassPane());
self::registerBlock(new Melon());
@ -190,25 +194,27 @@ class Block extends Position implements BlockIds, Metadatable{
self::registerBlock(new NetherWartPlant());
self::registerBlock(new EnchantingTable());
self::registerBlock(new BrewingStand());
//TODO: CAULDRON_BLOCK
//TODO: END_PORTAL
self::registerBlock(new EndPortalFrame());
self::registerBlock(new EndStone());
//TODO: DRAGON_EGG
self::registerBlock(new RedstoneLamp());
self::registerBlock(new LitRedstoneLamp());
//TODO: DROPPER
self::registerBlock(new ActivatorRail());
self::registerBlock(new CocoaBlock());
self::registerBlock(new SandstoneStairs());
self::registerBlock(new EmeraldOre());
//TODO: ENDER_CHEST
self::registerBlock(new TripwireHook());
self::registerBlock(new Tripwire());
self::registerBlock(new Emerald());
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::JUNGLE_STAIRS, 0, "Jungle Stairs"));
//TODO: COMMAND_BLOCK
//TODO: BEACON
self::registerBlock(new CobblestoneWall());
self::registerBlock(new FlowerPot());
self::registerBlock(new Carrot());
@ -219,20 +225,23 @@ class Block extends Position implements BlockIds, Metadatable{
self::registerBlock(new TrappedChest());
self::registerBlock(new WeightedPressurePlateLight());
self::registerBlock(new WeightedPressurePlateHeavy());
//TODO: COMPARATOR_BLOCK
//TODO: POWERED_COMPARATOR
self::registerBlock(new DaylightSensor());
self::registerBlock(new Redstone());
//TODO: NETHER_QUARTZ_ORE
//TODO: HOPPER_BLOCK
self::registerBlock(new Quartz());
self::registerBlock(new QuartzStairs());
self::registerBlock(new DoubleWoodenSlab());
self::registerBlock(new WoodenSlab());
self::registerBlock(new StainedClay());
//TODO: STAINED_GLASS_PANE
self::registerBlock(new Leaves2());
self::registerBlock(new Wood2());
self::registerBlock(new WoodenStairs(Block::ACACIA_STAIRS, 0, "Acacia Stairs"));
self::registerBlock(new WoodenStairs(Block::DARK_OAK_STAIRS, 0, "Dark Oak Stairs"));
//TODO: SLIME
self::registerBlock(new IronTrapdoor());
self::registerBlock(new Prismarine());
@ -244,11 +253,18 @@ class Block extends Position implements BlockIds, Metadatable{
self::registerBlock(new PackedIce());
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::BIRCH_FENCE_GATE, 0, "Birch 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::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::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 GrassPath());
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::WHITE_GLAZED_TERRACOTTA, 0, "White 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::RED_GLAZED_TERRACOTTA, 0, "Red 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 Beetroot());
self::registerBlock(new Stonecutter());
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){
if($block === null){
@ -332,7 +375,7 @@ class Block extends Position implements BlockIds, Metadatable{
*
* @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{
$block = self::$fullList[($id << 4) | $meta];
if($block !== null){
@ -382,14 +425,14 @@ class Block extends Position implements BlockIds, Metadatable{
/**
* @return string
*/
public function getName(){
public function getName() : string{
return $this->fallbackName;
}
/**
* @return int
*/
final public function getId(){
final public function getId() : int{
return $this->id;
}
@ -406,32 +449,32 @@ class Block extends Position implements BlockIds, Metadatable{
/**
* @return int
*/
final public function getDamage(){
final public function getDamage() : int{
return $this->meta;
}
/**
* @param int $meta
*/
final public function setDamage($meta){
final public function setDamage(int $meta){
$this->meta = $meta & 0x0f;
}
/**
* Places the Block, using block space and block target, and side. Returns if the block has been placed.
*
* @param Item $item
* @param Block $block
* @param Block $target
* @param int $face
* @param float $fx
* @param float $fy
* @param float $fz
* @param Player $player = null
* @param Item $item
* @param Block $block
* @param Block $target
* @param int $face
* @param float $fx
* @param float $fy
* @param float $fz
* @param Player|null $player
*
* @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);
}
@ -442,7 +485,7 @@ class Block extends Position implements BlockIds, Metadatable{
*
* @return bool
*/
public function isBreakable(Item $item){
public function isBreakable(Item $item) : bool{
return true;
}
@ -451,9 +494,9 @@ class Block extends Position implements BlockIds, Metadatable{
*
* @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);
}
@ -462,56 +505,56 @@ class Block extends Position implements BlockIds, Metadatable{
*
* @param int $type
*
* @return int|bool
* @return bool|int
*/
public function onUpdate($type){
public function onUpdate(int $type){
return false;
}
/**
* Do actions when activated by Item. Returns if it has done anything
*
* @param Item $item
* @param Player $player
* @param Item $item
* @param Player|null $player
*
* @return bool
*/
public function onActivate(Item $item, Player $player = null){
public function onActivate(Item $item, Player $player = null) : bool{
return false;
}
/**
* @return float
*/
public function getHardness(){
public function getHardness() : float{
return 10;
}
/**
* @return float
*/
public function getResistance(){
public function getResistance() : float{
return $this->getHardness() * 5;
}
/**
* @return int
*/
public function getToolType(){
public function getToolType() : int{
return Tool::TYPE_NONE;
}
/**
* @return float
*/
public function getFrictionFactor(){
public function getFrictionFactor() : float{
return 0.6;
}
/**
* @return int 0-15
*/
public function getLightLevel(){
public function getLightLevel() : int{
return 0;
}
@ -540,45 +583,43 @@ class Block extends Position implements BlockIds, Metadatable{
/**
* AKA: Block->isPlaceable
*
* @return bool
*/
public function canBePlaced(){
public function canBePlaced() : bool{
return true;
}
/**
* @return bool
*/
public function canBeReplaced(){
public function canBeReplaced() : bool{
return false;
}
/**
* @return bool
*/
public function isTransparent(){
public function isTransparent() : bool{
return false;
}
public function isSolid(){
public function isSolid() : bool{
return true;
}
/**
* AKA: Block->isFlowable
*
* @return bool
*/
public function canBeFlowedInto(){
public function canBeFlowedInto() : bool{
return false;
}
public function hasEntityCollision(){
public function hasEntityCollision() : bool{
return false;
}
public function canPassThrough(){
public function canPassThrough() : bool{
return false;
}
@ -616,13 +657,9 @@ class Block extends Position implements BlockIds, Metadatable{
* @return array
*/
public function getDrops(Item $item){
if(!isset(self::$list[$this->getId()])){ //Unknown blocks
return [];
}else{
return [
[$this->getItemId(), $this->getDamage(), 1],
];
}
return [
[$this->getItemId(), $this->getDamage(), 1],
];
}
/**
@ -632,7 +669,7 @@ class Block extends Position implements BlockIds, Metadatable{
*
* @return float
*/
public function getBreakTime(Item $item){
public function getBreakTime(Item $item) : float{
$base = $this->getHardness() * 1.5;
if($this->canBeBrokenWith($item)){
if($this->getToolType() === Tool::TYPE_SHEARS and $item->isShears()){
@ -671,10 +708,18 @@ class Block extends Position implements BlockIds, Metadatable{
return $base;
}
public function canBeBrokenWith(Item $item){
public function canBeBrokenWith(Item $item) : bool{
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()
*
@ -705,7 +750,7 @@ class Block extends Position implements BlockIds, Metadatable{
*
* @return bool
*/
public function collidesWithBB(AxisAlignedBB $bb){
public function collidesWithBB(AxisAlignedBB $bb) : bool{
$bb2 = $this->getBoundingBox();
return $bb2 !== null and $bb->intersectsWith($bb2);

View File

@ -30,19 +30,19 @@ class Bookshelf extends Solid{
protected $id = self::BOOKSHELF;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName(){
public function getName() : string{
return "Bookshelf";
}
public function getHardness(){
public function getHardness() : float{
return 1.5;
}
public function getToolType(){
public function getToolType() : int{
return Tool::TYPE_AXE;
}
@ -52,4 +52,8 @@ class Bookshelf extends Solid{
];
}
public function getFuelTime() : int{
return 300;
}
}

View File

@ -29,19 +29,19 @@ class BrewingStand extends Transparent{
protected $id = self::BREWING_STAND_BLOCK;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName(){
public function getName() : string{
return "Brewing Stand";
}
public function getHardness(){
public function getHardness() : float{
return 0.5;
}
public function getToolType(){
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}
}

View File

@ -29,23 +29,23 @@ class BrickStairs extends Stair{
protected $id = self::BRICK_STAIRS;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getHardness(){
public function getHardness() : float{
return 2;
}
public function getResistance(){
public function getResistance() : float{
return 30;
}
public function getToolType(){
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}
public function getName(){
public function getName() : string{
return "Brick Stairs";
}

View File

@ -30,23 +30,23 @@ class Bricks extends Solid{
protected $id = self::BRICK_BLOCK;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getHardness(){
public function getHardness() : float{
return 2;
}
public function getResistance(){
public function getResistance() : float{
return 30;
}
public function getToolType(){
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}
public function getName(){
public function getName() : string{
return "Bricks";
}

View File

@ -32,19 +32,19 @@ class BrownMushroom extends Flowable{
protected $id = self::BROWN_MUSHROOM;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName(){
public function getName() : string{
return "Brown Mushroom";
}
public function getLightLevel(){
public function getLightLevel() : int{
return 1;
}
public function onUpdate($type){
public function onUpdate(int $type){
if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(Vector3::SIDE_DOWN)->isTransparent() === true){
$this->getLevel()->useBreakOn($this);
@ -56,7 +56,7 @@ class BrownMushroom extends Flowable{
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);
if($down->isTransparent() === false){
$this->getLevel()->setBlock($block, $this, true, true);

View File

@ -38,27 +38,27 @@ class BurningFurnace extends Solid{
protected $id = self::BURNING_FURNACE;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName(){
public function getName() : string{
return "Burning Furnace";
}
public function getHardness(){
public function getHardness() : float{
return 3.5;
}
public function getToolType(){
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}
public function getLightLevel(){
public function getLightLevel() : int{
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 = [
0 => 4,
1 => 2,
@ -91,7 +91,7 @@ class BurningFurnace extends Solid{
return true;
}
public function onActivate(Item $item, Player $player = null){
public function onActivate(Item $item, Player $player = null) : bool{
if($player instanceof Player){
$furnace = $this->getLevel()->getTile($this);
if(!($furnace instanceof TileFurnace)){

View File

@ -38,19 +38,19 @@ class Cactus extends Transparent{
protected $id = self::CACTUS;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getHardness(){
public function getHardness() : float{
return 0.4;
}
public function hasEntityCollision(){
public function hasEntityCollision() : bool{
return true;
}
public function getName(){
public function getName() : string{
return "Cactus";
}
@ -71,7 +71,7 @@ class Cactus extends Transparent{
$entity->attack($ev->getFinalDamage(), $ev);
}
public function onUpdate($type){
public function onUpdate(int $type){
if($type === Level::BLOCK_UPDATE_NORMAL){
$down = $this->getSide(Vector3::SIDE_DOWN);
if($down->getId() !== self::SAND and $down->getId() !== self::CACTUS){
@ -108,7 +108,7 @@ class Cactus extends Transparent{
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);
if($down->getId() === self::SAND or $down->getId() === self::CACTUS){
$block0 = $this->getSide(Vector3::SIDE_NORTH);

View File

@ -36,15 +36,15 @@ class Cake extends Transparent implements FoodSource{
protected $id = self::CAKE_BLOCK;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getHardness(){
public function getHardness() : float{
return 0.5;
}
public function getName(){
public function getName() : string{
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);
if($down->getId() !== self::AIR){
$this->getLevel()->setBlock($block, $this, true, true);
@ -73,7 +73,7 @@ class Cake extends Transparent implements FoodSource{
return false;
}
public function onUpdate($type){
public function onUpdate(int $type){
if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(Vector3::SIDE_DOWN)->getId() === self::AIR){ //Replace with common break method
$this->getLevel()->setBlock($this, new Air(), true);
@ -89,7 +89,7 @@ class Cake extends Transparent implements FoodSource{
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()){
$ev = new EntityEatBlockEvent($player, $this);

View File

@ -23,6 +23,7 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\ColorBlockMetaHelper;
use pocketmine\item\Item;
use pocketmine\level\Level;
use pocketmine\math\AxisAlignedBB;
@ -33,38 +34,20 @@ class Carpet extends Flowable{
protected $id = self::CARPET;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getHardness(){
public function getHardness() : float{
return 0.1;
}
public function isSolid(){
public function isSolid() : bool{
return true;
}
public function getName(){
static $names = [
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];
public function getName() : string{
return ColorBlockMetaHelper::getColorFromMeta($this->meta) . " Carpet";
}
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);
if($down->getId() !== self::AIR){
$this->getLevel()->setBlock($block, $this, true, true);
@ -90,7 +73,7 @@ class Carpet extends Flowable{
return false;
}
public function onUpdate($type){
public function onUpdate(int $type){
if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(Vector3::SIDE_DOWN)->getId() === self::AIR){
$this->getLevel()->useBreakOn($this);

View File

@ -29,11 +29,11 @@ class Carrot extends Crops{
protected $id = self::CARROT_BLOCK;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName(){
public function getName() : string{
return "Carrot Block";
}

View File

@ -40,19 +40,19 @@ class Chest extends Transparent{
protected $id = self::CHEST;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getHardness(){
public function getHardness() : float{
return 2.5;
}
public function getName(){
public function getName() : string{
return "Chest";
}
public function getToolType(){
public function getToolType() : int{
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 = [
0 => 4,
1 => 2,
@ -124,7 +124,7 @@ class Chest extends Transparent{
return true;
}
public function onBreak(Item $item){
public function onBreak(Item $item) : bool{
$t = $this->getLevel()->getTile($this);
if($t instanceof TileChest){
$t->unpair();
@ -134,7 +134,7 @@ class Chest extends Transparent{
return true;
}
public function onActivate(Item $item, Player $player = null){
public function onActivate(Item $item, Player $player = null) : bool{
if($player instanceof Player){
$top = $this->getSide(Vector3::SIDE_UP);
if($top->isTransparent() !== true){
@ -174,4 +174,8 @@ class Chest extends Transparent{
[$this->id, 0, 1],
];
}
public function getFuelTime() : int{
return 300;
}
}

View File

@ -30,19 +30,19 @@ class Clay extends Solid{
protected $id = self::CLAY_BLOCK;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getHardness(){
public function getHardness() : float{
return 0.6;
}
public function getToolType(){
public function getToolType() : int{
return Tool::TYPE_SHOVEL;
}
public function getName(){
public function getName() : string{
return "Clay Block";
}

View File

@ -30,19 +30,19 @@ class Coal extends Solid{
protected $id = self::COAL_BLOCK;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getHardness(){
public function getHardness() : float{
return 5;
}
public function getToolType(){
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}
public function getName(){
public function getName() : string{
return "Coal Block";
}
@ -55,4 +55,8 @@ class Coal extends Solid{
return [];
}
}
public function getFuelTime() : int{
return 16000;
}
}

View File

@ -30,19 +30,19 @@ class CoalOre extends Solid{
protected $id = self::COAL_ORE;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getHardness(){
public function getHardness() : float{
return 3;
}
public function getToolType(){
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}
public function getName(){
public function getName() : string{
return "Coal Ore";
}

View File

@ -30,19 +30,19 @@ class Cobblestone extends Solid{
protected $id = self::COBBLESTONE;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getToolType(){
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}
public function getName(){
public function getName() : string{
return "Cobblestone";
}
public function getHardness(){
public function getHardness() : float{
return 2;
}

View File

@ -29,19 +29,19 @@ class CobblestoneStairs extends Stair{
protected $id = self::COBBLESTONE_STAIRS;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getHardness(){
public function getHardness() : float{
return 2;
}
public function getToolType(){
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}
public function getName(){
public function getName() : string{
return "Cobblestone Stairs";
}

View File

@ -33,23 +33,23 @@ class CobblestoneWall extends Transparent{
protected $id = self::COBBLESTONE_WALL;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function isSolid(){
public function isSolid() : bool{
return false;
}
public function getToolType(){
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}
public function getHardness(){
public function getHardness() : float{
return 2;
}
public function getName(){
public function getName() : string{
if($this->meta === 0x01){
return "Mossy Cobblestone Wall";
}

View File

@ -31,23 +31,23 @@ class Cobweb extends Flowable{
protected $id = self::COBWEB;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function hasEntityCollision(){
public function hasEntityCollision() : bool{
return true;
}
public function getName(){
public function getName() : string{
return "Cobweb";
}
public function getHardness(){
public function getHardness() : float{
return 4;
}
public function getToolType(){
public function getToolType() : int{
return Tool::TYPE_SWORD;
}

View File

@ -27,11 +27,11 @@ class CocoaBlock extends Solid{
protected $id = self::COCOA_BLOCK;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName(){
public function getName() : string{
return "Cocoa Block";
}
}

View File

@ -31,23 +31,23 @@ class CraftingTable extends Solid{
protected $id = self::CRAFTING_TABLE;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getHardness(){
public function getHardness() : float{
return 2.5;
}
public function getName(){
public function getName() : string{
return "Crafting Table";
}
public function getToolType(){
public function getToolType() : int{
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){
$player->craftingType = 1;
}
@ -60,4 +60,8 @@ class CraftingTable extends Solid{
[$this->id, 0, 1],
];
}
public function getFuelTime() : int{
return 300;
}
}

View File

@ -32,7 +32,7 @@ use pocketmine\Server;
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){
$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
$block = clone $this;
$block->meta += mt_rand(2, 5);
@ -65,7 +65,7 @@ abstract class Crops extends Flowable{
return false;
}
public function onUpdate($type){
public function onUpdate(int $type){
if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(Vector3::SIDE_DOWN)->getId() !== Block::FARMLAND){
$this->getLevel()->useBreakOn($this);

View File

@ -32,16 +32,16 @@ class Dandelion extends Flowable{
protected $id = self::DANDELION;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName(){
public function getName() : string{
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);
if($down->getId() === 2 or $down->getId() === 3 or $down->getId() === 60){
$this->getLevel()->setBlock($block, $this, true, true);
@ -52,7 +52,7 @@ class Dandelion extends Flowable{
return false;
}
public function onUpdate($type){
public function onUpdate(int $type){
if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(Vector3::SIDE_DOWN)->isTransparent() === true){
$this->getLevel()->useBreakOn($this);

View File

@ -27,15 +27,19 @@ class DaylightSensor extends Transparent{
protected $id = self::DAYLIGHT_SENSOR;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName(){
public function getName() : string{
return "Daylight Sensor";
}
public function getHardness(){
public function getHardness() : float{
return 0.2;
}
public function getFuelTime() : int{
return 300;
}
}

View File

@ -30,16 +30,16 @@ class DeadBush extends Flowable{
protected $id = self::DEAD_BUSH;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName(){
public function getName() : string{
return "Dead Bush";
}
public function onUpdate($type){
public function onUpdate(int $type){
if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(Vector3::SIDE_DOWN)->isTransparent() === true){
$this->getLevel()->useBreakOn($this);

View File

@ -27,11 +27,7 @@ class DetectorRail extends Rail{
protected $id = self::DETECTOR_RAIL;
public function __construct($meta = 0){
$this->meta = $meta;
}
public function getName(){
public function getName() : string{
return "Detector Rail";
}
}

View File

@ -30,19 +30,19 @@ class Diamond extends Solid{
protected $id = self::DIAMOND_BLOCK;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getHardness(){
public function getHardness() : float{
return 5;
}
public function getName(){
public function getName() : string{
return "Diamond Block";
}
public function getToolType(){
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}

View File

@ -30,19 +30,19 @@ class DiamondOre extends Solid{
protected $id = self::DIAMOND_ORE;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getHardness(){
public function getHardness() : float{
return 3;
}
public function getName(){
public function getName() : string{
return "Diamond Ore";
}
public function getToolType(){
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}

View File

@ -31,23 +31,23 @@ class Dirt extends Solid{
protected $id = self::DIRT;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getHardness(){
public function getHardness() : float{
return 0.5;
}
public function getToolType(){
public function getToolType() : int{
return Tool::TYPE_SHOVEL;
}
public function getName(){
public function getName() : string{
return "Dirt";
}
public function onActivate(Item $item, Player $player = null){
public function onActivate(Item $item, Player $player = null) : bool{
if($item->isHoe()){
$item->useOn($this);
$this->getLevel()->setBlock($this, Block::get(Block::FARMLAND, 0), true);

View File

@ -33,7 +33,7 @@ use pocketmine\Player;
abstract class Door extends Transparent{
public function isSolid(){
public function isSolid() : bool{
return false;
}
@ -201,7 +201,7 @@ abstract class Door extends Transparent{
return $bb;
}
public function onUpdate($type){
public function onUpdate(int $type){
if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(Vector3::SIDE_DOWN)->getId() === self::AIR){ //Replace with common break method
$this->getLevel()->setBlock($this, new Air(), false);
@ -216,7 +216,7 @@ abstract class Door extends Transparent{
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){
$blockUp = $this->getSide(Vector3::SIDE_UP);
$blockDown = $this->getSide(Vector3::SIDE_DOWN);
@ -246,7 +246,7 @@ abstract class Door extends Transparent{
return false;
}
public function onBreak(Item $item){
public function onBreak(Item $item) : bool{
if(($this->getDamage() & 0x08) === 0x08){
$down = $this->getSide(Vector3::SIDE_DOWN);
if($down->getId() === $this->getId()){
@ -263,7 +263,7 @@ abstract class Door extends Transparent{
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
$down = $this->getSide(Vector3::SIDE_DOWN);
if($down->getId() === $this->getId()){

View File

@ -33,15 +33,15 @@ class DoublePlant extends Flowable{
protected $id = self::DOUBLE_PLANT;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function canBeReplaced(){
public function canBeReplaced() : bool{
return $this->meta === 2 or $this->meta === 3; //grass or fern
}
public function getName(){
public function getName() : string{
static $names = [
0 => "Sunflower",
1 => "Lilac",
@ -53,7 +53,7 @@ class DoublePlant extends Flowable{
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();
if(($id === Block::GRASS or $id === Block::DIRT) and $block->getSide(Vector3::SIDE_UP)->canBeReplaced()){
$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){
$down = $this->getSide(Vector3::SIDE_DOWN);
if(!$this->isValidHalfPlant() or (($this->meta & self::BITFLAG_TOP) === 0 and $down->isTransparent())){
@ -96,7 +96,7 @@ class DoublePlant extends Flowable{
return false;
}
public function onBreak(Item $item){
public function onBreak(Item $item) : bool{
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));
}

View File

@ -30,19 +30,19 @@ class DoubleStoneSlab extends Solid{
protected $id = self::DOUBLE_STONE_SLAB;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getHardness(){
public function getHardness() : float{
return 2;
}
public function getToolType(){
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}
public function getName(){
public function getName() : string{
static $names = [
0 => "Stone",
1 => "Sandstone",

View File

@ -30,30 +30,28 @@ class DoubleWoodenSlab extends Solid{
protected $id = self::DOUBLE_WOODEN_SLAB;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getHardness(){
public function getHardness() : float{
return 2;
}
public function getToolType(){
public function getToolType() : int{
return Tool::TYPE_AXE;
}
public function getName(){
public function getName() : string{
static $names = [
0 => "Oak",
1 => "Spruce",
2 => "Birch",
3 => "Jungle",
4 => "Acacia",
5 => "Dark Oak",
6 => "",
7 => ""
5 => "Dark Oak"
];
return "Double " . $names[$this->meta & 0x07] . " Wooden Slab";
return "Double " . ($names[$this->meta & 0x07] ?? "") . " Wooden Slab";
}
public function getDrops(Item $item){

View File

@ -30,19 +30,19 @@ class Emerald extends Solid{
protected $id = self::EMERALD_BLOCK;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getHardness(){
public function getHardness() : float{
return 5;
}
public function getToolType(){
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}
public function getName(){
public function getName() : string{
return "Emerald Block";
}

View File

@ -30,19 +30,19 @@ class EmeraldOre extends Solid{
protected $id = self::EMERALD_ORE;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName(){
public function getName() : string{
return "Emerald Ore";
}
public function getToolType(){
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}
public function getHardness(){
public function getHardness() : float{
return 3;
}

View File

@ -36,11 +36,11 @@ class EnchantingTable extends Transparent{
protected $id = self::ENCHANTING_TABLE;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$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);
$nbt = new CompoundTag("", [
new StringTag("id", Tile::ENCHANT_TABLE),
@ -64,23 +64,23 @@ class EnchantingTable extends Transparent{
return true;
}
public function getHardness(){
public function getHardness() : float{
return 5;
}
public function getResistance(){
public function getResistance() : float{
return 6000;
}
public function getName(){
public function getName() : string{
return "Enchanting Table";
}
public function getToolType(){
public function getToolType() : int{
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){
//TODO lock

View File

@ -30,27 +30,27 @@ class EndPortalFrame extends Solid{
protected $id = self::END_PORTAL_FRAME;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getLightLevel(){
public function getLightLevel() : int{
return 1;
}
public function getName(){
public function getName() : string{
return "End Portal Frame";
}
public function getHardness(){
public function getHardness() : float{
return -1;
}
public function getResistance(){
public function getResistance() : float{
return 18000000;
}
public function isBreakable(Item $item){
public function isBreakable(Item $item) : bool{
return false;
}

View File

@ -29,19 +29,19 @@ class EndStone extends Solid{
protected $id = self::END_STONE;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName(){
public function getName() : string{
return "End Stone";
}
public function getToolType(){
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}
public function getHardness(){
public function getHardness() : float{
return 3;
}
}

View File

@ -35,7 +35,7 @@ use pocketmine\nbt\tag\ListTag;
abstract class Fallable extends Solid{
public function onUpdate($type){
public function onUpdate(int $type){
if($type === Level::BLOCK_UPDATE_NORMAL){
$down = $this->getSide(Vector3::SIDE_DOWN);
if($down->getId() === self::AIR or ($down instanceof Liquid)){

View File

@ -31,19 +31,19 @@ class Farmland extends Transparent{
protected $id = self::FARMLAND;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName(){
public function getName() : string{
return "Farmland";
}
public function getHardness(){
public function getHardness() : float{
return 0.6;
}
public function getToolType(){
public function getToolType() : int{
return Tool::TYPE_SHOVEL;
}

View File

@ -37,31 +37,29 @@ class Fence extends Transparent{
protected $id = self::FENCE;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getHardness(){
public function getHardness() : float{
return 2;
}
public function getToolType(){
public function getToolType() : int{
return Tool::TYPE_AXE;
}
public function getName(){
public function getName() : string{
static $names = [
self::FENCE_OAK => "Oak Fence",
self::FENCE_SPRUCE => "Spruce Fence",
self::FENCE_BIRCH => "Birch Fence",
self::FENCE_JUNGLE => "Jungle 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(){
@ -90,4 +88,8 @@ class Fence extends Transparent{
return ($block instanceof Fence or $block instanceof FenceGate) ? true : $block->isSolid() and !$block->isTransparent();
}
public function getFuelTime() : int{
return 300;
}
}

View File

@ -31,11 +31,11 @@ use pocketmine\Player;
class FenceGate extends Transparent{
public function getHardness(){
public function getHardness() : float{
return 2;
}
public function getToolType(){
public function getToolType() : int{
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->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);
if($player !== null){
@ -92,4 +92,8 @@ class FenceGate extends Transparent{
$this->level->addSound(new DoorSound($this));
return true;
}
public function getFuelTime() : int{
return 300;
}
}

View File

@ -37,27 +37,27 @@ class Fire extends Flowable{
protected $id = self::FIRE;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function hasEntityCollision(){
public function hasEntityCollision() : bool{
return true;
}
public function getName(){
public function getName() : string{
return "Fire Block";
}
public function getLightLevel(){
public function getLightLevel() : int{
return 15;
}
public function isBreakable(Item $item){
public function isBreakable(Item $item) : bool{
return false;
}
public function canBeReplaced(){
public function canBeReplaced() : bool{
return true;
}
@ -79,7 +79,7 @@ class Fire extends Flowable{
return [];
}
public function onUpdate($type){
public function onUpdate(int $type){
if($type === Level::BLOCK_UPDATE_NORMAL){
for($s = 0; $s <= 5; ++$s){
$side = $this->getSide($s);

View File

@ -25,19 +25,19 @@ namespace pocketmine\block;
abstract class Flowable extends Transparent{
public function canBeFlowedInto(){
public function canBeFlowedInto() : bool{
return true;
}
public function getHardness(){
public function getHardness() : float{
return 0;
}
public function getResistance(){
public function getResistance() : float{
return 0;
}
public function isSolid(){
public function isSolid() : bool{
return false;
}

View File

@ -41,11 +41,11 @@ class Flower extends Flowable{
protected $id = self::RED_FLOWER;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName(){
public function getName() : string{
static $names = [
self::TYPE_POPPY => "Poppy",
self::TYPE_BLUE_ORCHID => "Blue Orchid",
@ -55,20 +55,12 @@ class Flower extends Flowable{
self::TYPE_ORANGE_TULIP => "Orange Tulip",
self::TYPE_WHITE_TULIP => "White Tulip",
self::TYPE_PINK_TULIP => "Pink Tulip",
self::TYPE_OXEYE_DAISY => "Oxeye Daisy",
9 => "Unknown",
10 => "Unknown",
11 => "Unknown",
12 => "Unknown",
13 => "Unknown",
14 => "Unknown",
15 => "Unknown"
self::TYPE_OXEYE_DAISY => "Oxeye Daisy"
];
return $names[$this->meta];
return $names[$this->meta] ?? "Unknown";
}
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);
if($down->getId() === Block::GRASS or $down->getId() === Block::DIRT or $down->getId() === Block::FARMLAND){
$this->getLevel()->setBlock($block, $this, true);
@ -79,7 +71,7 @@ class Flower extends Flowable{
return false;
}
public function onUpdate($type){
public function onUpdate(int $type){
if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(Vector3::SIDE_DOWN)->isTransparent()){
$this->getLevel()->useBreakOn($this);

View File

@ -42,11 +42,11 @@ class FlowerPot extends Flowable{
protected $id = self::FLOWER_POT_BLOCK;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName(){
public function getName() : string{
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()){
return false;
}
@ -87,7 +87,7 @@ class FlowerPot extends Flowable{
return true;
}
public function onUpdate($type){
public function onUpdate(int $type){
if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(Vector3::SIDE_DOWN)->isTransparent() === true){
$this->getLevel()->useBreakOn($this);
@ -99,7 +99,7 @@ class FlowerPot extends Flowable{
return false;
}
public function onActivate(Item $item, Player $player = null){
public function onActivate(Item $item, Player $player = null) : bool{
$pot = $this->getLevel()->getTile($this);
if(!($pot instanceof TileFlowerPot)){
return false;

View File

@ -28,11 +28,11 @@ class Furnace extends BurningFurnace{
protected $id = self::FURNACE;
public function getName(){
public function getName() : string{
return "Furnace";
}
public function getLightLevel(){
public function getLightLevel() : int{
return 0;
}
}

View File

@ -29,15 +29,15 @@ class Glass extends Transparent{
protected $id = self::GLASS;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName(){
public function getName() : string{
return "Glass";
}
public function getHardness(){
public function getHardness() : float{
return 0.3;
}

View File

@ -29,15 +29,15 @@ class GlassPane extends Thin{
protected $id = self::GLASS_PANE;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName(){
public function getName() : string{
return "Glass Pane";
}
public function getHardness(){
public function getHardness() : float{
return 0.3;
}

View File

@ -30,15 +30,15 @@ use pocketmine\Player;
class GlazedTerracotta extends Solid{
public function getHardness(){
public function getHardness() : float{
return 1.4;
}
public function getToolType(){
public function getToolType() : int{
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){
$faces = [
0 => 4,

View File

@ -28,15 +28,15 @@ class GlowingObsidian extends Solid{
protected $id = self::GLOWING_OBSIDIAN;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName(){
public function getName() : string{
return "Glowing Obsidian";
}
public function getLightLevel(){
public function getLightLevel() : int{
return 12;
}

View File

@ -29,15 +29,15 @@ class GlowingRedstoneOre extends RedstoneOre{
protected $id = self::GLOWING_REDSTONE_ORE;
public function getName(){
public function getName() : string{
return "Glowing Redstone Ore";
}
public function getLightLevel(){
public function getLightLevel() : int{
return 9;
}
public function onUpdate($type){
public function onUpdate(int $type){
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);

View File

@ -30,23 +30,23 @@ class Glowstone extends Transparent{
protected $id = self::GLOWSTONE;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName(){
public function getName() : string{
return "Glowstone";
}
public function getHardness(){
public function getHardness() : float{
return 0.3;
}
public function getToolType(){
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}
public function getLightLevel(){
public function getLightLevel() : int{
return 15;
}

View File

@ -30,19 +30,19 @@ class Gold extends Solid{
protected $id = self::GOLD_BLOCK;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName(){
public function getName() : string{
return "Gold Block";
}
public function getHardness(){
public function getHardness() : float{
return 3;
}
public function getToolType(){
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}

View File

@ -30,19 +30,19 @@ class GoldOre extends Solid{
protected $id = self::GOLD_ORE;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName(){
public function getName() : string{
return "Gold Ore";
}
public function getHardness(){
public function getHardness() : float{
return 3;
}
public function getToolType(){
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}

View File

@ -36,19 +36,19 @@ class Grass extends Solid{
protected $id = self::GRASS;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName(){
public function getName() : string{
return "Grass";
}
public function getHardness(){
public function getHardness() : float{
return 0.6;
}
public function getToolType(){
public function getToolType() : int{
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){
$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
@ -97,7 +97,7 @@ class Grass extends Solid{
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){
$item->count--;
TallGrassObject::growGrass($this->getLevel(), $this, new Random(mt_rand()), 8, 2);

View File

@ -31,15 +31,15 @@ class GrassPath extends Transparent{
protected $id = self::GRASS_PATH;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName(){
public function getName() : string{
return "Grass Path";
}
public function getToolType(){
public function getToolType() : int{
return Tool::TYPE_SHOVEL;
}
@ -54,7 +54,7 @@ class GrassPath extends Transparent{
);
}
public function getHardness(){
public function getHardness() : float{
return 0.6;
}

View File

@ -30,19 +30,19 @@ class Gravel extends Fallable{
protected $id = self::GRAVEL;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName(){
public function getName() : string{
return "Gravel";
}
public function getHardness(){
public function getHardness() : float{
return 0.6;
}
public function getToolType(){
public function getToolType() : int{
return Tool::TYPE_SHOVEL;
}

View File

@ -29,19 +29,19 @@ class HardenedClay extends Solid{
protected $id = self::HARDENED_CLAY;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName(){
public function getName() : string{
return "Hardened Clay";
}
public function getToolType(){
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}
public function getHardness(){
public function getHardness() : float{
return 1.25;
}
}

View File

@ -30,19 +30,19 @@ class HayBale extends Solid{
protected $id = self::HAY_BALE;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName(){
public function getName() : string{
return "Hay Bale";
}
public function getHardness(){
public function getHardness() : float{
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 = [
0 => 0,
1 => 0,

View File

@ -31,15 +31,15 @@ class Ice extends Transparent{
protected $id = self::ICE;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName(){
public function getName() : string{
return "Ice";
}
public function getHardness(){
public function getHardness() : float{
return 0.5;
}
@ -47,17 +47,17 @@ class Ice extends Transparent{
return 2;
}
public function getToolType(){
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}
public function onBreak(Item $item){
public function onBreak(Item $item) : bool{
$this->getLevel()->setBlock($this, new Water(), true);
return true;
}
public function onUpdate($type){
public function onUpdate(int $type){
if($type === Level::BLOCK_UPDATE_RANDOM){
if($this->level->getHighestAdjacentBlockLight($this->x, $this->y, $this->z) >= 12){
$this->level->useBreakOn($this);

View File

@ -30,19 +30,19 @@ class Iron extends Solid{
protected $id = self::IRON_BLOCK;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName(){
public function getName() : string{
return "Iron Block";
}
public function getToolType(){
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}
public function getHardness(){
public function getHardness() : float{
return 5;
}

View File

@ -30,19 +30,19 @@ class IronBars extends Thin{
protected $id = self::IRON_BARS;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName(){
public function getName() : string{
return "Iron Bars";
}
public function getHardness(){
public function getHardness() : float{
return 5;
}
public function getToolType(){
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}

View File

@ -30,19 +30,19 @@ class IronDoor extends Door{
protected $id = self::IRON_DOOR_BLOCK;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName(){
public function getName() : string{
return "Iron Door Block";
}
public function getToolType(){
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}
public function getHardness(){
public function getHardness() : float{
return 5;
}

View File

@ -30,19 +30,19 @@ class IronOre extends Solid{
protected $id = self::IRON_ORE;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName(){
public function getName() : string{
return "Iron Ore";
}
public function getToolType(){
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}
public function getHardness(){
public function getHardness() : float{
return 3;
}

View File

@ -29,15 +29,15 @@ class IronTrapdoor extends Trapdoor{
protected $id = self::IRON_TRAPDOOR;
public function getName(){
public function getName() : string{
return "Iron Trapdoor";
}
public function getHardness(){
public function getHardness() : float{
return 5;
}
public function getToolType(){
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}
}

View File

@ -35,15 +35,15 @@ use pocketmine\tile\Tile;
class ItemFrame extends Flowable{
protected $id = Block::ITEM_FRAME_BLOCK;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName(){
public function getName() : string{
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);
if(!($tile instanceof TileItemFrame)){
$nbt = new CompoundTag("", [
@ -74,7 +74,7 @@ class ItemFrame extends Flowable{
return true;
}
public function onBreak(Item $item){
public function onBreak(Item $item) : bool{
$tile = $this->level->getTile($this);
if($tile instanceof TileItemFrame){
//TODO: add events
@ -85,7 +85,7 @@ class ItemFrame extends Flowable{
return parent::onBreak($item);
}
public function onUpdate($type){
public function onUpdate(int $type){
if($type === Level::BLOCK_UPDATE_NORMAL){
$sides = [
0 => 4,
@ -101,7 +101,7 @@ class ItemFrame extends Flowable{
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){
return false;
}

View File

@ -34,23 +34,23 @@ class Ladder extends Transparent{
protected $id = self::LADDER;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName(){
public function getName() : string{
return "Ladder";
}
public function hasEntityCollision(){
public function hasEntityCollision() : bool{
return true;
}
public function isSolid(){
public function isSolid() : bool{
return false;
}
public function getHardness(){
public function getHardness() : float{
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){
$faces = [
2 => 2,
@ -128,7 +128,7 @@ class Ladder extends Transparent{
return false;
}
public function onUpdate($type){
public function onUpdate(int $type){
if($type === Level::BLOCK_UPDATE_NORMAL){
$sides = [
2 => 3,
@ -145,7 +145,7 @@ class Ladder extends Transparent{
return false;
}
public function getToolType(){
public function getToolType() : int{
return Tool::TYPE_AXE;
}

View File

@ -30,19 +30,19 @@ class Lapis extends Solid{
protected $id = self::LAPIS_BLOCK;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName(){
public function getName() : string{
return "Lapis Lazuli Block";
}
public function getToolType(){
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}
public function getHardness(){
public function getHardness() : float{
return 3;
}

View File

@ -30,19 +30,19 @@ class LapisOre extends Solid{
protected $id = self::LAPIS_ORE;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getHardness(){
public function getHardness() : float{
return 3;
}
public function getToolType(){
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}
public function getName(){
public function getName() : string{
return "Lapis Lazuli Ore";
}

View File

@ -35,15 +35,15 @@ class Lava extends Liquid{
protected $id = self::FLOWING_LAVA;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getLightLevel(){
public function getLightLevel() : int{
return 15;
}
public function getName(){
public function getName() : string{
return "Lava";
}
@ -62,7 +62,7 @@ class Lava extends Liquid{
$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);
$this->getLevel()->scheduleDelayedBlockUpdate($this, $this->tickRate());

View File

@ -41,19 +41,19 @@ class Leaves extends Transparent{
protected $id = self::LEAVES;
protected $woodType = self::WOOD;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getHardness(){
public function getHardness() : float{
return 0.2;
}
public function getToolType(){
public function getToolType() : int{
return Tool::TYPE_SHEARS;
}
public function getName(){
public function getName() : string{
static $names = [
self::OAK => "Oak Leaves",
self::SPRUCE => "Spruce Leaves",
@ -132,7 +132,7 @@ class Leaves extends Transparent{
return false;
}
public function onUpdate($type){
public function onUpdate(int $type){
if($type === Level::BLOCK_UPDATE_NORMAL){
if(($this->meta & 0b00001100) === 0){
$this->meta |= 0x08;
@ -159,9 +159,9 @@ class Leaves extends Transparent{
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->getLevel()->setBlock($this, $this, true);
return $this->getLevel()->setBlock($this, $this, true);
}
public function getDrops(Item $item){

View File

@ -30,7 +30,7 @@ class Leaves2 extends Leaves{
protected $id = self::LEAVES2;
protected $woodType = self::WOOD2;
public function getName(){
public function getName() : string{
static $names = [
self::ACACIA => "Acacia Leaves",
self::DARK_OAK => "Dark Oak Leaves",

View File

@ -27,11 +27,11 @@ class Lever extends Flowable{
protected $id = self::LEVER;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName(){
public function getName() : string{
return "Lever";
}
}

View File

@ -33,19 +33,19 @@ abstract class Liquid extends Transparent{
/** @var Vector3 */
private $temporalVector = null;
public function hasEntityCollision(){
public function hasEntityCollision() : bool{
return true;
}
public function isBreakable(Item $item){
public function isBreakable(Item $item) : bool{
return false;
}
public function canBeReplaced(){
public function canBeReplaced() : bool{
return true;
}
public function isSolid(){
public function isSolid() : bool{
return false;
}
@ -188,7 +188,7 @@ abstract class Liquid extends Transparent{
return 0;
}
public function onUpdate($type){
public function onUpdate(int $type){
if($type === Level::BLOCK_UPDATE_NORMAL){
$this->checkForHarden();
$this->getLevel()->scheduleDelayedBlockUpdate($this, $this->tickRate());
@ -358,7 +358,7 @@ abstract class Liquid extends Transparent{
return $cost;
}
public function getHardness(){
public function getHardness() : float{
return 100;
}

View File

@ -27,11 +27,11 @@ class LitPumpkin extends Pumpkin{
protected $id = self::LIT_PUMPKIN;
public function getLightLevel(){
public function getLightLevel() : int{
return 15;
}
public function getName(){
public function getName() : string{
return "Jack o'Lantern";
}
}

View File

@ -27,11 +27,11 @@ class LitRedstoneLamp extends RedstoneLamp{
protected $id = self::LIT_REDSTONE_LAMP;
public function __construct($meta = 0){
$this->meta = $meta;
}
public function getName(){
public function getName() : string{
return "Lit Redstone Lamp";
}
public function getLightLevel() : int{
return 15;
}
}

View File

@ -30,19 +30,19 @@ class Melon extends Transparent{
protected $id = self::MELON_BLOCK;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName(){
public function getName() : string{
return "Melon Block";
}
public function getHardness(){
public function getHardness() : float{
return 1;
}
public function getToolType(){
public function getToolType() : int{
return Tool::TYPE_AXE;
}

View File

@ -33,15 +33,15 @@ class MelonStem extends Crops{
protected $id = self::MELON_STEM;
public function getName(){
public function getName() : string{
return "Melon Stem";
}
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function onUpdate($type){
public function onUpdate(int $type){
if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(Vector3::SIDE_DOWN)->getId() !== Block::FARMLAND){
$this->getLevel()->useBreakOn($this);

View File

@ -30,19 +30,19 @@ class MonsterSpawner extends Solid{
protected $id = self::MONSTER_SPAWNER;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getHardness(){
public function getHardness() : float{
return 5;
}
public function getToolType(){
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}
public function getName(){
public function getName() : string{
return "Monster Spawner";
}

View File

@ -30,19 +30,19 @@ class MossyCobblestone extends Solid{
protected $id = self::MOSSY_COBBLESTONE;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName(){
public function getName() : string{
return "Moss Stone";
}
public function getHardness(){
public function getHardness() : float{
return 2;
}
public function getToolType(){
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}

View File

@ -34,19 +34,19 @@ class Mycelium extends Solid{
protected $id = self::MYCELIUM;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName(){
public function getName() : string{
return "Mycelium";
}
public function getToolType(){
public function getToolType() : int{
return Tool::TYPE_SHOVEL;
}
public function getHardness(){
public function getHardness() : float{
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){
//TODO: light levels
$x = mt_rand($this->x - 1, $this->x + 1);

View File

@ -30,19 +30,19 @@ class NetherBrick extends Solid{
protected $id = self::NETHER_BRICK;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getToolType(){
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}
public function getName(){
public function getName() : string{
return "Nether Bricks";
}
public function getHardness(){
public function getHardness() : float{
return 2;
}

View File

@ -29,19 +29,19 @@ class NetherBrickFence extends Transparent{
protected $id = self::NETHER_BRICK_FENCE;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getHardness(){
public function getHardness() : float{
return 2;
}
public function getToolType(){
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}
public function getName(){
public function getName() : string{
return "Nether Brick Fence";
}

View File

@ -29,19 +29,19 @@ class NetherBrickStairs extends Stair{
protected $id = self::NETHER_BRICK_STAIRS;
public function getName(){
public function getName() : string{
return "Nether Brick Stairs";
}
public function getHardness(){
public function getHardness() : float{
return 2;
}
public function getToolType(){
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}

View 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 [];
}
}

View File

@ -33,11 +33,11 @@ use pocketmine\Player;
class NetherWartPlant extends Flowable{
protected $id = Block::NETHER_WART_PLANT;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$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);
if($down->getId() === Block::SOUL_SAND){
$this->getLevel()->setBlock($block, $this, false, true);
@ -48,7 +48,7 @@ class NetherWartPlant extends Flowable{
return false;
}
public function onUpdate($type){
public function onUpdate(int $type){
switch($type){
case Level::BLOCK_UPDATE_RANDOM:
if($this->meta < 3 and mt_rand(0, 10) === 0){ //Still growing

View File

@ -30,19 +30,19 @@ class Netherrack extends Solid{
protected $id = self::NETHERRACK;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName(){
public function getName() : string{
return "Netherrack";
}
public function getHardness(){
public function getHardness() : float{
return 0.4;
}
public function getToolType(){
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}

View File

@ -27,11 +27,15 @@ class NoteBlock extends Solid{
protected $id = self::NOTE_BLOCK;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName(){
public function getName() : string{
return "Note Block";
}
public function getFuelTime() : int{
return 300;
}
}

View File

@ -30,19 +30,19 @@ class Obsidian extends Solid{
protected $id = self::OBSIDIAN;
public function __construct($meta = 0){
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName(){
public function getName() : string{
return "Obsidian";
}
public function getToolType(){
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}
public function getHardness(){
public function getHardness() : float{
return 35;
}

Some files were not shown because too many files have changed in this diff Show More