PHP7 to master

This commit is contained in:
Intyre
2016-02-21 12:47:30 +01:00
153 changed files with 2836 additions and 3536 deletions

View File

@ -0,0 +1,35 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\block;
class ActivatorRail extends Solid {
protected $id = self::ACTIVATOR_RAIL;
public function __construct($meta = 0){
$this->meta = $meta;
}
public function getName(){
return "Activator Rail";
}
}

View File

@ -63,9 +63,9 @@ class Block extends Position implements Metadatable{
const GOLD_ORE = 14;
const IRON_ORE = 15;
const COAL_ORE = 16;
const LOG = 17;
const WOOD = 17;
const TRUNK = 17;
const LOG = 17;
const LEAVES = 18;
const LEAVE = 18;
const SPONGE = 19;
@ -74,18 +74,18 @@ class Block extends Position implements Metadatable{
const LAPIS_BLOCK = 22;
const SANDSTONE = 24;
const NOTE_BLOCK = 25;
const BED_BLOCK = 26;
const POWERED_RAIL = 27;
const DETECTOR_RAIL = 28;
const COBWEB = 30;
const TALL_GRASS = 31;
const BUSH = 32;
const DEAD_BUSH = 32;
const WOOL = 35;
const DANDELION = 37;
const ROSE = 38;
const POPPY = 38;
const ROSE = 38;
const RED_FLOWER = 38;
const BROWN_MUSHROOM = 39;
const RED_MUSHROOM = 40;
@ -110,7 +110,7 @@ class Block extends Position implements Metadatable{
const OAK_WOOD_STAIRS = 53;
const OAK_WOODEN_STAIRS = 53;
const CHEST = 54;
const REDSTONE_WIRE = 55;
const DIAMOND_ORE = 56;
const DIAMOND_BLOCK = 57;
const CRAFTING_TABLE = 58;
@ -125,17 +125,20 @@ class Block extends Position implements Metadatable{
const WOODEN_DOOR_BLOCK = 64;
const WOOD_DOOR_BLOCK = 64;
const LADDER = 65;
const RAIL = 66;
const COBBLE_STAIRS = 67;
const COBBLESTONE_STAIRS = 67;
const WALL_SIGN = 68;
const LEVER = 69;
const STONE_PRESSURE_PLATE = 70;
const IRON_DOOR_BLOCK = 71;
const WOODEN_PRESSURE_PLATE = 72;
const REDSTONE_ORE = 73;
const GLOWING_REDSTONE_ORE = 74;
const LIT_REDSTONE_ORE = 74;
const REDSTONE_TORCH = 75;
const LIT_REDSTONE_TORCH = 76;
const STONE_BUTTON = 77;
const SNOW = 78;
const SNOW_LAYER = 78;
const ICE = 79;
@ -152,18 +155,17 @@ class Block extends Position implements Metadatable{
const GLOWSTONE = 89;
const GLOWSTONE_BLOCK = 89;
const PORTAL_BLOCK = 90;
const LIT_PUMPKIN = 91;
const JACK_O_LANTERN = 91;
const CAKE_BLOCK = 92;
const TRAPDOOR = 96;
const WOODEN_TRAPDOOR = 96;
const WOOD_TRAPDOOR = 96;
const MONSTER_EGG_BLOCK = 97;
const STONE_BRICKS = 98;
const STONE_BRICK = 98;
const BROWN_MUSHROOM_BLOCK = 99;
const RED_MUSHROOM_BLOCK = 100;
const IRON_BAR = 101;
const IRON_BARS = 101;
const GLASS_PANE = 102;
@ -183,17 +185,24 @@ class Block extends Position implements Metadatable{
const NETHER_BRICK_BLOCK = 112;
const NETHER_BRICK_FENCE = 113;
const NETHER_BRICKS_STAIRS = 114;
const NETHER_WART_BLOCK = 115;
const ENCHANTING_TABLE = 116;
const ENCHANT_TABLE = 116;
const ENCHANTMENT_TABLE = 116;
const BREWING_STAND = 117;
const END_PORTAL_FRAME = 120;
const END_STONE = 121;
const REDSTONE_LAMP = 122;
const LIT_REDSTONE_LAMP = 123;
const ACTIVATOR_RAIL = 126;
const COCOA_BLOCK = 127;
const SANDSTONE_STAIRS = 128;
const EMERALD_ORE = 129;
const TRIPWIRE_HOOK = 131;
const TRIPWIRE = 132;
const EMERALD_BLOCK = 133;
const SPRUCE_WOOD_STAIRS = 134;
const SPRUCE_WOODEN_STAIRS = 134;
@ -208,11 +217,16 @@ class Block extends Position implements Metadatable{
const FLOWER_POT_BLOCK = 140;
const CARROT_BLOCK = 141;
const POTATO_BLOCK = 142;
const WOODEN_BUTTON = 143;
const MOB_HEAD_BLOCK = 144;
const ANVIL = 145;
const TRAPPED_CHEST = 146;
const WEIGHTED_PRESSURE_PLATE_LIGHT = 147;
const WEIGHTED_PRESSURE_PLATE_HEAVY = 148;
const DAYLIGHT_SENSOR = 151;
const REDSTONE_BLOCK = 152;
const NETHER_QUARTZ_ORE = 153;
const QUARTZ_BLOCK = 155;
const QUARTZ_STAIRS = 156;
@ -238,6 +252,7 @@ class Block extends Position implements Metadatable{
const DARK_OAK_WOODEN_STAIRS = 164;
const IRON_TRAPDOOR = 167;
const HAY_BALE = 170;
const CARPET = 171;
const HARDENED_CLAY = 172;
@ -245,6 +260,8 @@ class Block extends Position implements Metadatable{
const PACKED_ICE = 174;
const DOUBLE_PLANT = 175;
const INVERTED_DAYLIGHT_SENSOR = 178;
const FENCE_GATE_SPRUCE = 183;
const FENCE_GATE_BIRCH = 184;
const FENCE_GATE_JUNGLE = 185;
@ -280,32 +297,6 @@ class Block extends Position implements Metadatable{
/** @var AxisAlignedBB */
public $boundingBox = null;
/**
* Backwards-compatibility with old way to define block properties
*
* @deprecated
*
* @param string $key
*
* @return mixed
*/
public function __get($key){
static $map = [
"hardness" => "getHardness",
"lightLevel" => "getLightLevel",
"frictionFactor" => "getFrictionFactor",
"name" => "getName",
"isPlaceable" => "canBePlaced",
"isReplaceable" => "canBeReplaced",
"isTransparent" => "isTransparent",
"isSolid" => "isSolid",
"isFlowable" => "canBeFlowedInto",
"isActivable" => "canBeActivated",
"hasEntityCollision" => "hasEntityCollision"
];
return isset($map[$key]) ? $this->{$map[$key]}() : null;
}
public static function init(){
if(self::$list === null){
self::$list = new \SplFixedArray(256);
@ -338,8 +329,13 @@ class Block extends Position implements Metadatable{
self::$list[self::GLASS] = Glass::class;
self::$list[self::LAPIS_ORE] = LapisOre::class;
self::$list[self::LAPIS_BLOCK] = Lapis::class;
self::$list[self::ACTIVATOR_RAIL] = ActivatorRail::class;
self::$list[self::COCOA_BLOCK] = CocoaBlock::class;
self::$list[self::SANDSTONE] = Sandstone::class;
self::$list[self::NOTE_BLOCK] = NoteBlock::class;
self::$list[self::BED_BLOCK] = Bed::class;
self::$list[self::POWERED_RAIL] = PoweredRail::class;
self::$list[self::DETECTOR_RAIL] = DetectorRail::class;
self::$list[self::COBWEB] = Cobweb::class;
self::$list[self::TALL_GRASS] = TallGrass::class;
self::$list[self::DEAD_BUSH] = DeadBush::class;
@ -373,14 +369,20 @@ class Block extends Position implements Metadatable{
self::$list[self::SIGN_POST] = SignPost::class;
self::$list[self::WOOD_DOOR_BLOCK] = WoodDoor::class;
self::$list[self::LADDER] = Ladder::class;
self::$list[self::RAIL] = Rail::class;
self::$list[self::COBBLESTONE_STAIRS] = CobblestoneStairs::class;
self::$list[self::WALL_SIGN] = WallSign::class;
self::$list[self::LEVER] = Lever::class;
self::$list[self::STONE_PRESSURE_PLATE] = StonePressurePlate::class;
self::$list[self::IRON_DOOR_BLOCK] = IronDoor::class;
self::$list[self::WOODEN_PRESSURE_PLATE] = WoodenPressurePlate::class;
self::$list[self::REDSTONE_ORE] = RedstoneOre::class;
self::$list[self::GLOWING_REDSTONE_ORE] = GlowingRedstoneOre::class;
self::$list[self::REDSTONE_TORCH] = RedstoneTorch::class;
self::$list[self::LIT_REDSTONE_TORCH] = LitRedstoneTorch::class;
self::$list[self::STONE_BUTTON] = StoneButton::class;
self::$list[self::SNOW_LAYER] = SnowLayer::class;
self::$list[self::ICE] = Ice::class;
self::$list[self::SNOW_BLOCK] = Snow::class;
@ -421,9 +423,12 @@ class Block extends Position implements Metadatable{
self::$list[self::BREWING_STAND] = BrewingStand::class;
self::$list[self::END_PORTAL_FRAME] = EndPortalFrame::class;
self::$list[self::END_STONE] = EndStone::class;
self::$list[self::REDSTONE_LAMP] = RedstoneLamp::class;
self::$list[self::LIT_REDSTONE_LAMP] = LitRedstoneLamp::class;
self::$list[self::SANDSTONE_STAIRS] = SandstoneStairs::class;
self::$list[self::EMERALD_ORE] = EmeraldOre::class;
self::$list[self::TRIPWIRE_HOOK] = TripwireHook::class;
self::$list[self::TRIPWIRE] = Tripwire::class;
self::$list[self::EMERALD_BLOCK] = Emerald::class;
self::$list[self::SPRUCE_WOOD_STAIRS] = SpruceWoodStairs::class;
self::$list[self::BIRCH_WOOD_STAIRS] = BirchWoodStairs::class;
@ -432,8 +437,13 @@ class Block extends Position implements Metadatable{
self::$list[self::FLOWER_POT_BLOCK] = FlowerPot::class;
self::$list[self::CARROT_BLOCK] = Carrot::class;
self::$list[self::POTATO_BLOCK] = Potato::class;
self::$list[self::WOODEN_BUTTON] = WoodenButton::class;
self::$list[self::ANVIL] = Anvil::class;
self::$list[self::TRAPPED_CHEST] = TrappedChest::class;
self::$list[self::WEIGHTED_PRESSURE_PLATE_LIGHT] = WeightedPressurePlateLight::class;
self::$list[self::WEIGHTED_PRESSURE_PLATE_HEAVY] = WeightedPressurePlateHeavy::class;
self::$list[self::DAYLIGHT_SENSOR] = DaylightSensor::class;
self::$list[self::REDSTONE_BLOCK] = Redstone::class;
self::$list[self::QUARTZ_BLOCK] = Quartz::class;

View File

@ -24,10 +24,10 @@ namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
use pocketmine\nbt\NBT;
use pocketmine\nbt\tag\Compound;
use pocketmine\nbt\tag\Enum;
use pocketmine\nbt\tag\Int;
use pocketmine\nbt\tag\String;
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\nbt\tag\ListTag;
use pocketmine\nbt\tag\IntTag;
use pocketmine\nbt\tag\StringTag;
use pocketmine\Player;
use pocketmine\tile\Furnace;
use pocketmine\tile\Tile;
@ -69,17 +69,17 @@ class BurningFurnace extends Solid{
];
$this->meta = $faces[$player instanceof Player ? $player->getDirection() : 0];
$this->getLevel()->setBlock($block, $this, true, true);
$nbt = new Compound("", [
new Enum("Items", []),
new String("id", Tile::FURNACE),
new Int("x", $this->x),
new Int("y", $this->y),
new Int("z", $this->z)
$nbt = new CompoundTag("", [
new ListTag("Items", []),
new StringTag("id", Tile::FURNACE),
new IntTag("x", $this->x),
new IntTag("y", $this->y),
new IntTag("z", $this->z)
]);
$nbt->Items->setTagType(NBT::TAG_Compound);
if($item->hasCustomName()){
$nbt->CustomName = new String("CustomName", $item->getCustomName());
$nbt->CustomName = new StringTag("CustomName", $item->getCustomName());
}
if($item->hasCustomBlockData()){
@ -106,18 +106,18 @@ class BurningFurnace extends Solid{
if($t instanceof Furnace){
$furnace = $t;
}else{
$nbt = new Compound("", [
new Enum("Items", []),
new String("id", Tile::FURNACE),
new Int("x", $this->x),
new Int("y", $this->y),
new Int("z", $this->z)
$nbt = new CompoundTag("", [
new ListTag("Items", []),
new StringTag("id", Tile::FURNACE),
new IntTag("x", $this->x),
new IntTag("y", $this->y),
new IntTag("z", $this->z)
]);
$nbt->Items->setTagType(NBT::TAG_Compound);
$furnace = Tile::createTile("Furnace", $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);
}
if(isset($furnace->namedtag->Lock) and $furnace->namedtag->Lock instanceof String){
if(isset($furnace->namedtag->Lock) and $furnace->namedtag->Lock instanceof StringTag){
if($furnace->namedtag->Lock->getValue() !== $item->getCustomName()){
return true;
}

View File

@ -25,10 +25,10 @@ use pocketmine\item\Item;
use pocketmine\item\Tool;
use pocketmine\math\AxisAlignedBB;
use pocketmine\nbt\NBT;
use pocketmine\nbt\tag\Compound;
use pocketmine\nbt\tag\Enum;
use pocketmine\nbt\tag\Int;
use pocketmine\nbt\tag\String;
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\nbt\tag\ListTag;
use pocketmine\nbt\tag\IntTag;
use pocketmine\nbt\tag\StringTag;
use pocketmine\Player;
use pocketmine\tile\Chest as TileChest;
use pocketmine\tile\Tile;
@ -96,17 +96,17 @@ class Chest extends Transparent{
}
$this->getLevel()->setBlock($block, $this, true, true);
$nbt = new Compound("", [
new Enum("Items", []),
new String("id", Tile::CHEST),
new Int("x", $this->x),
new Int("y", $this->y),
new Int("z", $this->z)
$nbt = new CompoundTag("", [
new ListTag("Items", []),
new StringTag("id", Tile::CHEST),
new IntTag("x", $this->x),
new IntTag("y", $this->y),
new IntTag("z", $this->z)
]);
$nbt->Items->setTagType(NBT::TAG_Compound);
if($item->hasCustomName()){
$nbt->CustomName = new String("CustomName", $item->getCustomName());
$nbt->CustomName = new StringTag("CustomName", $item->getCustomName());
}
if($item->hasCustomBlockData()){
@ -147,18 +147,18 @@ class Chest extends Transparent{
if($t instanceof TileChest){
$chest = $t;
}else{
$nbt = new Compound("", [
new Enum("Items", []),
new String("id", Tile::CHEST),
new Int("x", $this->x),
new Int("y", $this->y),
new Int("z", $this->z)
$nbt = new CompoundTag("", [
new ListTag("Items", []),
new StringTag("id", Tile::CHEST),
new IntTag("x", $this->x),
new IntTag("y", $this->y),
new IntTag("z", $this->z)
]);
$nbt->Items->setTagType(NBT::TAG_Compound);
$chest = Tile::createTile("Chest", $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);
}
if(isset($chest->namedtag->Lock) and $chest->namedtag->Lock instanceof String){
if(isset($chest->namedtag->Lock) and $chest->namedtag->Lock instanceof StringTag){
if($chest->namedtag->Lock->getValue() !== $item->getCustomName()){
return true;
}

View File

@ -0,0 +1,35 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\block;
class CocoaBlock extends Solid {
protected $id = self::COCOA_BLOCK;
public function __construct($meta = 0){
$this->meta = $meta;
}
public function getName(){
return "Cocoa Block";
}
}

View File

@ -0,0 +1,35 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\block;
class DaylightSensor extends Solid {
protected $id = self::DAYLIGHT_SENSOR;
public function __construct($meta = 0){
$this->meta = $meta;
}
public function getName(){
return "Daylight Sensor";
}
}

View File

@ -0,0 +1,35 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\block;
class DetectorRail extends Solid {
protected $id = self::DETECTOR_RAIL;
public function __construct($meta = 0){
$this->meta = $meta;
}
public function getName(){
return "Detector Rail";
}
}

View File

@ -51,7 +51,7 @@ class DoubleSlab extends Solid{
6 => "Quartz",
7 => "Nether Brick",
];
return "Double " . $names[$this->meta & 0x07] . " Slab";
return "DoubleTag " . $names[$this->meta & 0x07] . " Slab";
}
public function getDrops(Item $item){

View File

@ -51,7 +51,7 @@ class DoubleWoodSlab extends Solid{
6 => "",
7 => ""
];
return "Double " . $names[$this->meta & 0x07] . " Wooden Slab";
return "DoubleTag " . $names[$this->meta & 0x07] . " Wooden Slab";
}
public function getDrops(Item $item){

View File

@ -25,9 +25,9 @@ use pocketmine\inventory\EnchantInventory;
use pocketmine\item\Item;
use pocketmine\item\Tool;
use pocketmine\nbt\tag\Compound;
use pocketmine\nbt\tag\Int;
use pocketmine\nbt\tag\String;
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\nbt\tag\IntTag;
use pocketmine\nbt\tag\StringTag;
use pocketmine\Player;
use pocketmine\tile\Tile;
@ -41,15 +41,15 @@ class EnchantingTable extends Transparent{
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$this->getLevel()->setBlock($block, $this, true, true);
$nbt = new Compound("", [
new String("id", Tile::ENCHANT_TABLE),
new Int("x", $this->x),
new Int("y", $this->y),
new Int("z", $this->z)
$nbt = new CompoundTag("", [
new StringTag("id", Tile::ENCHANT_TABLE),
new IntTag("x", $this->x),
new IntTag("y", $this->y),
new IntTag("z", $this->z)
]);
if($item->hasCustomName()){
$nbt->CustomName = new String("CustomName", $item->getCustomName());
$nbt->CustomName = new StringTag("CustomName", $item->getCustomName());
}
if($item->hasCustomBlockData()){

View File

@ -37,7 +37,7 @@ class EndPortalFrame extends Solid{
}
public function getName(){
return "End Portal Frame";
return "EndTag Portal Frame";
}
public function getHardness(){

View File

@ -33,7 +33,7 @@ class EndStone extends Solid{
}
public function getName(){
return "End Stone";
return "EndTag Stone";
}
public function getToolType(){

View File

@ -25,12 +25,12 @@ use pocketmine\entity\Entity;
use pocketmine\item\Item;
use pocketmine\level\Level;
use pocketmine\math\Vector3;
use pocketmine\nbt\tag\Byte;
use pocketmine\nbt\tag\Compound;
use pocketmine\nbt\tag\Double;
use pocketmine\nbt\tag\Enum;
use pocketmine\nbt\tag\Float;
use pocketmine\nbt\tag\Int;
use pocketmine\nbt\tag\ByteTag;
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\nbt\tag\DoubleTag;
use pocketmine\nbt\tag\ListTag;
use pocketmine\nbt\tag\FloatTag;
use pocketmine\nbt\tag\IntTag;
use pocketmine\Player;
abstract class Fallable extends Solid{
@ -45,23 +45,23 @@ abstract class Fallable extends Solid{
if($type === Level::BLOCK_UPDATE_NORMAL){
$down = $this->getSide(Vector3::SIDE_DOWN);
if($down->getId() === self::AIR or ($down instanceof Liquid)){
$fall = Entity::createEntity("FallingSand", $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), new Compound("", [
"Pos" => new Enum("Pos", [
new Double("", $this->x + 0.5),
new Double("", $this->y),
new Double("", $this->z + 0.5)
$fall = Entity::createEntity("FallingSand", $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), new CompoundTag("", [
"Pos" => new ListTag("Pos", [
new DoubleTag("", $this->x + 0.5),
new DoubleTag("", $this->y),
new DoubleTag("", $this->z + 0.5)
]),
"Motion" => new Enum("Motion", [
new Double("", 0),
new Double("", 0),
new Double("", 0)
"Motion" => new ListTag("Motion", [
new DoubleTag("", 0),
new DoubleTag("", 0),
new DoubleTag("", 0)
]),
"Rotation" => new Enum("Rotation", [
new Float("", 0),
new Float("", 0)
"Rotation" => new ListTag("Rotation", [
new FloatTag("", 0),
new FloatTag("", 0)
]),
"TileID" => new Int("TileID", $this->getId()),
"Data" => new Byte("Data", $this->getDamage()),
"TileID" => new IntTag("TileID", $this->getId()),
"Data" => new ByteTag("Data", $this->getDamage()),
]));
$fall->spawnToAll();

View File

@ -0,0 +1,35 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\block;
class Lever extends Solid {
protected $id = self::LEVER;
public function __construct($meta = 0){
$this->meta = $meta;
}
public function getName(){
return "Lever";
}
}

View File

@ -0,0 +1,35 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\block;
class LitRedstoneLamp extends Solid {
protected $id = self::LIT_REDSTONE_LAMP;
public function __construct($meta = 0){
$this->meta = $meta;
}
public function getName(){
return "Lit Redstone Lamp";
}
}

View File

@ -0,0 +1,35 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\block;
class LitRedstoneTorch extends Solid {
protected $id = self::REDSTONE_TORCH;
public function __construct($meta = 0){
$this->meta = $meta;
}
public function getName(){
return "Lit Redstone Torch";
}
}

View File

@ -0,0 +1,35 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\block;
class NoteBlock extends Solid {
protected $id = self::NOTE_BLOCK;
public function __construct($meta = 0){
$this->meta = $meta;
}
public function getName(){
return "Note Block";
}
}

View File

@ -53,11 +53,11 @@ class Planks extends Solid{
self::BIRCH => "Birch Wood Planks",
self::JUNGLE => "Jungle Wood Planks",
self::ACACIA => "Acacia Wood Planks",
self::DARK_OAK => "Jungle Wood Planks",
self::DARK_OAK => "Dark Oak Wood Planks",
"",
""
];
return $names[$this->meta & 0x07];
}
}
}

View File

@ -0,0 +1,34 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\block;
class PoweredRail extends Solid {
protected $id = self::POWERED_RAIL;
public function __construct($meta = 0){
$this->meta = $meta;
}
public function getName(){
return "Powered Rail";
}
}

View File

@ -0,0 +1,35 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\block;
class Rail extends Solid {
protected $id = self::RAIL;
public function __construct($meta = 0){
$this->meta = $meta;
}
public function getName(){
return "Rail";
}
}

View File

@ -0,0 +1,35 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\block;
class RedstoneLamp extends Solid {
protected $id = self::REDSTONE_LAMP;
public function __construct($meta = 0){
$this->meta = $meta;
}
public function getName(){
return "Redstone Lamp";
}
}

View File

@ -0,0 +1,35 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\block;
class RedstoneTorch extends Solid {
protected $id = self::REDSTONE_TORCH;
public function __construct($meta = 0){
$this->meta = $meta;
}
public function getName(){
return "Redstone Torch";
}
}

View File

@ -0,0 +1,35 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\block;
class StoneButton extends Solid {
protected $id = self::STONE_BUTTON;
public function __construct($meta = 0){
$this->meta = $meta;
}
public function getName(){
return "Stone Button";
}
}

View File

@ -0,0 +1,35 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\block;
class StonePressurePlate extends Solid {
protected $id = self::STONE_PRESSURE_PLATE;
public function __construct($meta = 0){
$this->meta = $meta;
}
public function getName(){
return "Stone Pressure Plate";
}
}

View File

@ -23,11 +23,11 @@ namespace pocketmine\block;
use pocketmine\entity\Entity;
use pocketmine\item\Item;
use pocketmine\nbt\tag\Byte;
use pocketmine\nbt\tag\Compound;
use pocketmine\nbt\tag\Double;
use pocketmine\nbt\tag\Enum;
use pocketmine\nbt\tag\Float;
use pocketmine\nbt\tag\ByteTag;
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\nbt\tag\DoubleTag;
use pocketmine\nbt\tag\ListTag;
use pocketmine\nbt\tag\FloatTag;
use pocketmine\Player;
use pocketmine\utils\Random;
@ -57,22 +57,22 @@ class TNT extends Solid{
$this->getLevel()->setBlock($this, new Air(), true);
$mot = (new Random())->nextSignedFloat() * M_PI * 2;
$tnt = Entity::createEntity("PrimedTNT", $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), new Compound("", [
"Pos" => new Enum("Pos", [
new Double("", $this->x + 0.5),
new Double("", $this->y),
new Double("", $this->z + 0.5)
$tnt = Entity::createEntity("PrimedTNT", $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), new CompoundTag("", [
"Pos" => new ListTag("Pos", [
new DoubleTag("", $this->x + 0.5),
new DoubleTag("", $this->y),
new DoubleTag("", $this->z + 0.5)
]),
"Motion" => new Enum("Motion", [
new Double("", -sin($mot) * 0.02),
new Double("", 0.2),
new Double("", -cos($mot) * 0.02)
"Motion" => new ListTag("Motion", [
new DoubleTag("", -sin($mot) * 0.02),
new DoubleTag("", 0.2),
new DoubleTag("", -cos($mot) * 0.02)
]),
"Rotation" => new Enum("Rotation", [
new Float("", 0),
new Float("", 0)
"Rotation" => new ListTag("Rotation", [
new FloatTag("", 0),
new FloatTag("", 0)
]),
"Fuse" => new Byte("Fuse", 80)
"Fuse" => new ByteTag("Fuse", 80)
]));
$tnt->spawnToAll();

View File

@ -25,10 +25,10 @@ use pocketmine\item\Item;
use pocketmine\item\Tool;
use pocketmine\math\AxisAlignedBB;
use pocketmine\nbt\NBT;
use pocketmine\nbt\tag\Compound;
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\nbt\tag\Enum;
use pocketmine\nbt\tag\Int;
use pocketmine\nbt\tag\String;
use pocketmine\nbt\tag\Int as IntTag;
use pocketmine\nbt\tag\String as StringTag;
use pocketmine\Player;
use pocketmine\tile\Chest as TileChest;
use pocketmine\tile\Tile;
@ -96,17 +96,17 @@ class TrappedChest extends Transparent{
}
$this->getLevel()->setBlock($block, $this, true, true);
$nbt = new Compound("", [
$nbt = new CompoundTag("", [
new Enum("Items", []),
new String("id", Tile::CHEST),
new Int("x", $this->x),
new Int("y", $this->y),
new Int("z", $this->z)
new StringTag("id", Tile::CHEST),
new IntTag("x", $this->x),
new IntTag("y", $this->y),
new IntTag("z", $this->z)
]);
$nbt->Items->setTagType(NBT::TAG_Compound);
if($item->hasCustomName()){
$nbt->CustomName = new String("CustomName", $item->getCustomName());
$nbt->CustomName = new StringTag("CustomName", $item->getCustomName());
}
if($item->hasCustomBlockData()){
@ -147,12 +147,12 @@ class TrappedChest extends Transparent{
if($t instanceof TileChest){
$chest = $t;
}else{
$nbt = new Compound("", [
$nbt = new CompoundTag("", [
new Enum("Items", []),
new String("id", Tile::CHEST),
new Int("x", $this->x),
new Int("y", $this->y),
new Int("z", $this->z)
new StringTag("id", Tile::CHEST),
new IntTag("x", $this->x),
new IntTag("y", $this->y),
new IntTag("z", $this->z)
]);
$nbt->Items->setTagType(NBT::TAG_Compound);
$chest = Tile::createTile("Chest", $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);
@ -178,4 +178,4 @@ class TrappedChest extends Transparent{
[$this->id, 0, 1],
];
}
}
}

View File

@ -0,0 +1,35 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\block;
class Tripwire extends Solid {
protected $id = self::TRIPWIRE;
public function __construct($meta = 0){
$this->meta = $meta;
}
public function getName(){
return "Tripwire";
}
}

View File

@ -0,0 +1,35 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\block;
class TripwireHook extends Solid {
protected $id = self::TRIPWIRE_HOOK;
public function __construct($meta = 0){
$this->meta = $meta;
}
public function getName(){
return "Tripwire Hook";
}
}

View File

@ -0,0 +1,35 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\block;
class WeightedPressurePlateHeavy extends Solid {
protected $id = self::WEIGHTED_PRESSURE_PLATE_HEAVY;
public function __construct($meta = 0){
$this->meta = $meta;
}
public function getName(){
return "Weighted Pressure Plate Heavy";
}
}

View File

@ -0,0 +1,35 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\block;
class WeightedPressurePlateLight extends Solid {
protected $id = self::WEIGHTED_PRESSURE_PLATE_LIGHT;
public function __construct($meta = 0){
$this->meta = $meta;
}
public function getName(){
return "Weighted Pressure Plate Light";
}
}

View File

@ -0,0 +1,35 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\block;
class WoodenButton extends Solid {
protected $id = self::WOODEN_BUTTON;
public function __construct($meta = 0){
$this->meta = $meta;
}
public function getName(){
return "Wooden Button";
}
}

View File

@ -0,0 +1,35 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\block;
class WoodenPressurePlate extends Solid{
protected $id = self::WOODEN_PRESSURE_PLATE;
public function __construct($meta = 0) {
$this->meta = $meta;
}
public function getName(){
return "Wooden Pressure Plate";
}
}