mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-20 16:00:20 +00:00
Merge pull request #1912 from Intyre/feature/block
EndPortal, EndStone, MonsterSpawner, Mycelium and Podzol blocks added
This commit is contained in:
commit
4858c7d82e
@ -99,7 +99,7 @@ abstract class Block extends Position implements Metadatable{
|
||||
const OBSIDIAN = 49;
|
||||
const TORCH = 50;
|
||||
const FIRE = 51;
|
||||
|
||||
const MONSTER_SPAWNER = 52;
|
||||
const WOOD_STAIRS = 53;
|
||||
const WOODEN_STAIRS = 53;
|
||||
const OAK_WOOD_STAIRS = 53;
|
||||
@ -168,12 +168,16 @@ abstract class Block extends Position implements Metadatable{
|
||||
const FENCE_GATE = 107;
|
||||
const BRICK_STAIRS = 108;
|
||||
const STONE_BRICK_STAIRS = 109;
|
||||
const MYCELIUM = 110;
|
||||
|
||||
const NETHER_BRICKS = 112;
|
||||
const NETHER_BRICK_BLOCK = 112;
|
||||
|
||||
const NETHER_BRICKS_STAIRS = 114;
|
||||
|
||||
const END_PORTAL = 120;
|
||||
const END_STONE = 121;
|
||||
|
||||
const SANDSTONE_STAIRS = 128;
|
||||
const EMERALD_ORE = 129;
|
||||
|
||||
@ -220,6 +224,7 @@ abstract class Block extends Position implements Metadatable{
|
||||
const HARDENED_CLAY = 172;
|
||||
const COAL_BLOCK = 173;
|
||||
|
||||
const PODZOL = 243;
|
||||
const BEETROOT_BLOCK = 244;
|
||||
const STONECUTTER = 245;
|
||||
const GLOWING_OBSIDIAN = 246;
|
||||
@ -249,9 +254,9 @@ abstract class Block extends Position implements Metadatable{
|
||||
[Item::STONE, 5],
|
||||
[Item::STONE, 6],
|
||||
[Item::DIRT, 0],
|
||||
//TODO: PODZOL
|
||||
[Item::PODZOL, 0],
|
||||
[Item::GRASS, 0],
|
||||
//TODO: MYCELIUM
|
||||
[Item::MYCELIUM, 0],
|
||||
[Item::CLAY_BLOCK, 0],
|
||||
[Item::HARDENED_CLAY, 0],
|
||||
[Item::STAINED_CLAY, 0],
|
||||
@ -322,7 +327,7 @@ abstract class Block extends Position implements Metadatable{
|
||||
[Item::OBSIDIAN, 0],
|
||||
[Item::ICE, 0],
|
||||
[Item::SNOW_BLOCK, 0],
|
||||
//TODO: ENDSTONE
|
||||
[Item::END_STONE, 0],
|
||||
|
||||
//Decoration
|
||||
[Item::COBBLESTONE_WALL, 0],
|
||||
@ -355,6 +360,7 @@ abstract class Block extends Position implements Metadatable{
|
||||
[Item::CHEST, 0],
|
||||
[Item::FURNACE, 0],
|
||||
//TODO: End Portal
|
||||
[Item::END_PORTAL, 0],
|
||||
[Item::DANDELION, 0],
|
||||
[Item::POPPY, 0],
|
||||
//TODO: blue orchid
|
||||
@ -400,7 +406,7 @@ abstract class Block extends Position implements Metadatable{
|
||||
[Item::LEAVES2, 1],
|
||||
[Item::CAKE, 0],
|
||||
[Item::SIGN, 0],
|
||||
//TODO: Monster Spawner
|
||||
[Item::MONSTER_SPAWNER, 0],
|
||||
[Item::WOOL, 0],
|
||||
[Item::WOOL, 7],
|
||||
[Item::WOOL, 6],
|
||||
@ -565,7 +571,7 @@ abstract class Block extends Position implements Metadatable{
|
||||
self::OBSIDIAN => new Obsidian(),
|
||||
self::TORCH => new Torch(),
|
||||
self::FIRE => new Fire(),
|
||||
|
||||
self::MONSTER_SPAWNER => new MonsterSpawner(),
|
||||
self::WOOD_STAIRS => new WoodStairs(),
|
||||
self::CHEST => new Chest(),
|
||||
|
||||
@ -617,10 +623,13 @@ abstract class Block extends Position implements Metadatable{
|
||||
self::BRICK_STAIRS => new BrickStairs(),
|
||||
self::STONE_BRICK_STAIRS => new StoneBrickStairs(),
|
||||
|
||||
self::MYCELIUM => new Mycelium(),
|
||||
self::NETHER_BRICKS => new NetherBrick(),
|
||||
|
||||
self::NETHER_BRICKS_STAIRS => new NetherBrickStairs(),
|
||||
|
||||
self::END_PORTAL => new EndPortal(),
|
||||
self::END_STONE => new EndStone(),
|
||||
self::SANDSTONE_STAIRS => new SandstoneStairs(),
|
||||
self::EMERALD_ORE => new EmeraldOre(),
|
||||
|
||||
@ -649,6 +658,7 @@ abstract class Block extends Position implements Metadatable{
|
||||
self::HARDENED_CLAY => new HardenedClay(),
|
||||
self::COAL_BLOCK => new Coal(),
|
||||
|
||||
self::PODZOL => new Podzol(),
|
||||
self::BEETROOT_BLOCK => new Beetroot(),
|
||||
self::STONECUTTER => new Stonecutter(),
|
||||
self::GLOWING_OBSIDIAN => new GlowingObsidian(),
|
||||
@ -893,4 +903,4 @@ abstract class Block extends Position implements Metadatable{
|
||||
$this->getLevel()->getBlockMetadata()->removeMetadata($this, $metadataKey, $plugin);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
31
src/pocketmine/block/EndPortal.php
Normal file
31
src/pocketmine/block/EndPortal.php
Normal file
@ -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;
|
||||
}
|
||||
}
|
48
src/pocketmine/block/EndStone.php
Normal file
48
src/pocketmine/block/EndStone.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
52
src/pocketmine/block/MonsterSpawner.php
Normal file
52
src/pocketmine/block/MonsterSpawner.php
Normal file
@ -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 [];
|
||||
}
|
||||
}
|
53
src/pocketmine/block/Mycelium.php
Normal file
53
src/pocketmine/block/Mycelium.php
Normal file
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
31
src/pocketmine/block/Podzol.php
Normal file
31
src/pocketmine/block/Podzol.php
Normal file
@ -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;
|
||||
}
|
||||
}
|
@ -95,7 +95,7 @@ class Item{
|
||||
const OBSIDIAN = 49;
|
||||
const TORCH = 50;
|
||||
const FIRE = 51;
|
||||
|
||||
const MONSTER_SPAWNER = 52;
|
||||
const WOOD_STAIRS = 53;
|
||||
const WOODEN_STAIRS = 53;
|
||||
const OAK_WOOD_STAIRS = 53;
|
||||
@ -164,12 +164,16 @@ class Item{
|
||||
const FENCE_GATE = 107;
|
||||
const BRICK_STAIRS = 108;
|
||||
const STONE_BRICK_STAIRS = 109;
|
||||
const MYCELIUM = 110;
|
||||
|
||||
const NETHER_BRICKS = 112;
|
||||
const NETHER_BRICK_BLOCK = 112;
|
||||
|
||||
const NETHER_BRICKS_STAIRS = 114;
|
||||
|
||||
const END_PORTAL = 120;
|
||||
const END_STONE = 121;
|
||||
|
||||
const SANDSTONE_STAIRS = 128;
|
||||
const EMERALD_ORE = 129;
|
||||
|
||||
@ -216,6 +220,7 @@ class Item{
|
||||
const HARDENED_CLAY = 172;
|
||||
const COAL_BLOCK = 173;
|
||||
|
||||
const PODZOL = 243;
|
||||
const BEETROOT_BLOCK = 244;
|
||||
const STONECUTTER = 245;
|
||||
const GLOWING_OBSIDIAN = 246;
|
||||
@ -620,4 +625,4 @@ class Item{
|
||||
return $this->id === $item->getID() and ($checkDamage === false or $this->getDamage() === $item->getDamage());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user