mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 08:17:34 +00:00
Used namespacer to identify moved files
This commit is contained in:
parent
a54d33957e
commit
028adce245
357
src/BlockAPI.php
357
src/BlockAPI.php
@ -28,6 +28,7 @@ use PocketMine\Level\Position as Position;
|
||||
use PocketMine\NBT\Tag\Compound as Compound;
|
||||
use PocketMine\NBT\Tag\Int as Int;
|
||||
use PocketMine\NBT\Tag\String as String;
|
||||
use PocketMine\Network\Protocol\UpdateBlockPacket as UpdateBlockPacket;
|
||||
use PocketMine\Tile\Sign as Sign;
|
||||
|
||||
class BlockAPI{
|
||||
@ -36,196 +37,196 @@ class BlockAPI{
|
||||
private $randomUpdates = array();
|
||||
public static $creative = array(
|
||||
//Building
|
||||
[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],
|
||||
[BRICKS, 0],
|
||||
[Item\Item::STONE, 0],
|
||||
[Item\Item::COBBLESTONE, 0],
|
||||
[Item\Item::STONE_BRICKS, 0],
|
||||
[Item\Item::STONE_BRICKS, 1],
|
||||
[Item\Item::STONE_BRICKS, 2],
|
||||
[Item\Item::MOSS_STONE, 0],
|
||||
[Item\Item::WOODEN_PLANKS, 0],
|
||||
[Item\Item::WOODEN_PLANKS, 1],
|
||||
[Item\Item::WOODEN_PLANKS, 2],
|
||||
[Item\Item::WOODEN_PLANKS, 3],
|
||||
[Item\Item::BRICKS, 0],
|
||||
|
||||
[DIRT, 0],
|
||||
[GRASS, 0],
|
||||
[Block\CLAY_BLOCK, 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],
|
||||
[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],
|
||||
[SANDSTONE_STAIRS, 0],
|
||||
[STONE_BRICK_STAIRS, 0],
|
||||
[Block\NETHER_BRICKS_STAIRS, 0],
|
||||
[Block\QUARTZ_STAIRS, 0],
|
||||
[SLAB, 0],
|
||||
[SLAB, 1],
|
||||
[Block\WOODEN_SLAB, 0],
|
||||
[Block\WOODEN_SLAB, 1],
|
||||
[Block\WOODEN_SLAB, 2],
|
||||
[Block\WOODEN_SLAB, 3],
|
||||
[SLAB, 3],
|
||||
[SLAB, 4],
|
||||
[SLAB, 5],
|
||||
[SLAB, 6],
|
||||
[Block\QUARTZ_BLOCK, 0],
|
||||
[Block\QUARTZ_BLOCK, 1],
|
||||
[Block\QUARTZ_BLOCK, 2],
|
||||
[Block\COAL_ORE, 0],
|
||||
[Block\IRON_ORE, 0],
|
||||
[Block\GOLD_ORE, 0],
|
||||
[Block\DIAMOND_ORE, 0],
|
||||
[Block\LAPIS_ORE, 0],
|
||||
[Block\REDSTONE_ORE, 0],
|
||||
[OBSIDIAN, 0],
|
||||
[ICE, 0],
|
||||
[Block\SNOW_BLOCK, 0],
|
||||
[Item\Item::DIRT, 0],
|
||||
[Item\Item::GRASS, 0],
|
||||
[Item\Item::CLAY_BLOCK, 0],
|
||||
[Item\Item::SANDSTONE, 0],
|
||||
[Item\Item::SANDSTONE, 1],
|
||||
[Item\Item::SANDSTONE, 2],
|
||||
[Item\Item::SAND, 0],
|
||||
[Item\Item::GRAVEL, 0],
|
||||
[Item\Item::TRUNK, 0],
|
||||
[Item\Item::TRUNK, 1],
|
||||
[Item\Item::TRUNK, 2],
|
||||
[Item\Item::TRUNK, 3],
|
||||
[Item\Item::NETHER_BRICKS, 0],
|
||||
[Item\Item::NETHERRACK, 0],
|
||||
[Item\Item::BEDROCK, 0],
|
||||
[Item\Item::COBBLESTONE_STAIRS, 0],
|
||||
[Item\Item::OAK_WOODEN_STAIRS, 0],
|
||||
[Item\Item::SPRUCE_WOODEN_STAIRS, 0],
|
||||
[Item\Item::BIRCH_WOODEN_STAIRS, 0],
|
||||
[Item\Item::JUNGLE_WOODEN_STAIRS, 0],
|
||||
[Item\Item::BRICK_STAIRS, 0],
|
||||
[Item\Item::SANDSTONE_STAIRS, 0],
|
||||
[Item\Item::STONE_BRICK_STAIRS, 0],
|
||||
[Item\Item::NETHER_BRICKS_STAIRS, 0],
|
||||
[Item\Item::QUARTZ_STAIRS, 0],
|
||||
[Item\Item::SLAB, 0],
|
||||
[Item\Item::SLAB, 1],
|
||||
[Item\Item::WOODEN_SLAB, 0],
|
||||
[Item\Item::WOODEN_SLAB, 1],
|
||||
[Item\Item::WOODEN_SLAB, 2],
|
||||
[Item\Item::WOODEN_SLAB, 3],
|
||||
[Item\Item::SLAB, 3],
|
||||
[Item\Item::SLAB, 4],
|
||||
[Item\Item::SLAB, 5],
|
||||
[Item\Item::SLAB, 6],
|
||||
[Item\Item::QUARTZ_BLOCK, 0],
|
||||
[Item\Item::QUARTZ_BLOCK, 1],
|
||||
[Item\Item::QUARTZ_BLOCK, 2],
|
||||
[Item\Item::COAL_ORE, 0],
|
||||
[Item\Item::IRON_ORE, 0],
|
||||
[Item\Item::GOLD_ORE, 0],
|
||||
[Item\Item::DIAMOND_ORE, 0],
|
||||
[Item\Item::LAPIS_ORE, 0],
|
||||
[Item\Item::REDSTONE_ORE, 0],
|
||||
[Item\Item::OBSIDIAN, 0],
|
||||
[Item\Item::ICE, 0],
|
||||
[Item\Item::SNOW_BLOCK, 0],
|
||||
|
||||
//Decoration
|
||||
[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],
|
||||
[GLASS, 0],
|
||||
[Block\GLOWSTONE_BLOCK, 0],
|
||||
[Block\NETHER_REACTOR, 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],
|
||||
[TRAPDOOR, 0],
|
||||
[FENCE, 0],
|
||||
[FENCE_GATE, 0],
|
||||
[Block\IRON_BARS, 0],
|
||||
[BED, 0],
|
||||
[BOOKSHELF, 0],
|
||||
[Block\PAINTING, 0],
|
||||
[WORKBENCH, 0],
|
||||
[STONECUTTER, 0],
|
||||
[CHEST, 0],
|
||||
[FURNACE, 0],
|
||||
[DANDELION, 0],
|
||||
[Block\CYAN_FLOWER, 0],
|
||||
[Block\BROWN_MUSHROOM, 0],
|
||||
[Block\RED_MUSHROOM, 0],
|
||||
[CACTUS, 0],
|
||||
[Block\MELON_BLOCK, 0],
|
||||
[PUMPKIN, 0],
|
||||
[Block\LIT_PUMPKIN, 0],
|
||||
[COBWEB, 0],
|
||||
[Block\HAY_BALE, 0],
|
||||
[Block\TALL_GRASS, 1],
|
||||
[Block\TALL_GRASS, 2],
|
||||
[Block\DEAD_BUSH, 0],
|
||||
[SAPLING, 0],
|
||||
[SAPLING, 1],
|
||||
[SAPLING, 2],
|
||||
[SAPLING, 3],
|
||||
[LEAVES, 0],
|
||||
[LEAVES, 1],
|
||||
[LEAVES, 2],
|
||||
[LEAVES, 3],
|
||||
[CAKE, 0],
|
||||
[Block\SIGN, 0],
|
||||
[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],
|
||||
[Item\Item::COBBLESTONE_WALL, 0],
|
||||
[Item\Item::COBBLESTONE_WALL, 1],
|
||||
[Item\Item::GOLD_BLOCK, 0],
|
||||
[Item\Item::IRON_BLOCK, 0],
|
||||
[Item\Item::DIAMOND_BLOCK, 0],
|
||||
[Item\Item::LAPIS_BLOCK, 0],
|
||||
[Item\Item::COAL_BLOCK, 0],
|
||||
[Item\Item::SNOW_LAYER, 0],
|
||||
[Item\Item::GLASS, 0],
|
||||
[Item\Item::GLOWSTONE_BLOCK, 0],
|
||||
[Item\Item::NETHER_REACTOR, 0],
|
||||
[Item\Item::WOOL, 0],
|
||||
[Item\Item::WOOL, 7],
|
||||
[Item\Item::WOOL, 6],
|
||||
[Item\Item::WOOL, 5],
|
||||
[Item\Item::WOOL, 4],
|
||||
[Item\Item::WOOL, 3],
|
||||
[Item\Item::WOOL, 2],
|
||||
[Item\Item::WOOL, 1],
|
||||
[Item\Item::WOOL, 15],
|
||||
[Item\Item::WOOL, 14],
|
||||
[Item\Item::WOOL, 13],
|
||||
[Item\Item::WOOL, 12],
|
||||
[Item\Item::WOOL, 11],
|
||||
[Item\Item::WOOL, 10],
|
||||
[Item\Item::WOOL, 9],
|
||||
[Item\Item::WOOL, 8],
|
||||
[Item\Item::LADDER, 0],
|
||||
[Item\Item::SPONGE, 0],
|
||||
[Item\Item::GLASS_PANE, 0],
|
||||
[Item\Item::WOODEN_DOOR, 0],
|
||||
[Item\Item::TRAPDOOR, 0],
|
||||
[Item\Item::FENCE, 0],
|
||||
[Item\Item::FENCE_GATE, 0],
|
||||
[Item\Item::IRON_BARS, 0],
|
||||
[Item\Item::BED, 0],
|
||||
[Item\Item::BOOKSHELF, 0],
|
||||
[Item\Item::PAINTING, 0],
|
||||
[Item\Item::WORKBENCH, 0],
|
||||
[Item\Item::STONECUTTER, 0],
|
||||
[Item\Item::CHEST, 0],
|
||||
[Item\Item::FURNACE, 0],
|
||||
[Item\Item::DANDELION, 0],
|
||||
[Item\Item::CYAN_FLOWER, 0],
|
||||
[Item\Item::BROWN_MUSHROOM, 0],
|
||||
[Item\Item::RED_MUSHROOM, 0],
|
||||
[Item\Item::CACTUS, 0],
|
||||
[Item\Item::MELON_BLOCK, 0],
|
||||
[Item\Item::PUMPKIN, 0],
|
||||
[Item\Item::LIT_PUMPKIN, 0],
|
||||
[Item\Item::COBWEB, 0],
|
||||
[Item\Item::HAY_BALE, 0],
|
||||
[Item\Item::TALL_GRASS, 1],
|
||||
[Item\Item::TALL_GRASS, 2],
|
||||
[Item\Item::DEAD_BUSH, 0],
|
||||
[Item\Item::SAPLING, 0],
|
||||
[Item\Item::SAPLING, 1],
|
||||
[Item\Item::SAPLING, 2],
|
||||
[Item\Item::SAPLING, 3],
|
||||
[Item\Item::LEAVES, 0],
|
||||
[Item\Item::LEAVES, 1],
|
||||
[Item\Item::LEAVES, 2],
|
||||
[Item\Item::LEAVES, 3],
|
||||
[Item\Item::CAKE, 0],
|
||||
[Item\Item::SIGN, 0],
|
||||
[Item\Item::CARPET, 0],
|
||||
[Item\Item::CARPET, 7],
|
||||
[Item\Item::CARPET, 6],
|
||||
[Item\Item::CARPET, 5],
|
||||
[Item\Item::CARPET, 4],
|
||||
[Item\Item::CARPET, 3],
|
||||
[Item\Item::CARPET, 2],
|
||||
[Item\Item::CARPET, 1],
|
||||
[Item\Item::CARPET, 15],
|
||||
[Item\Item::CARPET, 14],
|
||||
[Item\Item::CARPET, 13],
|
||||
[Item\Item::CARPET, 12],
|
||||
[Item\Item::CARPET, 11],
|
||||
[Item\Item::CARPET, 10],
|
||||
[Item\Item::CARPET, 9],
|
||||
[Item\Item::CARPET, 8],
|
||||
|
||||
//Tools
|
||||
//array(RAILS, 0),
|
||||
//array(POWERED_RAILS, 0),
|
||||
[TORCH, 0],
|
||||
[Block\BUCKET, 0],
|
||||
[Block\BUCKET, 8],
|
||||
[Block\BUCKET, 10],
|
||||
[TNT, 0],
|
||||
[Block\IRON_HOE, 0],
|
||||
[Block\IRON_SWORD, 0],
|
||||
[Block\BOW, 0],
|
||||
[Block\SHEARS, 0],
|
||||
[Block\FLINT_AND_STEEL, 0],
|
||||
[Block\CLOCK, 0],
|
||||
[Block\COMPASS, 0],
|
||||
[Block\MINECART, 0],
|
||||
[Item\Item::TORCH, 0],
|
||||
[Item\Item::BUCKET, 0],
|
||||
[Item\Item::BUCKET, 8],
|
||||
[Item\Item::BUCKET, 10],
|
||||
[Item\Item::TNT, 0],
|
||||
[Item\Item::IRON_HOE, 0],
|
||||
[Item\Item::IRON_SWORD, 0],
|
||||
[Item\Item::BOW, 0],
|
||||
[Item\Item::SHEARS, 0],
|
||||
[Item\Item::FLINT_AND_STEEL, 0],
|
||||
[Item\Item::CLOCK, 0],
|
||||
[Item\Item::COMPASS, 0],
|
||||
[Item\Item::MINECART, 0],
|
||||
array(SPAWN_EGG, MOB_CHICKEN),
|
||||
array(SPAWN_EGG, MOB_COW),
|
||||
array(SPAWN_EGG, MOB_PIG),
|
||||
array(SPAWN_EGG, MOB_SHEEP),
|
||||
|
||||
//Seeds
|
||||
[SUGARCANE, 0],
|
||||
[WHEAT, 0],
|
||||
[Block\SEEDS, 0],
|
||||
[Block\MELON_SEEDS, 0],
|
||||
[PUMPKIN_SEEDS, 0],
|
||||
[CARROT, 0],
|
||||
[POTATO, 0],
|
||||
[Block\BEETROOT_SEEDS, 0],
|
||||
[Block\EGG, 0],
|
||||
[Block\DYE, 0],
|
||||
[Block\DYE, 7],
|
||||
[Block\DYE, 6],
|
||||
[Block\DYE, 5],
|
||||
[Block\DYE, 4],
|
||||
[Block\DYE, 3],
|
||||
[Block\DYE, 2],
|
||||
[Block\DYE, 1],
|
||||
[Block\DYE, 15],
|
||||
[Block\DYE, 14],
|
||||
[Block\DYE, 13],
|
||||
[Block\DYE, 12],
|
||||
[Block\DYE, 11],
|
||||
[Block\DYE, 10],
|
||||
[Block\DYE, 9],
|
||||
[Block\DYE, 8],
|
||||
[Item\Item::SUGARCANE, 0],
|
||||
[Item\Item::WHEAT, 0],
|
||||
[Item\Item::SEEDS, 0],
|
||||
[Item\Item::MELON_SEEDS, 0],
|
||||
[Item\Item::PUMPKIN_SEEDS, 0],
|
||||
[Item\Item::CARROT, 0],
|
||||
[Item\Item::POTATO, 0],
|
||||
[Item\Item::BEETROOT_SEEDS, 0],
|
||||
[Item\Item::EGG, 0],
|
||||
[Item\Item::DYE, 0],
|
||||
[Item\Item::DYE, 7],
|
||||
[Item\Item::DYE, 6],
|
||||
[Item\Item::DYE, 5],
|
||||
[Item\Item::DYE, 4],
|
||||
[Item\Item::DYE, 3],
|
||||
[Item\Item::DYE, 2],
|
||||
[Item\Item::DYE, 1],
|
||||
[Item\Item::DYE, 15],
|
||||
[Item\Item::DYE, 14],
|
||||
[Item\Item::DYE, 13],
|
||||
[Item\Item::DYE, 12],
|
||||
[Item\Item::DYE, 11],
|
||||
[Item\Item::DYE, 10],
|
||||
[Item\Item::DYE, 9],
|
||||
[Item\Item::DYE, 8],
|
||||
|
||||
);
|
||||
|
||||
@ -306,7 +307,7 @@ class BlockAPI{
|
||||
}
|
||||
|
||||
private function cancelAction(Block $block, Player $player, $send = true){
|
||||
$pk = new Network\Protocol\UpdateBlockPacket;
|
||||
$pk = new UpdateBlockPacket;
|
||||
$pk->x = $block->x;
|
||||
$pk->y = $block->y;
|
||||
$pk->z = $block->z;
|
||||
|
131
src/Player.php
131
src/Player.php
@ -38,8 +38,29 @@ use PocketMine\NBT\Tag\Float as Float;
|
||||
use PocketMine\NBT\Tag\Int as Int;
|
||||
use PocketMine\NBT\Tag\Short as Short;
|
||||
use PocketMine\NBT\Tag\String as String;
|
||||
use PocketMine\Network\Protocol\AdventureSettingsPacket as AdventureSettingsPacket;
|
||||
use PocketMine\Network\Protocol\AnimatePacket as AnimatePacket;
|
||||
use PocketMine\Network\Protocol\ChunkDataPacket as ChunkDataPacket;
|
||||
use PocketMine\Network\Protocol\ContainerClosePacket as ContainerClosePacket;
|
||||
use PocketMine\Network\Protocol\ContainerSetContentPacket as ContainerSetContentPacket;
|
||||
use PocketMine\Network\Protocol\ContainerSetDataPacket as ContainerSetDataPacket;
|
||||
use PocketMine\Network\Protocol\ContainerSetSlotPacket as ContainerSetSlotPacket;
|
||||
use PocketMine\Network\Protocol\DataPacket as DataPacket;
|
||||
use PocketMine\Network\Protocol\DisconnectPacket as DisconnectPacket;
|
||||
use PocketMine\Network\Protocol\EntityEventPacket as EntityEventPacket;
|
||||
use PocketMine\Network\Protocol\Info as ProtocolInfo;
|
||||
use PocketMine\Network\Protocol\LoginStatusPacket as LoginStatusPacket;
|
||||
use PocketMine\Network\Protocol\MessagePacket as MessagePacket;
|
||||
use PocketMine\Network\Protocol\PongPacket as PongPacket;
|
||||
use PocketMine\Network\Protocol\ServerHandshakePacket as ServerHandshakePacket;
|
||||
use PocketMine\Network\Protocol\SetEntityDataPacket as SetEntityDataPacket;
|
||||
use PocketMine\Network\Protocol\SetSpawnPositionPacket as SetSpawnPositionPacket;
|
||||
use PocketMine\Network\Protocol\SetTimePacket as SetTimePacket;
|
||||
use PocketMine\Network\Protocol\StartGamePacket as StartGamePacket;
|
||||
use PocketMine\Network\Protocol\TakeItemEntityPacket as TakeItemEntityPacket;
|
||||
use PocketMine\Network\Protocol\TileEventPacket as TileEventPacket;
|
||||
use PocketMine\Network\Protocol\UnknownPacket as UnknownPacket;
|
||||
use PocketMine\Network\Protocol\UpdateBlockPacket as UpdateBlockPacket;
|
||||
use PocketMine\Network\RakNet\Info as Info;
|
||||
use PocketMine\Network\RakNet\Packet as Packet;
|
||||
use PocketMine\PMF\LevelFormat as LevelFormat;
|
||||
@ -372,7 +393,7 @@ class Player extends RealHuman{
|
||||
$level = $pos->level;
|
||||
}
|
||||
$this->spawnPosition = new Position($pos->x, $pos->y, $pos->z, $level);
|
||||
$pk = new Network\Protocol\SetSpawnPositionPacket;
|
||||
$pk = new SetSpawnPositionPacket;
|
||||
$pk->x = (int) $this->spawnPosition->x;
|
||||
$pk->y = (int) $this->spawnPosition->y;
|
||||
$pk->z = (int) $this->spawnPosition->z;
|
||||
@ -501,7 +522,7 @@ class Player extends RealHuman{
|
||||
$Yndex = $this->chunksLoaded[$index];
|
||||
$this->chunksLoaded[$index] = 0; //Load them all
|
||||
$this->level->useChunk($X, $Z, $this);
|
||||
$pk = new Network\Protocol\ChunkDataPacket;
|
||||
$pk = new ChunkDataPacket;
|
||||
$pk->chunkX = $X;
|
||||
$pk->chunkZ = $Z;
|
||||
$pk->data = $this->level->getOrderedChunk($X, $Z, $Yndex);
|
||||
@ -556,7 +577,7 @@ class Player extends RealHuman{
|
||||
$reason = $reason == "" ? "server stop" : $reason;
|
||||
$this->sendChat("You have been kicked. Reason: " . $reason . "\n");
|
||||
$this->sendBuffer();
|
||||
$this->directDataPacket(new Network\Protocol\DisconnectPacket);
|
||||
$this->directDataPacket(new DisconnectPacket);
|
||||
unset(Player::$list[$this->CID]);
|
||||
$this->connected = false;
|
||||
$this->level->freeAllChunks($this);
|
||||
@ -640,7 +661,7 @@ class Player extends RealHuman{
|
||||
return; //TODO: Check if Mojang adds this
|
||||
$s = (int) $s;
|
||||
if(!isset($this->inventory[$s])){
|
||||
$pk = new Network\Protocol\ContainerSetSlotPacket;
|
||||
$pk = new ContainerSetSlotPacket;
|
||||
$pk->windowid = 0;
|
||||
$pk->slot = (int) $s;
|
||||
$pk->item = Item::get(AIR, 0, 0);
|
||||
@ -648,7 +669,7 @@ class Player extends RealHuman{
|
||||
}
|
||||
|
||||
$slot = $this->inventory[$s];
|
||||
$pk = new Network\Protocol\ContainerSetSlotPacket;
|
||||
$pk = new ContainerSetSlotPacket;
|
||||
$pk->windowid = 0;
|
||||
$pk->slot = (int) $s;
|
||||
$pk->item = $slot;
|
||||
@ -668,13 +689,13 @@ class Player extends RealHuman{
|
||||
if($data instanceof Furnace){
|
||||
foreach($this->windows as $id => $w){
|
||||
if($w === $data){
|
||||
$pk = new Network\Protocol\ContainerSetDataPacket;
|
||||
$pk = new ContainerSetDataPacket;
|
||||
$pk->windowid = $id;
|
||||
$pk->property = 0; //Smelting
|
||||
$pk->value = floor($data->namedtag->CookTime);
|
||||
$this->dataPacket($pk);
|
||||
|
||||
$pk = new Network\Protocol\ContainerSetDataPacket;
|
||||
$pk = new ContainerSetDataPacket;
|
||||
$pk->windowid = $id;
|
||||
$pk->property = 1; //Fire icon
|
||||
$pk->value = $data->namedtag->BurnTicks;
|
||||
@ -688,7 +709,7 @@ class Player extends RealHuman{
|
||||
if($data["tile"]->level === $this->level){
|
||||
foreach($this->windows as $id => $w){
|
||||
if($w === $data["tile"]){
|
||||
$pk = new Network\Protocol\ContainerSetSlotPacket;
|
||||
$pk = new ContainerSetSlotPacket;
|
||||
$pk->windowid = $id;
|
||||
$pk->slot = $data["slot"] + (isset($data["offset"]) ? $data["offset"] : 0);
|
||||
$pk->item = $data["slotdata"];
|
||||
@ -700,7 +721,7 @@ class Player extends RealHuman{
|
||||
case "player.pickup":
|
||||
if($data["eid"] === $this->id){
|
||||
$data["eid"] = 0;
|
||||
$pk = new Network\Protocol\TakeItemEntityPacket;
|
||||
$pk = new TakeItemEntityPacket;
|
||||
$pk->eid = 0;
|
||||
$pk->target = $data["entity"]->getID();
|
||||
$this->dataPacket($pk);
|
||||
@ -716,7 +737,7 @@ class Player extends RealHuman{
|
||||
break;
|
||||
}
|
||||
} elseif($data["entity"]->level === $this->level){
|
||||
$pk = new Network\Protocol\TakeItemEntityPacket;
|
||||
$pk = new TakeItemEntityPacket;
|
||||
$pk->eid = $data["eid"];
|
||||
$pk->target = $data["entity"]->getID();
|
||||
$this->dataPacket($pk);
|
||||
@ -726,7 +747,7 @@ class Player extends RealHuman{
|
||||
if($data["eid"] === $this->id or $data["entity"]->level !== $this->level){
|
||||
break;
|
||||
}
|
||||
$pk = new Network\Protocol\AnimatePacket;
|
||||
$pk = new AnimatePacket;
|
||||
$pk->eid = $data["eid"];
|
||||
$pk->action = $data["action"]; //1 swing arm,
|
||||
$this->dataPacket($pk);
|
||||
@ -738,7 +759,7 @@ class Player extends RealHuman{
|
||||
$eid = $data->getID();
|
||||
}
|
||||
if($data->level === $this->level){
|
||||
$pk = new Network\Protocol\SetEntityDataPacket;
|
||||
$pk = new SetEntityDataPacket;
|
||||
$pk->eid = $eid;
|
||||
$pk->metadata = $data->getMetadata();
|
||||
$this->dataPacket($pk);
|
||||
@ -751,7 +772,7 @@ class Player extends RealHuman{
|
||||
$eid = $data["entity"]->getID();
|
||||
}
|
||||
if($data["entity"]->level === $this->level){
|
||||
$pk = new Network\Protocol\EntityEventPacket;
|
||||
$pk = new EntityEventPacket;
|
||||
$pk->eid = $eid;
|
||||
$pk->event = $data["event"];
|
||||
$this->dataPacket($pk);
|
||||
@ -798,7 +819,7 @@ class Player extends RealHuman{
|
||||
}
|
||||
|
||||
if($m !== ""){
|
||||
$pk = new Network\Protocol\MessagePacket;
|
||||
$pk = new MessagePacket;
|
||||
$pk->source = ($author instanceof Player) ? $author->username : $author;
|
||||
$pk->message = TextFormat::clean($m); //Colors not implemented :(
|
||||
$this->dataPacket($pk);
|
||||
@ -851,7 +872,7 @@ class Player extends RealHuman{
|
||||
$flags |= 0x20; //Show Nametags
|
||||
}
|
||||
|
||||
$pk = new Network\Protocol\AdventureSettingsPacket;
|
||||
$pk = new AdventureSettingsPacket;
|
||||
$pk->flags = $flags;
|
||||
$this->dataPacket($pk);
|
||||
}
|
||||
@ -1209,7 +1230,7 @@ class Player extends RealHuman{
|
||||
case ProtocolInfo::PONG_PACKET:
|
||||
break;
|
||||
case ProtocolInfo::PING_PACKET:
|
||||
$pk = new Network\Protocol\PongPacket;
|
||||
$pk = new PongPacket;
|
||||
$pk->ptime = $packet->time;
|
||||
$pk->time = abs(microtime(true) * 1000);
|
||||
$this->directDataPacket($pk);
|
||||
@ -1221,7 +1242,7 @@ class Player extends RealHuman{
|
||||
if($this->loggedIn === true){
|
||||
break;
|
||||
}
|
||||
$pk = new Network\Protocol\ServerHandshakePacket;
|
||||
$pk = new ServerHandshakePacket;
|
||||
$pk->port = $this->port;
|
||||
$pk->session = $packet->session;
|
||||
$pk->session2 = Utils::readLong("\x00\x00\x00\x00\x04\x44\x0b\xa9");
|
||||
@ -1246,11 +1267,11 @@ class Player extends RealHuman{
|
||||
}
|
||||
if($packet->protocol1 !== ProtocolInfo::CURRENT_PROTOCOL){
|
||||
if($packet->protocol1 < ProtocolInfo::CURRENT_PROTOCOL){
|
||||
$pk = new Network\Protocol\LoginStatusPacket;
|
||||
$pk = new LoginStatusPacket;
|
||||
$pk->status = 1;
|
||||
$this->directDataPacket($pk);
|
||||
} else{
|
||||
$pk = new Network\Protocol\LoginStatusPacket;
|
||||
$pk = new LoginStatusPacket;
|
||||
$pk->status = 2;
|
||||
$this->directDataPacket($pk);
|
||||
}
|
||||
@ -1320,7 +1341,7 @@ class Player extends RealHuman{
|
||||
Player::saveOffline($this->username, $nbt);
|
||||
$this->auth = true;
|
||||
|
||||
$pk = new Network\Protocol\LoginStatusPacket;
|
||||
$pk = new LoginStatusPacket;
|
||||
$pk->status = 0;
|
||||
$this->dataPacket($pk);
|
||||
|
||||
@ -1333,7 +1354,7 @@ class Player extends RealHuman{
|
||||
$this->slot = $this->hotbar[0];
|
||||
}
|
||||
|
||||
$pk = new Network\Protocol\StartGamePacket;
|
||||
$pk = new StartGamePacket;
|
||||
$pk->seed = $this->level->getSeed();
|
||||
$pk->x = $this->x;
|
||||
$pk->y = $this->y;
|
||||
@ -1385,7 +1406,7 @@ class Player extends RealHuman{
|
||||
$this->server->schedule(30, array($this, "orderChunks"), array(), true);
|
||||
$this->blocked = false;
|
||||
|
||||
$pk = new Network\Protocol\SetTimePacket;
|
||||
$pk = new SetTimePacket;
|
||||
$pk->time = $this->level->getTime();
|
||||
$pk->started = $this->level->stopTime == false;
|
||||
$this->dataPacket($pk);
|
||||
@ -1483,7 +1504,7 @@ class Player extends RealHuman{
|
||||
$target = $this->level->getBlock($blockVector);
|
||||
$block = $target->getSide($packet->face);
|
||||
|
||||
$pk = new Network\Protocol\UpdateBlockPacket;
|
||||
$pk = new UpdateBlockPacket;
|
||||
$pk->x = $target->x;
|
||||
$pk->y = $target->y;
|
||||
$pk->z = $target->z;
|
||||
@ -1491,7 +1512,7 @@ class Player extends RealHuman{
|
||||
$pk->meta = $target->getMetadata();
|
||||
$this->dataPacket($pk);
|
||||
|
||||
$pk = new Network\Protocol\UpdateBlockPacket;
|
||||
$pk = new UpdateBlockPacket;
|
||||
$pk->x = $block->x;
|
||||
$pk->y = $block->y;
|
||||
$pk->z = $block->z;
|
||||
@ -1539,7 +1560,7 @@ class Player extends RealHuman{
|
||||
$target = $this->level->getBlock($blockVector);
|
||||
$block = $target->getSide($packet->face);
|
||||
|
||||
$pk = new Network\Protocol\UpdateBlockPacket;
|
||||
$pk = new UpdateBlockPacket;
|
||||
$pk->x = $target->x;
|
||||
$pk->y = $target->y;
|
||||
$pk->z = $target->z;
|
||||
@ -1547,7 +1568,7 @@ class Player extends RealHuman{
|
||||
$pk->meta = $target->getMetadata();
|
||||
$this->dataPacket($pk);
|
||||
|
||||
$pk = new Network\Protocol\UpdateBlockPacket;
|
||||
$pk = new UpdateBlockPacket;
|
||||
$pk->x = $block->x;
|
||||
$pk->y = $block->y;
|
||||
$pk->z = $block->z;
|
||||
@ -1642,7 +1663,7 @@ class Player extends RealHuman{
|
||||
if($this->spawned === false or $this->blocked === true or $this->distance($blockVector) > 8){
|
||||
$target = $this->level->getBlock($blockVector);
|
||||
|
||||
$pk = new Network\Protocol\UpdateBlockPacket;
|
||||
$pk = new UpdateBlockPacket;
|
||||
$pk->x = $target->x;
|
||||
$pk->y = $target->y;
|
||||
$pk->z = $target->z;
|
||||
@ -1834,30 +1855,30 @@ class Player extends RealHuman{
|
||||
switch($packet->event){
|
||||
case 9: //Eating
|
||||
$items = array(
|
||||
APPLE => 4,
|
||||
MUSHROOM_STEW => 10,
|
||||
BEETROOT_SOUP => 10,
|
||||
BREAD => 5,
|
||||
RAW_PORKCHOP => 3,
|
||||
COOKED_PORKCHOP => 8,
|
||||
RAW_BEEF => 3,
|
||||
STEAK => 8,
|
||||
COOKED_CHICKEN => 6,
|
||||
RAW_CHICKEN => 2,
|
||||
MELON_SLICE => 2,
|
||||
GOLDEN_APPLE => 10,
|
||||
PUMPKIN_PIE => 8,
|
||||
CARROT => 4,
|
||||
POTATO => 1,
|
||||
BAKED_POTATO => 6,
|
||||
//COOKIE => 2,
|
||||
//COOKED_FISH => 5,
|
||||
//RAW_FISH => 2,
|
||||
Item\Item::APPLE => 4,
|
||||
Item\Item::MUSHROOM_STEW => 10,
|
||||
Item\Item::BEETROOT_SOUP => 10,
|
||||
Item\Item::BREAD => 5,
|
||||
Item\Item::RAW_PORKCHOP => 3,
|
||||
Item\Item::COOKED_PORKCHOP => 8,
|
||||
Item\Item::RAW_BEEF => 3,
|
||||
Item\Item::STEAK => 8,
|
||||
Item\Item::COOKED_CHICKEN => 6,
|
||||
Item\Item::RAW_CHICKEN => 2,
|
||||
Item\Item::MELON_SLICE => 2,
|
||||
Item\Item::GOLDEN_APPLE => 10,
|
||||
Item\Item::PUMPKIN_PIE => 8,
|
||||
Item\Item::CARROT => 4,
|
||||
Item\Item::POTATO => 1,
|
||||
Item\Item::BAKED_POTATO => 6,
|
||||
//Item\Item::COOKIE => 2,
|
||||
//Item\Item::COOKED_FISH => 5,
|
||||
//Item\Item::RAW_FISH => 2,
|
||||
);
|
||||
$slot = $this->getSlot($this->slot);
|
||||
if($this->entity->getHealth() < 20 and isset($items[$slot->getID()])){
|
||||
|
||||
$pk = new Network\Protocol\EntityEventPacket;
|
||||
$pk = new EntityEventPacket;
|
||||
$pk->eid = 0;
|
||||
$pk->event = 9;
|
||||
$this->dataPacket($pk);
|
||||
@ -1867,7 +1888,7 @@ class Player extends RealHuman{
|
||||
if($slot->getCount() <= 0){
|
||||
$this->setSlot($this->slot, Item::get(AIR, 0, 0));
|
||||
}
|
||||
if($slot->getID() === MUSHROOM_STEW or $slot->getID() === BEETROOT_SOUP){
|
||||
if($slot->getID() === Item\Item::MUSHROOM_STEW or $slot->getID() === Item\Item::BEETROOT_SOUP){
|
||||
$this->addItem(Item::get(BOWL, 0, 1));
|
||||
}
|
||||
}
|
||||
@ -1928,7 +1949,7 @@ class Player extends RealHuman{
|
||||
if(isset($this->windows[$packet->windowid])){
|
||||
if(is_array($this->windows[$packet->windowid])){
|
||||
foreach($this->windows[$packet->windowid] as $ob){
|
||||
$pk = new Network\Protocol\TileEventPacket;
|
||||
$pk = new TileEventPacket;
|
||||
$pk->x = $ob->x;
|
||||
$pk->y = $ob->y;
|
||||
$pk->z = $ob->z;
|
||||
@ -1937,7 +1958,7 @@ class Player extends RealHuman{
|
||||
Player::broadcastPacket($this->level->players, $pk);
|
||||
}
|
||||
} elseif($this->windows[$packet->windowid] instanceof Chest){
|
||||
$pk = new Network\Protocol\TileEventPacket;
|
||||
$pk = new TileEventPacket;
|
||||
$pk->x = $this->windows[$packet->windowid]->x;
|
||||
$pk->y = $this->windows[$packet->windowid]->y;
|
||||
$pk->z = $this->windows[$packet->windowid]->z;
|
||||
@ -1948,7 +1969,7 @@ class Player extends RealHuman{
|
||||
}
|
||||
unset($this->windows[$packet->windowid]);
|
||||
|
||||
$pk = new Network\Protocol\ContainerClosePacket;
|
||||
$pk = new ContainerClosePacket;
|
||||
$pk->windowid = $packet->windowid;
|
||||
$this->dataPacket($pk);
|
||||
break;
|
||||
@ -2038,7 +2059,7 @@ class Player extends RealHuman{
|
||||
"player" => $this,
|
||||
)) === false
|
||||
){
|
||||
$pk = new Network\Protocol\ContainerSetSlotPacket;
|
||||
$pk = new ContainerSetSlotPacket;
|
||||
$pk->windowid = $packet->windowid;
|
||||
$pk->slot = $packet->slot;
|
||||
$pk->item = $slot;
|
||||
@ -2091,7 +2112,7 @@ class Player extends RealHuman{
|
||||
"player" => $this,
|
||||
)) === false
|
||||
){
|
||||
$pk = new Network\Protocol\ContainerSetSlotPacket;
|
||||
$pk = new ContainerSetSlotPacket;
|
||||
$pk->windowid = $packet->windowid;
|
||||
$pk->slot = $packet->slot;
|
||||
$pk->item = $slot;
|
||||
@ -2171,7 +2192,7 @@ class Player extends RealHuman{
|
||||
$hotbar[] = $slot <= -1 ? -1 : $slot + 9;
|
||||
}
|
||||
|
||||
$pk = new Network\Protocol\ContainerSetContentPacket;
|
||||
$pk = new ContainerSetContentPacket;
|
||||
$pk->windowid = 0;
|
||||
$pk->slots = $this->inventory;
|
||||
$pk->hotbar = $hotbar;
|
||||
@ -2215,7 +2236,7 @@ class Player extends RealHuman{
|
||||
foreach($buffer as $i => $buf){
|
||||
$cnts[] = $count = $this->counter[0]++;
|
||||
|
||||
$pk = new Network\Protocol\UnknownPacket;
|
||||
$pk = new UnknownPacket;
|
||||
$pk->packetID = $packet->pid();
|
||||
$pk->reliability = 2;
|
||||
$pk->hasSplit = true;
|
||||
|
@ -21,9 +21,10 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
|
||||
use PocketMine\Item\Item as Item;
|
||||
use PocketMine\ServerAPI as ServerAPI;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
use PocketMine\Network\Protocol\ChatPacket as ChatPacket;
|
||||
use PocketMine\ServerAPI as ServerAPI;
|
||||
|
||||
class Bed extends Transparent{
|
||||
public function __construct($type = 0){
|
||||
@ -35,7 +36,7 @@ class Bed extends Transparent{
|
||||
|
||||
public function onActivate(Item $item, Player $player){
|
||||
if(ServerAPI::request()->api->time->getPhase($player->level) !== "night"){
|
||||
$pk = new Network\Protocol\ChatPacket;
|
||||
$pk = new ChatPacket;
|
||||
$pk->message = "You can only sleep at night";
|
||||
$player->dataPacket($pk);
|
||||
|
||||
@ -58,7 +59,7 @@ class Bed extends Transparent{
|
||||
} elseif($blockWest->getID() === $this->id and ($blockWest->meta & 0x08) === 0x08){
|
||||
$b = $blockWest;
|
||||
} else{
|
||||
$pk = new Network\Protocol\ChatPacket;
|
||||
$pk = new ChatPacket;
|
||||
$pk->message = "This bed is incomplete";
|
||||
$player->dataPacket($pk);
|
||||
|
||||
@ -67,7 +68,7 @@ class Bed extends Transparent{
|
||||
}
|
||||
|
||||
if($player->sleepOn($b) === false){
|
||||
$pk = new Network\Protocol\ChatPacket;
|
||||
$pk = new ChatPacket;
|
||||
$pk->message = "This bed is occupied";
|
||||
$player->dataPacket($pk);
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ class Beetroot extends Flowable{
|
||||
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
$down = $this->getSide(0);
|
||||
if($down->getID() === FARMLAND){
|
||||
if($down->getID() === self::FARMLAND){
|
||||
$this->level->setBlock($block, $this, true, false, true);
|
||||
|
||||
return true;
|
||||
@ -43,7 +43,7 @@ class Beetroot extends Flowable{
|
||||
}
|
||||
|
||||
public function onActivate(Item $item, Player $player){
|
||||
if($item->getID() === Item\DYE and $item->getMetadata() === 0x0F){ //Bonemeal
|
||||
if($item->getID() === Item\Item::DYE and $item->getMetadata() === 0x0F){ //Bonemeal
|
||||
$this->meta = 0x07;
|
||||
$this->level->setBlock($this, $this, true, false, true);
|
||||
if(($player->gamemode & 0x01) === 0){
|
||||
@ -84,10 +84,10 @@ class Beetroot extends Flowable{
|
||||
public function getDrops(Item $item, Player $player){
|
||||
$drops = array();
|
||||
if($this->meta >= 0x07){
|
||||
$drops[] = array(Item\BEETROOT, 0, 1);
|
||||
$drops[] = array(Item\BEETROOT_SEEDS, 0, mt_rand(0, 3));
|
||||
$drops[] = array(Item\Item::BEETROOT, 0, 1);
|
||||
$drops[] = array(Item\Item::BEETROOT_SEEDS, 0, mt_rand(0, 3));
|
||||
} else{
|
||||
$drops[] = array(Item\BEETROOT_SEEDS, 0, 1);
|
||||
$drops[] = array(Item\Item::BEETROOT_SEEDS, 0, 1);
|
||||
}
|
||||
|
||||
return $drops;
|
||||
|
@ -23,184 +23,185 @@
|
||||
* All Block classes are in here
|
||||
*/
|
||||
namespace PocketMine\Block;
|
||||
const AIR = 0;
|
||||
const STONE = 1;
|
||||
const GRASS = 2;
|
||||
const DIRT = 3;
|
||||
const COBBLESTONE = 4;
|
||||
const COBBLE = 4;
|
||||
const PLANK = 5;
|
||||
const PLANKS = 5;
|
||||
const WOODEN_PLANK = 5;
|
||||
const WOODEN_PLANKS = 5;
|
||||
const SAPLING = 6;
|
||||
const SAPLINGS = 6;
|
||||
const BEDROCK = 7;
|
||||
const WATER = 8;
|
||||
const STILL_WATER = 9;
|
||||
const LAVA = 10;
|
||||
const STILL_LAVA = 11;
|
||||
const SAND = 12;
|
||||
const GRAVEL = 13;
|
||||
const GOLD_ORE = 14;
|
||||
const IRON_ORE = 15;
|
||||
const COAL_ORE = 16;
|
||||
const WOOD = 17;
|
||||
const TRUNK = 17;
|
||||
const LOG = 17;
|
||||
const LEAVES = 18;
|
||||
const LEAVE = 18;
|
||||
const SPONGE = 19;
|
||||
const GLASS = 20;
|
||||
const LAPIS_ORE = 21;
|
||||
const LAPIS_BLOCK = 22;
|
||||
|
||||
const SANDSTONE = 24;
|
||||
|
||||
const BED_BLOCK = 26;
|
||||
|
||||
|
||||
const COBWEB = 30;
|
||||
const TALL_GRASS = 31;
|
||||
const BUSH = 32;
|
||||
const DEAD_BUSH = 32;
|
||||
const WOOL = 35;
|
||||
const DANDELION = 37;
|
||||
const ROSE = 38;
|
||||
const CYAN_FLOWER = 38;
|
||||
const BROWN_MUSHROOM = 39;
|
||||
const RED_MUSHROOM = 40;
|
||||
const GOLD_BLOCK = 41;
|
||||
const IRON_BLOCK = 42;
|
||||
const DOUBLE_SLAB = 43;
|
||||
const DOUBLE_SLABS = 43;
|
||||
const SLAB = 44;
|
||||
const SLABS = 44;
|
||||
const BRICKS = 45;
|
||||
const BRICKS_BLOCK = 45;
|
||||
const TNT = 46;
|
||||
const BOOKSHELF = 47;
|
||||
const MOSS_STONE = 48;
|
||||
const MOSSY_STONE = 48;
|
||||
const OBSIDIAN = 49;
|
||||
const TORCH = 50;
|
||||
const FIRE = 51;
|
||||
|
||||
const WOOD_STAIRS = 53;
|
||||
const WOODEN_STAIRS = 53;
|
||||
const OAK_WOOD_STAIRS = 53;
|
||||
const OAK_WOODEN_STAIRS = 53;
|
||||
const CHEST = 54;
|
||||
|
||||
const DIAMOND_ORE = 56;
|
||||
const DIAMOND_BLOCK = 57;
|
||||
const CRAFTING_TABLE = 58;
|
||||
const WORKBENCH = 58;
|
||||
const WHEAT_BLOCK = 59;
|
||||
const FARMLAND = 60;
|
||||
const FURNACE = 61;
|
||||
const BURNING_FURNACE = 62;
|
||||
const LIT_FURNACE = 62;
|
||||
const SIGN_POST = 63;
|
||||
const DOOR_BLOCK = 64;
|
||||
const WOODEN_DOOR_BLOCK = 64;
|
||||
const WOOD_DOOR_BLOCK = 64;
|
||||
const LADDER = 65;
|
||||
|
||||
const COBBLE_STAIRS = 67;
|
||||
const COBBLESTONE_STAIRS = 67;
|
||||
const WALL_SIGN = 68;
|
||||
|
||||
const IRON_DOOR_BLOCK = 71;
|
||||
|
||||
const REDSTONE_ORE = 73;
|
||||
const GLOWING_REDSTONE_ORE = 74;
|
||||
const LIT_REDSTONE_ORE = 74;
|
||||
|
||||
const SNOW = 78;
|
||||
const SNOW_LAYER = 78;
|
||||
const ICE = 79;
|
||||
const SNOW_BLOCK = 80;
|
||||
const CACTUS = 81;
|
||||
const CLAY_BLOCK = 82;
|
||||
const REEDS = 83;
|
||||
const SUGARCANE_BLOCK = 83;
|
||||
|
||||
const FENCE = 85;
|
||||
const PUMPKIN = 86;
|
||||
const NETHERRACK = 87;
|
||||
const SOUL_SAND = 88;
|
||||
const GLOWSTONE = 89;
|
||||
const GLOWSTONE_BLOCK = 89;
|
||||
|
||||
|
||||
const LIT_PUMPKIN = 91;
|
||||
const JACK_O_LANTERN = 91;
|
||||
const CAKE_BLOCK = 92;
|
||||
|
||||
const TRAPDOOR = 96;
|
||||
|
||||
const STONE_BRICKS = 98;
|
||||
const STONE_BRICK = 98;
|
||||
|
||||
const IRON_BAR = 101;
|
||||
const IRON_BARS = 101;
|
||||
const GLASS_PANE = 102;
|
||||
const GLASS_PANEL = 102;
|
||||
const MELON_BLOCK = 103;
|
||||
const PUMPKIN_STEM = 104;
|
||||
const MELON_STEM = 105;
|
||||
|
||||
const FENCE_GATE = 107;
|
||||
const BRICK_STAIRS = 108;
|
||||
const STONE_BRICK_STAIRS = 109;
|
||||
|
||||
const NETHER_BRICKS = 112;
|
||||
const NETHER_BRICK_BLOCK = 112;
|
||||
|
||||
const NETHER_BRICKS_STAIRS = 114;
|
||||
|
||||
const SANDSTONE_STAIRS = 128;
|
||||
|
||||
const SPRUCE_WOOD_STAIRS = 134;
|
||||
const SPRUCE_WOODEN_STAIRS = 134;
|
||||
const BIRCH_WOOD_STAIRS = 135;
|
||||
const BIRCH_WOODEN_STAIRS = 135;
|
||||
const JUNGLE_WOOD_STAIRS = 136;
|
||||
const JUNGLE_WOODEN_STAIRS = 136;
|
||||
|
||||
const COBBLE_WALL = 139;
|
||||
const STONE_WALL = 139;
|
||||
const COBBLESTONE_WALL = 139;
|
||||
|
||||
const CARROT_BLOCK = 141;
|
||||
const POTATO_BLOCK = 142;
|
||||
|
||||
const QUARTZ_BLOCK = 155;
|
||||
const QUARTZ_STAIRS = 156;
|
||||
const DOUBLE_WOOD_SLAB = 157;
|
||||
const DOUBLE_WOODEN_SLAB = 157;
|
||||
const DOUBLE_WOOD_SLABS = 157;
|
||||
const DOUBLE_WOODEN_SLABS = 157;
|
||||
const WOOD_SLAB = 158;
|
||||
const WOODEN_SLAB = 158;
|
||||
const WOOD_SLABS = 158;
|
||||
const WOODEN_SLABS = 158;
|
||||
|
||||
const HAY_BALE = 170;
|
||||
const CARPET = 171;
|
||||
|
||||
const COAL_BLOCK = 173;
|
||||
|
||||
const BEETROOT_BLOCK = 244;
|
||||
const STONECUTTER = 245;
|
||||
const GLOWING_OBSIDIAN = 246;
|
||||
const NETHER_REACTOR = 247;
|
||||
|
||||
use PocketMine;
|
||||
use PocketMine\Level\Position as Position;
|
||||
|
||||
abstract class Block extends Position{
|
||||
const AIR = 0;
|
||||
const STONE = 1;
|
||||
const GRASS = 2;
|
||||
const DIRT = 3;
|
||||
const COBBLESTONE = 4;
|
||||
const COBBLE = 4;
|
||||
const PLANK = 5;
|
||||
const PLANKS = 5;
|
||||
const WOODEN_PLANK = 5;
|
||||
const WOODEN_PLANKS = 5;
|
||||
const SAPLING = 6;
|
||||
const SAPLINGS = 6;
|
||||
const BEDROCK = 7;
|
||||
const WATER = 8;
|
||||
const STILL_WATER = 9;
|
||||
const LAVA = 10;
|
||||
const STILL_LAVA = 11;
|
||||
const SAND = 12;
|
||||
const GRAVEL = 13;
|
||||
const GOLD_ORE = 14;
|
||||
const IRON_ORE = 15;
|
||||
const COAL_ORE = 16;
|
||||
const WOOD = 17;
|
||||
const TRUNK = 17;
|
||||
const LOG = 17;
|
||||
const LEAVES = 18;
|
||||
const LEAVE = 18;
|
||||
const SPONGE = 19;
|
||||
const GLASS = 20;
|
||||
const LAPIS_ORE = 21;
|
||||
const LAPIS_BLOCK = 22;
|
||||
|
||||
const SANDSTONE = 24;
|
||||
|
||||
const BED_BLOCK = 26;
|
||||
|
||||
|
||||
const COBWEB = 30;
|
||||
const TALL_GRASS = 31;
|
||||
const BUSH = 32;
|
||||
const DEAD_BUSH = 32;
|
||||
const WOOL = 35;
|
||||
const DANDELION = 37;
|
||||
const ROSE = 38;
|
||||
const CYAN_FLOWER = 38;
|
||||
const BROWN_MUSHROOM = 39;
|
||||
const RED_MUSHROOM = 40;
|
||||
const GOLD_BLOCK = 41;
|
||||
const IRON_BLOCK = 42;
|
||||
const DOUBLE_SLAB = 43;
|
||||
const DOUBLE_SLABS = 43;
|
||||
const SLAB = 44;
|
||||
const SLABS = 44;
|
||||
const BRICKS = 45;
|
||||
const BRICKS_BLOCK = 45;
|
||||
const TNT = 46;
|
||||
const BOOKSHELF = 47;
|
||||
const MOSS_STONE = 48;
|
||||
const MOSSY_STONE = 48;
|
||||
const OBSIDIAN = 49;
|
||||
const TORCH = 50;
|
||||
const FIRE = 51;
|
||||
|
||||
const WOOD_STAIRS = 53;
|
||||
const WOODEN_STAIRS = 53;
|
||||
const OAK_WOOD_STAIRS = 53;
|
||||
const OAK_WOODEN_STAIRS = 53;
|
||||
const CHEST = 54;
|
||||
|
||||
const DIAMOND_ORE = 56;
|
||||
const DIAMOND_BLOCK = 57;
|
||||
const CRAFTING_TABLE = 58;
|
||||
const WORKBENCH = 58;
|
||||
const WHEAT_BLOCK = 59;
|
||||
const FARMLAND = 60;
|
||||
const FURNACE = 61;
|
||||
const BURNING_FURNACE = 62;
|
||||
const LIT_FURNACE = 62;
|
||||
const SIGN_POST = 63;
|
||||
const DOOR_BLOCK = 64;
|
||||
const WOODEN_DOOR_BLOCK = 64;
|
||||
const WOOD_DOOR_BLOCK = 64;
|
||||
const LADDER = 65;
|
||||
|
||||
const COBBLE_STAIRS = 67;
|
||||
const COBBLESTONE_STAIRS = 67;
|
||||
const WALL_SIGN = 68;
|
||||
|
||||
const IRON_DOOR_BLOCK = 71;
|
||||
|
||||
const REDSTONE_ORE = 73;
|
||||
const GLOWING_REDSTONE_ORE = 74;
|
||||
const LIT_REDSTONE_ORE = 74;
|
||||
|
||||
const SNOW = 78;
|
||||
const SNOW_LAYER = 78;
|
||||
const ICE = 79;
|
||||
const SNOW_BLOCK = 80;
|
||||
const CACTUS = 81;
|
||||
const CLAY_BLOCK = 82;
|
||||
const REEDS = 83;
|
||||
const SUGARCANE_BLOCK = 83;
|
||||
|
||||
const FENCE = 85;
|
||||
const PUMPKIN = 86;
|
||||
const NETHERRACK = 87;
|
||||
const SOUL_SAND = 88;
|
||||
const GLOWSTONE = 89;
|
||||
const GLOWSTONE_BLOCK = 89;
|
||||
|
||||
|
||||
const LIT_PUMPKIN = 91;
|
||||
const JACK_O_LANTERN = 91;
|
||||
const CAKE_BLOCK = 92;
|
||||
|
||||
const TRAPDOOR = 96;
|
||||
|
||||
const STONE_BRICKS = 98;
|
||||
const STONE_BRICK = 98;
|
||||
|
||||
const IRON_BAR = 101;
|
||||
const IRON_BARS = 101;
|
||||
const GLASS_PANE = 102;
|
||||
const GLASS_PANEL = 102;
|
||||
const MELON_BLOCK = 103;
|
||||
const PUMPKIN_STEM = 104;
|
||||
const MELON_STEM = 105;
|
||||
|
||||
const FENCE_GATE = 107;
|
||||
const BRICK_STAIRS = 108;
|
||||
const STONE_BRICK_STAIRS = 109;
|
||||
|
||||
const NETHER_BRICKS = 112;
|
||||
const NETHER_BRICK_BLOCK = 112;
|
||||
|
||||
const NETHER_BRICKS_STAIRS = 114;
|
||||
|
||||
const SANDSTONE_STAIRS = 128;
|
||||
|
||||
const SPRUCE_WOOD_STAIRS = 134;
|
||||
const SPRUCE_WOODEN_STAIRS = 134;
|
||||
const BIRCH_WOOD_STAIRS = 135;
|
||||
const BIRCH_WOODEN_STAIRS = 135;
|
||||
const JUNGLE_WOOD_STAIRS = 136;
|
||||
const JUNGLE_WOODEN_STAIRS = 136;
|
||||
|
||||
const COBBLE_WALL = 139;
|
||||
const STONE_WALL = 139;
|
||||
const COBBLESTONE_WALL = 139;
|
||||
|
||||
const CARROT_BLOCK = 141;
|
||||
const POTATO_BLOCK = 142;
|
||||
|
||||
const QUARTZ_BLOCK = 155;
|
||||
const QUARTZ_STAIRS = 156;
|
||||
const DOUBLE_WOOD_SLAB = 157;
|
||||
const DOUBLE_WOODEN_SLAB = 157;
|
||||
const DOUBLE_WOOD_SLABS = 157;
|
||||
const DOUBLE_WOODEN_SLABS = 157;
|
||||
const WOOD_SLAB = 158;
|
||||
const WOODEN_SLAB = 158;
|
||||
const WOOD_SLABS = 158;
|
||||
const WOODEN_SLABS = 158;
|
||||
|
||||
const HAY_BALE = 170;
|
||||
const CARPET = 171;
|
||||
|
||||
const COAL_BLOCK = 173;
|
||||
|
||||
const BEETROOT_BLOCK = 244;
|
||||
const STONECUTTER = 245;
|
||||
const GLOWING_OBSIDIAN = 246;
|
||||
const NETHER_REACTOR = 247;
|
||||
|
||||
|
||||
public static $list = array();
|
||||
protected $id;
|
||||
protected $meta;
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
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;
|
||||
@ -28,7 +29,6 @@ use PocketMine\NBT\Tag\Int as Int;
|
||||
use PocketMine\NBT\Tag\String as String;
|
||||
use PocketMine\Tile\Furnace as Furnace;
|
||||
use PocketMine\Tile\Tile as Tile;
|
||||
use PocketMine;
|
||||
|
||||
class BurningFurnace extends Solid{
|
||||
public function __construct($meta = 0){
|
||||
|
@ -21,10 +21,10 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
use PocketMine\Math\Vector3 as Vector3;
|
||||
use PocketMine\ServerAPI as ServerAPI;
|
||||
use PocketMine;
|
||||
|
||||
class Cactus extends Transparent{
|
||||
public function __construct($meta = 0){
|
||||
@ -36,18 +36,18 @@ class Cactus extends Transparent{
|
||||
public function onUpdate($type){
|
||||
if($type === BLOCK_UPDATE_NORMAL){
|
||||
$down = $this->getSide(0);
|
||||
if($down->getID() !== SAND and $down->getID() !== CACTUS){ //Replace with common break method
|
||||
if($down->getID() !== self::SAND and $down->getID() !== self::CACTUS){ //Replace with common break method
|
||||
$this->level->setBlock($this, new Air(), false);
|
||||
ServerAPI::request()->api->entity->drop($this, Item::get($this->id));
|
||||
|
||||
return BLOCK_UPDATE_NORMAL;
|
||||
}
|
||||
} elseif($type === BLOCK_UPDATE_RANDOM){
|
||||
if($this->getSide(0)->getID() !== CACTUS){
|
||||
if($this->getSide(0)->getID() !== self::CACTUS){
|
||||
if($this->meta == 0x0F){
|
||||
for($y = 1; $y < 3; ++$y){
|
||||
$b = $this->level->getBlock(new Vector3($this->x, $this->y + $y, $this->z));
|
||||
if($b->getID() === AIR){
|
||||
if($b->getID() === self::AIR){
|
||||
$this->level->setBlock($b, new Cactus(), true, false, true);
|
||||
break;
|
||||
}
|
||||
@ -68,7 +68,7 @@ class Cactus extends Transparent{
|
||||
|
||||
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){
|
||||
if($down->getID() === self::SAND or $down->getID() === self::CACTUS){
|
||||
$block0 = $this->getSide(2);
|
||||
$block1 = $this->getSide(3);
|
||||
$block2 = $this->getSide(4);
|
||||
|
@ -35,7 +35,7 @@ class Cake extends Transparent{
|
||||
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
$down = $this->getSide(0);
|
||||
if($down->getID() !== AIR){
|
||||
if($down->getID() !== self::AIR){
|
||||
$this->level->setBlock($block, $this, true, false, true);
|
||||
|
||||
return true;
|
||||
@ -46,7 +46,7 @@ class Cake extends Transparent{
|
||||
|
||||
public function onUpdate($type){
|
||||
if($type === BLOCK_UPDATE_NORMAL){
|
||||
if($this->getSide(0)->getID() === AIR){ //Replace with common break method
|
||||
if($this->getSide(0)->getID() === self::AIR){ //Replace with common break method
|
||||
$this->level->setBlock($this, new Air(), true, false, true);
|
||||
|
||||
return BLOCK_UPDATE_NORMAL;
|
||||
|
@ -53,7 +53,7 @@ class Carpet extends Flowable{
|
||||
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
$down = $this->getSide(0);
|
||||
if($down->getID() !== AIR){
|
||||
if($down->getID() !== self::AIR){
|
||||
$this->level->setBlock($block, $this, true, false, true);
|
||||
|
||||
return true;
|
||||
@ -64,7 +64,7 @@ class Carpet extends Flowable{
|
||||
|
||||
public function onUpdate($type){
|
||||
if($type === BLOCK_UPDATE_NORMAL){
|
||||
if($this->getSide(0)->getID() === AIR){ //Replace with common break method
|
||||
if($this->getSide(0)->getID() === self::AIR){ //Replace with common break method
|
||||
//TODO
|
||||
//ServerAPI::request()->api->entity->drop($this, Item::get($this->id, $this->meta, 1));
|
||||
$this->level->setBlock($this, new Air(), true, false, true);
|
||||
|
@ -33,7 +33,7 @@ class Carrot extends Flowable{
|
||||
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
$down = $this->getSide(0);
|
||||
if($down->getID() === FARMLAND){
|
||||
if($down->getID() === self::FARMLAND){
|
||||
$this->level->setBlock($block, $this, true, false, true);
|
||||
|
||||
return true;
|
||||
@ -43,7 +43,7 @@ class Carrot extends Flowable{
|
||||
}
|
||||
|
||||
public function onActivate(Item $item, Player $player){
|
||||
if($item->getID() === Item\DYE and $item->getMetadata() === 0x0F){ //Bonemeal
|
||||
if($item->getID() === Item\Item::DYE and $item->getMetadata() === 0x0F){ //Bonemeal
|
||||
$this->meta = 0x07;
|
||||
$this->level->setBlock($this, $this, true, false, true);
|
||||
if(($player->gamemode & 0x01) === 0){
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
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;
|
||||
@ -28,7 +29,6 @@ use PocketMine\NBT\Tag\Int as Int;
|
||||
use PocketMine\NBT\Tag\String as String;
|
||||
use PocketMine\Tile\Chest as TileChest;
|
||||
use PocketMine\Tile\Tile as Tile;
|
||||
use PocketMine;
|
||||
|
||||
class Chest extends Transparent{
|
||||
public function __construct($meta = 0){
|
||||
|
@ -32,7 +32,7 @@ class Clay extends Solid{
|
||||
|
||||
public function getDrops(Item $item, Player $player){
|
||||
return array(
|
||||
array(Item\CLAY, 0, 4),
|
||||
array(Item\Item::CLAY, 0, 4),
|
||||
);
|
||||
}
|
||||
}
|
@ -21,9 +21,10 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
|
||||
use PocketMine\Item\Item as Item;
|
||||
use PocketMine\Player as Player;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
use PocketMine\Network\Protocol\LevelEventPacket as LevelEventPacket;
|
||||
use PocketMine\Player as Player;
|
||||
|
||||
|
||||
abstract class Door extends Transparent{
|
||||
@ -34,7 +35,7 @@ abstract class Door extends Transparent{
|
||||
|
||||
public function onUpdate($type){
|
||||
if($type === BLOCK_UPDATE_NORMAL){
|
||||
if($this->getSide(0)->getID() === AIR){ //Replace with common break method
|
||||
if($this->getSide(0)->getID() === self::AIR){ //Replace with common break method
|
||||
$this->level->setBlock($this, new Air(), false);
|
||||
if($this->getSide(1) instanceof Door){
|
||||
$this->level->setBlock($this->getSide(1), new Air(), false);
|
||||
@ -102,7 +103,7 @@ abstract class Door extends Transparent{
|
||||
$this->level->setBlock($down, Block::get($this->id, $meta), true, false, true);
|
||||
$players = $this->level->getUsingChunk($this->x >> 4, $this->z >> 4);
|
||||
unset($players[$player->CID]);
|
||||
$pk = new Network\Protocol\LevelEventPacket;
|
||||
$pk = new LevelEventPacket;
|
||||
$pk->x = $this->x;
|
||||
$pk->y = $this->y;
|
||||
$pk->z = $this->z;
|
||||
@ -119,7 +120,7 @@ abstract class Door extends Transparent{
|
||||
$this->level->setBlock($this, $this, true, false, true);
|
||||
$players = $this->level->getUsingChunk($this->x >> 4, $this->z >> 4);
|
||||
unset($players[$player->CID]);
|
||||
$pk = new Network\Protocol\LevelEventPacket;
|
||||
$pk = new LevelEventPacket;
|
||||
$pk->x = $this->x;
|
||||
$pk->y = $this->y;
|
||||
$pk->z = $this->z;
|
||||
|
@ -21,9 +21,9 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
use PocketMine\ServerAPI as ServerAPI;
|
||||
use PocketMine;
|
||||
|
||||
class Fallable extends Solid{
|
||||
|
||||
|
@ -41,7 +41,7 @@ class Fire extends Flowable{
|
||||
if($type === BLOCK_UPDATE_NORMAL){
|
||||
for($s = 0; $s <= 5; ++$s){
|
||||
$side = $this->getSide($s);
|
||||
if($side->getID() !== AIR and !($side instanceof Liquid)){
|
||||
if($side->getID() !== self::AIR and !($side instanceof Liquid)){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -49,7 +49,7 @@ class Fire extends Flowable{
|
||||
|
||||
return BLOCK_UPDATE_NORMAL;
|
||||
} elseif($type === BLOCK_UPDATE_RANDOM){
|
||||
if($this->getSide(0)->getID() !== NETHERRACK){
|
||||
if($this->getSide(0)->getID() !== self::NETHERRACK){
|
||||
$this->level->setBlock($this, new Air(), true, false, true);
|
||||
|
||||
return BLOCK_UPDATE_NORMAL;
|
||||
|
@ -21,9 +21,9 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
use PocketMine\ServerAPI as ServerAPI;
|
||||
use PocketMine;
|
||||
|
||||
class Generic extends Block{
|
||||
|
||||
@ -51,7 +51,7 @@ class Generic extends Block{
|
||||
public function onUpdate($type){
|
||||
if($this->hasPhysics === true and $type === BLOCK_UPDATE_NORMAL){
|
||||
$down = $this->getSide(0);
|
||||
if($down->getID() === AIR or ($down instanceof Liquid)){
|
||||
if($down->getID() === self::AIR or ($down instanceof Liquid)){
|
||||
$data = array(
|
||||
"x" => $this->x + 0.5,
|
||||
"y" => $this->y + 0.5,
|
||||
|
@ -21,10 +21,10 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
use PocketMine\Level\Position as Position;
|
||||
use PocketMine\Utils\Utils as Utils;
|
||||
use PocketMine;
|
||||
|
||||
class GlowingRedstoneOre extends Solid{
|
||||
public function __construct(){
|
||||
@ -62,7 +62,7 @@ class GlowingRedstoneOre extends Solid{
|
||||
public function getDrops(Item $item, Player $player){
|
||||
if($item->isPickaxe() >= 4){
|
||||
return array(
|
||||
array(Item\REDSTONE_DUST, 0, mt_rand(4, 5)),
|
||||
array(Item\Item::REDSTONE_DUST, 0, mt_rand(4, 5)),
|
||||
);
|
||||
} else{
|
||||
return array();
|
||||
|
@ -32,7 +32,7 @@ class Glowstone extends Transparent{
|
||||
|
||||
public function getDrops(Item $item, Player $player){
|
||||
return array(
|
||||
array(Item\GLOWSTONE_DUST, 0, mt_rand(2, 4)),
|
||||
array(Item\Item::GLOWSTONE_DUST, 0, mt_rand(2, 4)),
|
||||
);
|
||||
}
|
||||
}
|
@ -21,10 +21,10 @@
|
||||
|
||||
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;
|
||||
use PocketMine;
|
||||
|
||||
class Grass extends Solid{
|
||||
public function __construct(){
|
||||
@ -40,7 +40,7 @@ class Grass extends Solid{
|
||||
}
|
||||
|
||||
public function onActivate(Item $item, Player $player){
|
||||
if($item->getID() === Item\DYE and $item->getMetadata() === 0x0F){
|
||||
if($item->getID() === Item\Item::DYE and $item->getMetadata() === 0x0F){
|
||||
if(($player->gamemode & 0x01) === 0){
|
||||
$item->count--;
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ class Gravel extends Fallable{
|
||||
public function getDrops(Item $item, Player $player){
|
||||
if(mt_rand(1, 10) === 1){
|
||||
return array(
|
||||
array(Item\FLINT, 0, 1),
|
||||
array(Item\Item::FLINT, 0, 1),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ class IronDoor extends Door{
|
||||
public function getDrops(Item $item, Player $player){
|
||||
if($item->isPickaxe() >= 1){
|
||||
return array(
|
||||
array(Item\IRON_DOOR, 0, 1),
|
||||
array(Item\Item::IRON_DOOR, 0, 1),
|
||||
);
|
||||
} else{
|
||||
return array();
|
||||
|
@ -53,7 +53,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
|
||||
/*if($this->getSide(0)->getID() === self::AIR){ //Replace with common break method
|
||||
ServerAPI::request()->api->entity->drop($this, Item::get(LADDER, 0, 1));
|
||||
$this->level->setBlock($this, new Air(), true, true, true);
|
||||
return BLOCK_UPDATE_NORMAL;
|
||||
|
@ -49,7 +49,7 @@ class LapisOre extends Solid{
|
||||
public function getDrops(Item $item, Player $player){
|
||||
if($item->isPickaxe() >= 3){
|
||||
return array(
|
||||
array(Item\DYE, 4, mt_rand(4, 8)),
|
||||
array(Item\Item::DYE, 4, mt_rand(4, 8)),
|
||||
);
|
||||
} else{
|
||||
return array();
|
||||
|
@ -21,10 +21,10 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
use PocketMine\Level\Position as Position;
|
||||
use PocketMine\ServerAPI as ServerAPI;
|
||||
use PocketMine;
|
||||
|
||||
class Lava extends Liquid{
|
||||
public function __construct($meta = 0){
|
||||
|
@ -21,9 +21,9 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
use PocketMine\ServerAPI as ServerAPI;
|
||||
use PocketMine;
|
||||
|
||||
class Leaves extends Transparent{
|
||||
const OAK = 0;
|
||||
@ -49,9 +49,9 @@ class Leaves extends Transparent{
|
||||
if(isset($visited[$index])){
|
||||
return false;
|
||||
}
|
||||
if($pos->getID() === WOOD){
|
||||
if($pos->getID() === self::WOOD){
|
||||
return true;
|
||||
} elseif($pos->getID() === LEAVES and $distance < 3){
|
||||
} elseif($pos->getID() === self::LEAVES and $distance < 3){
|
||||
$visited[$index] = true;
|
||||
$down = $pos->getSide(0)->getID();
|
||||
if($down === WOOD){
|
||||
@ -151,7 +151,7 @@ class Leaves extends Transparent{
|
||||
$drops[] = array(LEAVES, $this->meta & 0x03, 1);
|
||||
} else{
|
||||
if(mt_rand(1, 20) === 1){ //Saplings
|
||||
$drops[] = array(Item\SAPLING, $this->meta & 0x03, 1);
|
||||
$drops[] = array(Item\Item::SAPLING, $this->meta & 0x03, 1);
|
||||
}
|
||||
if(($this->meta & 0x03) === self::OAK and mt_rand(1, 200) === 1){ //Apples
|
||||
$drops[] = array(APPLE, 0, 1);
|
||||
|
@ -32,7 +32,7 @@ class Melon extends Transparent{
|
||||
|
||||
public function getDrops(Item $item, Player $player){
|
||||
return array(
|
||||
array(Item\MELON_SLICE, 0, mt_rand(3, 7)),
|
||||
array(Item\Item::MELON_SLICE, 0, mt_rand(3, 7)),
|
||||
);
|
||||
}
|
||||
}
|
@ -33,7 +33,7 @@ class MelonStem extends Flowable{
|
||||
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
$down = $this->getSide(0);
|
||||
if($down->getID() === FARMLAND){
|
||||
if($down->getID() === self::FARMLAND){
|
||||
$this->level->setBlock($block, $this, true, false, true);
|
||||
|
||||
return true;
|
||||
@ -61,13 +61,13 @@ class MelonStem extends Flowable{
|
||||
} else{
|
||||
for($side = 2; $side <= 5; ++$side){
|
||||
$b = $this->getSide($side);
|
||||
if($b->getID() === MELON_BLOCK){
|
||||
if($b->getID() === self::MELON_BLOCK){
|
||||
return BLOCK_UPDATE_RANDOM;
|
||||
}
|
||||
}
|
||||
$side = $this->getSide(mt_rand(2, 5));
|
||||
$d = $side->getSide(0);
|
||||
if($side->getID() === AIR and ($d->getID() === FARMLAND or $d->getID() === GRASS or $d->getID() === DIRT)){
|
||||
if($side->getID() === self::AIR and ($d->getID() === self::FARMLAND or $d->getID() === self::GRASS or $d->getID() === self::DIRT)){
|
||||
$this->level->setBlock($side, new Melon(), true, false, true);
|
||||
}
|
||||
}
|
||||
@ -80,7 +80,7 @@ class MelonStem extends Flowable{
|
||||
}
|
||||
|
||||
public function onActivate(Item $item, Player $player){
|
||||
if($item->getID() === Item\DYE and $item->getMetadata() === 0x0F){ //Bonemeal
|
||||
if($item->getID() === Item\Item::DYE and $item->getMetadata() === 0x0F){ //Bonemeal
|
||||
$this->meta = 0x07;
|
||||
$this->level->setBlock($this, $this, true, false, true);
|
||||
if(($player->gamemode & 0x01) === 0){
|
||||
@ -95,7 +95,7 @@ class MelonStem extends Flowable{
|
||||
|
||||
public function getDrops(Item $item, Player $player){
|
||||
return array(
|
||||
array(Item\MELON_SEEDS, 0, mt_rand(0, 2)),
|
||||
array(Item\Item::MELON_SEEDS, 0, mt_rand(0, 2)),
|
||||
);
|
||||
}
|
||||
}
|
@ -33,7 +33,7 @@ class Potato extends Flowable{
|
||||
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
$down = $this->getSide(0);
|
||||
if($down->getID() === FARMLAND){
|
||||
if($down->getID() === self::FARMLAND){
|
||||
$this->level->setBlock($block, $this, true, false, true);
|
||||
|
||||
return true;
|
||||
@ -43,7 +43,7 @@ class Potato extends Flowable{
|
||||
}
|
||||
|
||||
public function onActivate(Item $item, Player $player){
|
||||
if($item->getID() === Item\DYE and $item->getMetadata() === 0x0F){ //Bonemeal
|
||||
if($item->getID() === Item\Item::DYE and $item->getMetadata() === 0x0F){ //Bonemeal
|
||||
$this->meta = 0x07;
|
||||
$this->level->setBlock($this, $this, true, false, true);
|
||||
if(($player->gamemode & 0x01) === 0){
|
||||
|
@ -33,7 +33,7 @@ class PumpkinStem extends Flowable{
|
||||
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
$down = $this->getSide(0);
|
||||
if($down->getID() === FARMLAND){
|
||||
if($down->getID() === self::FARMLAND){
|
||||
$this->level->setBlock($block, $this, true, false, true);
|
||||
|
||||
return true;
|
||||
@ -61,13 +61,13 @@ class PumpkinStem extends Flowable{
|
||||
} else{
|
||||
for($side = 2; $side <= 5; ++$side){
|
||||
$b = $this->getSide($side);
|
||||
if($b->getID() === PUMPKIN){
|
||||
if($b->getID() === self::PUMPKIN){
|
||||
return BLOCK_UPDATE_RANDOM;
|
||||
}
|
||||
}
|
||||
$side = $this->getSide(mt_rand(2, 5));
|
||||
$d = $side->getSide(0);
|
||||
if($side->getID() === AIR and ($d->getID() === FARMLAND or $d->getID() === GRASS or $d->getID() === DIRT)){
|
||||
if($side->getID() === self::AIR and ($d->getID() === self::FARMLAND or $d->getID() === self::GRASS or $d->getID() === self::DIRT)){
|
||||
$this->level->setBlock($side, new Pumpkin(), true, false, true);
|
||||
}
|
||||
}
|
||||
@ -80,7 +80,7 @@ class PumpkinStem extends Flowable{
|
||||
}
|
||||
|
||||
public function onActivate(Item $item, Player $player){
|
||||
if($item->getID() === Item\DYE and $item->getMetadata() === 0x0F){ //Bonemeal
|
||||
if($item->getID() === Item\Item::DYE and $item->getMetadata() === 0x0F){ //Bonemeal
|
||||
$this->meta = 0x07;
|
||||
$this->level->setBlock($this, $this, true, false, true);
|
||||
if(($player->gamemode & 0x01) === 0){
|
||||
@ -95,7 +95,7 @@ class PumpkinStem extends Flowable{
|
||||
|
||||
public function getDrops(Item $item, Player $player){
|
||||
return array(
|
||||
array(Item\PUMPKIN_SEEDS, 0, mt_rand(0, 2)),
|
||||
array(Item\Item::PUMPKIN_SEEDS, 0, mt_rand(0, 2)),
|
||||
);
|
||||
}
|
||||
}
|
@ -21,10 +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;
|
||||
|
||||
class Sapling extends Flowable{
|
||||
const OAK = 0;
|
||||
@ -48,7 +48,7 @@ class Sapling extends Flowable{
|
||||
|
||||
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){
|
||||
if($down->getID() === self::GRASS or $down->getID() === self::DIRT or $down->getID() === self::FARMLAND){
|
||||
$this->level->setBlock($block, $this, true, false, true);
|
||||
|
||||
return true;
|
||||
@ -58,7 +58,7 @@ class Sapling extends Flowable{
|
||||
}
|
||||
|
||||
public function onActivate(Item $item, Player $player){
|
||||
if($item->getID() === Item\DYE and $item->getMetadata() === 0x0F){ //Bonemeal
|
||||
if($item->getID() === Item\Item::DYE and $item->getMetadata() === 0x0F){ //Bonemeal
|
||||
Tree::growTree($this->level, $this, new Random(), $this->meta & 0x03);
|
||||
if(($player->gamemode & 0x01) === 0){
|
||||
$item->count--;
|
||||
|
@ -58,7 +58,7 @@ class SignPost extends Transparent{
|
||||
|
||||
public function onUpdate($type){
|
||||
if($type === BLOCK_UPDATE_NORMAL){
|
||||
if($this->getSide(0)->getID() === AIR){ //Replace with common break method
|
||||
if($this->getSide(0)->getID() === self::AIR){ //Replace with common break method
|
||||
//TODO
|
||||
//ServerAPI::request()->api->entity->drop($this, Item::get(SIGN, 0, 1));
|
||||
$this->level->setBlock($this, new Air(), true, true, true);
|
||||
@ -78,7 +78,7 @@ class SignPost extends Transparent{
|
||||
|
||||
public function getDrops(Item $item, Player $player){
|
||||
return array(
|
||||
array(Item\SIGN, 0, 1),
|
||||
array(Item\Item::SIGN, 0, 1),
|
||||
);
|
||||
}
|
||||
}
|
@ -49,11 +49,11 @@ class Slab extends Transparent{
|
||||
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)){
|
||||
if($target->getID() === self::SLAB and ($target->getMetadata() & 0x08) === 0x08 and ($target->getMetadata() & 0x07) === ($this->meta & 0x07)){
|
||||
$this->level->setBlock($target, Block::get(DOUBLE_SLAB, $this->meta), true, false, true);
|
||||
|
||||
return true;
|
||||
} elseif($block->getID() === SLAB and ($block->getMetadata() & 0x07) === ($this->meta & 0x07)){
|
||||
} elseif($block->getID() === self::SLAB and ($block->getMetadata() & 0x07) === ($this->meta & 0x07)){
|
||||
$this->level->setBlock($block, Block::get(DOUBLE_SLAB, $this->meta), true, false, true);
|
||||
|
||||
return true;
|
||||
@ -61,17 +61,17 @@ class Slab extends Transparent{
|
||||
$this->meta |= 0x08;
|
||||
}
|
||||
} elseif($face === 1){
|
||||
if($target->getID() === SLAB and ($target->getMetadata() & 0x08) === 0 and ($target->getMetadata() & 0x07) === ($this->meta & 0x07)){
|
||||
if($target->getID() === self::SLAB and ($target->getMetadata() & 0x08) === 0 and ($target->getMetadata() & 0x07) === ($this->meta & 0x07)){
|
||||
$this->level->setBlock($target, Block::get(DOUBLE_SLAB, $this->meta), true, false, true);
|
||||
|
||||
return true;
|
||||
} elseif($block->getID() === SLAB and ($block->getMetadata() & 0x07) === ($this->meta & 0x07)){
|
||||
} elseif($block->getID() === self::SLAB and ($block->getMetadata() & 0x07) === ($this->meta & 0x07)){
|
||||
$this->level->setBlock($block, Block::get(DOUBLE_SLAB, $this->meta), true, false, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
} elseif(!$player->inBlock($block)){
|
||||
if($block->getID() === SLAB){
|
||||
if($block->getID() === self::SLAB){
|
||||
if(($block->getMetadata() & 0x07) === ($this->meta & 0x07)){
|
||||
$this->level->setBlock($block, Block::get(DOUBLE_SLAB, $this->meta), true, false, true);
|
||||
|
||||
@ -87,7 +87,7 @@ class Slab extends Transparent{
|
||||
} else{
|
||||
return false;
|
||||
}
|
||||
if($block->getID() === SLAB and ($target->getMetadata() & 0x07) !== ($this->meta & 0x07)){
|
||||
if($block->getID() === self::SLAB and ($target->getMetadata() & 0x07) !== ($this->meta & 0x07)){
|
||||
return false;
|
||||
}
|
||||
$this->level->setBlock($block, $this, true, false, true);
|
||||
|
@ -46,7 +46,7 @@ class SnowLayer extends Flowable{
|
||||
|
||||
public function onUpdate($type){
|
||||
if($type === BLOCK_UPDATE_NORMAL){
|
||||
if($this->getSide(0)->getID() === AIR){ //Replace with common break method
|
||||
if($this->getSide(0)->getID() === self::AIR){ //Replace with common break method
|
||||
$this->level->setBlock($this, new Air(), true, false, true);
|
||||
|
||||
return BLOCK_UPDATE_NORMAL;
|
||||
@ -59,7 +59,7 @@ class SnowLayer extends Flowable{
|
||||
public function getDrops(Item $item, Player $player){
|
||||
if($item->isShovel() !== false){
|
||||
return array(
|
||||
array(Item\SNOWBALL, 0, 1),
|
||||
array(Item\Item::SNOWBALL, 0, 1),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -21,9 +21,9 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
use PocketMine\Math\Vector3 as Vector3;
|
||||
use PocketMine;
|
||||
|
||||
class Sugarcane extends Flowable{
|
||||
public function __construct($meta = 0){
|
||||
@ -38,11 +38,11 @@ class Sugarcane extends Flowable{
|
||||
}
|
||||
|
||||
public function onActivate(Item $item, Player $player){
|
||||
if($item->getID() === DYE and $item->getMetadata() === 0x0F){ //Bonemeal
|
||||
if($this->getSide(0)->getID() !== SUGARCANE_BLOCK){
|
||||
if($item->getID() === self::DYE and $item->getMetadata() === 0x0F){ //Bonemeal
|
||||
if($this->getSide(0)->getID() !== self::SUGARCANE_BLOCK){
|
||||
for($y = 1; $y < 3; ++$y){
|
||||
$b = $this->level->getBlock(new Vector3($this->x, $this->y + $y, $this->z));
|
||||
if($b->getID() === AIR){
|
||||
if($b->getID() === self::AIR){
|
||||
$this->level->setBlock($b, new Sugarcane(), true, false, true);
|
||||
break;
|
||||
}
|
||||
@ -63,7 +63,7 @@ class Sugarcane extends Flowable{
|
||||
public function onUpdate($type){
|
||||
if($type === BLOCK_UPDATE_NORMAL){
|
||||
$down = $this->getSide(0);
|
||||
if($down->isTransparent === true and $down->getID() !== SUGARCANE_BLOCK){ //Replace with common break method
|
||||
if($down->isTransparent === true and $down->getID() !== self::SUGARCANE_BLOCK){ //Replace with common break method
|
||||
//TODO
|
||||
//ServerAPI::request()->api->entity->drop($this, Item::get(SUGARCANE));
|
||||
$this->level->setBlock($this, new Air(), false, false, true);
|
||||
@ -71,11 +71,11 @@ class Sugarcane extends Flowable{
|
||||
return BLOCK_UPDATE_NORMAL;
|
||||
}
|
||||
} elseif($type === BLOCK_UPDATE_RANDOM){
|
||||
if($this->getSide(0)->getID() !== SUGARCANE_BLOCK){
|
||||
if($this->getSide(0)->getID() !== self::SUGARCANE_BLOCK){
|
||||
if($this->meta === 0x0F){
|
||||
for($y = 1; $y < 3; ++$y){
|
||||
$b = $this->level->getBlock(new Vector3($this->x, $this->y + $y, $this->z));
|
||||
if($b->getID() === AIR){
|
||||
if($b->getID() === self::AIR){
|
||||
$this->level->setBlock($b, new Sugarcane(), true, false, true);
|
||||
break;
|
||||
}
|
||||
@ -96,11 +96,11 @@ class Sugarcane extends Flowable{
|
||||
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
$down = $this->getSide(0);
|
||||
if($down->getID() === SUGARCANE_BLOCK){
|
||||
if($down->getID() === self::SUGARCANE_BLOCK){
|
||||
$this->level->setBlock($block, new Sugarcane(), true, false, true);
|
||||
|
||||
return true;
|
||||
} elseif($down->getID() === GRASS or $down->getID() === DIRT or $down->getID() === SAND){
|
||||
} elseif($down->getID() === self::GRASS or $down->getID() === self::DIRT or $down->getID() === self::SAND){
|
||||
$block0 = $down->getSide(2);
|
||||
$block1 = $down->getSide(3);
|
||||
$block2 = $down->getSide(4);
|
||||
|
@ -32,7 +32,7 @@ class TNT extends Solid{
|
||||
}
|
||||
|
||||
public function onActivate(Item $item, Player $player){
|
||||
if($item->getID() === Item\FLINT_STEEL){
|
||||
if($item->getID() === Item\Item::FLINT_STEEL){
|
||||
if(($player->gamemode & 0x01) === 0){
|
||||
$item->useOn($this);
|
||||
}
|
||||
|
@ -47,12 +47,12 @@ class TallGrass extends Flowable{
|
||||
public function getDrops(Item\Item $item, Player $player){
|
||||
$drops = array();
|
||||
$possibleDrops = array(
|
||||
array(Item\WHEAT_SEEDS, 0, 1),
|
||||
array(Item\CARROT, 0, 1),
|
||||
array(Item\POTATO, 0, 1),
|
||||
array(Item\BEETROOT_SEEDS, 0, 1),
|
||||
array(Item\MELON_SEEDS, 0, 1),
|
||||
array(Item\PUMPKIN_SEEDS, 0, 1),
|
||||
array(Item\Item::WHEAT_SEEDS, 0, 1),
|
||||
array(Item\Item::CARROT, 0, 1),
|
||||
array(Item\Item::POTATO, 0, 1),
|
||||
array(Item\Item::BEETROOT_SEEDS, 0, 1),
|
||||
array(Item\Item::MELON_SEEDS, 0, 1),
|
||||
array(Item\Item::PUMPKIN_SEEDS, 0, 1),
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
|
@ -43,7 +43,7 @@ class Torch extends Flowable{
|
||||
0 => 0,
|
||||
);
|
||||
|
||||
if($this->getSide($faces[$side])->isTransparent === true and !($side === 0 and $this->getSide(0)->getID() === FENCE)){ //Replace with common break method
|
||||
if($this->getSide($faces[$side])->isTransparent === true and !($side === 0 and $this->getSide(0)->getID() === self::FENCE)){ //Replace with common break method
|
||||
//TODO
|
||||
//ServerAPI::request()->api->entity->drop($this, Item::get($this->id, 0, 1));
|
||||
$this->level->setBlock($this, new Air(), true, false, true);
|
||||
@ -68,7 +68,7 @@ class Torch extends Flowable{
|
||||
$this->level->setBlock($block, $this, true, false, true);
|
||||
|
||||
return true;
|
||||
} elseif($this->getSide(0)->isTransparent === false or $this->getSide(0)->getID() === FENCE){
|
||||
} elseif($this->getSide(0)->isTransparent === false or $this->getSide(0)->getID() === self::FENCE){
|
||||
$this->meta = 0;
|
||||
$this->level->setBlock($block, $this, true, false, true);
|
||||
|
||||
|
@ -37,7 +37,7 @@ class Trapdoor extends Transparent{
|
||||
}
|
||||
|
||||
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){
|
||||
if(($target->isTransparent === false or $target->getID() === self::SLAB) and $face !== 0 and $face !== 1){
|
||||
$faces = array(
|
||||
2 => 0,
|
||||
3 => 1,
|
||||
|
@ -21,9 +21,9 @@
|
||||
|
||||
namespace PocketMine\Block;
|
||||
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
use PocketMine\ServerAPI as ServerAPI;
|
||||
use PocketMine;
|
||||
|
||||
class Water extends Liquid{
|
||||
public function __construct($meta = 0){
|
||||
|
@ -33,7 +33,7 @@ class Wheat extends Flowable{
|
||||
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
$down = $this->getSide(0);
|
||||
if($down->getID() === FARMLAND){
|
||||
if($down->getID() === self::FARMLAND){
|
||||
$this->level->setBlock($block, $this, true, false, true);
|
||||
|
||||
return true;
|
||||
@ -43,7 +43,7 @@ class Wheat extends Flowable{
|
||||
}
|
||||
|
||||
public function onActivate(Item $item, Player $player){
|
||||
if($item->getID() === Item\DYE and $item->getMetadata() === 0x0F){ //Bonemeal
|
||||
if($item->getID() === Item\Item::DYE and $item->getMetadata() === 0x0F){ //Bonemeal
|
||||
$this->meta = 0x07;
|
||||
$this->level->setBlock($this, $this, true, false, true);
|
||||
if(($player->gamemode & 0x01) === 0){
|
||||
@ -80,10 +80,10 @@ class Wheat extends Flowable{
|
||||
public function getDrops(Item $item, Player $player){
|
||||
$drops = array();
|
||||
if($this->meta >= 0x07){
|
||||
$drops[] = array(Item\WHEAT, 0, 1);
|
||||
$drops[] = array(Item\WHEAT_SEEDS, 0, mt_rand(0, 3));
|
||||
$drops[] = array(Item\Item::WHEAT, 0, 1);
|
||||
$drops[] = array(Item\Item::WHEAT_SEEDS, 0, mt_rand(0, 3));
|
||||
} else{
|
||||
$drops[] = array(Item\WHEAT_SEEDS, 0, 1);
|
||||
$drops[] = array(Item\Item::WHEAT_SEEDS, 0, 1);
|
||||
}
|
||||
|
||||
return $drops;
|
||||
|
@ -33,7 +33,7 @@ class WoodDoor extends Door{
|
||||
|
||||
public function getDrops(Item $item, Player $player){
|
||||
return array(
|
||||
array(Item\WOODEN_DOOR, 0, 1),
|
||||
array(Item\Item::WOODEN_DOOR, 0, 1),
|
||||
);
|
||||
}
|
||||
}
|
@ -45,11 +45,11 @@ class WoodSlab extends Transparent{
|
||||
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)){
|
||||
if($target->getID() === self::WOOD_SLAB and ($target->getMetadata() & 0x08) === 0x08 and ($target->getMetadata() & 0x07) === ($this->meta & 0x07)){
|
||||
$this->level->setBlock($target, Block::get(DOUBLE_WOOD_SLAB, $this->meta), true, false, true);
|
||||
|
||||
return true;
|
||||
} elseif($block->getID() === WOOD_SLAB and ($block->getMetadata() & 0x07) === ($this->meta & 0x07)){
|
||||
} elseif($block->getID() === self::WOOD_SLAB and ($block->getMetadata() & 0x07) === ($this->meta & 0x07)){
|
||||
$this->level->setBlock($block, Block::get(DOUBLE_WOOD_SLAB, $this->meta), true, false, true);
|
||||
|
||||
return true;
|
||||
@ -57,17 +57,17 @@ class WoodSlab extends Transparent{
|
||||
$this->meta |= 0x08;
|
||||
}
|
||||
} elseif($face === 1){
|
||||
if($target->getID() === WOOD_SLAB and ($target->getMetadata() & 0x08) === 0 and ($target->getMetadata() & 0x07) === ($this->meta & 0x07)){
|
||||
if($target->getID() === self::WOOD_SLAB and ($target->getMetadata() & 0x08) === 0 and ($target->getMetadata() & 0x07) === ($this->meta & 0x07)){
|
||||
$this->level->setBlock($target, Block::get(DOUBLE_WOOD_SLAB, $this->meta), true, false, true);
|
||||
|
||||
return true;
|
||||
} elseif($block->getID() === WOOD_SLAB and ($block->getMetadata() & 0x07) === ($this->meta & 0x07)){
|
||||
} elseif($block->getID() === self::WOOD_SLAB and ($block->getMetadata() & 0x07) === ($this->meta & 0x07)){
|
||||
$this->level->setBlock($block, Block::get(DOUBLE_WOOD_SLAB, $this->meta), true, false, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
} elseif(!$player->inBlock($block)){
|
||||
if($block->getID() === WOOD_SLAB){
|
||||
if($block->getID() === self::WOOD_SLAB){
|
||||
if(($block->getMetadata() & 0x07) === ($this->meta & 0x07)){
|
||||
$this->level->setBlock($block, Block::get(DOUBLE_WOOD_SLAB, $this->meta), true, false, true);
|
||||
|
||||
@ -83,7 +83,7 @@ class WoodSlab extends Transparent{
|
||||
} else{
|
||||
return false;
|
||||
}
|
||||
if($block->getID() === WOOD_SLAB and ($target->getMetadata() & 0x07) !== ($this->meta & 0x07)){
|
||||
if($block->getID() === self::WOOD_SLAB and ($target->getMetadata() & 0x07) !== ($this->meta & 0x07)){
|
||||
return false;
|
||||
}
|
||||
$this->level->setBlock($block, $this, true, false, true);
|
||||
|
@ -24,6 +24,7 @@
|
||||
*/
|
||||
namespace PocketMine\Entity;
|
||||
|
||||
use PocketMine;
|
||||
use PocketMine\Event\Entity\EntityLevelChangeEvent as EntityLevelChangeEvent;
|
||||
use PocketMine\Event\Entity\EntityMotionEvent as EntityMotionEvent;
|
||||
use PocketMine\Event\Entity\EntityMoveEvent as EntityMoveEvent;
|
||||
@ -34,9 +35,12 @@ use PocketMine\Level\Position as Position;
|
||||
use PocketMine\Math\AxisAlignedBB as AxisAlignedBB;
|
||||
use PocketMine\Math\Vector3 as Vector3;
|
||||
use PocketMine\NBT\Tag\Compound as Compound;
|
||||
use PocketMine\Network\Protocol\MoveEntityPacket_PosRot as MoveEntityPacket_PosRot;
|
||||
use PocketMine\Network\Protocol\MovePlayerPacket as MovePlayerPacket;
|
||||
use PocketMine\Network\Protocol\RemoveEntityPacket as RemoveEntityPacket;
|
||||
use PocketMine\Network\Protocol\SetEntityMotionPacket as SetEntityMotionPacket;
|
||||
use PocketMine\Player as Player;
|
||||
use PocketMine\PMF\LevelFormat as LevelFormat;
|
||||
use PocketMine;
|
||||
|
||||
abstract class Entity extends Position{
|
||||
public static $entityCount = 1;
|
||||
@ -156,7 +160,7 @@ abstract class Entity extends Position{
|
||||
|
||||
public function despawnFrom(Player $player){
|
||||
if(isset($this->hasSpawned[$player->getID()])){
|
||||
$pk = new Network\Protocol\RemoveEntityPacket;
|
||||
$pk = new RemoveEntityPacket;
|
||||
$pk->eid = $this->id;
|
||||
$player->dataPacket($pk);
|
||||
unset($this->hasSpawned[$player->getID()]);
|
||||
@ -216,7 +220,7 @@ abstract class Entity extends Position{
|
||||
$this->lastPitch = $this->pitch;
|
||||
|
||||
if($this instanceof Human){
|
||||
$pk = new Network\Protocol\MovePlayerPacket;
|
||||
$pk = new MovePlayerPacket;
|
||||
$pk->eid = $this->id;
|
||||
$pk->x = $this->x;
|
||||
$pk->y = $this->y;
|
||||
@ -225,7 +229,7 @@ abstract class Entity extends Position{
|
||||
$pk->pitch = $this->pitch;
|
||||
$pk->bodyYaw = $this->yaw;
|
||||
} else{
|
||||
$pk = new Network\Protocol\MoveEntityPacket_PosRot;
|
||||
$pk = new MoveEntityPacket_PosRot;
|
||||
$pk->eid = $this->id;
|
||||
$pk->x = $this->x;
|
||||
$pk->y = $this->y;
|
||||
@ -239,7 +243,7 @@ abstract class Entity extends Position{
|
||||
if($this->motionChanged === true){
|
||||
$this->motionChanged = false;
|
||||
|
||||
$pk = new Network\Protocol\SetEntityMotionPacket;
|
||||
$pk = new SetEntityMotionPacket;
|
||||
$pk->eid = $this->id;
|
||||
$pk->speedX = $this->motionX;
|
||||
$pk->speedY = $this->motionY;
|
||||
@ -460,7 +464,7 @@ abstract class Entity extends Position{
|
||||
$this->getNextChunk(true);
|
||||
$this->forceMovement = $pos;
|
||||
|
||||
$pk = new Network\Protocol\MovePlayerPacket;
|
||||
$pk = new MovePlayerPacket;
|
||||
$pk->eid = 0;
|
||||
$pk->x = $this->x;
|
||||
$pk->y = $this->y;
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
namespace PocketMine\Entity;
|
||||
|
||||
use PocketMine;
|
||||
use PocketMine\Event\Entity\EntityArmorChangeEvent as EntityArmorChangeEvent;
|
||||
use PocketMine\Event\Entity\EntityInventoryChangeEvent as EntityInventoryChangeEvent;
|
||||
use PocketMine\Event\Event as Event;
|
||||
@ -29,7 +30,11 @@ use PocketMine\Item\Item as Item;
|
||||
use PocketMine\NBT\Tag\Byte as Byte;
|
||||
use PocketMine\NBT\Tag\Compound as Compound;
|
||||
use PocketMine\NBT\Tag\Short as Short;
|
||||
use PocketMine;
|
||||
use PocketMine\Network\Protocol\AddPlayerPacket as AddPlayerPacket;
|
||||
use PocketMine\Network\Protocol\ContainerSetContentPacket as ContainerSetContentPacket;
|
||||
use PocketMine\Network\Protocol\PlayerEquipmentPacket as PlayerEquipmentPacket;
|
||||
use PocketMine\Network\Protocol\RemovePlayerPacket as RemovePlayerPacket;
|
||||
use PocketMine\Network\Protocol\SetEntityMotionPacket as SetEntityMotionPacket;
|
||||
|
||||
class Human extends Creature implements ProjectileSource, InventorySource{
|
||||
|
||||
@ -121,7 +126,7 @@ class Human extends Creature implements ProjectileSource, InventorySource{
|
||||
if($player !== $this and !isset($this->hasSpawned[$player->getID()])){
|
||||
$this->hasSpawned[$player->getID()] = $player;
|
||||
|
||||
$pk = new Network\Protocol\AddPlayerPacket;
|
||||
$pk = new AddPlayerPacket;
|
||||
$pk->clientID = 0;
|
||||
$pk->username = $this->nameTag;
|
||||
$pk->eid = $this->id;
|
||||
@ -135,7 +140,7 @@ class Human extends Creature implements ProjectileSource, InventorySource{
|
||||
$pk->metadata = $this->getMetadata();
|
||||
$player->dataPacket($pk);
|
||||
|
||||
$pk = new Network\Protocol\SetEntityMotionPacket;
|
||||
$pk = new SetEntityMotionPacket;
|
||||
$pk->eid = $this->id;
|
||||
$pk->speedX = $this->motionX;
|
||||
$pk->speedY = $this->motionY;
|
||||
@ -150,7 +155,7 @@ class Human extends Creature implements ProjectileSource, InventorySource{
|
||||
|
||||
public function despawnFrom(Player $player){
|
||||
if(isset($this->hasSpawned[$player->getID()])){
|
||||
$pk = new Network\Protocol\RemovePlayerPacket;
|
||||
$pk = new RemovePlayerPacket;
|
||||
$pk->eid = $this->id;
|
||||
$pk->clientID = 0;
|
||||
$player->dataPacket($pk);
|
||||
@ -177,7 +182,7 @@ class Human extends Creature implements ProjectileSource, InventorySource{
|
||||
}
|
||||
|
||||
public function sendCurrentEquipmentSlot(Player $player){
|
||||
$pk = new Network\Protocol\PlayerEquipmentPacket;
|
||||
$pk = new PlayerEquipmentPacket;
|
||||
$pk->eid = $this->id;
|
||||
$pk->item = $this->getSlot($this->slot)->getID();
|
||||
$pk->meta = $this->getSlot($this->slot)->getMetadata();
|
||||
@ -225,7 +230,7 @@ class Human extends Creature implements ProjectileSource, InventorySource{
|
||||
$pk->slots = $slots;
|
||||
$player->dataPacket($pk);
|
||||
} elseif($this instanceof Player){
|
||||
$pk = new Network\Protocol\ContainerSetContentPacket;
|
||||
$pk = new ContainerSetContentPacket;
|
||||
$pk->windowid = 0x78; //Armor window id
|
||||
$pk->slots = $this->armor;
|
||||
$this->dataPacket($pk);
|
||||
|
@ -22,8 +22,8 @@
|
||||
namespace PocketMine\Event\Entity;
|
||||
|
||||
use PocketMine\Entity\Entity as Entity;
|
||||
use PocketMine\Event;
|
||||
use PocketMine;
|
||||
use PocketMine\Event;
|
||||
use PocketMine\Item\Item as Item;
|
||||
|
||||
class EntityArmorChangeEvent extends EntityEvent implements CancellableEvent{
|
||||
|
@ -22,8 +22,8 @@
|
||||
namespace PocketMine\Event\Entity;
|
||||
|
||||
use PocketMine\Entity\Entity as Entity;
|
||||
use PocketMine\Event;
|
||||
use PocketMine;
|
||||
use PocketMine\Event;
|
||||
use PocketMine\Item\Item as Item;
|
||||
|
||||
class EntityInventoryChangeEvent extends EntityEvent implements CancellableEvent{
|
||||
|
@ -22,8 +22,8 @@
|
||||
namespace PocketMine\Event\Entity;
|
||||
|
||||
use PocketMine\Entity\Entity as Entity;
|
||||
use PocketMine\Event;
|
||||
use PocketMine;
|
||||
use PocketMine\Event;
|
||||
use PocketMine\Level\Level as Level;
|
||||
|
||||
class EntityLevelChangeEvent extends EntityEvent implements CancellableEvent{
|
||||
|
@ -22,8 +22,8 @@
|
||||
namespace PocketMine\Event\Entity;
|
||||
|
||||
use PocketMine\Entity\Entity as Entity;
|
||||
use PocketMine\Event;
|
||||
use PocketMine;
|
||||
use PocketMine\Event;
|
||||
use PocketMine\Math\Vector3 as Vector3;
|
||||
|
||||
class EntityMotionEvent extends EntityEvent implements CancellableEvent{
|
||||
|
@ -22,8 +22,8 @@
|
||||
namespace PocketMine\Event\Entity;
|
||||
|
||||
use PocketMine\Entity\Entity as Entity;
|
||||
use PocketMine\Event;
|
||||
use PocketMine;
|
||||
use PocketMine\Event;
|
||||
use PocketMine\Math\Vector3 as Vector3;
|
||||
|
||||
class EntityMoveEvent extends EntityEvent implements CancellableEvent{
|
||||
|
@ -22,8 +22,8 @@
|
||||
namespace PocketMine\Event\Tile;
|
||||
|
||||
use PocketMine\Event;
|
||||
use PocketMine\Item\Item as Item;
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
use PocketMine\Tile\Tile as Tile;
|
||||
|
||||
class TileInventoryChangeEvent extends TileEvent implements CancellableEvent{
|
||||
|
@ -21,13 +21,13 @@
|
||||
|
||||
namespace PocketMine\Item;
|
||||
|
||||
use PocketMine;
|
||||
use PocketMine\Block\Air as Air;
|
||||
use PocketMine\Block\Block as Block;
|
||||
use PocketMine\Block\Lava as Lava;
|
||||
use PocketMine\Block\Liquid as Liquid;
|
||||
use PocketMine\Block\Water as Water;
|
||||
use PocketMine\Level\Level as Level;
|
||||
use PocketMine;
|
||||
|
||||
class Bucket extends Item{
|
||||
public function __construct($meta = 0, $count = 1){
|
||||
@ -48,7 +48,7 @@ class Bucket extends Item{
|
||||
}
|
||||
} elseif($this->meta === WATER){
|
||||
//Support Make Non-Support Water to Support Water
|
||||
if($block->getID() === AIR || ($block instanceof Water && ($block->getMetadata() & 0x07) != 0x00)){
|
||||
if($block->getID() === self::AIR || ($block instanceof Water && ($block->getMetadata() & 0x07) != 0x00)){
|
||||
$water = new Water();
|
||||
$level->setBlock($block, $water, true, false, true);
|
||||
$water->place(clone $this, $player, $block, $target, $face, $fx, $fy, $fz);
|
||||
@ -59,7 +59,7 @@ class Bucket extends Item{
|
||||
return true;
|
||||
}
|
||||
} elseif($this->meta === LAVA){
|
||||
if($block->getID() === AIR){
|
||||
if($block->getID() === self::AIR){
|
||||
$level->setBlock($block, new Lava(), true, false, true);
|
||||
if(($player->gamemode & 0x01) === 0){
|
||||
$this->meta = 0;
|
||||
|
@ -21,11 +21,11 @@
|
||||
|
||||
namespace PocketMine\Item;
|
||||
|
||||
use PocketMine;
|
||||
use PocketMine\Block\Block as Block;
|
||||
use PocketMine\Block\Fire as Fire;
|
||||
use PocketMine\Block\Solid as Solid;
|
||||
use PocketMine\Level\Level as Level;
|
||||
use PocketMine;
|
||||
|
||||
class FlintSteel extends Item{
|
||||
public function __construct($meta = 0, $count = 1){
|
||||
@ -39,7 +39,7 @@ class FlintSteel extends Item{
|
||||
$player->setSlot($player->slot, new Item(AIR, 0, 0));
|
||||
}
|
||||
|
||||
if($block->getID() === AIR and ($target instanceof Solid)){
|
||||
if($block->getID() === self::AIR and ($target instanceof Solid)){
|
||||
$level->setBlock($block, new Fire(), true, false, true);
|
||||
|
||||
return true;
|
||||
|
@ -23,339 +23,339 @@
|
||||
* All the Item classes
|
||||
*/
|
||||
namespace PocketMine\Item;
|
||||
|
||||
//All Block IDs are here too
|
||||
const AIR = 0;
|
||||
const STONE = 1;
|
||||
const GRASS = 2;
|
||||
const DIRT = 3;
|
||||
const COBBLESTONE = 4;
|
||||
const COBBLE = 4;
|
||||
const PLANK = 5;
|
||||
const PLANKS = 5;
|
||||
const WOODEN_PLANK = 5;
|
||||
const WOODEN_PLANKS = 5;
|
||||
const SAPLING = 6;
|
||||
const SAPLINGS = 6;
|
||||
const BEDROCK = 7;
|
||||
const WATER = 8;
|
||||
const STILL_WATER = 9;
|
||||
const LAVA = 10;
|
||||
const STILL_LAVA = 11;
|
||||
const SAND = 12;
|
||||
const GRAVEL = 13;
|
||||
const GOLD_ORE = 14;
|
||||
const IRON_ORE = 15;
|
||||
const COAL_ORE = 16;
|
||||
const WOOD = 17;
|
||||
const TRUNK = 17;
|
||||
const LEAVES = 18;
|
||||
const LEAVE = 18;
|
||||
const SPONGE = 19;
|
||||
const GLASS = 20;
|
||||
const LAPIS_ORE = 21;
|
||||
const LAPIS_BLOCK = 22;
|
||||
|
||||
const SANDSTONE = 24;
|
||||
|
||||
const BED_BLOCK = 26;
|
||||
|
||||
|
||||
const COBWEB = 30;
|
||||
const TALL_GRASS = 31;
|
||||
const BUSH = 32;
|
||||
const DEAD_BUSH = 32;
|
||||
const WOOL = 35;
|
||||
const DANDELION = 37;
|
||||
const ROSE = 38;
|
||||
const CYAN_FLOWER = 38;
|
||||
const BROWN_MUSHROOM = 39;
|
||||
const RED_MUSHROOM = 40;
|
||||
const GOLD_BLOCK = 41;
|
||||
const IRON_BLOCK = 42;
|
||||
const DOUBLE_SLAB = 43;
|
||||
const DOUBLE_SLABS = 43;
|
||||
const SLAB = 44;
|
||||
const SLABS = 44;
|
||||
const BRICKS = 45;
|
||||
const BRICKS_BLOCK = 45;
|
||||
const TNT = 46;
|
||||
const BOOKSHELF = 47;
|
||||
const MOSS_STONE = 48;
|
||||
const MOSSY_STONE = 48;
|
||||
const OBSIDIAN = 49;
|
||||
const TORCH = 50;
|
||||
const FIRE = 51;
|
||||
|
||||
const WOOD_STAIRS = 53;
|
||||
const WOODEN_STAIRS = 53;
|
||||
const OAK_WOOD_STAIRS = 53;
|
||||
const OAK_WOODEN_STAIRS = 53;
|
||||
const CHEST = 54;
|
||||
|
||||
const DIAMOND_ORE = 56;
|
||||
const DIAMOND_BLOCK = 57;
|
||||
const CRAFTING_TABLE = 58;
|
||||
const WORKBENCH = 58;
|
||||
const WHEAT_BLOCK = 59;
|
||||
const FARMLAND = 60;
|
||||
const FURNACE = 61;
|
||||
const BURNING_FURNACE = 62;
|
||||
const LIT_FURNACE = 62;
|
||||
const SIGN_POST = 63;
|
||||
const DOOR_BLOCK = 64;
|
||||
const WOODEN_DOOR_BLOCK = 64;
|
||||
const WOOD_DOOR_BLOCK = 64;
|
||||
const LADDER = 65;
|
||||
|
||||
const COBBLE_STAIRS = 67;
|
||||
const COBBLESTONE_STAIRS = 67;
|
||||
const WALL_SIGN = 68;
|
||||
|
||||
const IRON_DOOR_BLOCK = 71;
|
||||
|
||||
const REDSTONE_ORE = 73;
|
||||
const GLOWING_REDSTONE_ORE = 74;
|
||||
const LIT_REDSTONE_ORE = 74;
|
||||
|
||||
const SNOW = 78;
|
||||
const SNOW_LAYER = 78;
|
||||
const ICE = 79;
|
||||
const SNOW_BLOCK = 80;
|
||||
const CACTUS = 81;
|
||||
const CLAY_BLOCK = 82;
|
||||
const REEDS = 83;
|
||||
const SUGARCANE_BLOCK = 83;
|
||||
|
||||
const FENCE = 85;
|
||||
const PUMPKIN = 86;
|
||||
const NETHERRACK = 87;
|
||||
const SOUL_SAND = 88;
|
||||
const GLOWSTONE = 89;
|
||||
const GLOWSTONE_BLOCK = 89;
|
||||
|
||||
|
||||
const LIT_PUMPKIN = 91;
|
||||
const JACK_O_LANTERN = 91;
|
||||
const CAKE_BLOCK = 92;
|
||||
|
||||
const TRAPDOOR = 96;
|
||||
|
||||
const STONE_BRICKS = 98;
|
||||
const STONE_BRICK = 98;
|
||||
|
||||
const IRON_BAR = 101;
|
||||
const IRON_BARS = 101;
|
||||
const GLASS_PANE = 102;
|
||||
const GLASS_PANEL = 102;
|
||||
const MELON_BLOCK = 103;
|
||||
const PUMPKIN_STEM = 104;
|
||||
const MELON_STEM = 105;
|
||||
|
||||
const FENCE_GATE = 107;
|
||||
const BRICK_STAIRS = 108;
|
||||
const STONE_BRICK_STAIRS = 109;
|
||||
|
||||
const NETHER_BRICKS = 112;
|
||||
const NETHER_BRICK_BLOCK = 112;
|
||||
|
||||
const NETHER_BRICKS_STAIRS = 114;
|
||||
|
||||
const SANDSTONE_STAIRS = 128;
|
||||
|
||||
const SPRUCE_WOOD_STAIRS = 134;
|
||||
const SPRUCE_WOODEN_STAIRS = 134;
|
||||
const BIRCH_WOOD_STAIRS = 135;
|
||||
const BIRCH_WOODEN_STAIRS = 135;
|
||||
const JUNGLE_WOOD_STAIRS = 136;
|
||||
const JUNGLE_WOODEN_STAIRS = 136;
|
||||
|
||||
const COBBLE_WALL = 139;
|
||||
const STONE_WALL = 139;
|
||||
const COBBLESTONE_WALL = 139;
|
||||
|
||||
const CARROT_BLOCK = 141;
|
||||
const POTATO_BLOCK = 142;
|
||||
|
||||
const QUARTZ_BLOCK = 155;
|
||||
const QUARTZ_STAIRS = 156;
|
||||
const DOUBLE_WOOD_SLAB = 157;
|
||||
const DOUBLE_WOODEN_SLAB = 157;
|
||||
const DOUBLE_WOOD_SLABS = 157;
|
||||
const DOUBLE_WOODEN_SLABS = 157;
|
||||
const WOOD_SLAB = 158;
|
||||
const WOODEN_SLAB = 158;
|
||||
const WOOD_SLABS = 158;
|
||||
const WOODEN_SLABS = 158;
|
||||
|
||||
const HAY_BALE = 170;
|
||||
const CARPET = 171;
|
||||
|
||||
const COAL_BLOCK = 173;
|
||||
|
||||
const BEETROOT_BLOCK = 244;
|
||||
const STONECUTTER = 245;
|
||||
const GLOWING_OBSIDIAN = 246;
|
||||
const NETHER_REACTOR = 247;
|
||||
|
||||
|
||||
//Normal Item IDs
|
||||
|
||||
const IRON_SHOVEL = 256; //Implemented
|
||||
const IRON_PICKAXE = 257; //Implemented
|
||||
const IRON_AXE = 258; //Implemented
|
||||
const FLINT_STEEL = 259;
|
||||
const FLINT_AND_STEEL = 259;
|
||||
const APPLE = 260; //Implemented
|
||||
const BOW = 261;
|
||||
const ARROW = 262;
|
||||
const COAL = 263; //Implemented
|
||||
const DIAMOND = 264; //Implemented
|
||||
const IRON_INGOT = 265; //Implemented
|
||||
const GOLD_INGOT = 266; //Implemented
|
||||
const IRON_SWORD = 267;
|
||||
const WOODEN_SWORD = 268; //Implemented
|
||||
const WOODEN_SHOVEL = 269; //Implemented
|
||||
const WOODEN_PICKAXE = 270; //Implemented
|
||||
const WOODEN_AXE = 271; //Implemented
|
||||
const STONE_SWORD = 272;
|
||||
const STONE_SHOVEL = 273;
|
||||
const STONE_PICKAXE = 274;
|
||||
const STONE_AXE = 275;
|
||||
const DIAMOND_SWORD = 276;
|
||||
const DIAMOND_SHOVEL = 277;
|
||||
const DIAMOND_PICKAXE = 278;
|
||||
const DIAMOND_AXE = 279;
|
||||
const STICK = 280; //Implemented
|
||||
const STICKS = 280;
|
||||
const BOWL = 281; //Implemented
|
||||
const MUSHROOM_STEW = 282;
|
||||
const GOLD_SWORD = 283;
|
||||
const GOLD_SHOVEL = 284;
|
||||
const GOLD_PICKAXE = 285;
|
||||
const GOLD_AXE = 286;
|
||||
const GOLDEN_SWORD = 283;
|
||||
const GOLDEN_SHOVEL = 284;
|
||||
const GOLDEN_PICKAXE = 285;
|
||||
const GOLDEN_AXE = 286;
|
||||
const STRING = 287;
|
||||
const FEATHER = 288; //Implemented
|
||||
const GUNPOWDER = 289;
|
||||
const WOODEN_HOE = 290;
|
||||
const STONE_HOE = 291;
|
||||
const IRON_HOE = 292; //Implemented
|
||||
const DIAMOND_HOE = 293;
|
||||
const GOLD_HOE = 294;
|
||||
const GOLDEN_HOE = 294;
|
||||
const SEEDS = 295;
|
||||
const WHEAT_SEEDS = 295;
|
||||
const WHEAT = 296;
|
||||
const BREAD = 297;
|
||||
const LEATHER_CAP = 298;
|
||||
const LEATHER_TUNIC = 299;
|
||||
const LEATHER_PANTS = 300;
|
||||
const LEATHER_BOOTS = 301;
|
||||
const CHAIN_HELMET = 302;
|
||||
const CHAIN_CHESTPLATE = 303;
|
||||
const CHAIN_LEGGINGS = 304;
|
||||
const CHAIN_BOOTS = 305;
|
||||
const IRON_HELMET = 306;
|
||||
const IRON_CHESTPLATE = 307;
|
||||
const IRON_LEGGINGS = 308;
|
||||
const IRON_BOOTS = 309;
|
||||
const DIAMOND_HELMET = 310;
|
||||
const DIAMOND_CHESTPLATE = 311;
|
||||
const DIAMOND_LEGGINGS = 312;
|
||||
const DIAMOND_BOOTS = 313;
|
||||
const GOLD_HELMET = 314;
|
||||
const GOLD_CHESTPLATE = 315;
|
||||
const GOLD_LEGGINGS = 316;
|
||||
const GOLD_BOOTS = 317;
|
||||
const FLINT = 318;
|
||||
const RAW_PORKCHOP = 319;
|
||||
const COOKED_PORKCHOP = 320;
|
||||
const PAINTING = 321;
|
||||
const GOLDEN_APPLE = 322;
|
||||
const SIGN = 323;
|
||||
const WOODEN_DOOR = 324;
|
||||
const BUCKET = 325;
|
||||
|
||||
const MINECART = 329;
|
||||
|
||||
const IRON_DOOR = 330;
|
||||
const REDSTONE = 331;
|
||||
const REDSTONE_DUST = 331;
|
||||
const SNOWBALL = 332;
|
||||
|
||||
const LEATHER = 334;
|
||||
|
||||
const BRICK = 336;
|
||||
const CLAY = 337;
|
||||
const SUGARCANE = 338;
|
||||
const SUGAR_CANE = 338;
|
||||
const SUGAR_CANES = 338;
|
||||
const PAPER = 339;
|
||||
const BOOK = 340;
|
||||
const SLIMEBALL = 341;
|
||||
|
||||
const EGG = 344;
|
||||
const COMPASS = 345;
|
||||
|
||||
const CLOCK = 347;
|
||||
const GLOWSTONE_DUST = 348;
|
||||
//const RAW_FISH = 349;
|
||||
//const COOKED_FISH = 350;
|
||||
const DYE = 351;
|
||||
const BONE = 352;
|
||||
const SUGAR = 353;
|
||||
const CAKE = 354;
|
||||
const BED = 355;
|
||||
|
||||
|
||||
//const COOKIE = 357;
|
||||
|
||||
|
||||
const SHEARS = 359;
|
||||
const MELON = 360;
|
||||
const MELON_SLICE = 360;
|
||||
const PUMPKIN_SEEDS = 361;
|
||||
const MELON_SEEDS = 362;
|
||||
const RAW_BEEF = 363;
|
||||
const STEAK = 364;
|
||||
const COOKED_BEEF = 364;
|
||||
|
||||
const RAW_CHICKEN = 365;
|
||||
const COOKED_CHICKEN = 366;
|
||||
|
||||
const SPAWN_EGG = 383;
|
||||
|
||||
const CARROT = 391;
|
||||
const CARROTS = 391;
|
||||
const POTATO = 392;
|
||||
const POTATOES = 392; //@shoghicp Why the heck do we need plural redundant Item ID here????
|
||||
const BAKED_POTATO = 393;
|
||||
const BAKED_POTATOES = 393;
|
||||
|
||||
const PUMPKIN_PIE = 400;
|
||||
|
||||
const NETHER_BRICK = 405;
|
||||
const QUARTZ = 406;
|
||||
const NETHER_QUARTZ = 406;
|
||||
|
||||
const CAMERA = 456;
|
||||
const BEETROOT = 457;
|
||||
const BEETROOT_SEEDS = 458;
|
||||
const BEETROOT_SEED = 458;
|
||||
const BEETROOT_SOUP = 459;
|
||||
use PocketMine;
|
||||
use PocketMine\Block\Block as Block;
|
||||
use PocketMine\Entity\Entity as Entity;
|
||||
use PocketMine\Item\Block as ItemBlock;
|
||||
use PocketMine\Level\Level as Level;
|
||||
use PocketMine\Recipes\Fuel as Fuel;
|
||||
use PocketMine\Recipes\Smelt as Smelt;
|
||||
use PocketMine;
|
||||
|
||||
class Item{
|
||||
//All Block IDs are here too
|
||||
const AIR = 0;
|
||||
const STONE = 1;
|
||||
const GRASS = 2;
|
||||
const DIRT = 3;
|
||||
const COBBLESTONE = 4;
|
||||
const COBBLE = 4;
|
||||
const PLANK = 5;
|
||||
const PLANKS = 5;
|
||||
const WOODEN_PLANK = 5;
|
||||
const WOODEN_PLANKS = 5;
|
||||
const SAPLING = 6;
|
||||
const SAPLINGS = 6;
|
||||
const BEDROCK = 7;
|
||||
const WATER = 8;
|
||||
const STILL_WATER = 9;
|
||||
const LAVA = 10;
|
||||
const STILL_LAVA = 11;
|
||||
const SAND = 12;
|
||||
const GRAVEL = 13;
|
||||
const GOLD_ORE = 14;
|
||||
const IRON_ORE = 15;
|
||||
const COAL_ORE = 16;
|
||||
const WOOD = 17;
|
||||
const TRUNK = 17;
|
||||
const LEAVES = 18;
|
||||
const LEAVE = 18;
|
||||
const SPONGE = 19;
|
||||
const GLASS = 20;
|
||||
const LAPIS_ORE = 21;
|
||||
const LAPIS_BLOCK = 22;
|
||||
|
||||
const SANDSTONE = 24;
|
||||
|
||||
const BED_BLOCK = 26;
|
||||
|
||||
|
||||
const COBWEB = 30;
|
||||
const TALL_GRASS = 31;
|
||||
const BUSH = 32;
|
||||
const DEAD_BUSH = 32;
|
||||
const WOOL = 35;
|
||||
const DANDELION = 37;
|
||||
const ROSE = 38;
|
||||
const CYAN_FLOWER = 38;
|
||||
const BROWN_MUSHROOM = 39;
|
||||
const RED_MUSHROOM = 40;
|
||||
const GOLD_BLOCK = 41;
|
||||
const IRON_BLOCK = 42;
|
||||
const DOUBLE_SLAB = 43;
|
||||
const DOUBLE_SLABS = 43;
|
||||
const SLAB = 44;
|
||||
const SLABS = 44;
|
||||
const BRICKS = 45;
|
||||
const BRICKS_BLOCK = 45;
|
||||
const TNT = 46;
|
||||
const BOOKSHELF = 47;
|
||||
const MOSS_STONE = 48;
|
||||
const MOSSY_STONE = 48;
|
||||
const OBSIDIAN = 49;
|
||||
const TORCH = 50;
|
||||
const FIRE = 51;
|
||||
|
||||
const WOOD_STAIRS = 53;
|
||||
const WOODEN_STAIRS = 53;
|
||||
const OAK_WOOD_STAIRS = 53;
|
||||
const OAK_WOODEN_STAIRS = 53;
|
||||
const CHEST = 54;
|
||||
|
||||
const DIAMOND_ORE = 56;
|
||||
const DIAMOND_BLOCK = 57;
|
||||
const CRAFTING_TABLE = 58;
|
||||
const WORKBENCH = 58;
|
||||
const WHEAT_BLOCK = 59;
|
||||
const FARMLAND = 60;
|
||||
const FURNACE = 61;
|
||||
const BURNING_FURNACE = 62;
|
||||
const LIT_FURNACE = 62;
|
||||
const SIGN_POST = 63;
|
||||
const DOOR_BLOCK = 64;
|
||||
const WOODEN_DOOR_BLOCK = 64;
|
||||
const WOOD_DOOR_BLOCK = 64;
|
||||
const LADDER = 65;
|
||||
|
||||
const COBBLE_STAIRS = 67;
|
||||
const COBBLESTONE_STAIRS = 67;
|
||||
const WALL_SIGN = 68;
|
||||
|
||||
const IRON_DOOR_BLOCK = 71;
|
||||
|
||||
const REDSTONE_ORE = 73;
|
||||
const GLOWING_REDSTONE_ORE = 74;
|
||||
const LIT_REDSTONE_ORE = 74;
|
||||
|
||||
const SNOW = 78;
|
||||
const SNOW_LAYER = 78;
|
||||
const ICE = 79;
|
||||
const SNOW_BLOCK = 80;
|
||||
const CACTUS = 81;
|
||||
const CLAY_BLOCK = 82;
|
||||
const REEDS = 83;
|
||||
const SUGARCANE_BLOCK = 83;
|
||||
|
||||
const FENCE = 85;
|
||||
const PUMPKIN = 86;
|
||||
const NETHERRACK = 87;
|
||||
const SOUL_SAND = 88;
|
||||
const GLOWSTONE = 89;
|
||||
const GLOWSTONE_BLOCK = 89;
|
||||
|
||||
|
||||
const LIT_PUMPKIN = 91;
|
||||
const JACK_O_LANTERN = 91;
|
||||
const CAKE_BLOCK = 92;
|
||||
|
||||
const TRAPDOOR = 96;
|
||||
|
||||
const STONE_BRICKS = 98;
|
||||
const STONE_BRICK = 98;
|
||||
|
||||
const IRON_BAR = 101;
|
||||
const IRON_BARS = 101;
|
||||
const GLASS_PANE = 102;
|
||||
const GLASS_PANEL = 102;
|
||||
const MELON_BLOCK = 103;
|
||||
const PUMPKIN_STEM = 104;
|
||||
const MELON_STEM = 105;
|
||||
|
||||
const FENCE_GATE = 107;
|
||||
const BRICK_STAIRS = 108;
|
||||
const STONE_BRICK_STAIRS = 109;
|
||||
|
||||
const NETHER_BRICKS = 112;
|
||||
const NETHER_BRICK_BLOCK = 112;
|
||||
|
||||
const NETHER_BRICKS_STAIRS = 114;
|
||||
|
||||
const SANDSTONE_STAIRS = 128;
|
||||
|
||||
const SPRUCE_WOOD_STAIRS = 134;
|
||||
const SPRUCE_WOODEN_STAIRS = 134;
|
||||
const BIRCH_WOOD_STAIRS = 135;
|
||||
const BIRCH_WOODEN_STAIRS = 135;
|
||||
const JUNGLE_WOOD_STAIRS = 136;
|
||||
const JUNGLE_WOODEN_STAIRS = 136;
|
||||
|
||||
const COBBLE_WALL = 139;
|
||||
const STONE_WALL = 139;
|
||||
const COBBLESTONE_WALL = 139;
|
||||
|
||||
const CARROT_BLOCK = 141;
|
||||
const POTATO_BLOCK = 142;
|
||||
|
||||
const QUARTZ_BLOCK = 155;
|
||||
const QUARTZ_STAIRS = 156;
|
||||
const DOUBLE_WOOD_SLAB = 157;
|
||||
const DOUBLE_WOODEN_SLAB = 157;
|
||||
const DOUBLE_WOOD_SLABS = 157;
|
||||
const DOUBLE_WOODEN_SLABS = 157;
|
||||
const WOOD_SLAB = 158;
|
||||
const WOODEN_SLAB = 158;
|
||||
const WOOD_SLABS = 158;
|
||||
const WOODEN_SLABS = 158;
|
||||
|
||||
const HAY_BALE = 170;
|
||||
const CARPET = 171;
|
||||
|
||||
const COAL_BLOCK = 173;
|
||||
|
||||
const BEETROOT_BLOCK = 244;
|
||||
const STONECUTTER = 245;
|
||||
const GLOWING_OBSIDIAN = 246;
|
||||
const NETHER_REACTOR = 247;
|
||||
|
||||
|
||||
//Normal Item IDs
|
||||
|
||||
const IRON_SHOVEL = 256; //Implemented
|
||||
const IRON_PICKAXE = 257; //Implemented
|
||||
const IRON_AXE = 258; //Implemented
|
||||
const FLINT_STEEL = 259;
|
||||
const FLINT_AND_STEEL = 259;
|
||||
const APPLE = 260; //Implemented
|
||||
const BOW = 261;
|
||||
const ARROW = 262;
|
||||
const COAL = 263; //Implemented
|
||||
const DIAMOND = 264; //Implemented
|
||||
const IRON_INGOT = 265; //Implemented
|
||||
const GOLD_INGOT = 266; //Implemented
|
||||
const IRON_SWORD = 267;
|
||||
const WOODEN_SWORD = 268; //Implemented
|
||||
const WOODEN_SHOVEL = 269; //Implemented
|
||||
const WOODEN_PICKAXE = 270; //Implemented
|
||||
const WOODEN_AXE = 271; //Implemented
|
||||
const STONE_SWORD = 272;
|
||||
const STONE_SHOVEL = 273;
|
||||
const STONE_PICKAXE = 274;
|
||||
const STONE_AXE = 275;
|
||||
const DIAMOND_SWORD = 276;
|
||||
const DIAMOND_SHOVEL = 277;
|
||||
const DIAMOND_PICKAXE = 278;
|
||||
const DIAMOND_AXE = 279;
|
||||
const STICK = 280; //Implemented
|
||||
const STICKS = 280;
|
||||
const BOWL = 281; //Implemented
|
||||
const MUSHROOM_STEW = 282;
|
||||
const GOLD_SWORD = 283;
|
||||
const GOLD_SHOVEL = 284;
|
||||
const GOLD_PICKAXE = 285;
|
||||
const GOLD_AXE = 286;
|
||||
const GOLDEN_SWORD = 283;
|
||||
const GOLDEN_SHOVEL = 284;
|
||||
const GOLDEN_PICKAXE = 285;
|
||||
const GOLDEN_AXE = 286;
|
||||
const STRING = 287;
|
||||
const FEATHER = 288; //Implemented
|
||||
const GUNPOWDER = 289;
|
||||
const WOODEN_HOE = 290;
|
||||
const STONE_HOE = 291;
|
||||
const IRON_HOE = 292; //Implemented
|
||||
const DIAMOND_HOE = 293;
|
||||
const GOLD_HOE = 294;
|
||||
const GOLDEN_HOE = 294;
|
||||
const SEEDS = 295;
|
||||
const WHEAT_SEEDS = 295;
|
||||
const WHEAT = 296;
|
||||
const BREAD = 297;
|
||||
const LEATHER_CAP = 298;
|
||||
const LEATHER_TUNIC = 299;
|
||||
const LEATHER_PANTS = 300;
|
||||
const LEATHER_BOOTS = 301;
|
||||
const CHAIN_HELMET = 302;
|
||||
const CHAIN_CHESTPLATE = 303;
|
||||
const CHAIN_LEGGINGS = 304;
|
||||
const CHAIN_BOOTS = 305;
|
||||
const IRON_HELMET = 306;
|
||||
const IRON_CHESTPLATE = 307;
|
||||
const IRON_LEGGINGS = 308;
|
||||
const IRON_BOOTS = 309;
|
||||
const DIAMOND_HELMET = 310;
|
||||
const DIAMOND_CHESTPLATE = 311;
|
||||
const DIAMOND_LEGGINGS = 312;
|
||||
const DIAMOND_BOOTS = 313;
|
||||
const GOLD_HELMET = 314;
|
||||
const GOLD_CHESTPLATE = 315;
|
||||
const GOLD_LEGGINGS = 316;
|
||||
const GOLD_BOOTS = 317;
|
||||
const FLINT = 318;
|
||||
const RAW_PORKCHOP = 319;
|
||||
const COOKED_PORKCHOP = 320;
|
||||
const PAINTING = 321;
|
||||
const GOLDEN_APPLE = 322;
|
||||
const SIGN = 323;
|
||||
const WOODEN_DOOR = 324;
|
||||
const BUCKET = 325;
|
||||
|
||||
const MINECART = 329;
|
||||
|
||||
const IRON_DOOR = 330;
|
||||
const REDSTONE = 331;
|
||||
const REDSTONE_DUST = 331;
|
||||
const SNOWBALL = 332;
|
||||
|
||||
const LEATHER = 334;
|
||||
|
||||
const BRICK = 336;
|
||||
const CLAY = 337;
|
||||
const SUGARCANE = 338;
|
||||
const SUGAR_CANE = 338;
|
||||
const SUGAR_CANES = 338;
|
||||
const PAPER = 339;
|
||||
const BOOK = 340;
|
||||
const SLIMEBALL = 341;
|
||||
|
||||
const EGG = 344;
|
||||
const COMPASS = 345;
|
||||
|
||||
const CLOCK = 347;
|
||||
const GLOWSTONE_DUST = 348;
|
||||
//const RAW_FISH = 349;
|
||||
//const COOKED_FISH = 350;
|
||||
const DYE = 351;
|
||||
const BONE = 352;
|
||||
const SUGAR = 353;
|
||||
const CAKE = 354;
|
||||
const BED = 355;
|
||||
|
||||
|
||||
//const COOKIE = 357;
|
||||
|
||||
|
||||
const SHEARS = 359;
|
||||
const MELON = 360;
|
||||
const MELON_SLICE = 360;
|
||||
const PUMPKIN_SEEDS = 361;
|
||||
const MELON_SEEDS = 362;
|
||||
const RAW_BEEF = 363;
|
||||
const STEAK = 364;
|
||||
const COOKED_BEEF = 364;
|
||||
|
||||
const RAW_CHICKEN = 365;
|
||||
const COOKED_CHICKEN = 366;
|
||||
|
||||
const SPAWN_EGG = 383;
|
||||
|
||||
const CARROT = 391;
|
||||
const CARROTS = 391;
|
||||
const POTATO = 392;
|
||||
const POTATOES = 392; //@shoghicp Why the heck do we need plural redundant Item ID here????
|
||||
const BAKED_POTATO = 393;
|
||||
const BAKED_POTATOES = 393;
|
||||
|
||||
const PUMPKIN_PIE = 400;
|
||||
|
||||
const NETHER_BRICK = 405;
|
||||
const QUARTZ = 406;
|
||||
const NETHER_QUARTZ = 406;
|
||||
|
||||
const CAMERA = 456;
|
||||
const BEETROOT = 457;
|
||||
const BEETROOT_SEEDS = 458;
|
||||
const BEETROOT_SEED = 458;
|
||||
const BEETROOT_SOUP = 459;
|
||||
|
||||
|
||||
public static $list = array();
|
||||
protected $block;
|
||||
@ -425,6 +425,35 @@ class Item{
|
||||
return $item;
|
||||
}
|
||||
|
||||
public static function fromString($str, $multiple = false){
|
||||
if($multiple === true){
|
||||
$blocks = array();
|
||||
foreach(explode(",", $str) as $b){
|
||||
$blocks[] = self::fromString($b, false);
|
||||
}
|
||||
|
||||
return $blocks;
|
||||
} else{
|
||||
$b = explode(":", str_replace(" ", "_", trim($str)));
|
||||
if(!isset($b[1])){
|
||||
$meta = 0;
|
||||
} else{
|
||||
$meta = ((int) $b[1]) & 0xFFFF;
|
||||
}
|
||||
|
||||
if(defined("PocketMine\\Item\\Item::".strtoupper($b[0]))){
|
||||
$item = self::get(constant("PocketMine\\Item\\Item::".strtoupper($b[0]))), $meta);
|
||||
if($item->getID() === self::AIR and strtoupper($b[0]) !== "AIR"){
|
||||
$item = self::get(((int) $b[0]) & 0xFFFF, $meta);
|
||||
}
|
||||
} else{
|
||||
$item = self::get(((int) $b[0]) & 0xFFFF, $meta);
|
||||
}
|
||||
|
||||
return $item;
|
||||
}
|
||||
}
|
||||
|
||||
public function __construct($id, $meta = 0, $count = 1, $name = "Unknown"){
|
||||
$this->id = (int) $id;
|
||||
$this->meta = (int) $meta;
|
||||
@ -460,7 +489,7 @@ class Item{
|
||||
if($this->block instanceof Block){
|
||||
return $this->block;
|
||||
} else{
|
||||
return Block::get(AIR);
|
||||
return Block::get(self::AIR);
|
||||
}
|
||||
}
|
||||
|
||||
@ -484,7 +513,7 @@ class Item{
|
||||
if(!isset(Fuel::$duration[$this->id])){
|
||||
return false;
|
||||
}
|
||||
if($this->id !== BUCKET or $this->meta === 10){
|
||||
if($this->id !== self::BUCKET or $this->meta === 10){
|
||||
return Fuel::$duration[$this->id];
|
||||
}
|
||||
|
||||
@ -518,7 +547,7 @@ class Item{
|
||||
|
||||
return true;
|
||||
} elseif($this->isHoe()){
|
||||
if(($object instanceof Block) and ($object->getID() === GRASS or $object->getID() === DIRT)){
|
||||
if(($object instanceof Block) and ($object->getID() === self::GRASS or $object->getID() === self::DIRT)){
|
||||
$this->meta++;
|
||||
}
|
||||
}
|
||||
@ -527,11 +556,11 @@ class Item{
|
||||
}
|
||||
|
||||
final public function isTool(){
|
||||
return ($this->id === FLINT_STEEL or $this->id === SHEARS or $this->isPickaxe() !== false or $this->isAxe() !== false or $this->isShovel() !== false or $this->isSword() !== false);
|
||||
return ($this->id === self::FLINT_STEEL or $this->id === self::SHEARS or $this->isPickaxe() !== false or $this->isAxe() !== false or $this->isShovel() !== false or $this->isSword() !== false);
|
||||
}
|
||||
|
||||
final public function getMaxDurability(){
|
||||
if(!$this->isTool() and $this->isHoe() === false and $this->id !== BOW){
|
||||
if(!$this->isTool() and $this->isHoe() === false and $this->id !== self::BOW){
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -541,9 +570,9 @@ class Item{
|
||||
3 => 132,
|
||||
4 => 251,
|
||||
5 => 1562,
|
||||
FLINT_STEEL => 65,
|
||||
SHEARS => 239,
|
||||
BOW => 385,
|
||||
self::FLINT_STEEL => 65,
|
||||
self::SHEARS => 239,
|
||||
self::BOW => 385,
|
||||
);
|
||||
|
||||
if(($type = $this->isPickaxe()) === false){
|
||||
@ -563,15 +592,15 @@ class Item{
|
||||
|
||||
final public function isPickaxe(){ //Returns false or level of the pickaxe
|
||||
switch($this->id){
|
||||
case IRON_PICKAXE:
|
||||
case self::IRON_PICKAXE:
|
||||
return 4;
|
||||
case WOODEN_PICKAXE:
|
||||
case self::WOODEN_PICKAXE:
|
||||
return 1;
|
||||
case STONE_PICKAXE:
|
||||
case self::STONE_PICKAXE:
|
||||
return 3;
|
||||
case DIAMOND_PICKAXE:
|
||||
case self::DIAMOND_PICKAXE:
|
||||
return 5;
|
||||
case GOLD_PICKAXE:
|
||||
case self::GOLD_PICKAXE:
|
||||
return 2;
|
||||
default:
|
||||
return false;
|
||||
@ -580,15 +609,15 @@ class Item{
|
||||
|
||||
final public function isAxe(){
|
||||
switch($this->id){
|
||||
case IRON_AXE:
|
||||
case self::IRON_AXE:
|
||||
return 4;
|
||||
case WOODEN_AXE:
|
||||
case self::WOODEN_AXE:
|
||||
return 1;
|
||||
case STONE_AXE:
|
||||
case self::STONE_AXE:
|
||||
return 3;
|
||||
case DIAMOND_AXE:
|
||||
case self::DIAMOND_AXE:
|
||||
return 5;
|
||||
case GOLD_AXE:
|
||||
case self::GOLD_AXE:
|
||||
return 2;
|
||||
default:
|
||||
return false;
|
||||
@ -597,15 +626,15 @@ class Item{
|
||||
|
||||
final public function isSword(){
|
||||
switch($this->id){
|
||||
case IRON_SWORD:
|
||||
case self::IRON_SWORD:
|
||||
return 4;
|
||||
case WOODEN_SWORD:
|
||||
case self::WOODEN_SWORD:
|
||||
return 1;
|
||||
case STONE_SWORD:
|
||||
case self::STONE_SWORD:
|
||||
return 3;
|
||||
case DIAMOND_SWORD:
|
||||
case self::DIAMOND_SWORD:
|
||||
return 5;
|
||||
case GOLD_SWORD:
|
||||
case self::GOLD_SWORD:
|
||||
return 2;
|
||||
default:
|
||||
return false;
|
||||
@ -614,15 +643,15 @@ class Item{
|
||||
|
||||
final public function isShovel(){
|
||||
switch($this->id){
|
||||
case IRON_SHOVEL:
|
||||
case self::IRON_SHOVEL:
|
||||
return 4;
|
||||
case WOODEN_SHOVEL:
|
||||
case self::WOODEN_SHOVEL:
|
||||
return 1;
|
||||
case STONE_SHOVEL:
|
||||
case self::STONE_SHOVEL:
|
||||
return 3;
|
||||
case DIAMOND_SHOVEL:
|
||||
case self::DIAMOND_SHOVEL:
|
||||
return 5;
|
||||
case GOLD_SHOVEL:
|
||||
case self::GOLD_SHOVEL:
|
||||
return 2;
|
||||
default:
|
||||
return false;
|
||||
@ -631,11 +660,11 @@ class Item{
|
||||
|
||||
public function isHoe(){
|
||||
switch($this->id){
|
||||
case IRON_HOE:
|
||||
case WOODEN_HOE:
|
||||
case STONE_HOE:
|
||||
case DIAMOND_HOE:
|
||||
case GOLD_HOE:
|
||||
case self::IRON_HOE:
|
||||
case self::WOODEN_HOE:
|
||||
case self::STONE_HOE:
|
||||
case self::DIAMOND_HOE:
|
||||
case self::GOLD_HOE:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
@ -643,7 +672,7 @@ class Item{
|
||||
}
|
||||
|
||||
public function isShears(){
|
||||
return ($this->id === SHEARS);
|
||||
return ($this->id === self::SHEARS);
|
||||
}
|
||||
|
||||
final public function __toString(){
|
||||
|
@ -21,10 +21,10 @@
|
||||
|
||||
namespace PocketMine\Item;
|
||||
|
||||
use PocketMine;
|
||||
use PocketMine\Block\Block as Block;
|
||||
use PocketMine\Level\Level as Level;
|
||||
use PocketMine\ServerAPI as ServerAPI;
|
||||
use PocketMine;
|
||||
|
||||
class Painting extends Item{
|
||||
public function __construct($meta = 0, $count = 1){
|
||||
|
@ -21,9 +21,9 @@
|
||||
|
||||
namespace PocketMine\Item;
|
||||
|
||||
use PocketMine;
|
||||
use PocketMine\Block\Block as Block;
|
||||
use PocketMine\Level\Level as Level;
|
||||
use PocketMine;
|
||||
|
||||
class SpawnEgg extends Item{
|
||||
public function __construct($meta = 0, $count = 1){
|
||||
|
@ -21,12 +21,13 @@
|
||||
|
||||
namespace PocketMine\Level;
|
||||
|
||||
use PocketMine;
|
||||
use PocketMine\Block\Block as Block;
|
||||
use PocketMine\Block\TNT as TNT;
|
||||
use PocketMine\Math\Vector3 as Vector3;
|
||||
use PocketMine\Network\Protocol\ExplodePacket as ExplodePacket;
|
||||
use PocketMine\Player as Player;
|
||||
use PocketMine\ServerAPI as ServerAPI;
|
||||
use PocketMine;
|
||||
|
||||
class Explosion{
|
||||
public static $specialDrops = array(
|
||||
@ -128,7 +129,7 @@ class Explosion{
|
||||
$this->level->level->setBlockID($block->x, $block->y, $block->z, 0);
|
||||
$send[] = new Vector3($block->x - $source->x, $block->y - $source->y, $block->z - $source->z);
|
||||
}
|
||||
$pk = new Network\Protocol\ExplodePacket;
|
||||
$pk = new ExplodePacket;
|
||||
$pk->x = $this->source->x;
|
||||
$pk->y = $this->source->y;
|
||||
$pk->z = $this->source->z;
|
||||
|
@ -24,12 +24,15 @@
|
||||
*/
|
||||
namespace PocketMine\Level;
|
||||
|
||||
use PocketMine;
|
||||
use PocketMine\Block\Air as Air;
|
||||
use PocketMine\Block\Block as Block;
|
||||
use PocketMine\Level\Generator\Generator as Generator;
|
||||
use PocketMine\Math\Vector3 as Vector3;
|
||||
use PocketMine\NBT\Tag\Compound as Compound;
|
||||
use PocketMine\NBT\Tag\Enum as Enum;
|
||||
use PocketMine\Network\Protocol\SetTimePacket as SetTimePacket;
|
||||
use PocketMine\Network\Protocol\UpdateBlockPacket as UpdateBlockPacket;
|
||||
use PocketMine\Player as Player;
|
||||
use PocketMine\PMF\LevelFormat as LevelFormat;
|
||||
use PocketMine\ServerAPI as ServerAPI;
|
||||
@ -39,7 +42,6 @@ use PocketMine\Tile\Sign as Sign;
|
||||
use PocketMine\Tile\Tile as Tile;
|
||||
use PocketMine\Utils\Cache as Cache;
|
||||
use PocketMine\Utils\Random as Random;
|
||||
use PocketMine;
|
||||
|
||||
class Level{
|
||||
public $players = array();
|
||||
@ -121,7 +123,7 @@ class Level{
|
||||
if($this->server->api->dhandle("time.change", array("level" => $this, "time" => $time)) !== false){
|
||||
$this->time = $time;
|
||||
|
||||
$pk = new Network\Protocol\SetTimePacket;
|
||||
$pk = new SetTimePacket;
|
||||
$pk->time = (int) $this->time;
|
||||
$pk->started = $this->stopTime == false;
|
||||
Player::broadcastPacket($this->players, $pk);
|
||||
@ -157,7 +159,7 @@ class Level{
|
||||
foreach($this->changedBlocks as $index => $mini){
|
||||
foreach($mini as $blocks){
|
||||
foreach($blocks as $b){
|
||||
$pk = new Network\Protocol\UpdateBlockPacket;
|
||||
$pk = new UpdateBlockPacket;
|
||||
$pk->x = $b->x;
|
||||
$pk->y = $b->y;
|
||||
$pk->z = $b->z;
|
||||
@ -298,7 +300,7 @@ class Level{
|
||||
public function setBlockRaw(Vector3 $pos, Block $block, $direct = true, $send = true){
|
||||
if(($ret = $this->level->setBlock($pos->x, $pos->y, $pos->z, $block->getID(), $block->getMetadata())) === true and $send !== false){
|
||||
if($direct === true){
|
||||
$pk = new Network\Protocol\UpdateBlockPacket;
|
||||
$pk = new UpdateBlockPacket;
|
||||
$pk->x = $pos->x;
|
||||
$pk->y = $pos->y;
|
||||
$pk->z = $pos->z;
|
||||
@ -343,7 +345,7 @@ class Level{
|
||||
$block->position($pos);
|
||||
|
||||
if($direct === true){
|
||||
$pk = new Network\Protocol\UpdateBlockPacket;
|
||||
$pk = new UpdateBlockPacket;
|
||||
$pk->x = $pos->x;
|
||||
$pk->y = $pos->y;
|
||||
$pk->z = $pos->z;
|
||||
|
@ -21,9 +21,9 @@
|
||||
|
||||
namespace PocketMine\Level;
|
||||
|
||||
use PocketMine;
|
||||
use PocketMine\PMF\LevelFormat as LevelFormat;
|
||||
use PocketMine\Utils\Config as Config;
|
||||
use PocketMine;
|
||||
|
||||
class LevelImport{
|
||||
private $path;
|
||||
|
@ -21,12 +21,12 @@
|
||||
|
||||
namespace PocketMine\Level;
|
||||
|
||||
use PocketMine;
|
||||
use PocketMine\Level\Generator\Generator as Generator;
|
||||
use PocketMine\PMF\LevelFormat as LevelFormat;
|
||||
use PocketMine\Utils\Config as Config;
|
||||
use PocketMine\Utils\Random as Random;
|
||||
use PocketMine\Utils\Utils as Utils;
|
||||
use PocketMine;
|
||||
|
||||
class WorldGenerator{
|
||||
private $seed, $level, $path, $random, $generator, $height;
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
namespace PocketMine\Level\Generator;
|
||||
|
||||
use PocketMine;
|
||||
use PocketMine\Block\CoalOre as CoalOre;
|
||||
use PocketMine\Block\DiamondOre as DiamondOre;
|
||||
use PocketMine\Block\Dirt as Dirt;
|
||||
@ -34,7 +35,6 @@ use PocketMine\Level\Generator\Populator\Ore as Ore;
|
||||
use PocketMine\Level\Level as Level;
|
||||
use PocketMine\Math\Vector3 as Vector3;
|
||||
use PocketMine\Utils\Random as Random;
|
||||
use PocketMine;
|
||||
|
||||
class Flat extends Generator{
|
||||
private $level, $random, $structure, $chunks, $options, $floorLevel, $preset, $populators = array();
|
||||
|
@ -24,9 +24,9 @@
|
||||
*/
|
||||
namespace PocketMine\Level\Generator;
|
||||
|
||||
use PocketMine;
|
||||
use PocketMine\Level\Level as Level;
|
||||
use PocketMine\Utils\Random as Random;
|
||||
use PocketMine;
|
||||
|
||||
abstract class Generator{
|
||||
private static $list = array();
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
namespace PocketMine\Level\Generator;
|
||||
|
||||
use PocketMine;
|
||||
use PocketMine\Block\CoalOre as CoalOre;
|
||||
use PocketMine\Block\DiamondOre as DiamondOre;
|
||||
use PocketMine\Block\Dirt as Dirt;
|
||||
@ -37,7 +38,6 @@ use PocketMine\Level\Generator\Populator\Tree as Tree;
|
||||
use PocketMine\Level\Level as Level;
|
||||
use PocketMine\Math\Vector3 as Vector3;
|
||||
use PocketMine\Utils\Random as Random;
|
||||
use PocketMine;
|
||||
|
||||
class Normal extends Generator{
|
||||
|
||||
|
@ -21,9 +21,9 @@
|
||||
|
||||
namespace PocketMine\Level\Generator\Object;
|
||||
|
||||
use PocketMine;
|
||||
use PocketMine\Level\Level as Level;
|
||||
use PocketMine\Math\Vector3 as Vector3;
|
||||
use PocketMine;
|
||||
|
||||
class BigTree extends Tree{
|
||||
private $trunkHeightMultiplier = 0.618;
|
||||
|
@ -21,11 +21,11 @@
|
||||
|
||||
namespace PocketMine\Level\Generator\Object;
|
||||
|
||||
use PocketMine;
|
||||
use PocketMine\Level\Level as Level;
|
||||
use PocketMine\Math\Vector3 as Vector3;
|
||||
use PocketMine\Math\VectorMath as VectorMath;
|
||||
use PocketMine\Utils\Random as Random;
|
||||
use PocketMine;
|
||||
|
||||
class Ore{
|
||||
private $random;
|
||||
|
@ -21,13 +21,13 @@
|
||||
|
||||
namespace PocketMine\Level\Generator\Object;
|
||||
|
||||
use PocketMine;
|
||||
use PocketMine\Block\Dirt as Dirt;
|
||||
use PocketMine\Block\Leaves as Leaves;
|
||||
use PocketMine\Block\Wood as Wood;
|
||||
use PocketMine\Level\Level as Level;
|
||||
use PocketMine\Math\Vector3 as Vector3;
|
||||
use PocketMine\Utils\Random as Random;
|
||||
use PocketMine;
|
||||
|
||||
class PineTree extends Tree{
|
||||
var $type = 1;
|
||||
|
@ -21,11 +21,11 @@
|
||||
|
||||
namespace PocketMine\Level\Generator\Object;
|
||||
|
||||
use PocketMine;
|
||||
use PocketMine\Block\Block as Block;
|
||||
use PocketMine\Level\Level as Level;
|
||||
use PocketMine\Math\Vector3 as Vector3;
|
||||
use PocketMine\Utils\Random as Random;
|
||||
use PocketMine;
|
||||
|
||||
class Pond{
|
||||
private $random;
|
||||
|
@ -21,13 +21,13 @@
|
||||
|
||||
namespace PocketMine\Level\Generator\Object;
|
||||
|
||||
use PocketMine;
|
||||
use PocketMine\Block\Dirt as Dirt;
|
||||
use PocketMine\Block\Leaves as Leaves;
|
||||
use PocketMine\Block\Wood as Wood;
|
||||
use PocketMine\Level\Level as Level;
|
||||
use PocketMine\Math\Vector3 as Vector3;
|
||||
use PocketMine\Utils\Random as Random;
|
||||
use PocketMine;
|
||||
|
||||
class SmallTree extends Tree{
|
||||
public $type = 0;
|
||||
|
@ -21,13 +21,13 @@
|
||||
|
||||
namespace PocketMine\Level\Generator\Object;
|
||||
|
||||
use PocketMine;
|
||||
use PocketMine\Block\Dirt as Dirt;
|
||||
use PocketMine\Block\Leaves as Leaves;
|
||||
use PocketMine\Block\Wood as Wood;
|
||||
use PocketMine\Level\Level as Level;
|
||||
use PocketMine\Math\Vector3 as Vector3;
|
||||
use PocketMine\Utils\Random as Random;
|
||||
use PocketMine;
|
||||
|
||||
class SpruceTree extends Tree{
|
||||
var $type = 1;
|
||||
|
@ -22,8 +22,8 @@
|
||||
namespace PocketMine\Level\Generator\Object;
|
||||
|
||||
use PocketMine\Block\Block as Block;
|
||||
use PocketMine\Level;
|
||||
use PocketMine;
|
||||
use PocketMine\Level;
|
||||
use PocketMine\Math\Vector3 as Vector3;
|
||||
|
||||
class TallGrass{
|
||||
|
@ -21,10 +21,10 @@
|
||||
|
||||
namespace PocketMine\Level\Generator\Object;
|
||||
|
||||
use PocketMine;
|
||||
use PocketMine\Block\Sapling as Sapling;
|
||||
use PocketMine\Level\Level as Level;
|
||||
use PocketMine\Math\Vector3 as Vector3;
|
||||
use PocketMine;
|
||||
|
||||
class Tree{
|
||||
public $overridable = array(
|
||||
|
@ -21,9 +21,9 @@
|
||||
|
||||
namespace PocketMine\Level\Generator\Populator;
|
||||
|
||||
use PocketMine;
|
||||
use PocketMine\Level\Level as Level;
|
||||
use PocketMine\Utils\Random as Random;
|
||||
use PocketMine;
|
||||
|
||||
class Mineshaft extends Populator{
|
||||
private static $DISTANCE = 256;
|
||||
|
@ -21,11 +21,11 @@
|
||||
|
||||
namespace PocketMine\Level\Generator\Populator;
|
||||
|
||||
use PocketMine;
|
||||
use PocketMine\Level\Generator\Object\Ore as ObjectOre;
|
||||
use PocketMine\Level\Level as Level;
|
||||
use PocketMine\Math\Vector3 as Vector3;
|
||||
use PocketMine\Utils\Random as Random;
|
||||
use PocketMine;
|
||||
|
||||
class Ore extends Populator{
|
||||
private $oreTypes = array();
|
||||
|
@ -21,11 +21,11 @@
|
||||
|
||||
namespace PocketMine\Level\Generator\Populator;
|
||||
|
||||
use PocketMine;
|
||||
use PocketMine\Block\Water as Water;
|
||||
use PocketMine\Level\Level as Level;
|
||||
use PocketMine\Math\Vector3 as Vector3;
|
||||
use PocketMine\Utils\Random as Random;
|
||||
use PocketMine;
|
||||
|
||||
class Pond extends Populator{
|
||||
private $waterOdd = 4;
|
||||
|
@ -24,9 +24,9 @@
|
||||
*/
|
||||
namespace PocketMine\Level\Generator\Populator;
|
||||
|
||||
use PocketMine;
|
||||
use PocketMine\Level\Level as Level;
|
||||
use PocketMine\Utils\Random as Random;
|
||||
use PocketMine;
|
||||
|
||||
abstract class Populator{
|
||||
public abstract function populate(Level $level, $chunkX, $chunkZ, Random $random);
|
||||
|
@ -21,9 +21,9 @@
|
||||
|
||||
namespace PocketMine\Level\Generator\Populator;
|
||||
|
||||
use PocketMine;
|
||||
use PocketMine\Block\TallGrass as BlockTallGrass;
|
||||
use PocketMine\Math\Vector3 as Vector3;
|
||||
use PocketMine;
|
||||
|
||||
class TallGrass extends Populator{
|
||||
private $level;
|
||||
|
@ -21,10 +21,10 @@
|
||||
|
||||
namespace PocketMine\Level\Generator\Populator;
|
||||
|
||||
use PocketMine;
|
||||
use PocketMine\Level\Level as Level;
|
||||
use PocketMine\Math\Vector3 as Vector3;
|
||||
use PocketMine\Utils\Random as Random;
|
||||
use PocketMine;
|
||||
|
||||
class Tree extends Populator{
|
||||
private $level;
|
||||
|
@ -37,6 +37,7 @@ const TAG_String = 8;
|
||||
const TAG_Enum = 9;
|
||||
const TAG_Compound = 10;
|
||||
const TAG_Int_Array = 11;
|
||||
use PocketMine;
|
||||
use PocketMine\NBT\Tag\Byte as Byte;
|
||||
use PocketMine\NBT\Tag\Byte_Array as Byte_Array;
|
||||
use PocketMine\NBT\Tag\Compound as Compound;
|
||||
@ -47,10 +48,11 @@ use PocketMine\NBT\Tag\Float as Float;
|
||||
use PocketMine\NBT\Tag\Int as Int;
|
||||
use PocketMine\NBT\Tag\Int_Array as Int_Array;
|
||||
use PocketMine\NBT\Tag\Long as Long;
|
||||
use PocketMine\NBT\Tag\NamedTAG as NamedTAG;
|
||||
use PocketMine\NBT\Tag\Short as Short;
|
||||
use PocketMine\NBT\Tag\String as String;
|
||||
use PocketMine\NBT\Tag\Tag as Tag;
|
||||
use PocketMine\Utils\Utils as Utils;
|
||||
use PocketMine;
|
||||
|
||||
class NBT implements \ArrayAccess{
|
||||
private $buffer;
|
||||
@ -160,9 +162,9 @@ class NBT implements \ArrayAccess{
|
||||
return $tag;
|
||||
}
|
||||
|
||||
public function writeTag(Tag\Tag $tag){
|
||||
public function writeTag(Tag $tag){
|
||||
$this->putByte($tag->getType());
|
||||
if($tag instanceof Tag\NamedTAG){
|
||||
if($tag instanceof NamedTAG){
|
||||
$this->putString($tag->getName());
|
||||
}
|
||||
$tag->write($this);
|
||||
|
@ -21,9 +21,9 @@
|
||||
|
||||
namespace PocketMine\NBT\Tag;
|
||||
|
||||
use PocketMine\NBT\Tag\Enum as TagEnum;
|
||||
use PocketMine;
|
||||
use PocketMine\NBT;
|
||||
use PocketMine;
|
||||
use PocketMine\NBT\Tag\Enum as TagEnum;
|
||||
|
||||
class Enum extends NamedTag implements \ArrayAccess, \Iterator{
|
||||
|
||||
|
@ -24,6 +24,7 @@
|
||||
*/
|
||||
namespace PocketMine\Network;
|
||||
|
||||
use PocketMine;
|
||||
use PocketMine\Event\Event as Event;
|
||||
use PocketMine\Event\EventHandler as EventHandler;
|
||||
use PocketMine\Event\Server\PacketReceiveEvent as PacketReceiveEvent;
|
||||
@ -33,7 +34,6 @@ use PocketMine\Network\Query\QueryPacket as QueryPacket;
|
||||
use PocketMine\Network\RakNet\Info as Info;
|
||||
use PocketMine\Network\RakNet\Packet as Packet;
|
||||
use PocketMine\ServerAPI as ServerAPI;
|
||||
use PocketMine;
|
||||
|
||||
class Handler{
|
||||
public $bandwidth;
|
||||
|
@ -21,9 +21,9 @@
|
||||
|
||||
namespace PocketMine\Network\Protocol;
|
||||
|
||||
use PocketMine;
|
||||
use PocketMine\Item\Item as Item;
|
||||
use PocketMine\Utils\Utils as Utils;
|
||||
use PocketMine;
|
||||
|
||||
abstract class DataPacket{
|
||||
private $offset = 0;
|
||||
|
@ -25,10 +25,10 @@
|
||||
*/
|
||||
namespace PocketMine\Network\Query;
|
||||
|
||||
use PocketMine;
|
||||
use PocketMine\Player as Player;
|
||||
use PocketMine\ServerAPI as ServerAPI;
|
||||
use PocketMine\Utils\Utils as Utils;
|
||||
use PocketMine;
|
||||
|
||||
class QueryHandler{
|
||||
private $socket, $server, $lastToken, $token, $longData, $timeout;
|
||||
|
@ -21,9 +21,9 @@
|
||||
|
||||
namespace PocketMine\Network\Query;
|
||||
|
||||
use PocketMine;
|
||||
use PocketMine\Network\Packet as Packet;
|
||||
use PocketMine\Utils\Utils as Utils;
|
||||
use PocketMine;
|
||||
|
||||
class QueryPacket extends Packet{
|
||||
const HANDSHAKE = 9;
|
||||
|
@ -21,10 +21,10 @@
|
||||
|
||||
namespace PocketMine\Network\RakNet;
|
||||
|
||||
use PocketMine;
|
||||
use PocketMine\Network\Packet as NetworkPacket;
|
||||
use PocketMine\Network\Protocol\Info as ProtocolInfo;
|
||||
use PocketMine\Utils\Utils as Utils;
|
||||
use PocketMine;
|
||||
|
||||
class Packet extends NetworkPacket{
|
||||
private $packetID;
|
||||
|
@ -29,7 +29,6 @@ use PocketMine;
|
||||
use PocketMine\ServerAPI as ServerAPI;
|
||||
|
||||
|
||||
|
||||
class RCON{
|
||||
private $socket, $password, $workers, $threads, $clientsPerThread;
|
||||
|
||||
|
@ -21,11 +21,11 @@
|
||||
|
||||
namespace PocketMine\PMF;
|
||||
|
||||
use PocketMine;
|
||||
use PocketMine\Level\Level as Level;
|
||||
use PocketMine\NBT\Tag\Compound as Compound;
|
||||
use PocketMine\NBT\Tag\Enum as Enum;
|
||||
use PocketMine\Utils\Utils as Utils;
|
||||
use PocketMine;
|
||||
|
||||
class LevelFormat extends PMF{
|
||||
const VERSION = 2;
|
||||
|
@ -24,9 +24,9 @@
|
||||
*/
|
||||
namespace PocketMine\Recipes;
|
||||
|
||||
use PocketMine;
|
||||
use PocketMine\BlockAPI as BlockAPI;
|
||||
use PocketMine\ServerAPI as ServerAPI;
|
||||
use PocketMine;
|
||||
|
||||
abstract class Crafting{
|
||||
private static $small = array( //Probably means craftable on crafting bench and in inventory. Name it better!
|
||||
@ -231,7 +231,7 @@ abstract class Crafting{
|
||||
$meta = array_pop($id);
|
||||
$id = $id[0];
|
||||
|
||||
$it = BlockAPI::fromString($id);
|
||||
$it = Item::fromString($id);
|
||||
$recipeItems[$it->getID()] = array($it->getID(), $meta === "?" ? false : intval($meta) & 0xFFFF, intval($item[1]));
|
||||
}
|
||||
ksort($recipeItems);
|
||||
|
@ -25,28 +25,28 @@ use PocketMine;
|
||||
|
||||
abstract class Fuel{
|
||||
public static $duration = array(
|
||||
Item\COAL => 80,
|
||||
Item\COAL_BLOCK => 800,
|
||||
Item\TRUNK => 15,
|
||||
Item\WOODEN_PLANKS => 15,
|
||||
Item\SAPLING => 5,
|
||||
Item\WOODEN_AXE => 10,
|
||||
Item\WOODEN_PICKAXE => 10,
|
||||
Item\WOODEN_SWORD => 10,
|
||||
Item\WOODEN_SHOVEL => 10,
|
||||
Item\WOODEN_HOE => 10,
|
||||
Item\STICK => 5,
|
||||
Item\FENCE => 15,
|
||||
Item\FENCE_GATE => 15,
|
||||
Item\WOODEN_STAIRS => 15,
|
||||
Item\SPRUCE_WOOD_STAIRS => 15,
|
||||
Item\BIRCH_WOOD_STAIRS => 15,
|
||||
Item\JUNGLE_WOOD_STAIRS => 15,
|
||||
Item\TRAPDOOR => 15,
|
||||
Item\WORKBENCH => 15,
|
||||
Item\BOOKSHELF => 15,
|
||||
Item\CHEST => 15,
|
||||
Item\BUCKET => 1000,
|
||||
Item\Item::COAL => 80,
|
||||
Item\Item::COAL_BLOCK => 800,
|
||||
Item\Item::TRUNK => 15,
|
||||
Item\Item::WOODEN_PLANKS => 15,
|
||||
Item\Item::SAPLING => 5,
|
||||
Item\Item::WOODEN_AXE => 10,
|
||||
Item\Item::WOODEN_PICKAXE => 10,
|
||||
Item\Item::WOODEN_SWORD => 10,
|
||||
Item\Item::WOODEN_SHOVEL => 10,
|
||||
Item\Item::WOODEN_HOE => 10,
|
||||
Item\Item::STICK => 5,
|
||||
Item\Item::FENCE => 15,
|
||||
Item\Item::FENCE_GATE => 15,
|
||||
Item\Item::WOODEN_STAIRS => 15,
|
||||
Item\Item::SPRUCE_WOOD_STAIRS => 15,
|
||||
Item\Item::BIRCH_WOOD_STAIRS => 15,
|
||||
Item\Item::JUNGLE_WOOD_STAIRS => 15,
|
||||
Item\Item::TRAPDOOR => 15,
|
||||
Item\Item::WORKBENCH => 15,
|
||||
Item\Item::BOOKSHELF => 15,
|
||||
Item\Item::CHEST => 15,
|
||||
Item\Item::BUCKET => 1000,
|
||||
|
||||
);
|
||||
|
||||
|
@ -24,20 +24,20 @@ use PocketMine;
|
||||
|
||||
class Smelt{
|
||||
public static $product = array(
|
||||
Item\COBBLESTONE => array(Item\STONE, 0),
|
||||
Item\SAND => array(Item\GLASS, 0),
|
||||
Item\TRUNK => array(Item\COAL, 1), //Charcoal
|
||||
Item\GOLD_ORE => array(Item\GOLD_INGOT, 0),
|
||||
Item\IRON_ORE => array(Item\IRON_INGOT, 0),
|
||||
Item\NETHERRACK => array(Item\NETHER_BRICK, 0),
|
||||
Item\RAW_PORKCHOP => array(Item\COOKED_PORKCHOP, 0),
|
||||
Item\CLAY => array(Item\BRICK, 0),
|
||||
//Item\RAW_FISH => array(Item\COOKED_FISH, 0),
|
||||
Item\CACTUS => array(Item\DYE, 2),
|
||||
Item\RED_MUSHROOM => array(Item\DYE, 1),
|
||||
Item\RAW_BEEF => array(Item\STEAK, 0),
|
||||
Item\RAW_CHICKEN => array(Item\COOKED_CHICKEN, 0),
|
||||
Item\RED_MUSHROOM => array(Item\DYE, 1),
|
||||
Item\POTATO => array(Item\BAKED_POTATO, 0),
|
||||
Item\Item::COBBLESTONE => array(Item\Item::STONE, 0),
|
||||
Item\Item::SAND => array(Item\Item::GLASS, 0),
|
||||
Item\Item::TRUNK => array(Item\Item::COAL, 1), //Charcoal
|
||||
Item\Item::GOLD_ORE => array(Item\Item::GOLD_INGOT, 0),
|
||||
Item\Item::IRON_ORE => array(Item\Item::IRON_INGOT, 0),
|
||||
Item\Item::NETHERRACK => array(Item\Item::NETHER_BRICK, 0),
|
||||
Item\Item::RAW_PORKCHOP => array(Item\Item::COOKED_PORKCHOP, 0),
|
||||
Item\Item::CLAY => array(Item\Item::BRICK, 0),
|
||||
//Item\Item::RAW_FISH => array(Item\Item::COOKED_FISH, 0),
|
||||
Item\Item::CACTUS => array(Item\Item::DYE, 2),
|
||||
Item\Item::RED_MUSHROOM => array(Item\Item::DYE, 1),
|
||||
Item\Item::RAW_BEEF => array(Item\Item::STEAK, 0),
|
||||
Item\Item::RAW_CHICKEN => array(Item\Item::COOKED_CHICKEN, 0),
|
||||
Item\Item::RED_MUSHROOM => array(Item\Item::DYE, 1),
|
||||
Item\Item::POTATO => array(Item\Item::BAKED_POTATO, 0),
|
||||
);
|
||||
}
|
@ -21,12 +21,13 @@
|
||||
|
||||
namespace PocketMine\Tile;
|
||||
|
||||
use PocketMine;
|
||||
use PocketMine\Level\Level as Level;
|
||||
use PocketMine\Math\Vector3 as Vector3;
|
||||
use PocketMine\NBT\Tag\Compound as Compound;
|
||||
use PocketMine\NBT\Tag\Int as Int;
|
||||
use PocketMine\NBT\Tag\String as String;
|
||||
use PocketMine;
|
||||
use PocketMine\Network\Protocol\EntityDataPacket as EntityDataPacket;
|
||||
|
||||
class Chest extends Spawnable{
|
||||
use Container;
|
||||
@ -115,7 +116,7 @@ class Chest extends Spawnable{
|
||||
)));
|
||||
}
|
||||
|
||||
$pk = new Network\Protocol\EntityDataPacket;
|
||||
$pk = new EntityDataPacket;
|
||||
$pk->x = $this->x;
|
||||
$pk->y = $this->y;
|
||||
$pk->z = $this->z;
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
namespace PocketMine\Tile;
|
||||
|
||||
use PocketMine;
|
||||
use PocketMine\Event\Event as Event;
|
||||
use PocketMine\Event\EventHandler as EventHandler;
|
||||
use PocketMine\Event\Tile\TileInventoryChangeEvent as TileInventoryChangeEvent;
|
||||
@ -29,7 +30,6 @@ use PocketMine\NBT\Tag\Byte as Byte;
|
||||
use PocketMine\NBT\Tag\Compound as Compound;
|
||||
use PocketMine\NBT\Tag\Short as Short;
|
||||
use PocketMine\Player as Player;
|
||||
use PocketMine;
|
||||
|
||||
trait Container{
|
||||
public function openInventory(Player $player){
|
||||
|
@ -21,11 +21,11 @@
|
||||
|
||||
namespace PocketMine\Tile;
|
||||
|
||||
use PocketMine;
|
||||
use PocketMine\Block\Block as Block;
|
||||
use PocketMine\Item\Item as Item;
|
||||
use PocketMine\Level\Level as Level;
|
||||
use PocketMine\NBT\Tag\Compound as Compound;
|
||||
use PocketMine;
|
||||
|
||||
class Furnace extends Tile{
|
||||
use Container;
|
||||
|
@ -21,11 +21,12 @@
|
||||
|
||||
namespace PocketMine\Tile;
|
||||
|
||||
use PocketMine;
|
||||
use PocketMine\NBT\NBT as NBT;
|
||||
use PocketMine\NBT\Tag\Compound as Compound;
|
||||
use PocketMine\NBT\Tag\Int as Int;
|
||||
use PocketMine\NBT\Tag\String as String;
|
||||
use PocketMine;
|
||||
use PocketMine\Network\Protocol\EntityDataPacket as EntityDataPacket;
|
||||
|
||||
class Sign extends Spawnable{
|
||||
|
||||
@ -70,7 +71,7 @@ class Sign extends Spawnable{
|
||||
new Int("y", (int) $this->y),
|
||||
new Int("z", (int) $this->z)
|
||||
)));
|
||||
$pk = new Network\Protocol\EntityDataPacket;
|
||||
$pk = new EntityDataPacket;
|
||||
$pk->x = $this->x;
|
||||
$pk->y = $this->y;
|
||||
$pk->z = $this->z;
|
||||
|
@ -25,11 +25,11 @@
|
||||
*/
|
||||
namespace PocketMine\Tile;
|
||||
|
||||
use PocketMine;
|
||||
use PocketMine\Level\Level as Level;
|
||||
use PocketMine\NBT\Tag\Compound as Compound;
|
||||
use PocketMine\PMF\LevelFormat as LevelFormat;
|
||||
use PocketMine\ServerAPI as ServerAPI;
|
||||
use PocketMine;
|
||||
|
||||
abstract class Tile extends Position{
|
||||
const SIGN = "Sign";
|
||||
|
Loading…
x
Reference in New Issue
Block a user