-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1912 from Intyre/feature/block
EndPortal, EndStone, MonsterSpawner, Mycelium and Podzol blocks added
- Loading branch information
Showing
7 changed files
with
239 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
/* | ||
* | ||
* ____ _ _ __ __ _ __ __ ____ | ||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ | ||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) | | ||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ | ||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* @author PocketMine Team | ||
* @link http://www.pocketmine.net/ | ||
* | ||
* | ||
*/ | ||
|
||
namespace pocketmine\block; | ||
|
||
use pocketmine\item\Item; | ||
|
||
class EndPortal extends Solid{ | ||
public function __construct($meta = 0){ | ||
parent::__construct(self::END_PORTAL, $meta, "End Portal"); | ||
$this->hardness = 18000000; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
/* | ||
* | ||
* ____ _ _ __ __ _ __ __ ____ | ||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ | ||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) | | ||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ | ||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* @author PocketMine Team | ||
* @link http://www.pocketmine.net/ | ||
* | ||
* | ||
*/ | ||
|
||
namespace pocketmine\block; | ||
|
||
use pocketmine\item\Item; | ||
|
||
class EndStone extends Solid{ | ||
public function __construct(){ | ||
parent::__construct(self::END_STONE, 0, "End Stone"); | ||
$this->hardness = 45; | ||
} | ||
|
||
public function getBreakTime(Item $item){ | ||
switch($item->isPickaxe()){ | ||
case 5: | ||
return 0.6; | ||
case 4: | ||
return 0.75; | ||
case 3: | ||
return 1.15; | ||
case 2: | ||
return 0.4; | ||
case 1: | ||
return 2.25; | ||
default: | ||
return 15; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?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/ | ||
* | ||
* | ||
*/ | ||
|
||
namespace pocketmine\block; | ||
|
||
use pocketmine\item\Item; | ||
|
||
class MonsterSpawner extends Solid{ | ||
public function __construct(){ | ||
parent::__construct(self::MONSTER_SPAWNER, 0, "Monster Spawner"); | ||
$this->hardness = 25; | ||
} | ||
|
||
public function getBreakTime(Item $item){ | ||
switch($item->isPickaxe()){ | ||
case 5: | ||
return 0.95; | ||
case 4: | ||
return 1.25; | ||
case 3: | ||
return 1.9; | ||
case 2: | ||
return 0.65; | ||
case 1: | ||
return 3.75; | ||
default: | ||
return 25; | ||
} | ||
} | ||
|
||
public function getDrops(Item $item){ | ||
return []; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?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/ | ||
* | ||
* | ||
*/ | ||
|
||
namespace pocketmine\block; | ||
|
||
use pocketmine\item\Item; | ||
|
||
class Mycelium extends Solid{ | ||
public function __construct(){ | ||
parent::__construct(self::MYCELIUM, 0, "Mycelium"); | ||
$this->hardness = 2.5; | ||
} | ||
|
||
public function getDrops(Item $item){ | ||
return [ | ||
[Item::DIRT, 0, 1], | ||
]; | ||
} | ||
|
||
public function onUpdate($type){ | ||
if($type === Level::BLOCK_UPDATE_RANDOM){ | ||
//TODO: light levels | ||
$x = mt_rand($this->x - 1, $this->x + 1); | ||
$y = mt_rand($this->y - 2, $this->y + 2); | ||
$z = mt_rand($this->z - 1, $this->z + 1); | ||
$block = $this->getLevel()->getBlockIdAt($x, $y, $z); | ||
if($block === Block::DIRT){ | ||
$block = $this->getLevel()->getBlock(new Vector3($x, $y, $z)); | ||
if($block->getSide(1) instanceof Transparent){ | ||
$this->getLevel()->setBlock($block, new Mycelium()); | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
/* | ||
* | ||
* ____ _ _ __ __ _ __ __ ____ | ||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \ | ||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) | | ||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/ | ||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_| | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* @author PocketMine Team | ||
* @link http://www.pocketmine.net/ | ||
* | ||
* | ||
*/ | ||
|
||
namespace pocketmine\block; | ||
|
||
use pocketmine\item\Item; | ||
|
||
class Podzol extends Solid{ | ||
public function __construct(){ | ||
parent::__construct(self::PODZOL, 0, "Podzol"); | ||
$this->hardness = 2.5; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters