mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 08:17:34 +00:00
Used namespacer on Blocks and Items
This commit is contained in:
parent
d490972a42
commit
6a736aa822
225
src/BlockAPI.php
225
src/BlockAPI.php
@ -31,6 +31,45 @@ use PocketMine\Tile\Sign as Sign;
|
||||
use PocketMine\NBT\Tag\Compound as Compound;
|
||||
use PocketMine\NBT\Tag\String as String;
|
||||
use PocketMine\NBT\Tag\Int as Int;
|
||||
use PocketMine\Block\STONE as STONE;
|
||||
use PocketMine\Block\COBBLESTONE as COBBLESTONE;
|
||||
use PocketMine\Block\BRICKS as BRICKS;
|
||||
use PocketMine\Block\DIRT as DIRT;
|
||||
use PocketMine\Block\GRASS as GRASS;
|
||||
use PocketMine\Block\SANDSTONE as SANDSTONE;
|
||||
use PocketMine\Block\SAND as SAND;
|
||||
use PocketMine\Block\GRAVEL as GRAVEL;
|
||||
use PocketMine\Block\NETHERRACK as NETHERRACK;
|
||||
use PocketMine\Block\BEDROCK as BEDROCK;
|
||||
use PocketMine\Block\SLAB as SLAB;
|
||||
use PocketMine\Block\OBSIDIAN as OBSIDIAN;
|
||||
use PocketMine\Block\ICE as ICE;
|
||||
use PocketMine\Block\GLASS as GLASS;
|
||||
use PocketMine\Block\WOOL as WOOL;
|
||||
use PocketMine\Block\LADDER as LADDER;
|
||||
use PocketMine\Block\SPONGE as SPONGE;
|
||||
use PocketMine\Block\TRAPDOOR as TRAPDOOR;
|
||||
use PocketMine\Block\FENCE as FENCE;
|
||||
use PocketMine\Block\BED as BED;
|
||||
use PocketMine\Block\BOOKSHELF as BOOKSHELF;
|
||||
use PocketMine\Block\WORKBENCH as WORKBENCH;
|
||||
use PocketMine\Block\STONECUTTER as STONECUTTER;
|
||||
use PocketMine\Block\CHEST as CHEST;
|
||||
use PocketMine\Block\FURNACE as FURNACE;
|
||||
use PocketMine\Block\DANDELION as DANDELION;
|
||||
use PocketMine\Block\CACTUS as CACTUS;
|
||||
use PocketMine\Block\PUMPKIN as PUMPKIN;
|
||||
use PocketMine\Block\COBWEB as COBWEB;
|
||||
use PocketMine\Block\SAPLING as SAPLING;
|
||||
use PocketMine\Block\LEAVES as LEAVES;
|
||||
use PocketMine\Block\CAKE as CAKE;
|
||||
use PocketMine\Block\CARPET as CARPET;
|
||||
use PocketMine\Block\TORCH as TORCH;
|
||||
use PocketMine\Block\TNT as TNT;
|
||||
use PocketMine\Block\SUGARCANE as SUGARCANE;
|
||||
use PocketMine\Block\WHEAT as WHEAT;
|
||||
use PocketMine\Block\CARROT as CARROT;
|
||||
use PocketMine\Block\POTATO as POTATO;
|
||||
|
||||
class BlockAPI{
|
||||
private $server;
|
||||
@ -38,53 +77,53 @@ class BlockAPI{
|
||||
private $randomUpdates = array();
|
||||
public static $creative = array(
|
||||
//Building
|
||||
[Block\STONE, 0],
|
||||
[Block\COBBLESTONE, 0],
|
||||
[Block\STONE_BRICKS, 0],
|
||||
[Block\STONE_BRICKS, 1],
|
||||
[Block\STONE_BRICKS, 2],
|
||||
[STONE, 0],
|
||||
[COBBLESTONE, 0],
|
||||
[STONE_BRICKS, 0],
|
||||
[STONE_BRICKS, 1],
|
||||
[STONE_BRICKS, 2],
|
||||
[Block\MOSS_STONE, 0],
|
||||
[Block\WOODEN_PLANKS, 0],
|
||||
[Block\WOODEN_PLANKS, 1],
|
||||
[Block\WOODEN_PLANKS, 2],
|
||||
[Block\WOODEN_PLANKS, 3],
|
||||
[Block\BRICKS, 0],
|
||||
[BRICKS, 0],
|
||||
|
||||
[Block\DIRT, 0],
|
||||
[Block\GRASS, 0],
|
||||
[DIRT, 0],
|
||||
[GRASS, 0],
|
||||
[Block\CLAY_BLOCK, 0],
|
||||
[Block\SANDSTONE, 0],
|
||||
[Block\SANDSTONE, 1],
|
||||
[Block\SANDSTONE, 2],
|
||||
[Block\SAND, 0],
|
||||
[Block\GRAVEL, 0],
|
||||
[SANDSTONE, 0],
|
||||
[SANDSTONE, 1],
|
||||
[SANDSTONE, 2],
|
||||
[SAND, 0],
|
||||
[GRAVEL, 0],
|
||||
[Block\TRUNK, 0],
|
||||
[Block\TRUNK, 1],
|
||||
[Block\TRUNK, 2],
|
||||
[Block\TRUNK, 3],
|
||||
[Block\NETHER_BRICKS, 0],
|
||||
[Block\NETHERRACK, 0],
|
||||
[Block\BEDROCK, 0],
|
||||
[Block\COBBLESTONE_STAIRS, 0],
|
||||
[NETHERRACK, 0],
|
||||
[BEDROCK, 0],
|
||||
[COBBLESTONE_STAIRS, 0],
|
||||
[Block\OAK_WOODEN_STAIRS, 0],
|
||||
[Block\SPRUCE_WOODEN_STAIRS, 0],
|
||||
[Block\BIRCH_WOODEN_STAIRS, 0],
|
||||
[Block\JUNGLE_WOODEN_STAIRS, 0],
|
||||
[Block\BRICK_STAIRS, 0],
|
||||
[Block\SANDSTONE_STAIRS, 0],
|
||||
[Block\STONE_BRICK_STAIRS, 0],
|
||||
[SANDSTONE_STAIRS, 0],
|
||||
[STONE_BRICK_STAIRS, 0],
|
||||
[Block\NETHER_BRICKS_STAIRS, 0],
|
||||
[Block\QUARTZ_STAIRS, 0],
|
||||
[Block\SLAB, 0],
|
||||
[Block\SLAB, 1],
|
||||
[SLAB, 0],
|
||||
[SLAB, 1],
|
||||
[Block\WOODEN_SLAB, 0],
|
||||
[Block\WOODEN_SLAB, 1],
|
||||
[Block\WOODEN_SLAB, 2],
|
||||
[Block\WOODEN_SLAB, 3],
|
||||
[Block\SLAB, 3],
|
||||
[Block\SLAB, 4],
|
||||
[Block\SLAB, 5],
|
||||
[Block\SLAB, 6],
|
||||
[SLAB, 3],
|
||||
[SLAB, 4],
|
||||
[SLAB, 5],
|
||||
[SLAB, 6],
|
||||
[Block\QUARTZ_BLOCK, 0],
|
||||
[Block\QUARTZ_BLOCK, 1],
|
||||
[Block\QUARTZ_BLOCK, 2],
|
||||
@ -94,101 +133,101 @@ class BlockAPI{
|
||||
[Block\DIAMOND_ORE, 0],
|
||||
[Block\LAPIS_ORE, 0],
|
||||
[Block\REDSTONE_ORE, 0],
|
||||
[Block\OBSIDIAN, 0],
|
||||
[Block\ICE, 0],
|
||||
[OBSIDIAN, 0],
|
||||
[ICE, 0],
|
||||
[Block\SNOW_BLOCK, 0],
|
||||
|
||||
//Decoration
|
||||
[Block\COBBLESTONE_WALL, 0],
|
||||
[Block\COBBLESTONE_WALL, 1],
|
||||
[COBBLESTONE_WALL, 0],
|
||||
[COBBLESTONE_WALL, 1],
|
||||
[Block\GOLD_BLOCK, 0],
|
||||
[Block\IRON_BLOCK, 0],
|
||||
[Block\DIAMOND_BLOCK, 0],
|
||||
[Block\LAPIS_BLOCK, 0],
|
||||
[Block\COAL_BLOCK, 0],
|
||||
[Block\SNOW_LAYER, 0],
|
||||
[Block\GLASS, 0],
|
||||
[GLASS, 0],
|
||||
[Block\GLOWSTONE_BLOCK, 0],
|
||||
[Block\NETHER_REACTOR, 0],
|
||||
[Block\WOOL, 0],
|
||||
[Block\WOOL, 7],
|
||||
[Block\WOOL, 6],
|
||||
[Block\WOOL, 5],
|
||||
[Block\WOOL, 4],
|
||||
[Block\WOOL, 3],
|
||||
[Block\WOOL, 2],
|
||||
[Block\WOOL, 1],
|
||||
[Block\WOOL, 15],
|
||||
[Block\WOOL, 14],
|
||||
[Block\WOOL, 13],
|
||||
[Block\WOOL, 12],
|
||||
[Block\WOOL, 11],
|
||||
[Block\WOOL, 10],
|
||||
[Block\WOOL, 9],
|
||||
[Block\WOOL, 8],
|
||||
[Block\LADDER, 0],
|
||||
[Block\SPONGE, 0],
|
||||
[Block\GLASS_PANE, 0],
|
||||
[WOOL, 0],
|
||||
[WOOL, 7],
|
||||
[WOOL, 6],
|
||||
[WOOL, 5],
|
||||
[WOOL, 4],
|
||||
[WOOL, 3],
|
||||
[WOOL, 2],
|
||||
[WOOL, 1],
|
||||
[WOOL, 15],
|
||||
[WOOL, 14],
|
||||
[WOOL, 13],
|
||||
[WOOL, 12],
|
||||
[WOOL, 11],
|
||||
[WOOL, 10],
|
||||
[WOOL, 9],
|
||||
[WOOL, 8],
|
||||
[LADDER, 0],
|
||||
[SPONGE, 0],
|
||||
[GLASS_PANE, 0],
|
||||
[Block\WOODEN_DOOR, 0],
|
||||
[Block\TRAPDOOR, 0],
|
||||
[Block\FENCE, 0],
|
||||
[Block\FENCE_GATE, 0],
|
||||
[TRAPDOOR, 0],
|
||||
[FENCE, 0],
|
||||
[FENCE_GATE, 0],
|
||||
[Block\IRON_BARS, 0],
|
||||
[Block\BED, 0],
|
||||
[Block\BOOKSHELF, 0],
|
||||
[BED, 0],
|
||||
[BOOKSHELF, 0],
|
||||
[Block\PAINTING, 0],
|
||||
[Block\WORKBENCH, 0],
|
||||
[Block\STONECUTTER, 0],
|
||||
[Block\CHEST, 0],
|
||||
[Block\FURNACE, 0],
|
||||
[Block\DANDELION, 0],
|
||||
[WORKBENCH, 0],
|
||||
[STONECUTTER, 0],
|
||||
[CHEST, 0],
|
||||
[FURNACE, 0],
|
||||
[DANDELION, 0],
|
||||
[Block\CYAN_FLOWER, 0],
|
||||
[Block\BROWN_MUSHROOM, 0],
|
||||
[Block\RED_MUSHROOM, 0],
|
||||
[Block\CACTUS, 0],
|
||||
[CACTUS, 0],
|
||||
[Block\MELON_BLOCK, 0],
|
||||
[Block\PUMPKIN, 0],
|
||||
[PUMPKIN, 0],
|
||||
[Block\LIT_PUMPKIN, 0],
|
||||
[Block\COBWEB, 0],
|
||||
[COBWEB, 0],
|
||||
[Block\HAY_BALE, 0],
|
||||
[Block\TALL_GRASS, 1],
|
||||
[Block\TALL_GRASS, 2],
|
||||
[Block\DEAD_BUSH, 0],
|
||||
[Block\SAPLING, 0],
|
||||
[Block\SAPLING, 1],
|
||||
[Block\SAPLING, 2],
|
||||
[Block\SAPLING, 3],
|
||||
[Block\LEAVES, 0],
|
||||
[Block\LEAVES, 1],
|
||||
[Block\LEAVES, 2],
|
||||
[Block\LEAVES, 3],
|
||||
[Block\CAKE, 0],
|
||||
[SAPLING, 0],
|
||||
[SAPLING, 1],
|
||||
[SAPLING, 2],
|
||||
[SAPLING, 3],
|
||||
[LEAVES, 0],
|
||||
[LEAVES, 1],
|
||||
[LEAVES, 2],
|
||||
[LEAVES, 3],
|
||||
[CAKE, 0],
|
||||
[Block\SIGN, 0],
|
||||
[Block\CARPET, 0],
|
||||
[Block\CARPET, 7],
|
||||
[Block\CARPET, 6],
|
||||
[Block\CARPET, 5],
|
||||
[Block\CARPET, 4],
|
||||
[Block\CARPET, 3],
|
||||
[Block\CARPET, 2],
|
||||
[Block\CARPET, 1],
|
||||
[Block\CARPET, 15],
|
||||
[Block\CARPET, 14],
|
||||
[Block\CARPET, 13],
|
||||
[Block\CARPET, 12],
|
||||
[Block\CARPET, 11],
|
||||
[Block\CARPET, 10],
|
||||
[Block\CARPET, 9],
|
||||
[Block\CARPET, 8],
|
||||
[CARPET, 0],
|
||||
[CARPET, 7],
|
||||
[CARPET, 6],
|
||||
[CARPET, 5],
|
||||
[CARPET, 4],
|
||||
[CARPET, 3],
|
||||
[CARPET, 2],
|
||||
[CARPET, 1],
|
||||
[CARPET, 15],
|
||||
[CARPET, 14],
|
||||
[CARPET, 13],
|
||||
[CARPET, 12],
|
||||
[CARPET, 11],
|
||||
[CARPET, 10],
|
||||
[CARPET, 9],
|
||||
[CARPET, 8],
|
||||
|
||||
//Tools
|
||||
//array(RAILS, 0),
|
||||
//array(POWERED_RAILS, 0),
|
||||
[Block\TORCH, 0],
|
||||
[TORCH, 0],
|
||||
[Block\BUCKET, 0],
|
||||
[Block\BUCKET, 8],
|
||||
[Block\BUCKET, 10],
|
||||
[Block\TNT, 0],
|
||||
[TNT, 0],
|
||||
[Block\IRON_HOE, 0],
|
||||
[Block\IRON_SWORD, 0],
|
||||
[Block\BOW, 0],
|
||||
@ -203,13 +242,13 @@ class BlockAPI{
|
||||
array(SPAWN_EGG, MOB_SHEEP),
|
||||
|
||||
//Seeds
|
||||
[Block\SUGARCANE, 0],
|
||||
[Block\WHEAT, 0],
|
||||
[SUGARCANE, 0],
|
||||
[WHEAT, 0],
|
||||
[Block\SEEDS, 0],
|
||||
[Block\MELON_SEEDS, 0],
|
||||
[Block\PUMPKIN_SEEDS, 0],
|
||||
[Block\CARROT, 0],
|
||||
[Block\POTATO, 0],
|
||||
[PUMPKIN_SEEDS, 0],
|
||||
[CARROT, 0],
|
||||
[POTATO, 0],
|
||||
[Block\BEETROOT_SEEDS, 0],
|
||||
[Block\EGG, 0],
|
||||
[Block\DYE, 0],
|
||||
|
@ -21,6 +21,10 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
use PocketMine\ServerAPI as ServerAPI;
|
||||
use PocketMine\Block\Block as Block;
|
||||
use PocketMine\Item\BED as BED;
|
||||
|
||||
class Bed extends Transparent{
|
||||
public function __construct($type = 0){
|
||||
@ -30,7 +34,7 @@ class Bed extends Transparent{
|
||||
$this->hardness = 1;
|
||||
}
|
||||
|
||||
public function onActivate(Item\Item $item, Player $player){
|
||||
public function onActivate(Item $item, Player $player){
|
||||
if(ServerAPI::request()->api->time->getPhase($player->level) !== "night"){
|
||||
$pk = new Network\Protocol\ChatPacket;
|
||||
$pk->message = "You can only sleep at night";
|
||||
@ -72,7 +76,7 @@ class Bed extends Transparent{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
$down = $this->getSide(0);
|
||||
if($down->isTransparent === false){
|
||||
$faces = array(
|
||||
@ -96,7 +100,7 @@ class Bed extends Transparent{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function onBreak(Item\Item $item, Player $player){
|
||||
public function onBreak(Item $item, Player $player){
|
||||
$blockNorth = $this->getSide(2); //Gets the blocks around them
|
||||
$blockSouth = $this->getSide(3);
|
||||
$blockEast = $this->getSide(5);
|
||||
@ -128,9 +132,9 @@ class Bed extends Transparent{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
return array(
|
||||
array(Item\BED, 0, 1),
|
||||
array(BED, 0, 1),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
|
||||
class Bedrock extends Solid{
|
||||
public function __construct(){
|
||||
@ -29,7 +30,7 @@ class Bedrock extends Solid{
|
||||
$this->hardness = 18000000;
|
||||
}
|
||||
|
||||
public function isBreakable(Item\Item $item, Player $player){
|
||||
public function isBreakable(Item $item, Player $player){
|
||||
if(($player->gamemode & 0x01) === 0x01){
|
||||
return true;
|
||||
}
|
||||
|
@ -21,6 +21,8 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
use PocketMine\ServerAPI as ServerAPI;
|
||||
|
||||
class Beetroot extends Flowable{
|
||||
public function __construct($meta = 0){
|
||||
@ -29,7 +31,7 @@ class Beetroot extends Flowable{
|
||||
$this->hardness = 0;
|
||||
}
|
||||
|
||||
public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
$down = $this->getSide(0);
|
||||
if($down->getID() === FARMLAND){
|
||||
$this->level->setBlock($block, $this, true, false, true);
|
||||
@ -39,7 +41,7 @@ class Beetroot extends Flowable{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function onActivate(Item\Item $item, Player $player){
|
||||
public function onActivate(Item $item, Player $player){
|
||||
if($item->getID() === Item\DYE and $item->getMetadata() === 0x0F){ //Bonemeal
|
||||
$this->meta = 0x07;
|
||||
$this->level->setBlock($this, $this, true, false, true);
|
||||
@ -57,7 +59,7 @@ class Beetroot extends Flowable{
|
||||
if($type === BLOCK_UPDATE_NORMAL){
|
||||
if($this->getSide(0)->isTransparent === true){ //Replace with common break method
|
||||
//TODO
|
||||
//ServerAPI::request()->api->entity->drop($this, Item\Item::get(BEETROOT_SEEDS, 0, 1));
|
||||
//ServerAPI::request()->api->entity->drop($this, Item::get(BEETROOT_SEEDS, 0, 1));
|
||||
$this->level->setBlock($this, new Air(), false, false, true);
|
||||
|
||||
return BLOCK_UPDATE_NORMAL;
|
||||
@ -78,7 +80,7 @@ class Beetroot extends Flowable{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
$drops = array();
|
||||
if($this->meta >= 0x07){
|
||||
$drops[] = array(Item\BEETROOT, 0, 1);
|
||||
|
@ -21,13 +21,14 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
|
||||
class BirchWoodStairs extends Stair{
|
||||
public function __construct($meta = 0){
|
||||
parent::__construct(BIRCH_WOOD_STAIRS, $meta, "Birch Wood Stairs");
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
return array(
|
||||
array($this->id, 0, 1),
|
||||
);
|
||||
|
@ -429,12 +429,12 @@ abstract class Block extends Position{
|
||||
/**
|
||||
* Returns an array of Item objects to be dropped
|
||||
*
|
||||
* @param Item\Item $item
|
||||
* @param ItemItem $item
|
||||
* @param Player $player
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(ItemItem $item, Player $player){
|
||||
if(!isset(self::$class[$this->id])){ //Unknown blocks
|
||||
return array();
|
||||
} else{
|
||||
@ -447,13 +447,13 @@ abstract class Block extends Position{
|
||||
/**
|
||||
* Returns the seconds that this block takes to be broken using an specific Item
|
||||
*
|
||||
* @param Item\Item $item
|
||||
* @param ItemItem $item
|
||||
* @param Player $player
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
|
||||
public function getBreakTime(Item\Item $item, Player $player){
|
||||
public function getBreakTime(ItemItem $item, Player $player){
|
||||
if(($player->gamemode & 0x01) === 0x01){
|
||||
return 0.15;
|
||||
}
|
||||
@ -470,7 +470,7 @@ abstract class Block extends Position{
|
||||
*/
|
||||
public function getSide($side){
|
||||
$v = parent::getSide($side);
|
||||
if($this->level instanceof Level\Level){
|
||||
if($this->level instanceof LevelLevel){
|
||||
return $this->level->getBlock($v);
|
||||
}
|
||||
|
||||
@ -484,27 +484,27 @@ abstract class Block extends Position{
|
||||
/**
|
||||
* Returns if the item can be broken with an specific Item
|
||||
*
|
||||
* @param Item\Item $item
|
||||
* @param ItemItem $item
|
||||
* @param Player $player
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
abstract function isBreakable(Item\Item $item, Player $player);
|
||||
abstract function isBreakable(ItemItem $item, Player $player);
|
||||
|
||||
/**
|
||||
* Do the actions needed so the block is broken with the Item
|
||||
*
|
||||
* @param Item\Item $item
|
||||
* @param ItemItem $item
|
||||
* @param Player $player
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
abstract function onBreak(Item\Item $item, Player $player);
|
||||
abstract function onBreak(ItemItem $item, Player $player);
|
||||
|
||||
/**
|
||||
* Places the Block, using block space and block target, and side. Returns if the block has been placed.
|
||||
*
|
||||
* @param Item\Item $item
|
||||
* @param ItemItem $item
|
||||
* @param Player $player
|
||||
* @param Block $block
|
||||
* @param Block $target
|
||||
@ -515,17 +515,17 @@ abstract class Block extends Position{
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
abstract function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz);
|
||||
abstract function place(ItemItem $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz);
|
||||
|
||||
/**
|
||||
* Do actions when activated by Item. Returns if it has done anything
|
||||
*
|
||||
* @param Item\Item $item
|
||||
* @param ItemItem $item
|
||||
* @param Player $player
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
abstract function onActivate(Item\Item $item, Player $player);
|
||||
abstract function onActivate(ItemItem $item, Player $player);
|
||||
|
||||
/**
|
||||
* Fires a block update on the Block
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
|
||||
class Bricks extends Solid{
|
||||
public function __construct(){
|
||||
@ -28,7 +29,7 @@ class Bricks extends Solid{
|
||||
$this->hardness = 30;
|
||||
}
|
||||
|
||||
public function getBreakTime(Item\Item $item, Player $player){
|
||||
public function getBreakTime(Item $item, Player $player){
|
||||
if(($player->gamemode & 0x01) === 0x01){
|
||||
return 0.20;
|
||||
}
|
||||
@ -48,7 +49,7 @@ class Bricks extends Solid{
|
||||
}
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
if($item->isPickaxe() >= 1){
|
||||
return array(
|
||||
array(BRICKS_BLOCK, 0, 1),
|
||||
|
@ -21,6 +21,8 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\ServerAPI as ServerAPI;
|
||||
use PocketMine\Item\Item as Item;
|
||||
|
||||
class BrownMushroom extends Flowable{
|
||||
public function __construct(){
|
||||
@ -32,7 +34,7 @@ class BrownMushroom extends Flowable{
|
||||
if($type === BLOCK_UPDATE_NORMAL){
|
||||
if($this->getSide(0)->isTransparent === true){ //Replace with common break method
|
||||
//TODO
|
||||
//ServerAPI::request()->api->entity->drop($this, Item\Item::get($this->id));
|
||||
//ServerAPI::request()->api->entity->drop($this, Item::get($this->id));
|
||||
$this->level->setBlock($this, new Air(), false, false, true);
|
||||
|
||||
return BLOCK_UPDATE_NORMAL;
|
||||
@ -42,7 +44,7 @@ class BrownMushroom extends Flowable{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
$down = $this->getSide(0);
|
||||
if($down->isTransparent === false){
|
||||
$this->level->setBlock($block, $this, true, false, true);
|
||||
|
@ -21,6 +21,13 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
use PocketMine\NBT\Tag\Compound as Compound;
|
||||
use PocketMine\NBT\Tag\Enum as Enum;
|
||||
use PocketMine\NBT\Tag\String as String;
|
||||
use PocketMine\Tile\Tile as Tile;
|
||||
use PocketMine\NBT\Tag\Int as Int;
|
||||
use PocketMine\Tile\Furnace as Furnace;
|
||||
|
||||
class BurningFurnace extends Solid{
|
||||
public function __construct($meta = 0){
|
||||
@ -29,7 +36,7 @@ class BurningFurnace extends Solid{
|
||||
$this->hardness = 17.5;
|
||||
}
|
||||
|
||||
public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
$faces = array(
|
||||
0 => 4,
|
||||
1 => 2,
|
||||
@ -38,41 +45,41 @@ class BurningFurnace extends Solid{
|
||||
);
|
||||
$this->meta = $faces[$player->getDirection()];
|
||||
$this->level->setBlock($block, $this, true, false, true);
|
||||
$nbt = new NBT\Tag\Compound(false, array(
|
||||
"Items" => new NBT\Tag\Enum("Items", array()),
|
||||
"id" => new NBT\Tag\String("id", Tile\Tile::FURNACE),
|
||||
"x" => new NBT\Tag\Int("x", $this->x),
|
||||
"y" => new NBT\Tag\Int("y", $this->y),
|
||||
"z" => new NBT\Tag\Int("z", $this->z)
|
||||
$nbt = new Compound(false, array(
|
||||
"Items" => new Enum("Items", array()),
|
||||
"id" => new String("id", Tile::FURNACE),
|
||||
"x" => new Int("x", $this->x),
|
||||
"y" => new Int("y", $this->y),
|
||||
"z" => new Int("z", $this->z)
|
||||
));
|
||||
$nbt->Items->setTagType(NBT\Tag_Compound);
|
||||
$furnace = new Tile\Furnace($this->level, $nbt);
|
||||
$furnace = new Furnace($this->level, $nbt);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function onBreak(Item\Item $item, Player $player){
|
||||
public function onBreak(Item $item, Player $player){
|
||||
$this->level->setBlock($this, new Air(), true, true, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function onActivate(Item\Item $item, Player $player){
|
||||
public function onActivate(Item $item, Player $player){
|
||||
|
||||
$t = $this->level->getTile($this);
|
||||
$furnace = false;
|
||||
if($t instanceof Tile\Furnace){
|
||||
if($t instanceof Furnace){
|
||||
$furnace = $t;
|
||||
} else{
|
||||
$nbt = new NBT\Tag\Compound(false, array(
|
||||
"Items" => new NBT\Tag\Enum("Items", array()),
|
||||
"id" => new NBT\Tag\String("id", Tile\Tile::FURNACE),
|
||||
"x" => new NBT\Tag\Int("x", $this->x),
|
||||
"y" => new NBT\Tag\Int("y", $this->y),
|
||||
"z" => new NBT\Tag\Int("z", $this->z)
|
||||
$nbt = new Compound(false, array(
|
||||
"Items" => new Enum("Items", array()),
|
||||
"id" => new String("id", Tile::FURNACE),
|
||||
"x" => new Int("x", $this->x),
|
||||
"y" => new Int("y", $this->y),
|
||||
"z" => new Int("z", $this->z)
|
||||
));
|
||||
$nbt->Items->setTagType(NBT\Tag_Compound);
|
||||
$furnace = new Tile\Furnace($this->level, $nbt);
|
||||
$furnace = new Furnace($this->level, $nbt);
|
||||
}
|
||||
|
||||
if(($player->gamemode & 0x01) === 0x01){
|
||||
@ -84,7 +91,7 @@ class BurningFurnace extends Solid{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getBreakTime(Item\Item $item, Player $player){
|
||||
public function getBreakTime(Item $item, Player $player){
|
||||
if(($player->gamemode & 0x01) === 0x01){
|
||||
return 0.20;
|
||||
}
|
||||
@ -104,14 +111,14 @@ class BurningFurnace extends Solid{
|
||||
}
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
$drops = array();
|
||||
if($item->isPickaxe() >= 1){
|
||||
$drops[] = array(FURNACE, 0, 1);
|
||||
}
|
||||
$t = $this->level->getTile($this);
|
||||
if($t instanceof Tile\Furnace){
|
||||
for($s = 0; $s < Tile\Furnace::SLOTS; ++$s){
|
||||
if($t instanceof Furnace){
|
||||
for($s = 0; $s < Furnace::SLOTS; ++$s){
|
||||
$slot = $t->getSlot($s);
|
||||
if($slot->getID() > AIR and $slot->getCount() > 0){
|
||||
$drops[] = array($slot->getID(), $slot->getMetadata(), $slot->getCount());
|
||||
|
@ -21,6 +21,9 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\ServerAPI as ServerAPI;
|
||||
use PocketMine\Item\Item as Item;
|
||||
use PocketMine\Math\Vector3 as Vector3;
|
||||
|
||||
class Cactus extends Transparent{
|
||||
public function __construct($meta = 0){
|
||||
@ -34,7 +37,7 @@ class Cactus extends Transparent{
|
||||
$down = $this->getSide(0);
|
||||
if($down->getID() !== SAND and $down->getID() !== CACTUS){ //Replace with common break method
|
||||
$this->level->setBlock($this, new Air(), false);
|
||||
ServerAPI::request()->api->entity->drop($this, Item\Item::get($this->id));
|
||||
ServerAPI::request()->api->entity->drop($this, Item::get($this->id));
|
||||
|
||||
return BLOCK_UPDATE_NORMAL;
|
||||
}
|
||||
@ -42,7 +45,7 @@ class Cactus extends Transparent{
|
||||
if($this->getSide(0)->getID() !== CACTUS){
|
||||
if($this->meta == 0x0F){
|
||||
for($y = 1; $y < 3; ++$y){
|
||||
$b = $this->level->getBlock(new Math\Vector3($this->x, $this->y + $y, $this->z));
|
||||
$b = $this->level->getBlock(new Vector3($this->x, $this->y + $y, $this->z));
|
||||
if($b->getID() === AIR){
|
||||
$this->level->setBlock($b, new Cactus(), true, false, true);
|
||||
break;
|
||||
@ -62,7 +65,7 @@ class Cactus extends Transparent{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
$down = $this->getSide(0);
|
||||
if($down->getID() === SAND or $down->getID() === CACTUS){
|
||||
$block0 = $this->getSide(2);
|
||||
@ -78,7 +81,7 @@ class Cactus extends Transparent{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
return array(
|
||||
array($this->id, 0, 1),
|
||||
);
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
|
||||
class Cake extends Transparent{
|
||||
public function __construct($meta = 0){
|
||||
@ -31,7 +32,7 @@ class Cake extends Transparent{
|
||||
$this->hardness = 2.5;
|
||||
}
|
||||
|
||||
public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
$down = $this->getSide(0);
|
||||
if($down->getID() !== AIR){
|
||||
$this->level->setBlock($block, $this, true, false, true);
|
||||
@ -54,11 +55,11 @@ class Cake extends Transparent{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
return array();
|
||||
}
|
||||
|
||||
public function onActivate(Item\Item $item, Player $player){
|
||||
public function onActivate(Item $item, Player $player){
|
||||
if($player->getHealth() < 20){
|
||||
++$this->meta;
|
||||
$player->heal(3, "cake");
|
||||
|
@ -21,6 +21,8 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
use PocketMine\ServerAPI as ServerAPI;
|
||||
|
||||
class Carpet extends Flowable{
|
||||
public function __construct($meta = 0){
|
||||
@ -49,7 +51,7 @@ class Carpet extends Flowable{
|
||||
$this->isSolid = true;
|
||||
}
|
||||
|
||||
public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
$down = $this->getSide(0);
|
||||
if($down->getID() !== AIR){
|
||||
$this->level->setBlock($block, $this, true, false, true);
|
||||
|
@ -21,6 +21,9 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
use PocketMine\ServerAPI as ServerAPI;
|
||||
use PocketMine\Item\CARROT as CARROT;
|
||||
|
||||
class Carrot extends Flowable{
|
||||
public function __construct($meta = 0){
|
||||
@ -29,7 +32,7 @@ class Carrot extends Flowable{
|
||||
$this->hardness = 0;
|
||||
}
|
||||
|
||||
public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
$down = $this->getSide(0);
|
||||
if($down->getID() === FARMLAND){
|
||||
$this->level->setBlock($block, $this, true, false, true);
|
||||
@ -40,7 +43,7 @@ class Carrot extends Flowable{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function onActivate(Item\Item $item, Player $player){
|
||||
public function onActivate(Item $item, Player $player){
|
||||
if($item->getID() === Item\DYE and $item->getMetadata() === 0x0F){ //Bonemeal
|
||||
$this->meta = 0x07;
|
||||
$this->level->setBlock($this, $this, true, false, true);
|
||||
@ -58,7 +61,7 @@ class Carrot extends Flowable{
|
||||
if($type === BLOCK_UPDATE_NORMAL){
|
||||
if($this->getSide(0)->isTransparent === true){ //Replace with common break method
|
||||
//TODO
|
||||
//ServerAPI::request()->api->entity->drop($this, Item\Item::get(Item\CARROT, 0, 1));
|
||||
//ServerAPI::request()->api->entity->drop($this, Item::get(CARROT, 0, 1));
|
||||
$this->level->setBlock($this, new Air(), false, false, true);
|
||||
|
||||
return BLOCK_UPDATE_NORMAL;
|
||||
@ -79,12 +82,12 @@ class Carrot extends Flowable{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
$drops = array();
|
||||
if($this->meta >= 0x07){
|
||||
$drops[] = array(Item\CARROT, 0, mt_rand(1, 4));
|
||||
$drops[] = array(CARROT, 0, mt_rand(1, 4));
|
||||
} else{
|
||||
$drops[] = array(Item\CARROT, 0, 1);
|
||||
$drops[] = array(CARROT, 0, 1);
|
||||
}
|
||||
|
||||
return $drops;
|
||||
|
@ -21,6 +21,13 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
use PocketMine\Tile\Chest as TileChest;
|
||||
use PocketMine\NBT\Tag\Compound as Compound;
|
||||
use PocketMine\NBT\Tag\Enum as Enum;
|
||||
use PocketMine\NBT\Tag\String as String;
|
||||
use PocketMine\Tile\Tile as Tile;
|
||||
use PocketMine\NBT\Tag\Int as Int;
|
||||
|
||||
class Chest extends Transparent{
|
||||
public function __construct($meta = 0){
|
||||
@ -29,7 +36,7 @@ class Chest extends Transparent{
|
||||
$this->hardness = 15;
|
||||
}
|
||||
|
||||
public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
$faces = array(
|
||||
0 => 4,
|
||||
1 => 2,
|
||||
@ -47,8 +54,8 @@ class Chest extends Transparent{
|
||||
continue;
|
||||
}
|
||||
$c = $this->getSide($side);
|
||||
if(($c instanceof Tile\Chest) and $c->getMetadata() === $this->meta){
|
||||
if((($tile = $this->level->getTile($c)) instanceof Tile\Chest) and !$tile->isPaired()){
|
||||
if(($c instanceof TileChest) and $c->getMetadata() === $this->meta){
|
||||
if((($tile = $this->level->getTile($c)) instanceof TileChest) and !$tile->isPaired()){
|
||||
$chest = $tile;
|
||||
break;
|
||||
}
|
||||
@ -56,17 +63,17 @@ class Chest extends Transparent{
|
||||
}
|
||||
|
||||
$this->level->setBlock($block, $this, true, false, true);
|
||||
$nbt = new NBT\Tag\Compound(false, array(
|
||||
"Items" => new NBT\Tag\Enum("Items", array()),
|
||||
"id" => new NBT\Tag\String("id", Tile\Tile::CHEST),
|
||||
"x" => new NBT\Tag\Int("x", $this->x),
|
||||
"y" => new NBT\Tag\Int("y", $this->y),
|
||||
"z" => new NBT\Tag\Int("z", $this->z)
|
||||
$nbt = new Compound(false, array(
|
||||
"Items" => new Enum("Items", array()),
|
||||
"id" => new String("id", Tile::CHEST),
|
||||
"x" => new Int("x", $this->x),
|
||||
"y" => new Int("y", $this->y),
|
||||
"z" => new Int("z", $this->z)
|
||||
));
|
||||
$nbt->Items->setTagType(NBT\Tag_Compound);
|
||||
$tile = new Tile\Chest($this->level, $nbt);
|
||||
$tile = new TileChest($this->level, $nbt);
|
||||
|
||||
if($chest instanceof Tile\Chest){
|
||||
if($chest instanceof TileChest){
|
||||
$chest->pairWith($tile);
|
||||
$tile->pairWith($chest);
|
||||
}
|
||||
@ -74,9 +81,9 @@ class Chest extends Transparent{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function onBreak(Item\Item $item, Player $player){
|
||||
public function onBreak(Item $item, Player $player){
|
||||
$t = $this->level->getTile($this);
|
||||
if($t instanceof Tile\Chest){
|
||||
if($t instanceof TileChest){
|
||||
$t->unpair();
|
||||
}
|
||||
$this->level->setBlock($this, new Air(), true, true, true);
|
||||
@ -84,7 +91,7 @@ class Chest extends Transparent{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function onActivate(Item\Item $item, Player $player){
|
||||
public function onActivate(Item $item, Player $player){
|
||||
$top = $this->getSide(1);
|
||||
if($top->isTransparent !== true){
|
||||
return true;
|
||||
@ -92,18 +99,18 @@ class Chest extends Transparent{
|
||||
|
||||
$t = $this->level->getTile($this);
|
||||
$chest = false;
|
||||
if($t instanceof Tile\Chest){
|
||||
if($t instanceof TileChest){
|
||||
$chest = $t;
|
||||
} else{
|
||||
$nbt = new NBT\Tag\Compound(false, array(
|
||||
"Items" => new NBT\Tag\Enum("Items", array()),
|
||||
"id" => new NBT\Tag\String("id", Tile\Tile::CHEST),
|
||||
"x" => new NBT\Tag\Int("x", $this->x),
|
||||
"y" => new NBT\Tag\Int("y", $this->y),
|
||||
"z" => new NBT\Tag\Int("z", $this->z)
|
||||
$nbt = new Compound(false, array(
|
||||
"Items" => new Enum("Items", array()),
|
||||
"id" => new String("id", Tile::CHEST),
|
||||
"x" => new Int("x", $this->x),
|
||||
"y" => new Int("y", $this->y),
|
||||
"z" => new Int("z", $this->z)
|
||||
));
|
||||
$nbt->Items->setTagType(NBT\Tag_Compound);
|
||||
$chest = new Tile\Chest($this->level, $nbt);
|
||||
$chest = new TileChest($this->level, $nbt);
|
||||
}
|
||||
|
||||
|
||||
@ -116,7 +123,7 @@ class Chest extends Transparent{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
$drops = array(
|
||||
array($this->id, 0, 1),
|
||||
);
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
|
||||
class Clay extends Solid{
|
||||
public function __construct(){
|
||||
@ -28,7 +29,7 @@ class Clay extends Solid{
|
||||
$this->hardness = 3;
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
return array(
|
||||
array(Item\CLAY, 0, 4),
|
||||
);
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
|
||||
class Coal extends Solid{
|
||||
public function __construct(){
|
||||
@ -28,7 +29,7 @@ class Coal extends Solid{
|
||||
$this->hardness = 30;
|
||||
}
|
||||
|
||||
public function getBreakTime(Item\Item $item, Player $player){
|
||||
public function getBreakTime(Item $item, Player $player){
|
||||
if(($player->gamemode & 0x01) === 0x01){
|
||||
return 0.20;
|
||||
}
|
||||
@ -48,7 +49,7 @@ class Coal extends Solid{
|
||||
}
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
if($item->isPickaxe() >= 1){
|
||||
return array(
|
||||
array(COAL_BLOCK, 0, 1),
|
||||
|
@ -21,6 +21,8 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
use PocketMine\Item\COAL as COAL;
|
||||
|
||||
class CoalOre extends Solid{
|
||||
public function __construct(){
|
||||
@ -28,7 +30,7 @@ class CoalOre extends Solid{
|
||||
$this->hardness = 15;
|
||||
}
|
||||
|
||||
public function getBreakTime(Item\Item $item, Player $player){
|
||||
public function getBreakTime(Item $item, Player $player){
|
||||
if(($player->gamemode & 0x01) === 0x01){
|
||||
return 0.20;
|
||||
}
|
||||
@ -48,10 +50,10 @@ class CoalOre extends Solid{
|
||||
}
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
if($item->isPickaxe() >= 1){
|
||||
return array(
|
||||
array(Item\COAL, 0, 1),
|
||||
array(COAL, 0, 1),
|
||||
);
|
||||
} else{
|
||||
return array();
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
|
||||
class Cobblestone extends Solid{
|
||||
public function __construct(){
|
||||
@ -28,7 +29,7 @@ class Cobblestone extends Solid{
|
||||
$this->hardness = 30;
|
||||
}
|
||||
|
||||
public function getBreakTime(Item\Item $item, Player $player){
|
||||
public function getBreakTime(Item $item, Player $player){
|
||||
if(($player->gamemode & 0x01) === 0x01){
|
||||
return 0.20;
|
||||
}
|
||||
@ -48,7 +49,7 @@ class Cobblestone extends Solid{
|
||||
}
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
if($item->isPickaxe() >= 1){
|
||||
return array(
|
||||
array(COBBLESTONE, 0, 1),
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
|
||||
class Cobweb extends Flowable{
|
||||
public function __construct(){
|
||||
@ -30,7 +31,7 @@ class Cobweb extends Flowable{
|
||||
$this->hardness = 25;
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
return array();
|
||||
}
|
||||
}
|
@ -21,6 +21,8 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
use PocketMine\ServerAPI as ServerAPI;
|
||||
|
||||
class CyanFlower extends Flowable{
|
||||
public function __construct(){
|
||||
@ -28,7 +30,7 @@ class CyanFlower extends Flowable{
|
||||
$this->hardness = 0;
|
||||
}
|
||||
|
||||
public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
$down = $this->getSide(0);
|
||||
if($down->getID() === 2 or $down->getID() === 3 or $down->getID() === 60){
|
||||
$this->level->setBlock($block, $this, true, false, true);
|
||||
@ -43,7 +45,7 @@ class CyanFlower extends Flowable{
|
||||
if($type === BLOCK_UPDATE_NORMAL){
|
||||
if($this->getSide(0)->isTransparent === true){ //Replace with common break method
|
||||
//TODO
|
||||
//ServerAPI::request()->api->entity->drop($this, Item\Item::get($this->id));
|
||||
//ServerAPI::request()->api->entity->drop($this, Item::get($this->id));
|
||||
$this->level->setBlock($this, new Air(), false, false, true);
|
||||
|
||||
return BLOCK_UPDATE_NORMAL;
|
||||
|
@ -21,6 +21,8 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
use PocketMine\ServerAPI as ServerAPI;
|
||||
|
||||
class Dandelion extends Flowable{
|
||||
public function __construct(){
|
||||
@ -28,7 +30,7 @@ class Dandelion extends Flowable{
|
||||
$this->hardness = 0;
|
||||
}
|
||||
|
||||
public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
$down = $this->getSide(0);
|
||||
if($down->getID() === 2 or $down->getID() === 3 or $down->getID() === 60){
|
||||
$this->level->setBlock($block, $this, true, false, true);
|
||||
@ -43,7 +45,7 @@ class Dandelion extends Flowable{
|
||||
if($type === BLOCK_UPDATE_NORMAL){
|
||||
if($this->getSide(0)->isTransparent === true){ //Replace with common break method
|
||||
//TODO
|
||||
//ServerAPI::request()->api->entity->drop($this, Item\Item::get($this->id));
|
||||
//ServerAPI::request()->api->entity->drop($this, Item::get($this->id));
|
||||
$this->level->setBlock($this, new Air(), false, false, true);
|
||||
|
||||
return BLOCK_UPDATE_NORMAL;
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
|
||||
class Diamond extends Solid{
|
||||
public function __construct(){
|
||||
@ -28,7 +29,7 @@ class Diamond extends Solid{
|
||||
$this->hardness = 30;
|
||||
}
|
||||
|
||||
public function getBreakTime(Item\Item $item, Player $player){
|
||||
public function getBreakTime(Item $item, Player $player){
|
||||
if(($player->gamemode & 0x01) === 0x01){
|
||||
return 0.20;
|
||||
}
|
||||
@ -42,7 +43,7 @@ class Diamond extends Solid{
|
||||
}
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
if($item->isPickaxe() >= 4){
|
||||
return array(
|
||||
array(DIAMOND_BLOCK, 0, 1),
|
||||
|
@ -21,6 +21,8 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
use PocketMine\Item\DIAMOND as DIAMOND;
|
||||
|
||||
class DiamondOre extends Solid{
|
||||
public function __construct(){
|
||||
@ -28,7 +30,7 @@ class DiamondOre extends Solid{
|
||||
$this->hardness = 15;
|
||||
}
|
||||
|
||||
public function getBreakTime(Item\Item $item, Player $player){
|
||||
public function getBreakTime(Item $item, Player $player){
|
||||
if(($player->gamemode & 0x01) === 0x01){
|
||||
return 0.20;
|
||||
}
|
||||
@ -42,10 +44,10 @@ class DiamondOre extends Solid{
|
||||
}
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
if($item->isPickaxe() >= 4){
|
||||
return array(
|
||||
array(Item\DIAMOND, 0, 1),
|
||||
array(DIAMOND, 0, 1),
|
||||
);
|
||||
} else{
|
||||
return array();
|
||||
|
@ -21,6 +21,8 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
use PocketMine\Block\Block as Block;
|
||||
|
||||
class Dirt extends Solid{
|
||||
public function __construct(){
|
||||
@ -29,7 +31,7 @@ class Dirt extends Solid{
|
||||
$this->hardness = 2.5;
|
||||
}
|
||||
|
||||
public function onActivate(Item\Item $item, Player $player){
|
||||
public function onActivate(Item $item, Player $player){
|
||||
if($item->isHoe()){
|
||||
if(($player->gamemode & 0x01) === 0){
|
||||
$item->useOn($this);
|
||||
|
@ -21,6 +21,9 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
use PocketMine\Block\Block as Block;
|
||||
use PocketMine\Player as Player;
|
||||
|
||||
|
||||
abstract class Door extends Transparent{
|
||||
@ -44,7 +47,7 @@ abstract class Door extends Transparent{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
if($face === 1){
|
||||
$blockUp = $this->getSide(1);
|
||||
$blockDown = $this->getSide(0);
|
||||
@ -74,7 +77,7 @@ abstract class Door extends Transparent{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function onBreak(Item\Item $item, Player $player){
|
||||
public function onBreak(Item $item, Player $player){
|
||||
if(($this->meta & 0x08) === 0x08){
|
||||
$down = $this->getSide(0);
|
||||
if($down->getID() === $this->id){
|
||||
@ -91,7 +94,7 @@ abstract class Door extends Transparent{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function onActivate(Item\Item $item, Player $player){
|
||||
public function onActivate(Item $item, Player $player){
|
||||
if(($this->meta & 0x08) === 0x08){ //Top
|
||||
$down = $this->getSide(0);
|
||||
if($down->getID() === $this->id){
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
|
||||
class DoubleSlab extends Solid{
|
||||
public function __construct($meta = 0){
|
||||
@ -38,7 +39,7 @@ class DoubleSlab extends Solid{
|
||||
$this->hardness = 30;
|
||||
}
|
||||
|
||||
public function getBreakTime(Item\Item $item, Player $player){
|
||||
public function getBreakTime(Item $item, Player $player){
|
||||
if(($player->gamemode & 0x01) === 0x01){
|
||||
return 0.20;
|
||||
}
|
||||
@ -58,7 +59,7 @@ class DoubleSlab extends Solid{
|
||||
}
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
if($item->isPickaxe() >= 1){
|
||||
return array(
|
||||
array(SLAB, $this->meta & 0x07, 2),
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
|
||||
class DoubleWoodSlab extends Solid{
|
||||
public function __construct($meta = 0){
|
||||
@ -35,7 +36,7 @@ class DoubleWoodSlab extends Solid{
|
||||
$this->hardness = 15;
|
||||
}
|
||||
|
||||
public function getBreakTime(Item\Item $item, Player $player){
|
||||
public function getBreakTime(Item $item, Player $player){
|
||||
if(($player->gamemode & 0x01) === 0x01){
|
||||
return 0.20;
|
||||
}
|
||||
@ -55,7 +56,7 @@ class DoubleWoodSlab extends Solid{
|
||||
}
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
return array(
|
||||
array(WOOD_SLAB, $this->meta & 0x07, 2),
|
||||
);
|
||||
|
@ -21,6 +21,8 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
use PocketMine\ServerAPI as ServerAPI;
|
||||
|
||||
class Fallable extends Solid{
|
||||
|
||||
@ -29,7 +31,7 @@ class Fallable extends Solid{
|
||||
$this->hasPhysics = true;
|
||||
}
|
||||
|
||||
public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
$ret = $this->level->setBlock($this, $this, true, false, true);
|
||||
ServerAPI::request()->api->block->blockUpdate(clone $this, BLOCK_UPDATE_NORMAL);
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
|
||||
class Farmland extends Solid{
|
||||
public function __construct($meta = 0){
|
||||
@ -28,7 +29,7 @@ class Farmland extends Solid{
|
||||
$this->hardness = 3;
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
return array(
|
||||
array(DIRT, 0, 1),
|
||||
);
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
|
||||
class FenceGate extends Transparent{
|
||||
public function __construct($meta = 0){
|
||||
@ -34,7 +35,7 @@ class FenceGate extends Transparent{
|
||||
$this->hardness = 15;
|
||||
}
|
||||
|
||||
public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
$faces = array(
|
||||
0 => 3,
|
||||
1 => 0,
|
||||
@ -47,13 +48,13 @@ class FenceGate extends Transparent{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
return array(
|
||||
array($this->id, 0, 1),
|
||||
);
|
||||
}
|
||||
|
||||
public function onActivate(Item\Item $item, Player $player){
|
||||
public function onActivate(Item $item, Player $player){
|
||||
$faces = array(
|
||||
0 => 3,
|
||||
1 => 0,
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
|
||||
class Fire extends Flowable{
|
||||
public function __construct($meta = 0){
|
||||
@ -31,7 +32,7 @@ class Fire extends Flowable{
|
||||
$this->hardness = 0;
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
return array();
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,8 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
use PocketMine\ServerAPI as ServerAPI;
|
||||
|
||||
class Generic extends Block{
|
||||
|
||||
@ -33,15 +35,15 @@ class Generic extends Block{
|
||||
parent::__construct($id, $meta, $name);
|
||||
}
|
||||
|
||||
public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
return $this->level->setBlock($this, $this, true, false, true);
|
||||
}
|
||||
|
||||
public function isBreakable(Item\Item $item, Player $player){
|
||||
public function isBreakable(Item $item, Player $player){
|
||||
return $this->breakable;
|
||||
}
|
||||
|
||||
public function onBreak(Item\Item $item, Player $player){
|
||||
public function onBreak(Item $item, Player $player){
|
||||
return $this->level->setBlock($this, new Air(), true, false, true);
|
||||
}
|
||||
|
||||
@ -69,7 +71,7 @@ class Generic extends Block{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function onActivate(Item\Item $item, Player $player){
|
||||
public function onActivate(Item $item, Player $player){
|
||||
return $this->isActivable;
|
||||
}
|
||||
}
|
@ -21,6 +21,7 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
|
||||
class Glass extends Transparent{
|
||||
public function __construct(){
|
||||
@ -28,7 +29,7 @@ class Glass extends Transparent{
|
||||
$this->hardness = 1.5;
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
return array();
|
||||
}
|
||||
}
|
@ -21,6 +21,10 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Block\Block as Block;
|
||||
use PocketMine\Level\Position as Position;
|
||||
use PocketMine\Utils\Utils as Utils;
|
||||
use PocketMine\Item\Item as Item;
|
||||
|
||||
class GlowingRedstoneOre extends Solid{
|
||||
public function __construct(){
|
||||
@ -34,14 +38,14 @@ class GlowingRedstoneOre extends Solid{
|
||||
|
||||
return BLOCK_UPDATE_WEAK;
|
||||
} else{
|
||||
$this->level->scheduleBlockUpdate(new Level\Position($this, 0, 0, $this->level), Utils\Utils::getRandomUpdateTicks(), BLOCK_UPDATE_RANDOM);
|
||||
$this->level->scheduleBlockUpdate(new Position($this, 0, 0, $this->level), Utils::getRandomUpdateTicks(), BLOCK_UPDATE_RANDOM);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public function getBreakTime(Item\Item $item, Player $player){
|
||||
public function getBreakTime(Item $item, Player $player){
|
||||
if(($player->gamemode & 0x01) === 0x01){
|
||||
return 0.20;
|
||||
}
|
||||
@ -55,7 +59,7 @@ class GlowingRedstoneOre extends Solid{
|
||||
}
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
if($item->isPickaxe() >= 4){
|
||||
return array(
|
||||
array(Item\REDSTONE_DUST, 0, mt_rand(4, 5)),
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
|
||||
class Glowstone extends Transparent{
|
||||
public function __construct(){
|
||||
@ -28,7 +29,7 @@ class Glowstone extends Transparent{
|
||||
$this->hardness = 1.5;
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
return array(
|
||||
array(Item\GLOWSTONE_DUST, 0, mt_rand(2, 4)),
|
||||
);
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
|
||||
class Gold extends Solid{
|
||||
public function __construct(){
|
||||
@ -28,7 +29,7 @@ class Gold extends Solid{
|
||||
$this->hardness = 30;
|
||||
}
|
||||
|
||||
public function getBreakTime(Item\Item $item, Player $player){
|
||||
public function getBreakTime(Item $item, Player $player){
|
||||
if(($player->gamemode & 0x01) === 0x01){
|
||||
return 0.20;
|
||||
}
|
||||
@ -42,7 +43,7 @@ class Gold extends Solid{
|
||||
}
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
if($item->isPickaxe() >= 4){
|
||||
return array(
|
||||
array(GOLD_BLOCK, 0, 1),
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
|
||||
class GoldOre extends Solid{
|
||||
public function __construct(){
|
||||
@ -28,7 +29,7 @@ class GoldOre extends Solid{
|
||||
$this->hardness = 15;
|
||||
}
|
||||
|
||||
public function getBreakTime(Item\Item $item, Player $player){
|
||||
public function getBreakTime(Item $item, Player $player){
|
||||
if(($player->gamemode & 0x01) === 0x01){
|
||||
return 0.20;
|
||||
}
|
||||
@ -42,7 +43,7 @@ class GoldOre extends Solid{
|
||||
}
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
if($item->isPickaxe() >= 4){
|
||||
return array(
|
||||
array(GOLD_ORE, 0, 1),
|
||||
|
@ -21,6 +21,9 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
use PocketMine\Level\Generator\Object\TallGrass as TallGrass;
|
||||
use PocketMine\Utils\Random as Random;
|
||||
|
||||
class Grass extends Solid{
|
||||
public function __construct(){
|
||||
@ -29,18 +32,18 @@ class Grass extends Solid{
|
||||
$this->hardness = 3;
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
return array(
|
||||
array(DIRT, 0, 1),
|
||||
);
|
||||
}
|
||||
|
||||
public function onActivate(Item\Item $item, Player $player){
|
||||
public function onActivate(Item $item, Player $player){
|
||||
if($item->getID() === Item\DYE and $item->getMetadata() === 0x0F){
|
||||
if(($player->gamemode & 0x01) === 0){
|
||||
$item->count--;
|
||||
}
|
||||
Level\Generator\Object\TallGrass::growGrass($this->level, $this, new Utils\Random(), 8, 2);
|
||||
TallGrass::growGrass($this->level, $this, new Random(), 8, 2);
|
||||
|
||||
return true;
|
||||
} elseif($item->isHoe()){
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
|
||||
class Gravel extends Fallable{
|
||||
public function __construct(){
|
||||
@ -28,7 +29,7 @@ class Gravel extends Fallable{
|
||||
$this->hardness = 3;
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
if(mt_rand(1, 10) === 1){
|
||||
return array(
|
||||
array(Item\FLINT, 0, 1),
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
|
||||
class HayBale extends Solid{
|
||||
public function __construct($meta = 0){
|
||||
@ -28,7 +29,7 @@ class HayBale extends Solid{
|
||||
$this->hardness = 10;
|
||||
}
|
||||
|
||||
public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
$faces = array(
|
||||
0 => 0,
|
||||
1 => 0,
|
||||
@ -44,7 +45,7 @@ class HayBale extends Solid{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
return array(
|
||||
array($this->id, 0, 1),
|
||||
);
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
|
||||
class Ice extends Transparent{
|
||||
public function __construct(){
|
||||
@ -28,7 +29,7 @@ class Ice extends Transparent{
|
||||
$this->hardness = 2.5;
|
||||
}
|
||||
|
||||
public function onBreak(Item\Item $item, Player $player){
|
||||
public function onBreak(Item $item, Player $player){
|
||||
if(($player->gamemode & 0x01) === 0){
|
||||
$this->level->setBlock($this, new Water(), true, false, true);
|
||||
} else{
|
||||
@ -38,7 +39,7 @@ class Ice extends Transparent{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getBreakTime(Item\Item $item, Player $player){
|
||||
public function getBreakTime(Item $item, Player $player){
|
||||
if(($player->gamemode & 0x01) === 0x01){
|
||||
return 0.20;
|
||||
}
|
||||
@ -58,7 +59,7 @@ class Ice extends Transparent{
|
||||
}
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
return array();
|
||||
}
|
||||
}
|
@ -21,6 +21,7 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
|
||||
class Iron extends Solid{
|
||||
public function __construct(){
|
||||
@ -28,7 +29,7 @@ class Iron extends Solid{
|
||||
$this->hardness = 30;
|
||||
}
|
||||
|
||||
public function getBreakTime(Item\Item $item, Player $player){
|
||||
public function getBreakTime(Item $item, Player $player){
|
||||
if(($player->gamemode & 0x01) === 0x01){
|
||||
return 0.20;
|
||||
}
|
||||
@ -44,7 +45,7 @@ class Iron extends Solid{
|
||||
}
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
if($item->isPickaxe() >= 3){
|
||||
return array(
|
||||
array(IRON_BLOCK, 0, 1),
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
|
||||
class IronDoor extends Door{
|
||||
public function __construct($meta = 0){
|
||||
@ -29,7 +30,7 @@ class IronDoor extends Door{
|
||||
$this->hardness = 25;
|
||||
}
|
||||
|
||||
public function getBreakTime(Item\Item $item, Player $player){
|
||||
public function getBreakTime(Item $item, Player $player){
|
||||
if(($player->gamemode & 0x01) === 0x01){
|
||||
return 0.20;
|
||||
}
|
||||
@ -49,7 +50,7 @@ class IronDoor extends Door{
|
||||
}
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
if($item->isPickaxe() >= 1){
|
||||
return array(
|
||||
array(Item\IRON_DOOR, 0, 1),
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
|
||||
class IronOre extends Solid{
|
||||
public function __construct(){
|
||||
@ -28,7 +29,7 @@ class IronOre extends Solid{
|
||||
$this->hardness = 15;
|
||||
}
|
||||
|
||||
public function getBreakTime(Item\Item $item, Player $player){
|
||||
public function getBreakTime(Item $item, Player $player){
|
||||
if(($player->gamemode & 0x01) === 0x01){
|
||||
return 0.20;
|
||||
}
|
||||
@ -44,7 +45,7 @@ class IronOre extends Solid{
|
||||
}
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
if($item->isPickaxe() >= 3){
|
||||
return array(
|
||||
array(IRON_ORE, 0, 1),
|
||||
|
@ -21,13 +21,14 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
|
||||
class JungleWoodStairs extends Stair{
|
||||
public function __construct($meta = 0){
|
||||
parent::__construct(JUNGLE_WOOD_STAIRS, $meta, "Jungle Wood Stairs");
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
return array(
|
||||
array($this->id, 0, 1),
|
||||
);
|
||||
|
@ -21,6 +21,8 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
use PocketMine\ServerAPI as ServerAPI;
|
||||
|
||||
class Ladder extends Transparent{
|
||||
public function __construct($meta = 0){
|
||||
@ -30,7 +32,7 @@ class Ladder extends Transparent{
|
||||
$this->hardness = 2;
|
||||
}
|
||||
|
||||
public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
if($target->isTransparent === false){
|
||||
$faces = array(
|
||||
2 => 2,
|
||||
@ -52,7 +54,7 @@ class Ladder extends Transparent{
|
||||
public function onUpdate($type){
|
||||
if($type === BLOCK_UPDATE_NORMAL){
|
||||
/*if($this->getSide(0)->getID() === AIR){ //Replace with common break method
|
||||
ServerAPI::request()->api->entity->drop($this, Item\Item::get(LADDER, 0, 1));
|
||||
ServerAPI::request()->api->entity->drop($this, Item::get(LADDER, 0, 1));
|
||||
$this->level->setBlock($this, new Air(), true, true, true);
|
||||
return BLOCK_UPDATE_NORMAL;
|
||||
}*/
|
||||
@ -61,7 +63,7 @@ class Ladder extends Transparent{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
return array(
|
||||
array($this->id, 0, 1),
|
||||
);
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
|
||||
class Lapis extends Solid{
|
||||
public function __construct(){
|
||||
@ -28,7 +29,7 @@ class Lapis extends Solid{
|
||||
$this->hardness = 15;
|
||||
}
|
||||
|
||||
public function getBreakTime(Item\Item $item, Player $player){
|
||||
public function getBreakTime(Item $item, Player $player){
|
||||
if(($player->gamemode & 0x01) === 0x01){
|
||||
return 0.20;
|
||||
}
|
||||
@ -44,7 +45,7 @@ class Lapis extends Solid{
|
||||
}
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
if($item->isPickaxe() >= 3){
|
||||
return array(
|
||||
array(LAPIS_BLOCK, 0, 1),
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
|
||||
class LapisOre extends Solid{
|
||||
public function __construct(){
|
||||
@ -28,7 +29,7 @@ class LapisOre extends Solid{
|
||||
$this->hardness = 15;
|
||||
}
|
||||
|
||||
public function getBreakTime(Item\Item $item, Player $player){
|
||||
public function getBreakTime(Item $item, Player $player){
|
||||
if(($player->gamemode & 0x01) === 0x01){
|
||||
return 0.20;
|
||||
}
|
||||
@ -44,7 +45,7 @@ class LapisOre extends Solid{
|
||||
}
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
if($item->isPickaxe() >= 3){
|
||||
return array(
|
||||
array(Item\DYE, 4, mt_rand(4, 8)),
|
||||
|
@ -21,6 +21,9 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
use PocketMine\ServerAPI as ServerAPI;
|
||||
use PocketMine\Level\Position as Position;
|
||||
|
||||
class Lava extends Liquid{
|
||||
public function __construct($meta = 0){
|
||||
@ -28,7 +31,7 @@ class Lava extends Liquid{
|
||||
$this->hardness = 0;
|
||||
}
|
||||
|
||||
public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
$ret = $this->level->setBlock($this, $this, true, false, true);
|
||||
ServerAPI::request()->api->block->scheduleBlockUpdate(clone $this, 40, BLOCK_UPDATE_NORMAL);
|
||||
|
||||
@ -99,7 +102,7 @@ class Lava extends Liquid{
|
||||
if($level !== 0x07){
|
||||
if($down instanceof Air || $down instanceof Lava){
|
||||
$this->level->setBlock($down, new Lava(0x01), false, false, true);
|
||||
ServerAPI::request()->api->block->scheduleBlockUpdate(new Level\Position($down, 0, 0, $this->level), 40, BLOCK_UPDATE_NORMAL);
|
||||
ServerAPI::request()->api->block->scheduleBlockUpdate(new Position($down, 0, 0, $this->level), 40, BLOCK_UPDATE_NORMAL);
|
||||
} else{
|
||||
for($side = 2; $side <= 5; ++$side){
|
||||
$b = $this->getSide($side);
|
||||
@ -107,7 +110,7 @@ class Lava extends Liquid{
|
||||
|
||||
} elseif($b->isFlowable === true){
|
||||
$this->level->setBlock($b, new Lava(min($level + 2, 7)), false, false, true);
|
||||
ServerAPI::request()->api->block->scheduleBlockUpdate(new Level\Position($b, 0, 0, $this->level), 40, BLOCK_UPDATE_NORMAL);
|
||||
ServerAPI::request()->api->block->scheduleBlockUpdate(new Position($b, 0, 0, $this->level), 40, BLOCK_UPDATE_NORMAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -121,7 +124,7 @@ class Lava extends Liquid{
|
||||
if($tlevel != 0x00){
|
||||
for($s = 0; $s <= 5; $s++){
|
||||
$ssb = $sb->getSide($s);
|
||||
ServerAPI::request()->api->block->scheduleBlockUpdate(new Level\Position($ssb, 0, 0, $this->level), 40, BLOCK_UPDATE_NORMAL);
|
||||
ServerAPI::request()->api->block->scheduleBlockUpdate(new Position($ssb, 0, 0, $this->level), 40, BLOCK_UPDATE_NORMAL);
|
||||
}
|
||||
$this->level->setBlock($sb, new Air(), false, false, true);
|
||||
}
|
||||
@ -132,7 +135,7 @@ class Lava extends Liquid{
|
||||
if($tlevel != 0x00){
|
||||
for($s = 0; $s <= 5; $s++){
|
||||
$ssb = $sb->getSide($s);
|
||||
ServerAPI::request()->api->block->scheduleBlockUpdate(new Level\Position($ssb, 0, 0, $this->level), 40, BLOCK_UPDATE_NORMAL);
|
||||
ServerAPI::request()->api->block->scheduleBlockUpdate(new Position($ssb, 0, 0, $this->level), 40, BLOCK_UPDATE_NORMAL);
|
||||
}
|
||||
$this->level->setBlock($b, new Air(), false, false, true);
|
||||
}
|
||||
|
@ -21,6 +21,9 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\ServerAPI as ServerAPI;
|
||||
use PocketMine\Item\Item as Item;
|
||||
use PocketMine\Item\APPLE as APPLE;
|
||||
|
||||
class Leaves extends Transparent{
|
||||
const OAK = 0;
|
||||
@ -122,11 +125,11 @@ class Leaves extends Transparent{
|
||||
$this->level->setBlock($this, new Air(), false, false, true);
|
||||
if(mt_rand(1, 20) === 1){ //Saplings
|
||||
//TODO
|
||||
ServerAPI::request()->api->entity->drop($this, Item\Item::get(SAPLING, $this->meta & 0x03, 1));
|
||||
ServerAPI::request()->api->entity->drop($this, Item::get(SAPLING, $this->meta & 0x03, 1));
|
||||
}
|
||||
if(($this->meta & 0x03) === self::OAK and mt_rand(1, 200) === 1){ //Apples
|
||||
//TODO
|
||||
ServerAPI::request()->api->entity->drop($this, Item\Item::get(APPLE, 0, 1));
|
||||
ServerAPI::request()->api->entity->drop($this, Item::get(APPLE, 0, 1));
|
||||
}
|
||||
|
||||
return BLOCK_UPDATE_NORMAL;
|
||||
@ -137,12 +140,12 @@ class Leaves extends Transparent{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
$this->meta |= 0x04;
|
||||
$this->level->setBlock($this, $this, true, false, true);
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
$drops = array();
|
||||
if($item->isShears()){
|
||||
$drops[] = array(LEAVES, $this->meta & 0x03, 1);
|
||||
@ -151,7 +154,7 @@ class Leaves extends Transparent{
|
||||
$drops[] = array(Item\SAPLING, $this->meta & 0x03, 1);
|
||||
}
|
||||
if(($this->meta & 0x03) === self::OAK and mt_rand(1, 200) === 1){ //Apples
|
||||
$drops[] = array(Item\APPLE, 0, 1);
|
||||
$drops[] = array(APPLE, 0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
|
||||
class LitPumpkin extends Solid{
|
||||
public function __construct(){
|
||||
@ -28,7 +29,7 @@ class LitPumpkin extends Solid{
|
||||
$this->hardness = 5;
|
||||
}
|
||||
|
||||
public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
$faces = array(
|
||||
0 => 4,
|
||||
1 => 2,
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
|
||||
class Melon extends Transparent{
|
||||
public function __construct(){
|
||||
@ -28,7 +29,7 @@ class Melon extends Transparent{
|
||||
$this->hardness = 5;
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
return array(
|
||||
array(Item\MELON_SLICE, 0, mt_rand(3, 7)),
|
||||
);
|
||||
|
@ -21,6 +21,8 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
use PocketMine\ServerAPI as ServerAPI;
|
||||
|
||||
class MelonStem extends Flowable{
|
||||
public function __construct($meta = 0){
|
||||
@ -29,7 +31,7 @@ class MelonStem extends Flowable{
|
||||
$this->hardness = 0;
|
||||
}
|
||||
|
||||
public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
$down = $this->getSide(0);
|
||||
if($down->getID() === FARMLAND){
|
||||
$this->level->setBlock($block, $this, true, false, true);
|
||||
@ -44,7 +46,7 @@ class MelonStem extends Flowable{
|
||||
if($type === BLOCK_UPDATE_NORMAL){
|
||||
if($this->getSide(0)->isTransparent === true){ //Replace with common break method
|
||||
//TODO
|
||||
//ServerAPI::request()->api->entity->drop($this, Item\Item::get(MELON_SEEDS, 0, mt_rand(0, 2)));
|
||||
//ServerAPI::request()->api->entity->drop($this, Item::get(MELON_SEEDS, 0, mt_rand(0, 2)));
|
||||
$this->level->setBlock($this, new Air(), false, false, true);
|
||||
|
||||
return BLOCK_UPDATE_NORMAL;
|
||||
@ -77,7 +79,7 @@ class MelonStem extends Flowable{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function onActivate(Item\Item $item, Player $player){
|
||||
public function onActivate(Item $item, Player $player){
|
||||
if($item->getID() === Item\DYE and $item->getMetadata() === 0x0F){ //Bonemeal
|
||||
$this->meta = 0x07;
|
||||
$this->level->setBlock($this, $this, true, false, true);
|
||||
@ -91,7 +93,7 @@ class MelonStem extends Flowable{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
return array(
|
||||
array(Item\MELON_SEEDS, 0, mt_rand(0, 2)),
|
||||
);
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
|
||||
class MossStone extends Solid{
|
||||
public function __construct($meta){
|
||||
@ -28,7 +29,7 @@ class MossStone extends Solid{
|
||||
$this->hardness = 30;
|
||||
}
|
||||
|
||||
public function getBreakTime(Item\Item $item, Player $player){
|
||||
public function getBreakTime(Item $item, Player $player){
|
||||
if(($player->gamemode & 0x01) === 0x01){
|
||||
return 0.20;
|
||||
}
|
||||
@ -48,7 +49,7 @@ class MossStone extends Solid{
|
||||
}
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
if($item->isPickaxe() >= 1){
|
||||
return array(
|
||||
array(MOSS_STONE, $this->meta, 1),
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
|
||||
class NetherBricks extends Solid{
|
||||
public function __construct(){
|
||||
@ -28,7 +29,7 @@ class NetherBricks extends Solid{
|
||||
$this->hardness = 30;
|
||||
}
|
||||
|
||||
public function getBreakTime(Item\Item $item, Player $player){
|
||||
public function getBreakTime(Item $item, Player $player){
|
||||
if(($player->gamemode & 0x01) === 0x01){
|
||||
return 0.20;
|
||||
}
|
||||
@ -48,7 +49,7 @@ class NetherBricks extends Solid{
|
||||
}
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
if($item->isPickaxe() >= 1){
|
||||
return array(
|
||||
array(NETHER_BRICKS, 0, 1),
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
|
||||
class Netherrack extends Solid{
|
||||
public function __construct(){
|
||||
@ -28,7 +29,7 @@ class Netherrack extends Solid{
|
||||
$this->hardness = 2;
|
||||
}
|
||||
|
||||
public function getBreakTime(Item\Item $item, Player $player){
|
||||
public function getBreakTime(Item $item, Player $player){
|
||||
if(($player->gamemode & 0x01) === 0x01){
|
||||
return 0.20;
|
||||
}
|
||||
@ -48,7 +49,7 @@ class Netherrack extends Solid{
|
||||
}
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
if($item->isPickaxe() >= 1){
|
||||
return array(
|
||||
array(NETHERRACK, 0, 1),
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
|
||||
class Obsidian extends Solid{
|
||||
public function __construct(){
|
||||
@ -28,7 +29,7 @@ class Obsidian extends Solid{
|
||||
$this->hardness = 6000;
|
||||
}
|
||||
|
||||
public function getBreakTime(Item\Item $item, Player $player){
|
||||
public function getBreakTime(Item $item, Player $player){
|
||||
if(($player->gamemode & 0x01) === 0x01){
|
||||
return 0.20;
|
||||
}
|
||||
@ -39,7 +40,7 @@ class Obsidian extends Solid{
|
||||
}
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
if($item->isPickaxe() >= 5){
|
||||
return array(
|
||||
array(OBSIDIAN, 0, 1),
|
||||
|
@ -21,6 +21,9 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
use PocketMine\ServerAPI as ServerAPI;
|
||||
use PocketMine\Item\POTATO as POTATO;
|
||||
|
||||
class Potato extends Flowable{
|
||||
public function __construct($meta = 0){
|
||||
@ -29,7 +32,7 @@ class Potato extends Flowable{
|
||||
$this->hardness = 0;
|
||||
}
|
||||
|
||||
public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
$down = $this->getSide(0);
|
||||
if($down->getID() === FARMLAND){
|
||||
$this->level->setBlock($block, $this, true, false, true);
|
||||
@ -40,7 +43,7 @@ class Potato extends Flowable{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function onActivate(Item\Item $item, Player $player){
|
||||
public function onActivate(Item $item, Player $player){
|
||||
if($item->getID() === Item\DYE and $item->getMetadata() === 0x0F){ //Bonemeal
|
||||
$this->meta = 0x07;
|
||||
$this->level->setBlock($this, $this, true, false, true);
|
||||
@ -58,7 +61,7 @@ class Potato extends Flowable{
|
||||
if($type === BLOCK_UPDATE_NORMAL){
|
||||
if($this->getSide(0)->isTransparent === true){ //Replace with common break method
|
||||
//TODO
|
||||
//ServerAPI::request()->api->entity->drop($this, Item\Item::get(POTATO, 0, 1));
|
||||
//ServerAPI::request()->api->entity->drop($this, Item::get(POTATO, 0, 1));
|
||||
$this->level->setBlock($this, new Air(), false, false, true);
|
||||
|
||||
return BLOCK_UPDATE_NORMAL;
|
||||
@ -79,12 +82,12 @@ class Potato extends Flowable{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
$drops = array();
|
||||
if($this->meta >= 0x07){
|
||||
$drops[] = array(Item\POTATO, 0, mt_rand(1, 4));
|
||||
$drops[] = array(POTATO, 0, mt_rand(1, 4));
|
||||
} else{
|
||||
$drops[] = array(Item\POTATO, 0, 1);
|
||||
$drops[] = array(POTATO, 0, 1);
|
||||
}
|
||||
|
||||
return $drops;
|
||||
|
@ -21,6 +21,8 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
use PocketMine\ServerAPI as ServerAPI;
|
||||
|
||||
class PumpkinStem extends Flowable{
|
||||
public function __construct($meta = 0){
|
||||
@ -29,7 +31,7 @@ class PumpkinStem extends Flowable{
|
||||
$this->hardness = 0;
|
||||
}
|
||||
|
||||
public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
$down = $this->getSide(0);
|
||||
if($down->getID() === FARMLAND){
|
||||
$this->level->setBlock($block, $this, true, false, true);
|
||||
@ -44,7 +46,7 @@ class PumpkinStem extends Flowable{
|
||||
if($type === BLOCK_UPDATE_NORMAL){
|
||||
if($this->getSide(0)->isTransparent === true){ //Replace with common break method
|
||||
//TODO
|
||||
//ServerAPI::request()->api->entity->drop($this, Item\Item::get(PUMPKIN_SEEDS, 0, mt_rand(0, 2)));
|
||||
//ServerAPI::request()->api->entity->drop($this, Item::get(PUMPKIN_SEEDS, 0, mt_rand(0, 2)));
|
||||
$this->level->setBlock($this, new Air(), false, false, true);
|
||||
|
||||
return BLOCK_UPDATE_NORMAL;
|
||||
@ -77,7 +79,7 @@ class PumpkinStem extends Flowable{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function onActivate(Item\Item $item, Player $player){
|
||||
public function onActivate(Item $item, Player $player){
|
||||
if($item->getID() === Item\DYE and $item->getMetadata() === 0x0F){ //Bonemeal
|
||||
$this->meta = 0x07;
|
||||
$this->level->setBlock($this, $this, true, false, true);
|
||||
@ -91,7 +93,7 @@ class PumpkinStem extends Flowable{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
return array(
|
||||
array(Item\PUMPKIN_SEEDS, 0, mt_rand(0, 2)),
|
||||
);
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
|
||||
class Quartz extends Solid{
|
||||
public function __construct($meta = 0){
|
||||
@ -34,7 +35,7 @@ class Quartz extends Solid{
|
||||
$this->name = $names[$this->meta & 0x03];
|
||||
}
|
||||
|
||||
public function getBreakTime(Item\Item $item, Player $player){
|
||||
public function getBreakTime(Item $item, Player $player){
|
||||
if(($player->gamemode & 0x01) === 0x01){
|
||||
return 0.20;
|
||||
}
|
||||
@ -54,7 +55,7 @@ class Quartz extends Solid{
|
||||
}
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
if($item->isPickaxe() >= 1){
|
||||
return array(
|
||||
array(QUARTZ_BLOCK, $this->meta & 0x03, 1),
|
||||
|
@ -21,6 +21,8 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\ServerAPI as ServerAPI;
|
||||
use PocketMine\Item\Item as Item;
|
||||
|
||||
class RedMushroom extends Flowable{
|
||||
public function __construct(){
|
||||
@ -32,7 +34,7 @@ class RedMushroom extends Flowable{
|
||||
if($type === BLOCK_UPDATE_NORMAL){
|
||||
if($this->getSide(0)->isTransparent === true){ //Replace with common break method
|
||||
//TODO
|
||||
//ServerAPI::request()->api->entity->drop($this, Item\Item::get($this->id));
|
||||
//ServerAPI::request()->api->entity->drop($this, Item::get($this->id));
|
||||
$this->level->setBlock($this, new Air(), false);
|
||||
|
||||
return BLOCK_UPDATE_NORMAL;
|
||||
@ -42,7 +44,7 @@ class RedMushroom extends Flowable{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
$down = $this->getSide(0);
|
||||
if($down->isTransparent === false){
|
||||
$this->level->setBlock($block, $this, true, false, true);
|
||||
|
@ -21,6 +21,8 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Block\Block as Block;
|
||||
use PocketMine\Item\Item as Item;
|
||||
|
||||
class RedstoneOre extends Solid{
|
||||
public function __construct(){
|
||||
@ -39,7 +41,7 @@ class RedstoneOre extends Solid{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
if($item->isPickaxe() >= 2){
|
||||
return array(
|
||||
array(Redstone\REDSTONE_DUST, 0, mt_rand(4, 5)),
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
|
||||
class Sandstone extends Solid{
|
||||
public function __construct($meta = 0){
|
||||
@ -34,7 +35,7 @@ class Sandstone extends Solid{
|
||||
$this->hardness = 4;
|
||||
}
|
||||
|
||||
public function getBreakTime(Item\Item $item, Player $player){
|
||||
public function getBreakTime(Item $item, Player $player){
|
||||
if(($player->gamemode & 0x01) === 0x01){
|
||||
return 0.20;
|
||||
}
|
||||
@ -54,7 +55,7 @@ class Sandstone extends Solid{
|
||||
}
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
if($item->isPickaxe() >= 1){
|
||||
return array(
|
||||
array(SANDSTONE, $this->meta & 0x03, 1),
|
||||
|
@ -21,6 +21,10 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
use PocketMine\Level\Generator\Object\Tree as Tree;
|
||||
use PocketMine\Utils\Random as Random;
|
||||
use PocketMine\ServerAPI as ServerAPI;
|
||||
|
||||
class Sapling extends Flowable{
|
||||
const OAK = 0;
|
||||
@ -42,7 +46,7 @@ class Sapling extends Flowable{
|
||||
$this->hardness = 0;
|
||||
}
|
||||
|
||||
public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
$down = $this->getSide(0);
|
||||
if($down->getID() === GRASS or $down->getID() === DIRT or $down->getID() === FARMLAND){
|
||||
$this->level->setBlock($block, $this, true, false, true);
|
||||
@ -53,9 +57,9 @@ class Sapling extends Flowable{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function onActivate(Item\Item $item, Player $player){
|
||||
public function onActivate(Item $item, Player $player){
|
||||
if($item->getID() === Item\DYE and $item->getMetadata() === 0x0F){ //Bonemeal
|
||||
Level\Generator\Object\Tree::growTree($this->level, $this, new Utils\Random(), $this->meta & 0x03);
|
||||
Tree::growTree($this->level, $this, new Random(), $this->meta & 0x03);
|
||||
if(($player->gamemode & 0x01) === 0){
|
||||
$item->count--;
|
||||
}
|
||||
@ -70,7 +74,7 @@ class Sapling extends Flowable{
|
||||
if($type === BLOCK_UPDATE_NORMAL){
|
||||
if($this->getSide(0)->isTransparent === true){ //Replace with common break method
|
||||
//TODO
|
||||
//ServerAPI::request()->api->entity->drop($this, Item\Item::get($this->id));
|
||||
//ServerAPI::request()->api->entity->drop($this, Item::get($this->id));
|
||||
$this->level->setBlock($this, new Air(), false, false, true);
|
||||
|
||||
return BLOCK_UPDATE_NORMAL;
|
||||
@ -78,7 +82,7 @@ class Sapling extends Flowable{
|
||||
} elseif($type === BLOCK_UPDATE_RANDOM){ //Growth
|
||||
if(mt_rand(1, 7) === 1){
|
||||
if(($this->meta & 0x08) === 0x08){
|
||||
Level\Generator\Object\Tree::growTree($this->level, $this, new Utils\Random(), $this->meta & 0x03);
|
||||
Tree::growTree($this->level, $this, new Random(), $this->meta & 0x03);
|
||||
} else{
|
||||
$this->meta |= 0x08;
|
||||
$this->level->setBlock($this, $this, true, false, true);
|
||||
@ -93,7 +97,7 @@ class Sapling extends Flowable{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
return array(
|
||||
array($this->id, $this->meta & 0x03, 1),
|
||||
);
|
||||
|
@ -21,6 +21,9 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
use PocketMine\Block\Block as Block;
|
||||
use PocketMine\ServerAPI as ServerAPI;
|
||||
|
||||
class SignPost extends Transparent{
|
||||
public function __construct($meta = 0){
|
||||
@ -30,7 +33,7 @@ class SignPost extends Transparent{
|
||||
$this->hardness = 5;
|
||||
}
|
||||
|
||||
public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
if($face !== 0){
|
||||
$faces = array(
|
||||
2 => 2,
|
||||
@ -58,7 +61,7 @@ class SignPost extends Transparent{
|
||||
if($type === BLOCK_UPDATE_NORMAL){
|
||||
if($this->getSide(0)->getID() === AIR){ //Replace with common break method
|
||||
//TODO
|
||||
//ServerAPI::request()->api->entity->drop($this, Item\Item::get(SIGN, 0, 1));
|
||||
//ServerAPI::request()->api->entity->drop($this, Item::get(SIGN, 0, 1));
|
||||
$this->level->setBlock($this, new Air(), true, true, true);
|
||||
|
||||
return BLOCK_UPDATE_NORMAL;
|
||||
@ -68,13 +71,13 @@ class SignPost extends Transparent{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function onBreak(Item\Item $item, Player $player){
|
||||
public function onBreak(Item $item, Player $player){
|
||||
$this->level->setBlock($this, new Air(), true, true, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
return array(
|
||||
array(Item\SIGN, 0, 1),
|
||||
);
|
||||
|
@ -21,6 +21,8 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
use PocketMine\Block\Block as Block;
|
||||
|
||||
class Slab extends Transparent{
|
||||
public function __construct($meta = 0){
|
||||
@ -44,7 +46,7 @@ class Slab extends Transparent{
|
||||
$this->hardness = 30;
|
||||
}
|
||||
|
||||
public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
$this->meta &= 0x07;
|
||||
if($face === 0){
|
||||
if($target->getID() === SLAB and ($target->getMetadata() & 0x08) === 0x08 and ($target->getMetadata() & 0x07) === ($this->meta & 0x07)){
|
||||
@ -93,7 +95,7 @@ class Slab extends Transparent{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getBreakTime(Item\Item $item, Player $player){
|
||||
public function getBreakTime(Item $item, Player $player){
|
||||
if(($player->gamemode & 0x01) === 0x01){
|
||||
return 0.20;
|
||||
}
|
||||
@ -113,7 +115,7 @@ class Slab extends Transparent{
|
||||
}
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
if($item->isPickaxe() >= 1){
|
||||
return array(
|
||||
array($this->id, $this->meta & 0x07, 1),
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
|
||||
class SnowLayer extends Flowable{
|
||||
public function __construct($meta = 0){
|
||||
@ -31,7 +32,7 @@ class SnowLayer extends Flowable{
|
||||
$this->hardness = 0.5;
|
||||
}
|
||||
|
||||
public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
$down = $this->getSide(0);
|
||||
if($down instanceof Solid){
|
||||
$this->level->setBlock($block, $this, true, false, true);
|
||||
@ -54,7 +55,7 @@ class SnowLayer extends Flowable{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
if($item->isShovel() !== false){
|
||||
return array(
|
||||
array(Item\SNOWBALL, 0, 1),
|
||||
|
@ -21,13 +21,14 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
|
||||
class SpruceWoodStairs extends Stair{
|
||||
public function __construct($meta = 0){
|
||||
parent::__construct(SPRUCE_WOOD_STAIRS, $meta, "Spruce Wood Stairs");
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
return array(
|
||||
array($this->id, 0, 1),
|
||||
);
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
|
||||
class Stair extends Transparent{
|
||||
|
||||
@ -34,7 +35,7 @@ class Stair extends Transparent{
|
||||
$this->hardness = 30;
|
||||
}
|
||||
|
||||
public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
$faces = array(
|
||||
0 => 0,
|
||||
1 => 2,
|
||||
@ -50,7 +51,7 @@ class Stair extends Transparent{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
if($item->isPickaxe() >= 1){
|
||||
return array(
|
||||
array($this->id, 0, 1),
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
|
||||
class Stone extends Solid{
|
||||
public function __construct(){
|
||||
@ -28,7 +29,7 @@ class Stone extends Solid{
|
||||
$this->hardness = 30;
|
||||
}
|
||||
|
||||
public function getBreakTime(Item\Item $item, Player $player){
|
||||
public function getBreakTime(Item $item, Player $player){
|
||||
if(($player->gamemode & 0x01) === 0x01){
|
||||
return 0.20;
|
||||
}
|
||||
@ -48,7 +49,7 @@ class Stone extends Solid{
|
||||
}
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
if($item->isPickaxe() >= 1){
|
||||
return array(
|
||||
array(COBBLESTONE, 0, 1),
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
|
||||
class StoneBricks extends Solid{
|
||||
public function __construct($meta = 0){
|
||||
@ -35,7 +36,7 @@ class StoneBricks extends Solid{
|
||||
$this->hardness = 30;
|
||||
}
|
||||
|
||||
public function getBreakTime(Item\Item $item, Player $player){
|
||||
public function getBreakTime(Item $item, Player $player){
|
||||
if(($player->gamemode & 0x01) === 0x01){
|
||||
return 0.20;
|
||||
}
|
||||
@ -55,7 +56,7 @@ class StoneBricks extends Solid{
|
||||
}
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
if($item->isPickaxe() >= 1){
|
||||
return array(
|
||||
array(STONE_BRICKS, $this->meta & 0x03, 1),
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
|
||||
class Stonecutter extends Solid{
|
||||
public function __construct($meta = 0){
|
||||
@ -28,13 +29,13 @@ class Stonecutter extends Solid{
|
||||
$this->isActivable = true;
|
||||
}
|
||||
|
||||
public function onActivate(Item\Item $item, Player $player){
|
||||
public function onActivate(Item $item, Player $player){
|
||||
$player->toCraft[-1] = 2;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
return array(
|
||||
array($this->id, 0, 1),
|
||||
);
|
||||
|
@ -21,6 +21,10 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
use PocketMine\Item\SUGARCANE as SUGARCANE;
|
||||
use PocketMine\Math\Vector3 as Vector3;
|
||||
use PocketMine\ServerAPI as ServerAPI;
|
||||
|
||||
class Sugarcane extends Flowable{
|
||||
public function __construct($meta = 0){
|
||||
@ -28,17 +32,17 @@ class Sugarcane extends Flowable{
|
||||
$this->hardness = 0;
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
return array(
|
||||
array(Item\SUGARCANE, 0, 1),
|
||||
array(SUGARCANE, 0, 1),
|
||||
);
|
||||
}
|
||||
|
||||
public function onActivate(Item\Item $item, Player $player){
|
||||
public function onActivate(Item $item, Player $player){
|
||||
if($item->getID() === DYE and $item->getMetadata() === 0x0F){ //Bonemeal
|
||||
if($this->getSide(0)->getID() !== SUGARCANE_BLOCK){
|
||||
for($y = 1; $y < 3; ++$y){
|
||||
$b = $this->level->getBlock(new Math\Vector3($this->x, $this->y + $y, $this->z));
|
||||
$b = $this->level->getBlock(new Vector3($this->x, $this->y + $y, $this->z));
|
||||
if($b->getID() === AIR){
|
||||
$this->level->setBlock($b, new Sugarcane(), true, false, true);
|
||||
break;
|
||||
@ -62,7 +66,7 @@ class Sugarcane extends Flowable{
|
||||
$down = $this->getSide(0);
|
||||
if($down->isTransparent === true and $down->getID() !== SUGARCANE_BLOCK){ //Replace with common break method
|
||||
//TODO
|
||||
//ServerAPI::request()->api->entity->drop($this, Item\Item::get(SUGARCANE));
|
||||
//ServerAPI::request()->api->entity->drop($this, Item::get(SUGARCANE));
|
||||
$this->level->setBlock($this, new Air(), false, false, true);
|
||||
|
||||
return BLOCK_UPDATE_NORMAL;
|
||||
@ -71,7 +75,7 @@ class Sugarcane extends Flowable{
|
||||
if($this->getSide(0)->getID() !== SUGARCANE_BLOCK){
|
||||
if($this->meta === 0x0F){
|
||||
for($y = 1; $y < 3; ++$y){
|
||||
$b = $this->level->getBlock(new Math\Vector3($this->x, $this->y + $y, $this->z));
|
||||
$b = $this->level->getBlock(new Vector3($this->x, $this->y + $y, $this->z));
|
||||
if($b->getID() === AIR){
|
||||
$this->level->setBlock($b, new Sugarcane(), true, false, true);
|
||||
break;
|
||||
@ -91,7 +95,7 @@ class Sugarcane extends Flowable{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
$down = $this->getSide(0);
|
||||
if($down->getID() === SUGARCANE_BLOCK){
|
||||
$this->level->setBlock($block, new Sugarcane(), true, false, true);
|
||||
|
@ -21,6 +21,8 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
use PocketMine\ServerAPI as ServerAPI;
|
||||
|
||||
class TNT extends Solid{
|
||||
public function __construct(){
|
||||
@ -29,7 +31,7 @@ class TNT extends Solid{
|
||||
$this->isActivable = true;
|
||||
}
|
||||
|
||||
public function onActivate(Item\Item $item, Player $player){
|
||||
public function onActivate(Item $item, Player $player){
|
||||
if($item->getID() === Item\FLINT_STEEL){
|
||||
if(($player->gamemode & 0x01) === 0){
|
||||
$item->useOn($this);
|
||||
|
@ -21,6 +21,8 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\ServerAPI as ServerAPI;
|
||||
use PocketMine\Item\Item as Item;
|
||||
|
||||
class Torch extends Flowable{
|
||||
public function __construct($meta = 0){
|
||||
@ -43,7 +45,7 @@ class Torch extends Flowable{
|
||||
|
||||
if($this->getSide($faces[$side])->isTransparent === true and !($side === 0 and $this->getSide(0)->getID() === FENCE)){ //Replace with common break method
|
||||
//TODO
|
||||
//ServerAPI::request()->api->entity->drop($this, Item\Item::get($this->id, 0, 1));
|
||||
//ServerAPI::request()->api->entity->drop($this, Item::get($this->id, 0, 1));
|
||||
$this->level->setBlock($this, new Air(), true, false, true);
|
||||
|
||||
return BLOCK_UPDATE_NORMAL;
|
||||
@ -53,7 +55,7 @@ class Torch extends Flowable{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
if($target->isTransparent === false and $face !== 0){
|
||||
$faces = array(
|
||||
1 => 5,
|
||||
@ -76,7 +78,7 @@ class Torch extends Flowable{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
return array(
|
||||
array($this->id, 0, 1),
|
||||
);
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
|
||||
class Trapdoor extends Transparent{
|
||||
public function __construct($meta = 0){
|
||||
@ -34,7 +35,7 @@ class Trapdoor extends Transparent{
|
||||
$this->hardness = 15;
|
||||
}
|
||||
|
||||
public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
if(($target->isTransparent === false or $target->getID() === SLAB) and $face !== 0 and $face !== 1){
|
||||
$faces = array(
|
||||
2 => 0,
|
||||
@ -54,13 +55,13 @@ class Trapdoor extends Transparent{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
return array(
|
||||
array($this->id, 0, 1),
|
||||
);
|
||||
}
|
||||
|
||||
public function onActivate(Item\Item $item, Player $player){
|
||||
public function onActivate(Item $item, Player $player){
|
||||
$this->meta ^= 0x04;
|
||||
$this->level->setBlock($this, $this, true, false, true);
|
||||
|
||||
|
@ -21,6 +21,8 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
use PocketMine\ServerAPI as ServerAPI;
|
||||
|
||||
class Water extends Liquid{
|
||||
public function __construct($meta = 0){
|
||||
@ -28,7 +30,7 @@ class Water extends Liquid{
|
||||
$this->hardness = 500;
|
||||
}
|
||||
|
||||
public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
$ret = $this->level->setBlock($this, $this, true, false, true);
|
||||
ServerAPI::request()->api->block->scheduleBlockUpdate(clone $this, 10, BLOCK_UPDATE_NORMAL);
|
||||
|
||||
|
@ -21,6 +21,8 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
use PocketMine\ServerAPI as ServerAPI;
|
||||
|
||||
class Wheat extends Flowable{
|
||||
public function __construct($meta = 0){
|
||||
@ -29,7 +31,7 @@ class Wheat extends Flowable{
|
||||
$this->hardness = 0;
|
||||
}
|
||||
|
||||
public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
$down = $this->getSide(0);
|
||||
if($down->getID() === FARMLAND){
|
||||
$this->level->setBlock($block, $this, true, false, true);
|
||||
@ -40,7 +42,7 @@ class Wheat extends Flowable{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function onActivate(Item\Item $item, Player $player){
|
||||
public function onActivate(Item $item, Player $player){
|
||||
if($item->getID() === Item\DYE and $item->getMetadata() === 0x0F){ //Bonemeal
|
||||
$this->meta = 0x07;
|
||||
$this->level->setBlock($this, $this, true, false, true);
|
||||
@ -58,7 +60,7 @@ class Wheat extends Flowable{
|
||||
if($type === BLOCK_UPDATE_NORMAL){
|
||||
if($this->getSide(0)->isTransparent === true){ //Replace with common break method
|
||||
//TODO
|
||||
//ServerAPI::request()->api->entity->drop($this, Item\Item::get(WHEAT_SEEDS, 0, 1));
|
||||
//ServerAPI::request()->api->entity->drop($this, Item::get(WHEAT_SEEDS, 0, 1));
|
||||
$this->level->setBlock($this, new Air(), false, false, true);
|
||||
|
||||
return BLOCK_UPDATE_NORMAL;
|
||||
@ -75,7 +77,7 @@ class Wheat extends Flowable{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
$drops = array();
|
||||
if($this->meta >= 0x07){
|
||||
$drops[] = array(Item\WHEAT, 0, 1);
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
|
||||
class Wood extends Solid{
|
||||
const OAK = 0;
|
||||
@ -40,7 +41,7 @@ class Wood extends Solid{
|
||||
$this->hardness = 10;
|
||||
}
|
||||
|
||||
public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
$faces = array(
|
||||
0 => 0,
|
||||
1 => 0,
|
||||
@ -56,7 +57,7 @@ class Wood extends Solid{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
return array(
|
||||
array($this->id, $this->meta & 0x03, 1),
|
||||
);
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
|
||||
class WoodDoor extends Door{
|
||||
public function __construct($meta = 0){
|
||||
@ -29,7 +30,7 @@ class WoodDoor extends Door{
|
||||
$this->hardness = 15;
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
return array(
|
||||
array(Item\WOODEN_DOOR, 0, 1),
|
||||
);
|
||||
|
@ -21,6 +21,8 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
use PocketMine\Block\Block as Block;
|
||||
|
||||
class WoodSlab extends Transparent{
|
||||
public function __construct($meta = 0){
|
||||
@ -40,7 +42,7 @@ class WoodSlab extends Transparent{
|
||||
$this->hardness = 15;
|
||||
}
|
||||
|
||||
public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
$this->meta &= 0x07;
|
||||
if($face === 0){
|
||||
if($target->getID() === WOOD_SLAB and ($target->getMetadata() & 0x08) === 0x08 and ($target->getMetadata() & 0x07) === ($this->meta & 0x07)){
|
||||
@ -89,7 +91,7 @@ class WoodSlab extends Transparent{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getBreakTime(Item\Item $item, Player $player){
|
||||
public function getBreakTime(Item $item, Player $player){
|
||||
if(($player->gamemode & 0x01) === 0x01){
|
||||
return 0.20;
|
||||
}
|
||||
@ -109,7 +111,7 @@ class WoodSlab extends Transparent{
|
||||
}
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
return array(
|
||||
array($this->id, $this->meta & 0x07, 1),
|
||||
);
|
||||
|
@ -21,13 +21,14 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
|
||||
class WoodStairs extends Stair{
|
||||
public function __construct($meta = 0){
|
||||
parent::__construct(WOOD_STAIRS, $meta, "Wood Stairs");
|
||||
}
|
||||
|
||||
public function getBreakTime(Item\Item $item, Player $player){
|
||||
public function getBreakTime(Item $item, Player $player){
|
||||
if(($player->gamemode & 0x01) === 0x01){
|
||||
return 0.20;
|
||||
}
|
||||
@ -47,7 +48,7 @@ class WoodStairs extends Stair{
|
||||
}
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
return array(
|
||||
array($this->id, 0, 1),
|
||||
);
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
|
||||
class Workbench extends Solid{
|
||||
public function __construct($meta = 0){
|
||||
@ -29,13 +30,13 @@ class Workbench extends Solid{
|
||||
$this->hardness = 15;
|
||||
}
|
||||
|
||||
public function onActivate(Item\Item $item, Player $player){
|
||||
public function onActivate(Item $item, Player $player){
|
||||
$player->toCraft[-1] = 1;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
public function getDrops(Item $item, Player $player){
|
||||
return array(
|
||||
array($this->id, 0, 1),
|
||||
);
|
||||
|
@ -26,6 +26,7 @@ use PocketMine\Block\Block as Block;
|
||||
use PocketMine\Block\Air as Air;
|
||||
use PocketMine\Block\Water as Water;
|
||||
use PocketMine\Block\Lava as Lava;
|
||||
use PocketMine\Block\Liquid as Liquid;
|
||||
|
||||
class Bucket extends Item{
|
||||
public function __construct($meta = 0, $count = 1){
|
||||
@ -36,7 +37,7 @@ class Bucket extends Item{
|
||||
|
||||
public function onActivate(Level $level, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
if($this->meta === AIR){
|
||||
if($target instanceof Block\Liquid){
|
||||
if($target instanceof Liquid){
|
||||
$level->setBlock($target, new Air(), true, false, true);
|
||||
if(($player->gamemode & 0x01) === 0){
|
||||
$this->meta = ($target instanceof Water) ? WATER : LAVA;
|
||||
|
@ -24,6 +24,7 @@ use PocketMine;
|
||||
use PocketMine\Level\Level as Level;
|
||||
use PocketMine\Block\Block as Block;
|
||||
use PocketMine\Block\Fire as Fire;
|
||||
use PocketMine\Block\Solid as Solid;
|
||||
|
||||
class FlintSteel extends Item{
|
||||
public function __construct($meta = 0, $count = 1){
|
||||
@ -37,7 +38,7 @@ class FlintSteel extends Item{
|
||||
$player->setSlot($player->slot, new Item(AIR, 0, 0));
|
||||
}
|
||||
|
||||
if($block->getID() === AIR and ($target instanceof Block\Solid)){
|
||||
if($block->getID() === AIR and ($target instanceof Solid)){
|
||||
$level->setBlock($block, new Fire(), true, false, true);
|
||||
return true;
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ class Level{
|
||||
public $nextSave;
|
||||
|
||||
/**
|
||||
* @var PMF\LevelFormat
|
||||
* @var PMFLevelFormat
|
||||
*/
|
||||
public $level;
|
||||
public $stopTime;
|
||||
|
Loading…
x
Reference in New Issue
Block a user