Merge pull request #10 from SOF3/master

Fixed some lines indented with 4 spaces rather than tabs
This commit is contained in:
SOFe 2016-10-03 01:05:23 +08:00 committed by GitHub
commit d7a78ee00f
56 changed files with 238 additions and 238 deletions

View File

@ -23,13 +23,13 @@ namespace pocketmine;
abstract class Collectable extends \Threaded implements \Collectable{ abstract class Collectable extends \Threaded implements \Collectable{
private $isGarbage = false; private $isGarbage = false;
public function isGarbage() : bool{
return $this->isGarbage;
}
public function setGarbage(){ public function isGarbage() : bool{
$this->isGarbage = true; return $this->isGarbage;
} }
public function setGarbage(){
$this->isGarbage = true;
}
} }

View File

@ -1614,7 +1614,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
} }
} }
} }
$nbt = $this->server->getOfflinePlayerData($this->username); $nbt = $this->server->getOfflinePlayerData($this->username);
$this->playedBefore = ($nbt["lastPlayed"] - $nbt["firstPlayed"]) > 1; // microtime(true) - microtime(true) may have less than one millisecond difference $this->playedBefore = ($nbt["lastPlayed"] - $nbt["firstPlayed"]) > 1; // microtime(true) - microtime(true) may have less than one millisecond difference
if(!isset($nbt->NameTag)){ if(!isset($nbt->NameTag)){

View File

@ -1701,7 +1701,7 @@ class Server{
return count($recipients); return count($recipients);
} }
/** /**
* @param string $popup * @param string $popup
* @param Player[]|null $recipients * @param Player[]|null $recipients
@ -1719,7 +1719,7 @@ class Server{
} }
} }
} }
/** @var Player[] $recipients */ /** @var Player[] $recipients */
foreach($recipients as $recipient){ foreach($recipients as $recipient){
$recipient->sendPopup($popup); $recipient->sendPopup($popup);
@ -2341,7 +2341,7 @@ class Server{
} }
$d = Utils::getRealMemoryUsage(); $d = Utils::getRealMemoryUsage();
$u = Utils::getMemoryUsage(true); $u = Utils::getMemoryUsage(true);
$usage = round(($u[0] / 1024) / 1024, 2) . "/" . round(($d[0] / 1024) / 1024, 2) . "/" . round(($u[1] / 1024) / 1024, 2) . "/".round(($u[2] / 1024) / 1024, 2)." MB @ " . Utils::getThreadCount() . " threads"; $usage = round(($u[0] / 1024) / 1024, 2) . "/" . round(($d[0] / 1024) / 1024, 2) . "/" . round(($u[1] / 1024) / 1024, 2) . "/".round(($u[2] / 1024) / 1024, 2)." MB @ " . Utils::getThreadCount() . " threads";

View File

@ -28,7 +28,7 @@ abstract class Worker extends \Worker{
/** @var \ClassLoader */ /** @var \ClassLoader */
protected $classLoader; protected $classLoader;
protected $isKilled = false; protected $isKilled = false;
public function getClassLoader(){ public function getClassLoader(){
@ -73,7 +73,7 @@ abstract class Worker extends \Worker{
$this->isKilled = true; $this->isKilled = true;
$this->notify(); $this->notify();
if($this->isRunning()){ if($this->isRunning()){
$this->shutdown(); $this->shutdown();
$this->notify(); $this->notify();

View File

@ -23,13 +23,13 @@ namespace pocketmine\block;
class ActivatorRail extends Solid { class ActivatorRail extends Solid {
protected $id = self::ACTIVATOR_RAIL; protected $id = self::ACTIVATOR_RAIL;
public function __construct($meta = 0){ public function __construct($meta = 0){
$this->meta = $meta; $this->meta = $meta;
} }
public function getName(){ public function getName(){
return "Activator Rail"; return "Activator Rail";
} }
} }

View File

@ -207,7 +207,7 @@ class Block extends Position implements BlockIds, Metadatable{
self::$list[self::TRAPPED_CHEST] = TrappedChest::class; self::$list[self::TRAPPED_CHEST] = TrappedChest::class;
self::$list[self::WEIGHTED_PRESSURE_PLATE_LIGHT] = WeightedPressurePlateLight::class; self::$list[self::WEIGHTED_PRESSURE_PLATE_LIGHT] = WeightedPressurePlateLight::class;
self::$list[self::WEIGHTED_PRESSURE_PLATE_HEAVY] = WeightedPressurePlateHeavy::class; self::$list[self::WEIGHTED_PRESSURE_PLATE_HEAVY] = WeightedPressurePlateHeavy::class;
self::$list[self::DAYLIGHT_SENSOR] = DaylightSensor::class; self::$list[self::DAYLIGHT_SENSOR] = DaylightSensor::class;
self::$list[self::REDSTONE_BLOCK] = Redstone::class; self::$list[self::REDSTONE_BLOCK] = Redstone::class;

View File

@ -22,7 +22,7 @@
namespace pocketmine\block; namespace pocketmine\block;
interface BlockIds{ interface BlockIds{
const AIR = 0; const AIR = 0;
const STONE = 1; const STONE = 1;
const GRASS = 2; const GRASS = 2;
@ -182,22 +182,22 @@ interface BlockIds{
const DOUBLE_WOOD_SLAB = 157; const DOUBLE_WOODEN_SLAB = 157; const DOUBLE_WOOD_SLABS = 157; const DOUBLE_WOODEN_SLABS = 157; 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 WOOD_SLAB = 158; const WOODEN_SLAB = 158; const WOOD_SLABS = 158; const WOODEN_SLABS = 158;
const STAINED_CLAY = 159; const STAINED_HARDENED_CLAY = 159; const STAINED_CLAY = 159; const STAINED_HARDENED_CLAY = 159;
const LEAVES2 = 161; const LEAVES2 = 161;
const WOOD2 = 162; const TRUNK2 = 162; const LOG2 = 162; const WOOD2 = 162; const TRUNK2 = 162; const LOG2 = 162;
const ACACIA_WOOD_STAIRS = 163; const ACACIA_WOODEN_STAIRS = 163; const ACACIA_WOOD_STAIRS = 163; const ACACIA_WOODEN_STAIRS = 163;
const DARK_OAK_WOOD_STAIRS = 164; const DARK_OAK_WOODEN_STAIRS = 164; const DARK_OAK_WOOD_STAIRS = 164; const DARK_OAK_WOODEN_STAIRS = 164;
const SLIME_BLOCK = 165; const SLIME_BLOCK = 165;
const IRON_TRAPDOOR = 167; const IRON_TRAPDOOR = 167;
const HAY_BALE = 170; const HAY_BALE = 170;
const CARPET = 171; const CARPET = 171;
const HARDENED_CLAY = 172; const HARDENED_CLAY = 172;
const COAL_BLOCK = 173; const COAL_BLOCK = 173;
const PACKED_ICE = 174; const PACKED_ICE = 174;
const DOUBLE_PLANT = 175; const DOUBLE_PLANT = 175;
const INVERTED_DAYLIGHT_SENSOR = 178; const DAYLIGHT_SENSOR_INVERTED = 178; const INVERTED_DAYLIGHT_SENSOR = 178; const DAYLIGHT_SENSOR_INVERTED = 178;
const RED_SANDSTONE = 179; const RED_SANDSTONE = 179;
const RED_SANDSTONE_STAIRS = 180; const RED_SANDSTONE_STAIRS = 180;
@ -208,7 +208,7 @@ interface BlockIds{
const JUNGLE_FENCE_GATE = 185; const FENCE_GATE_JUNGLE = 185; const JUNGLE_FENCE_GATE = 185; const FENCE_GATE_JUNGLE = 185;
const DARK_OAK_FENCE_GATE = 186; const FENCE_GATE_DARK_OAK = 186; const DARK_OAK_FENCE_GATE = 186; const FENCE_GATE_DARK_OAK = 186;
const ACACIA_FENCE_GATE = 187; const FENCE_GATE_ACACIA = 187; const ACACIA_FENCE_GATE = 187; const FENCE_GATE_ACACIA = 187;
const SPRUCE_DOOR_BLOCK = 193; const SPRUCE_DOOR_BLOCK = 193;
const BIRCH_DOOR_BLOCK = 194; const BIRCH_DOOR_BLOCK = 194;
const JUNGLE_DOOR_BLOCK = 195; const JUNGLE_DOOR_BLOCK = 195;
@ -216,7 +216,7 @@ interface BlockIds{
const DARK_OAK_DOOR_BLOCK = 197; const DARK_OAK_DOOR_BLOCK = 197;
const GRASS_PATH = 198; const GRASS_PATH = 198;
const ITEM_FRAME_BLOCK = 199; const ITEM_FRAME_BLOCK = 199;
const PODZOL = 243; const PODZOL = 243;
const BEETROOT_BLOCK = 244; const BEETROOT_BLOCK = 244;
const STONECUTTER = 245; const STONECUTTER = 245;

View File

@ -23,13 +23,13 @@ namespace pocketmine\block;
class CocoaBlock extends Solid { class CocoaBlock extends Solid {
protected $id = self::COCOA_BLOCK; protected $id = self::COCOA_BLOCK;
public function __construct($meta = 0){ public function __construct($meta = 0){
$this->meta = $meta; $this->meta = $meta;
} }
public function getName(){ public function getName(){
return "Cocoa Block"; return "Cocoa Block";
} }
} }

View File

@ -23,13 +23,13 @@ namespace pocketmine\block;
class DaylightSensor extends Solid { class DaylightSensor extends Solid {
protected $id = self::DAYLIGHT_SENSOR; protected $id = self::DAYLIGHT_SENSOR;
public function __construct($meta = 0){ public function __construct($meta = 0){
$this->meta = $meta; $this->meta = $meta;
} }
public function getName(){ public function getName(){
return "Daylight Sensor"; return "Daylight Sensor";
} }
} }

View File

@ -23,13 +23,13 @@ namespace pocketmine\block;
class DetectorRail extends Solid { class DetectorRail extends Solid {
protected $id = self::DETECTOR_RAIL; protected $id = self::DETECTOR_RAIL;
public function __construct($meta = 0){ public function __construct($meta = 0){
$this->meta = $meta; $this->meta = $meta;
} }
public function getName(){ public function getName(){
return "Detector Rail"; return "Detector Rail";
} }
} }

View File

@ -32,7 +32,7 @@ class Fence extends Transparent{
const FENCE_JUNGLE = 3; const FENCE_JUNGLE = 3;
const FENCE_ACACIA = 4; const FENCE_ACACIA = 4;
const FENCE_DARKOAK = 5; const FENCE_DARKOAK = 5;
protected $id = self::FENCE; protected $id = self::FENCE;
public function __construct($meta = 0){ public function __construct($meta = 0){

View File

@ -113,7 +113,7 @@ class FlowerPot extends Flowable{
$this->setDamage(self::STATE_FULL); //specific damage value is unnecessary, it just needs to be non-zero to show an item. $this->setDamage(self::STATE_FULL); //specific damage value is unnecessary, it just needs to be non-zero to show an item.
$this->getLevel()->setBlock($this, $this, true, false); $this->getLevel()->setBlock($this, $this, true, false);
$pot->setItem($item); $pot->setItem($item);
if($player instanceof Player){ if($player instanceof Player){
if($player->isSurvival()){ if($player->isSurvival()){
$item->setCount($item->getCount() - 1); $item->setCount($item->getCount() - 1);

View File

@ -23,13 +23,13 @@ namespace pocketmine\block;
class Lever extends Solid { class Lever extends Solid {
protected $id = self::LEVER; protected $id = self::LEVER;
public function __construct($meta = 0){ public function __construct($meta = 0){
$this->meta = $meta; $this->meta = $meta;
} }
public function getName(){ public function getName(){
return "Lever"; return "Lever";
} }
} }

View File

@ -23,13 +23,13 @@ namespace pocketmine\block;
class LitRedstoneLamp extends Solid { class LitRedstoneLamp extends Solid {
protected $id = self::LIT_REDSTONE_LAMP; protected $id = self::LIT_REDSTONE_LAMP;
public function __construct($meta = 0){ public function __construct($meta = 0){
$this->meta = $meta; $this->meta = $meta;
} }
public function getName(){ public function getName(){
return "Lit Redstone Lamp"; return "Lit Redstone Lamp";
} }
} }

View File

@ -23,13 +23,13 @@ namespace pocketmine\block;
class LitRedstoneTorch extends Solid { class LitRedstoneTorch extends Solid {
protected $id = self::REDSTONE_TORCH; protected $id = self::REDSTONE_TORCH;
public function __construct($meta = 0){ public function __construct($meta = 0){
$this->meta = $meta; $this->meta = $meta;
} }
public function getName(){ public function getName(){
return "Lit Redstone Torch"; return "Lit Redstone Torch";
} }
} }

View File

@ -30,7 +30,7 @@ class NetherBrickFence extends Transparent {
public function __construct($meta = 0){ public function __construct($meta = 0){
$this->meta = $meta; $this->meta = $meta;
} }
public function getBreakTime(Item $item){ public function getBreakTime(Item $item){
if ($item instanceof Air){ if ($item instanceof Air){
//Breaking by hand //Breaking by hand
@ -45,15 +45,15 @@ class NetherBrickFence extends Transparent {
public function getHardness(){ public function getHardness(){
return 2; return 2;
} }
public function getToolType(){ public function getToolType(){
return Tool::TYPE_PICKAXE; return Tool::TYPE_PICKAXE;
} }
public function getName(){ public function getName(){
return "Nether Brick Fence"; return "Nether Brick Fence";
} }
public function canConnect(Block $block){ public function canConnect(Block $block){
//TODO: activate comments when the NetherBrickFenceGate class has been created. //TODO: activate comments when the NetherBrickFenceGate class has been created.
return ($block instanceof NetherBrickFence /* or $block instanceof NetherBrickFenceGate */) ? true : $block->isSolid() and !$block->isTransparent(); return ($block instanceof NetherBrickFence /* or $block instanceof NetherBrickFenceGate */) ? true : $block->isSolid() and !$block->isTransparent();

View File

@ -23,13 +23,13 @@ namespace pocketmine\block;
class NoteBlock extends Solid { class NoteBlock extends Solid {
protected $id = self::NOTE_BLOCK; protected $id = self::NOTE_BLOCK;
public function __construct($meta = 0){ public function __construct($meta = 0){
$this->meta = $meta; $this->meta = $meta;
} }
public function getName(){ public function getName(){
return "Note Block"; return "Note Block";
} }
} }

View File

@ -22,13 +22,13 @@
namespace pocketmine\block; namespace pocketmine\block;
class PoweredRail extends Solid { class PoweredRail extends Solid {
protected $id = self::POWERED_RAIL; protected $id = self::POWERED_RAIL;
public function __construct($meta = 0){ public function __construct($meta = 0){
$this->meta = $meta; $this->meta = $meta;
} }
public function getName(){ public function getName(){
return "Powered Rail"; return "Powered Rail";
} }
} }

View File

@ -30,7 +30,7 @@ class Quartz extends Solid{
const QUARTZ_CHISELED = 1; const QUARTZ_CHISELED = 1;
const QUARTZ_PILLAR = 2; const QUARTZ_PILLAR = 2;
const QUARTZ_PILLAR2 = 3; const QUARTZ_PILLAR2 = 3;
protected $id = self::QUARTZ_BLOCK; protected $id = self::QUARTZ_BLOCK;
public function __construct($meta = 0){ public function __construct($meta = 0){

View File

@ -23,13 +23,13 @@ namespace pocketmine\block;
class Rail extends Solid { class Rail extends Solid {
protected $id = self::RAIL; protected $id = self::RAIL;
public function __construct($meta = 0){ public function __construct($meta = 0){
$this->meta = $meta; $this->meta = $meta;
} }
public function getName(){ public function getName(){
return "Rail"; return "Rail";
} }
} }

View File

@ -23,13 +23,13 @@ namespace pocketmine\block;
class RedstoneLamp extends Solid { class RedstoneLamp extends Solid {
protected $id = self::REDSTONE_LAMP; protected $id = self::REDSTONE_LAMP;
public function __construct($meta = 0){ public function __construct($meta = 0){
$this->meta = $meta; $this->meta = $meta;
} }
public function getName(){ public function getName(){
return "Redstone Lamp"; return "Redstone Lamp";
} }
} }

View File

@ -23,13 +23,13 @@ namespace pocketmine\block;
class RedstoneTorch extends Solid { class RedstoneTorch extends Solid {
protected $id = self::REDSTONE_TORCH; protected $id = self::REDSTONE_TORCH;
public function __construct($meta = 0){ public function __construct($meta = 0){
$this->meta = $meta; $this->meta = $meta;
} }
public function getName(){ public function getName(){
return "Redstone Torch"; return "Redstone Torch";
} }
} }

View File

@ -53,7 +53,7 @@ class StoneBricks extends Solid{
]; ];
return $names[$this->meta & 0x03]; return $names[$this->meta & 0x03];
} }
public function getDrops(Item $item){ public function getDrops(Item $item){
if($item->isPickaxe() >= Tool::TIER_WOODEN){ if($item->isPickaxe() >= Tool::TIER_WOODEN){
return [ return [

View File

@ -23,13 +23,13 @@ namespace pocketmine\block;
class StoneButton extends Solid { class StoneButton extends Solid {
protected $id = self::STONE_BUTTON; protected $id = self::STONE_BUTTON;
public function __construct($meta = 0){ public function __construct($meta = 0){
$this->meta = $meta; $this->meta = $meta;
} }
public function getName(){ public function getName(){
return "Stone Button"; return "Stone Button";
} }
} }

View File

@ -46,7 +46,7 @@ class TallGrass extends Flowable{
]; ];
return $names[$this->meta & 0x03]; return $names[$this->meta & 0x03];
} }
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$down = $this->getSide(0); $down = $this->getSide(0);
if($down->getId() === self::GRASS){ if($down->getId() === self::GRASS){

View File

@ -22,9 +22,9 @@
namespace pocketmine\block; namespace pocketmine\block;
class TrappedChest extends Chest{ class TrappedChest extends Chest{
//TODO: Redstone! //TODO: Redstone!
protected $id = self::TRAPPED_CHEST; protected $id = self::TRAPPED_CHEST;
public function getName(){ public function getName(){

View File

@ -23,13 +23,13 @@ namespace pocketmine\block;
class Tripwire extends Solid { class Tripwire extends Solid {
protected $id = self::TRIPWIRE; protected $id = self::TRIPWIRE;
public function __construct($meta = 0){ public function __construct($meta = 0){
$this->meta = $meta; $this->meta = $meta;
} }
public function getName(){ public function getName(){
return "Tripwire"; return "Tripwire";
} }
} }

View File

@ -23,13 +23,13 @@ namespace pocketmine\block;
class TripwireHook extends Solid { class TripwireHook extends Solid {
protected $id = self::TRIPWIRE_HOOK; protected $id = self::TRIPWIRE_HOOK;
public function __construct($meta = 0){ public function __construct($meta = 0){
$this->meta = $meta; $this->meta = $meta;
} }
public function getName(){ public function getName(){
return "Tripwire Hook"; return "Tripwire Hook";
} }
} }

View File

@ -23,13 +23,13 @@ namespace pocketmine\block;
class WeightedPressurePlateHeavy extends Solid { class WeightedPressurePlateHeavy extends Solid {
protected $id = self::WEIGHTED_PRESSURE_PLATE_HEAVY; protected $id = self::WEIGHTED_PRESSURE_PLATE_HEAVY;
public function __construct($meta = 0){ public function __construct($meta = 0){
$this->meta = $meta; $this->meta = $meta;
} }
public function getName(){ public function getName(){
return "Weighted Pressure Plate Heavy"; return "Weighted Pressure Plate Heavy";
} }
} }

View File

@ -23,13 +23,13 @@ namespace pocketmine\block;
class WeightedPressurePlateLight extends Solid { class WeightedPressurePlateLight extends Solid {
protected $id = self::WEIGHTED_PRESSURE_PLATE_LIGHT; protected $id = self::WEIGHTED_PRESSURE_PLATE_LIGHT;
public function __construct($meta = 0){ public function __construct($meta = 0){
$this->meta = $meta; $this->meta = $meta;
} }
public function getName(){ public function getName(){
return "Weighted Pressure Plate Light"; return "Weighted Pressure Plate Light";
} }
} }

View File

@ -23,13 +23,13 @@ namespace pocketmine\block;
class WoodenButton extends Solid { class WoodenButton extends Solid {
protected $id = self::WOODEN_BUTTON; protected $id = self::WOODEN_BUTTON;
public function __construct($meta = 0){ public function __construct($meta = 0){
$this->meta = $meta; $this->meta = $meta;
} }
public function getName(){ public function getName(){
return "Wooden Button"; return "Wooden Button";
} }
} }

View File

@ -22,7 +22,7 @@
namespace pocketmine\block; namespace pocketmine\block;
class WoodenPressurePlate extends Solid{ class WoodenPressurePlate extends Solid{
protected $id = self::WOODEN_PRESSURE_PLATE; protected $id = self::WOODEN_PRESSURE_PLATE;
public function __construct($meta = 0) { public function __construct($meta = 0) {

View File

@ -52,7 +52,7 @@ class PlayerInteractEvent extends PlayerEvent implements Cancellable{
/** @var \pocketmine\item\Item */ /** @var \pocketmine\item\Item */
protected $item; protected $item;
protected $action; protected $action;
public function __construct(Player $player, Item $item, Vector3 $block, $face, $action = PlayerInteractEvent::RIGHT_CLICK_BLOCK){ public function __construct(Player $player, Item $item, Vector3 $block, $face, $action = PlayerInteractEvent::RIGHT_CLICK_BLOCK){

View File

@ -52,7 +52,7 @@ class CraftingManager{
if(count($recipe["Result"]) == 1){ if(count($recipe["Result"]) == 1){
$first = $recipe["Result"][0]; $first = $recipe["Result"][0];
$result = new ShapelessRecipe(Item::get($first["ID"], $first["Damage"], $first["Count"])); $result = new ShapelessRecipe(Item::get($first["ID"], $first["Damage"], $first["Count"]));
foreach($recipe["Ingredients"] as $ingredient){ foreach($recipe["Ingredients"] as $ingredient){
$result->addIngredient(Item::get($ingredient["ID"], $ingredient["Damage"], $ingredient["Count"])); $result->addIngredient(Item::get($ingredient["ID"], $ingredient["Damage"], $ingredient["Count"]));
} }

View File

@ -399,7 +399,7 @@ class PlayerInventory extends BaseInventory{
$index = $this->getHotbarSlotIndex($i); $index = $this->getHotbarSlotIndex($i);
$pk->hotbar[] = $index <= -1 ? -1 : $index + $this->getHotbarSize(); $pk->hotbar[] = $index <= -1 ? -1 : $index + $this->getHotbarSize();
} }
if($player->getGamemode() & 0x01 === 0x01){ //Send special inventory for creative or spectator if($player->getGamemode() & 0x01 === 0x01){ //Send special inventory for creative or spectator
$pk2 = new ContainerSetContentPacket(); $pk2 = new ContainerSetContentPacket();
$pk2->windowid = ContainerSetContentPacket::SPECIAL_CREATIVE; $pk2->windowid = ContainerSetContentPacket::SPECIAL_CREATIVE;

View File

@ -226,7 +226,7 @@ class Item implements ItemIds{
self::clearCreativeItems(); self::clearCreativeItems();
$creativeItems = new Config(Server::getInstance()->getFilePath() . "src/pocketmine/resources/creativeitems.json", Config::JSON, []); $creativeItems = new Config(Server::getInstance()->getFilePath() . "src/pocketmine/resources/creativeitems.json", Config::JSON, []);
foreach($creativeItems->getAll() as $item){ foreach($creativeItems->getAll() as $item){
self::addCreativeItem(Item::get($item["ID"], $item["Damage"])); self::addCreativeItem(Item::get($item["ID"], $item["Damage"]));
} }

View File

@ -18,13 +18,13 @@
* *
* *
*/ */
namespace pocketmine\item; namespace pocketmine\item;
use pocketmine\block\BlockIds; use pocketmine\block\BlockIds;
interface ItemIds extends BlockIds{ interface ItemIds extends BlockIds{
//All BlockIds are also accessible through this interface. //All BlockIds are also accessible through this interface.
const IRON_SHOVEL = 256; const IRON_SHOVEL = 256;
const IRON_PICKAXE = 257; const IRON_PICKAXE = 257;
@ -105,7 +105,7 @@ interface ItemIds extends BlockIds{
const SNOWBALL = 332; const SNOWBALL = 332;
const BOAT = 333; const BOAT = 333;
const LEATHER = 334; const LEATHER = 334;
const BRICK = 336; const BRICK = 336;
const CLAY = 337; const CLAY = 337;
const SUGARCANE = 338; const SUGAR_CANE = 338; const SUGAR_CANES = 338; const SUGARCANE = 338; const SUGAR_CANE = 338; const SUGAR_CANES = 338;
@ -113,7 +113,7 @@ interface ItemIds extends BlockIds{
const BOOK = 340; const BOOK = 340;
const SLIMEBALL = 341; const SLIMEBALL = 341;
const MINECART_WITH_CHEST = 342; const MINECART_WITH_CHEST = 342;
const EGG = 344; const EGG = 344;
const COMPASS = 345; const COMPASS = 345;
const FISHING_ROD = 346; const FISHING_ROD = 346;
@ -156,7 +156,7 @@ interface ItemIds extends BlockIds{
const SPAWN_EGG = 383; const SPAWN_EGG = 383;
const BOTTLE_O_ENCHANTING = 384; const ENCHANTING_BOTTLE = 384; const BOTTLE_O_ENCHANTING = 384; const ENCHANTING_BOTTLE = 384;
const FIRE_CHARGE = 385; const FIRE_CHARGE = 385;
const EMERALD = 388; const EMERALD = 388;
const ITEM_FRAME = 389; const ITEM_FRAME = 389;
const FLOWER_POT = 390; const FLOWER_POT = 390;
@ -168,7 +168,7 @@ interface ItemIds extends BlockIds{
const GOLDEN_CARROT = 396; const GOLDEN_CARROT = 396;
const MOB_HEAD = 397; const SKULL = 397; const MOB_HEAD = 397; const SKULL = 397;
const CARROT_ON_A_STICK = 398; const CARROT_ON_A_STICK = 398;
const PUMPKIN_PIE = 400; const PUMPKIN_PIE = 400;
const ENCHANTED_BOOK = 403; const ENCHANTED_BOOK = 403;
@ -178,7 +178,7 @@ interface ItemIds extends BlockIds{
const NETHER_QUARTZ = 406; const NETHER_QUARTZ = 406;
const MINECART_WITH_TNT = 407; const MINECART_WITH_TNT = 407;
const MINECART_WITH_HOPPER = 408; const MINECART_WITH_HOPPER = 408;
const HOPPER = 410; const HOPPER = 410;
const RAW_RABBIT = 411; const RAW_RABBIT = 411;
const COOKED_RABBIT = 412; const COOKED_RABBIT = 412;
@ -191,18 +191,18 @@ interface ItemIds extends BlockIds{
const DIAMOND_HORSE_ARMOR = 419; const DIAMOND_HORSE_ARMOR = 419;
const LEAD = 420; const LEASH = 420; const LEAD = 420; const LEASH = 420;
const NAMETAG = 421; const NAMETAG = 421;
const RAW_MUTTON = 423; const RAW_MUTTON = 423;
const COOKED_MUTTON = 424; const COOKED_MUTTON = 424;
const SPRUCE_DOOR = 427; const SPRUCE_DOOR = 427;
const BIRCH_DOOR = 428; const BIRCH_DOOR = 428;
const JUNGLE_DOOR = 429; const JUNGLE_DOOR = 429;
const ACACIA_DOOR = 430; const ACACIA_DOOR = 430;
const DARK_OAK_DOOR = 431; const DARK_OAK_DOOR = 431;
const SPLASH_POTION = 438; const SPLASH_POTION = 438;
const BEETROOT = 457; const BEETROOT = 457;
const BEETROOT_SEEDS = 458; const BEETROOT_SEED = 458; const BEETROOT_SEEDS = 458; const BEETROOT_SEED = 458;
const BEETROOT_SOUP = 459; const BEETROOT_SOUP = 459;

View File

@ -426,7 +426,7 @@ class Level implements ChunkManager, Metadatable{
$this->blockCache = []; $this->blockCache = [];
$this->temporalPosition = null; $this->temporalPosition = null;
} }
public function addSound(Sound $sound, array $players = null){ public function addSound(Sound $sound, array $players = null){
$pk = $sound->encode(); $pk = $sound->encode();
@ -450,7 +450,7 @@ class Level implements ChunkManager, Metadatable{
} }
} }
} }
public function addParticle(Particle $particle, array $players = null){ public function addParticle(Particle $particle, array $players = null){
$pk = $particle->encode(); $pk = $particle->encode();
@ -1065,7 +1065,7 @@ class Level implements ChunkManager, Metadatable{
$maxX = Math::ceilFloat($bb->maxX); $maxX = Math::ceilFloat($bb->maxX);
$maxY = Math::ceilFloat($bb->maxY); $maxY = Math::ceilFloat($bb->maxY);
$maxZ = Math::ceilFloat($bb->maxZ); $maxZ = Math::ceilFloat($bb->maxZ);
$collides = []; $collides = [];
if($targetFirst){ if($targetFirst){
@ -1581,9 +1581,9 @@ class Level implements ChunkManager, Metadatable{
$this->addParticle(new DestroyBlockParticle($target->add(0.5), $target), $players); $this->addParticle(new DestroyBlockParticle($target->add(0.5), $target), $players);
} }
$target->onBreak($item); $target->onBreak($item);
$tile = $this->getTile($target); $tile = $this->getTile($target);
if($tile !== null){ if($tile !== null){
if($tile instanceof InventoryHolder){ if($tile instanceof InventoryHolder){

View File

@ -46,7 +46,7 @@ class Chunk extends BaseFullChunk{
$this->nbt = new CompoundTag("Level", []); $this->nbt = new CompoundTag("Level", []);
return; return;
} }
$this->nbt = $nbt; $this->nbt = $nbt;
if(isset($this->nbt->Entities) and $this->nbt->Entities instanceof ListTag){ if(isset($this->nbt->Entities) and $this->nbt->Entities instanceof ListTag){
@ -313,7 +313,7 @@ class Chunk extends BaseFullChunk{
return null; return null;
} }
} }
public static function fromFastBinary($data, LevelProvider $provider = null){ public static function fromFastBinary($data, LevelProvider $provider = null){
try{ try{
@ -351,7 +351,7 @@ class Chunk extends BaseFullChunk{
return null; return null;
} }
} }
public function toFastBinary(){ public function toFastBinary(){
return return
Binary::writeInt($this->x) . Binary::writeInt($this->x) .

View File

@ -39,7 +39,7 @@ class SpruceTree extends Tree{
$this->treeHeight = $random->nextBoundedInt(4) + 6; $this->treeHeight = $random->nextBoundedInt(4) + 6;
$topSize = $this->treeHeight - (1 + $random->nextBoundedInt(2)); $topSize = $this->treeHeight - (1 + $random->nextBoundedInt(2));
$lRadius = 2 + $random->nextBoundedInt(2); $lRadius = 2 + $random->nextBoundedInt(2);
$this->placeTrunk($level, $x, $y, $z, $random, $this->treeHeight - $random->nextBoundedInt(3)); $this->placeTrunk($level, $x, $y, $z, $random, $this->treeHeight - $random->nextBoundedInt(3));
@ -54,7 +54,7 @@ class SpruceTree extends Tree{
$xOff = abs($xx - $x); $xOff = abs($xx - $x);
for($zz = $z - $radius; $zz <= $z + $radius; ++$zz){ for($zz = $z - $radius; $zz <= $z + $radius; ++$zz){
$zOff = abs($zz - $z); $zOff = abs($zz - $z);
if($xOff === $radius and $zOff === $radius and $radius > 0){ if($xOff === $radius and $zOff === $radius and $radius > 0){
continue; continue;
} }
@ -62,10 +62,10 @@ class SpruceTree extends Tree{
$level->setBlockIdAt($xx, $yyy, $zz, $this->leafBlock); $level->setBlockIdAt($xx, $yyy, $zz, $this->leafBlock);
$level->setBlockDataAt($xx, $yyy, $zz, $this->type); $level->setBlockDataAt($xx, $yyy, $zz, $this->type);
} }
} }
} }
if($radius >= $maxR){ if($radius >= $maxR){
$radius = $minR; $radius = $minR;
$minR = 1; $minR = 1;
if(++$maxR > $lRadius){ if(++$maxR > $lRadius){

View File

@ -26,14 +26,14 @@ use pocketmine\math\Vector3;
use pocketmine\network\protocol\LevelEventPacket; use pocketmine\network\protocol\LevelEventPacket;
class DestroyBlockParticle extends Particle{ class DestroyBlockParticle extends Particle{
protected $data; protected $data;
public function __construct(Vector3 $pos, Block $b){ public function __construct(Vector3 $pos, Block $b){
parent::__construct($pos->x, $pos->y, $pos->z); parent::__construct($pos->x, $pos->y, $pos->z);
$this->data = $b->getId() + ($b->getDamage() << 12); $this->data = $b->getId() + ($b->getDamage() << 12);
} }
public function encode(){ public function encode(){
$pk = new LevelEventPacket; $pk = new LevelEventPacket;
$pk->evid = LevelEventPacket::EVENT_PARTICLE_DESTROY; $pk->evid = LevelEventPacket::EVENT_PARTICLE_DESTROY;
@ -41,7 +41,7 @@ class DestroyBlockParticle extends Particle{
$pk->y = $this->y; $pk->y = $this->y;
$pk->z = $this->z; $pk->z = $this->z;
$pk->data = $this->data; $pk->data = $this->data;
return $pk; return $pk;
} }
} }

View File

@ -53,11 +53,11 @@ class FloatingTextParticle extends Particle{
public function setTitle($title){ public function setTitle($title){
$this->title = $title; $this->title = $title;
} }
public function isInvisible(){ public function isInvisible(){
return $this->invisible; return $this->invisible;
} }
public function setInvisible($value = true){ public function setInvisible($value = true){
$this->invisible = (bool) $value; $this->invisible = (bool) $value;
} }
@ -75,7 +75,7 @@ class FloatingTextParticle extends Particle{
} }
if(!$this->invisible){ if(!$this->invisible){
$pk = new AddEntityPacket(); $pk = new AddEntityPacket();
$pk->eid = $this->entityId; $pk->eid = $this->entityId;
$pk->type = ItemEntity::NETWORK_ID; $pk->type = ItemEntity::NETWORK_ID;
@ -94,11 +94,11 @@ class FloatingTextParticle extends Particle{
Entity::DATA_NAMETAG => [Entity::DATA_TYPE_STRING, $this->title . ($this->text !== "" ? "\n" . $this->text : "")], Entity::DATA_NAMETAG => [Entity::DATA_TYPE_STRING, $this->title . ($this->text !== "" ? "\n" . $this->text : "")],
Entity::DATA_SHOW_NAMETAG => [Entity::DATA_TYPE_BYTE, 1], Entity::DATA_SHOW_NAMETAG => [Entity::DATA_TYPE_BYTE, 1],
Entity::DATA_NO_AI => [Entity::DATA_TYPE_BYTE, 1] Entity::DATA_NO_AI => [Entity::DATA_TYPE_BYTE, 1]
]; ];
$p[] = $pk; $p[] = $pk;
} }
return $p; return $p;
} }
} }

View File

@ -25,7 +25,7 @@ use pocketmine\math\Vector3;
use pocketmine\network\protocol\LevelEventPacket; use pocketmine\network\protocol\LevelEventPacket;
class GenericParticle extends Particle{ class GenericParticle extends Particle{
protected $id; protected $id;
protected $data; protected $data;
@ -34,7 +34,7 @@ class GenericParticle extends Particle{
$this->id = $id & 0xFFF; $this->id = $id & 0xFFF;
$this->data = $data; $this->data = $data;
} }
public function encode(){ public function encode(){
$pk = new LevelEventPacket; $pk = new LevelEventPacket;
$pk->evid = LevelEventPacket::EVENT_ADD_PARTICLE_MASK | $this->id; $pk->evid = LevelEventPacket::EVENT_ADD_PARTICLE_MASK | $this->id;
@ -42,7 +42,7 @@ class GenericParticle extends Particle{
$pk->y = $this->y; $pk->y = $this->y;
$pk->z = $this->z; $pk->z = $this->z;
$pk->data = $this->data; $pk->data = $this->data;
return $pk; return $pk;
} }
} }

View File

@ -25,16 +25,16 @@ use pocketmine\math\Vector3;
use pocketmine\network\protocol\LevelEventPacket; use pocketmine\network\protocol\LevelEventPacket;
class MobSpawnParticle extends Particle{ class MobSpawnParticle extends Particle{
protected $width; protected $width;
protected $height; protected $height;
public function __construct(Vector3 $pos, $width = 0, $height = 0){ public function __construct(Vector3 $pos, $width = 0, $height = 0){
parent::__construct($pos->x, $pos->y, $pos->z); parent::__construct($pos->x, $pos->y, $pos->z);
$this->width = $width; $this->width = $width;
$this->height = $height; $this->height = $height;
} }
public function encode(){ public function encode(){
$pk = new LevelEventPacket; $pk = new LevelEventPacket;
$pk->evid = LevelEventPacket::EVENT_PARTICLE_SPAWN; $pk->evid = LevelEventPacket::EVENT_PARTICLE_SPAWN;
@ -42,7 +42,7 @@ class MobSpawnParticle extends Particle{
$pk->y = $this->y; $pk->y = $this->y;
$pk->z = $this->z; $pk->z = $this->z;
$pk->data = ($this->width & 0xff) + (($this->height & 0xff) << 8); $pk->data = ($this->width & 0xff) + (($this->height & 0xff) << 8);
return $pk; return $pk;
} }
} }

View File

@ -58,7 +58,7 @@ abstract class Particle extends Vector3{
const TYPE_VILLAGER_ANGRY = 30; const TYPE_VILLAGER_ANGRY = 30;
const TYPE_VILLAGER_HAPPY = 31; const TYPE_VILLAGER_HAPPY = 31;
const TYPE_ENCHANTMENT_TABLE = 32; const TYPE_ENCHANTMENT_TABLE = 32;
/** /**
* @return DataPacket|DataPacket[] * @return DataPacket|DataPacket[]
*/ */

View File

@ -25,25 +25,25 @@ use pocketmine\math\Vector3;
use pocketmine\network\protocol\LevelEventPacket; use pocketmine\network\protocol\LevelEventPacket;
class GenericSound extends Sound{ class GenericSound extends Sound{
public function __construct(Vector3 $pos, $id, $pitch = 0){ public function __construct(Vector3 $pos, $id, $pitch = 0){
parent::__construct($pos->x, $pos->y, $pos->z); parent::__construct($pos->x, $pos->y, $pos->z);
$this->id = (int) $id; $this->id = (int) $id;
$this->pitch = (float) $pitch * 1000; $this->pitch = (float) $pitch * 1000;
} }
protected $pitch = 0; protected $pitch = 0;
protected $id; protected $id;
public function getPitch(){ public function getPitch(){
return $this->pitch / 1000; return $this->pitch / 1000;
} }
public function setPitch($pitch){ public function setPitch($pitch){
$this->pitch = (float) $pitch * 1000; $this->pitch = (float) $pitch * 1000;
} }
public function encode(){ public function encode(){
$pk = new LevelEventPacket; $pk = new LevelEventPacket;
$pk->evid = $this->id; $pk->evid = $this->id;
@ -51,7 +51,7 @@ class GenericSound extends Sound{
$pk->y = $this->y; $pk->y = $this->y;
$pk->z = $this->z; $pk->z = $this->z;
$pk->data = (int) $this->pitch; $pk->data = (int) $this->pitch;
return $pk; return $pk;
} }

View File

@ -25,7 +25,7 @@ use pocketmine\math\Vector3;
use pocketmine\network\protocol\DataPacket; use pocketmine\network\protocol\DataPacket;
abstract class Sound extends Vector3{ abstract class Sound extends Vector3{
/** /**
* @return DataPacket|DataPacket[] * @return DataPacket|DataPacket[]
*/ */

View File

@ -108,7 +108,7 @@ class NBT{
} }
$item = Item::get($tag->id->getValue(), !isset($tag->Damage) ? 0 : $tag->Damage->getValue(), $tag->Count->getValue()); $item = Item::get($tag->id->getValue(), !isset($tag->Damage) ? 0 : $tag->Damage->getValue(), $tag->Count->getValue());
if(isset($tag->tag) and $tag->tag instanceof CompoundTag){ if(isset($tag->tag) and $tag->tag instanceof CompoundTag){
$item->setNamedTag($tag->tag); $item->setNamedTag($tag->tag);
} }

View File

@ -26,7 +26,7 @@ use pocketmine\nbt\NBT;
#include <rules/NBT.h> #include <rules/NBT.h>
class StringTag extends NamedTag{ class StringTag extends NamedTag{
public function getType(){ public function getType(){
return NBT::TAG_String; return NBT::TAG_String;
} }

View File

@ -26,7 +26,7 @@ namespace pocketmine\network\protocol;
class FullChunkDataPacket extends DataPacket{ class FullChunkDataPacket extends DataPacket{
const NETWORK_ID = Info::FULL_CHUNK_DATA_PACKET; const NETWORK_ID = Info::FULL_CHUNK_DATA_PACKET;
const ORDER_COLUMNS = 0; const ORDER_COLUMNS = 0;
const ORDER_LAYERED = 1; const ORDER_LAYERED = 1;
@ -41,9 +41,9 @@ class FullChunkDataPacket extends DataPacket{
public function encode(){ public function encode(){
$this->reset(); $this->reset();
$this->putInt($this->chunkX); $this->putInt($this->chunkX);
$this->putInt($this->chunkZ); $this->putInt($this->chunkZ);
$this->putByte($this->order); $this->putByte($this->order);
$this->putInt(strlen($this->data)); $this->putInt(strlen($this->data));
$this->put($this->data); $this->put($this->data);
} }

View File

@ -26,7 +26,7 @@ namespace pocketmine\network\protocol;
class PlayStatusPacket extends DataPacket{ class PlayStatusPacket extends DataPacket{
const NETWORK_ID = Info::PLAY_STATUS_PACKET; const NETWORK_ID = Info::PLAY_STATUS_PACKET;
const LOGIN_SUCCESS = 0; const LOGIN_SUCCESS = 0;
const LOGIN_FAILED_CLIENT = 1; const LOGIN_FAILED_CLIENT = 1;
const LOGIN_FAILED_SERVER = 2; const LOGIN_FAILED_SERVER = 2;

View File

@ -29,7 +29,7 @@ class UpdateBlockPacket extends DataPacket{
const FLAG_NONE = 0b0000; const FLAG_NONE = 0b0000;
const FLAG_NEIGHBORS = 0b0001; const FLAG_NEIGHBORS = 0b0001;
const FLAG_NETWORK = 0b0010; const FLAG_NETWORK = 0b0010;
const FLAG_NOGRAPHIC = 0b0100; const FLAG_NOGRAPHIC = 0b0100;
const FLAG_PRIORITY = 0b1000; const FLAG_PRIORITY = 0b1000;

View File

@ -44,7 +44,7 @@ class QueryHandler{
The Query protocol is built on top of the existing Minecraft PE UDP network stack. The Query protocol is built on top of the existing Minecraft PE UDP network stack.
Because the 0xFE packet does not exist in the MCPE protocol, Because the 0xFE packet does not exist in the MCPE protocol,
we can identify Query packets and remove them from the packet queue. we can identify Query packets and remove them from the packet queue.
Then, the Query class handles itself sending the packets in raw form, because Then, the Query class handles itself sending the packets in raw form, because
packets can conflict with the MCPE ones. packets can conflict with the MCPE ones.
*/ */

View File

@ -39,7 +39,7 @@ class FlowerPot extends Spawnable{
} }
parent::__construct($chunk, $nbt); parent::__construct($chunk, $nbt);
} }
public function canAddItem(Item $item): bool{ public function canAddItem(Item $item): bool{
if(!$this->isEmpty()){ if(!$this->isEmpty()){
return false; return false;
@ -61,11 +61,11 @@ class FlowerPot extends Spawnable{
return false; return false;
} }
} }
public function getItem(): Item{ public function getItem(): Item{
return Item::get((int) ($this->namedtag["item"] ?? 0), (int) ($this->namedtag["mData"] ?? 0), 1); return Item::get((int) ($this->namedtag["item"] ?? 0), (int) ($this->namedtag["mData"] ?? 0), 1);
} }
public function setItem(Item $item){ public function setItem(Item $item){
$this->namedtag["item"] = $item->getId(); $this->namedtag["item"] = $item->getId();
$this->namedtag["mData"] = $item->getDamage(); $this->namedtag["mData"] = $item->getDamage();
@ -76,15 +76,15 @@ class FlowerPot extends Spawnable{
$this->level->clearChunkCache($this->chunk->getX(), $this->chunk->getZ()); $this->level->clearChunkCache($this->chunk->getX(), $this->chunk->getZ());
} }
} }
public function removeItem(){ public function removeItem(){
$this->setItem(Item::get(Item::AIR)); $this->setItem(Item::get(Item::AIR));
} }
public function isEmpty(): bool{ public function isEmpty(): bool{
return $this->getItem()->getId() === Item::AIR; return $this->getItem()->getId() === Item::AIR;
} }
public function getSpawnCompound(): CompoundTag{ public function getSpawnCompound(): CompoundTag{
return new CompoundTag("", [ return new CompoundTag("", [
new StringTag("id", Tile::FLOWER_POT), new StringTag("id", Tile::FLOWER_POT),

View File

@ -33,7 +33,7 @@ class BinaryStream extends \stdClass{
public $offset; public $offset;
public $buffer; public $buffer;
public function __construct($buffer = "", $offset = 0){ public function __construct($buffer = "", $offset = 0){
$this->buffer = $buffer; $this->buffer = $buffer;
$this->offset = $offset; $this->offset = $offset;
@ -196,19 +196,19 @@ class BinaryStream extends \stdClass{
public function getSlot(){ public function getSlot(){
$id = $this->getSignedShort(); $id = $this->getSignedShort();
if($id <= 0){ if($id <= 0){
return Item::get(0, 0, 0); return Item::get(0, 0, 0);
} }
$cnt = $this->getByte(); $cnt = $this->getByte();
$data = $this->getShort(); $data = $this->getShort();
$nbtLen = $this->getLShort(); $nbtLen = $this->getLShort();
$nbt = ""; $nbt = "";
if($nbtLen > 0){ if($nbtLen > 0){
$nbt = $this->get($nbtLen); $nbt = $this->get($nbtLen);
} }
@ -226,14 +226,14 @@ class BinaryStream extends \stdClass{
$this->putShort(0); $this->putShort(0);
return; return;
} }
$this->putShort($item->getId()); $this->putShort($item->getId());
$this->putByte($item->getCount()); $this->putByte($item->getCount());
$this->putShort($item->getDamage() === null ? -1 : $item->getDamage()); $this->putShort($item->getDamage() === null ? -1 : $item->getDamage());
$nbt = $item->getCompoundTag(); $nbt = $item->getCompoundTag();
$this->putLShort(strlen($nbt)); $this->putLShort(strlen($nbt));
$this->put($nbt); $this->put($nbt);
} }
public function getString(){ public function getString(){

View File

@ -26,7 +26,7 @@ namespace pocketmine\utils;
*/ */
abstract class TextFormat{ abstract class TextFormat{
const ESCAPE = "\xc2\xa7"; //§ const ESCAPE = "\xc2\xa7"; //§
const BLACK = TextFormat::ESCAPE . "0"; const BLACK = TextFormat::ESCAPE . "0";
const DARK_BLUE = TextFormat::ESCAPE . "1"; const DARK_BLUE = TextFormat::ESCAPE . "1";
const DARK_GREEN = TextFormat::ESCAPE . "2"; const DARK_GREEN = TextFormat::ESCAPE . "2";