mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 16:51:42 +00:00
Fixed some lines indented with 4 spaces rather than tabs
This commit is contained in:
parent
6fc435da0e
commit
e913b16804
@ -23,13 +23,13 @@ namespace pocketmine;
|
||||
|
||||
abstract class Collectable extends \Threaded implements \Collectable{
|
||||
|
||||
private $isGarbage = false;
|
||||
|
||||
public function isGarbage() : bool{
|
||||
return $this->isGarbage;
|
||||
}
|
||||
private $isGarbage = false;
|
||||
|
||||
public function setGarbage(){
|
||||
$this->isGarbage = true;
|
||||
}
|
||||
public function isGarbage() : bool{
|
||||
return $this->isGarbage;
|
||||
}
|
||||
|
||||
public function setGarbage(){
|
||||
$this->isGarbage = true;
|
||||
}
|
||||
}
|
||||
|
@ -1614,7 +1614,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$nbt = $this->server->getOfflinePlayerData($this->username);
|
||||
$this->playedBefore = ($nbt["lastPlayed"] - $nbt["firstPlayed"]) > 1; // microtime(true) - microtime(true) may have less than one millisecond difference
|
||||
if(!isset($nbt->NameTag)){
|
||||
|
@ -1701,7 +1701,7 @@ class Server{
|
||||
|
||||
return count($recipients);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $popup
|
||||
* @param Player[]|null $recipients
|
||||
@ -1719,7 +1719,7 @@ class Server{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** @var Player[] $recipients */
|
||||
foreach($recipients as $recipient){
|
||||
$recipient->sendPopup($popup);
|
||||
@ -2341,7 +2341,7 @@ class Server{
|
||||
}
|
||||
|
||||
$d = Utils::getRealMemoryUsage();
|
||||
|
||||
|
||||
$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";
|
||||
|
||||
|
@ -28,7 +28,7 @@ abstract class Worker extends \Worker{
|
||||
|
||||
/** @var \ClassLoader */
|
||||
protected $classLoader;
|
||||
|
||||
|
||||
protected $isKilled = false;
|
||||
|
||||
public function getClassLoader(){
|
||||
@ -73,7 +73,7 @@ abstract class Worker extends \Worker{
|
||||
$this->isKilled = true;
|
||||
|
||||
$this->notify();
|
||||
|
||||
|
||||
if($this->isRunning()){
|
||||
$this->shutdown();
|
||||
$this->notify();
|
||||
|
@ -23,13 +23,13 @@ namespace pocketmine\block;
|
||||
|
||||
class ActivatorRail extends Solid {
|
||||
|
||||
protected $id = self::ACTIVATOR_RAIL;
|
||||
protected $id = self::ACTIVATOR_RAIL;
|
||||
|
||||
public function __construct($meta = 0){
|
||||
$this->meta = $meta;
|
||||
}
|
||||
public function __construct($meta = 0){
|
||||
$this->meta = $meta;
|
||||
}
|
||||
|
||||
public function getName(){
|
||||
return "Activator Rail";
|
||||
}
|
||||
public function getName(){
|
||||
return "Activator Rail";
|
||||
}
|
||||
}
|
||||
|
@ -207,7 +207,7 @@ class Block extends Position implements BlockIds, Metadatable{
|
||||
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;
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
namespace pocketmine\block;
|
||||
|
||||
interface BlockIds{
|
||||
|
||||
|
||||
const AIR = 0;
|
||||
const STONE = 1;
|
||||
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 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 LEAVES2 = 161;
|
||||
const WOOD2 = 162; const TRUNK2 = 162; const LOG2 = 162;
|
||||
const ACACIA_WOOD_STAIRS = 163; const ACACIA_WOODEN_STAIRS = 163;
|
||||
const DARK_OAK_WOOD_STAIRS = 164; const DARK_OAK_WOODEN_STAIRS = 164;
|
||||
const SLIME_BLOCK = 165;
|
||||
|
||||
|
||||
const IRON_TRAPDOOR = 167;
|
||||
|
||||
|
||||
const HAY_BALE = 170;
|
||||
const CARPET = 171;
|
||||
const HARDENED_CLAY = 172;
|
||||
const COAL_BLOCK = 173;
|
||||
const PACKED_ICE = 174;
|
||||
const DOUBLE_PLANT = 175;
|
||||
|
||||
|
||||
const INVERTED_DAYLIGHT_SENSOR = 178; const DAYLIGHT_SENSOR_INVERTED = 178;
|
||||
const RED_SANDSTONE = 179;
|
||||
const RED_SANDSTONE_STAIRS = 180;
|
||||
@ -208,7 +208,7 @@ interface BlockIds{
|
||||
const JUNGLE_FENCE_GATE = 185; const FENCE_GATE_JUNGLE = 185;
|
||||
const DARK_OAK_FENCE_GATE = 186; const FENCE_GATE_DARK_OAK = 186;
|
||||
const ACACIA_FENCE_GATE = 187; const FENCE_GATE_ACACIA = 187;
|
||||
|
||||
|
||||
const SPRUCE_DOOR_BLOCK = 193;
|
||||
const BIRCH_DOOR_BLOCK = 194;
|
||||
const JUNGLE_DOOR_BLOCK = 195;
|
||||
@ -216,7 +216,7 @@ interface BlockIds{
|
||||
const DARK_OAK_DOOR_BLOCK = 197;
|
||||
const GRASS_PATH = 198;
|
||||
const ITEM_FRAME_BLOCK = 199;
|
||||
|
||||
|
||||
const PODZOL = 243;
|
||||
const BEETROOT_BLOCK = 244;
|
||||
const STONECUTTER = 245;
|
||||
|
@ -23,13 +23,13 @@ namespace pocketmine\block;
|
||||
|
||||
class CocoaBlock extends Solid {
|
||||
|
||||
protected $id = self::COCOA_BLOCK;
|
||||
protected $id = self::COCOA_BLOCK;
|
||||
|
||||
public function __construct($meta = 0){
|
||||
$this->meta = $meta;
|
||||
}
|
||||
public function __construct($meta = 0){
|
||||
$this->meta = $meta;
|
||||
}
|
||||
|
||||
public function getName(){
|
||||
return "Cocoa Block";
|
||||
}
|
||||
public function getName(){
|
||||
return "Cocoa Block";
|
||||
}
|
||||
}
|
||||
|
@ -23,13 +23,13 @@ namespace pocketmine\block;
|
||||
|
||||
class DaylightSensor extends Solid {
|
||||
|
||||
protected $id = self::DAYLIGHT_SENSOR;
|
||||
protected $id = self::DAYLIGHT_SENSOR;
|
||||
|
||||
public function __construct($meta = 0){
|
||||
$this->meta = $meta;
|
||||
}
|
||||
public function __construct($meta = 0){
|
||||
$this->meta = $meta;
|
||||
}
|
||||
|
||||
public function getName(){
|
||||
return "Daylight Sensor";
|
||||
}
|
||||
public function getName(){
|
||||
return "Daylight Sensor";
|
||||
}
|
||||
}
|
||||
|
@ -23,13 +23,13 @@ namespace pocketmine\block;
|
||||
|
||||
class DetectorRail extends Solid {
|
||||
|
||||
protected $id = self::DETECTOR_RAIL;
|
||||
protected $id = self::DETECTOR_RAIL;
|
||||
|
||||
public function __construct($meta = 0){
|
||||
$this->meta = $meta;
|
||||
}
|
||||
public function __construct($meta = 0){
|
||||
$this->meta = $meta;
|
||||
}
|
||||
|
||||
public function getName(){
|
||||
return "Detector Rail";
|
||||
}
|
||||
public function getName(){
|
||||
return "Detector Rail";
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ class Fence extends Transparent{
|
||||
const FENCE_JUNGLE = 3;
|
||||
const FENCE_ACACIA = 4;
|
||||
const FENCE_DARKOAK = 5;
|
||||
|
||||
|
||||
protected $id = self::FENCE;
|
||||
|
||||
public function __construct($meta = 0){
|
||||
|
@ -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->getLevel()->setBlock($this, $this, true, false);
|
||||
$pot->setItem($item);
|
||||
|
||||
|
||||
if($player instanceof Player){
|
||||
if($player->isSurvival()){
|
||||
$item->setCount($item->getCount() - 1);
|
||||
|
@ -23,13 +23,13 @@ namespace pocketmine\block;
|
||||
|
||||
class Lever extends Solid {
|
||||
|
||||
protected $id = self::LEVER;
|
||||
protected $id = self::LEVER;
|
||||
|
||||
public function __construct($meta = 0){
|
||||
$this->meta = $meta;
|
||||
}
|
||||
public function __construct($meta = 0){
|
||||
$this->meta = $meta;
|
||||
}
|
||||
|
||||
public function getName(){
|
||||
return "Lever";
|
||||
}
|
||||
public function getName(){
|
||||
return "Lever";
|
||||
}
|
||||
}
|
||||
|
@ -23,13 +23,13 @@ namespace pocketmine\block;
|
||||
|
||||
class LitRedstoneLamp extends Solid {
|
||||
|
||||
protected $id = self::LIT_REDSTONE_LAMP;
|
||||
protected $id = self::LIT_REDSTONE_LAMP;
|
||||
|
||||
public function __construct($meta = 0){
|
||||
$this->meta = $meta;
|
||||
}
|
||||
public function __construct($meta = 0){
|
||||
$this->meta = $meta;
|
||||
}
|
||||
|
||||
public function getName(){
|
||||
return "Lit Redstone Lamp";
|
||||
}
|
||||
public function getName(){
|
||||
return "Lit Redstone Lamp";
|
||||
}
|
||||
}
|
||||
|
@ -23,13 +23,13 @@ namespace pocketmine\block;
|
||||
|
||||
class LitRedstoneTorch extends Solid {
|
||||
|
||||
protected $id = self::REDSTONE_TORCH;
|
||||
protected $id = self::REDSTONE_TORCH;
|
||||
|
||||
public function __construct($meta = 0){
|
||||
$this->meta = $meta;
|
||||
}
|
||||
public function __construct($meta = 0){
|
||||
$this->meta = $meta;
|
||||
}
|
||||
|
||||
public function getName(){
|
||||
return "Lit Redstone Torch";
|
||||
}
|
||||
public function getName(){
|
||||
return "Lit Redstone Torch";
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ class NetherBrickFence extends Transparent {
|
||||
public function __construct($meta = 0){
|
||||
$this->meta = $meta;
|
||||
}
|
||||
|
||||
|
||||
public function getBreakTime(Item $item){
|
||||
if ($item instanceof Air){
|
||||
//Breaking by hand
|
||||
@ -45,15 +45,15 @@ class NetherBrickFence extends Transparent {
|
||||
public function getHardness(){
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
||||
public function getToolType(){
|
||||
return Tool::TYPE_PICKAXE;
|
||||
}
|
||||
|
||||
|
||||
public function getName(){
|
||||
return "Nether Brick Fence";
|
||||
}
|
||||
|
||||
|
||||
public function canConnect(Block $block){
|
||||
//TODO: activate comments when the NetherBrickFenceGate class has been created.
|
||||
return ($block instanceof NetherBrickFence /* or $block instanceof NetherBrickFenceGate */) ? true : $block->isSolid() and !$block->isTransparent();
|
||||
|
@ -23,13 +23,13 @@ namespace pocketmine\block;
|
||||
|
||||
class NoteBlock extends Solid {
|
||||
|
||||
protected $id = self::NOTE_BLOCK;
|
||||
protected $id = self::NOTE_BLOCK;
|
||||
|
||||
public function __construct($meta = 0){
|
||||
$this->meta = $meta;
|
||||
}
|
||||
public function __construct($meta = 0){
|
||||
$this->meta = $meta;
|
||||
}
|
||||
|
||||
public function getName(){
|
||||
return "Note Block";
|
||||
}
|
||||
public function getName(){
|
||||
return "Note Block";
|
||||
}
|
||||
}
|
||||
|
@ -22,13 +22,13 @@
|
||||
namespace pocketmine\block;
|
||||
|
||||
class PoweredRail extends Solid {
|
||||
protected $id = self::POWERED_RAIL;
|
||||
protected $id = self::POWERED_RAIL;
|
||||
|
||||
public function __construct($meta = 0){
|
||||
$this->meta = $meta;
|
||||
}
|
||||
public function __construct($meta = 0){
|
||||
$this->meta = $meta;
|
||||
}
|
||||
|
||||
public function getName(){
|
||||
return "Powered Rail";
|
||||
}
|
||||
public function getName(){
|
||||
return "Powered Rail";
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ class Quartz extends Solid{
|
||||
const QUARTZ_CHISELED = 1;
|
||||
const QUARTZ_PILLAR = 2;
|
||||
const QUARTZ_PILLAR2 = 3;
|
||||
|
||||
|
||||
protected $id = self::QUARTZ_BLOCK;
|
||||
|
||||
public function __construct($meta = 0){
|
||||
|
@ -23,13 +23,13 @@ namespace pocketmine\block;
|
||||
|
||||
class Rail extends Solid {
|
||||
|
||||
protected $id = self::RAIL;
|
||||
protected $id = self::RAIL;
|
||||
|
||||
public function __construct($meta = 0){
|
||||
$this->meta = $meta;
|
||||
}
|
||||
public function __construct($meta = 0){
|
||||
$this->meta = $meta;
|
||||
}
|
||||
|
||||
public function getName(){
|
||||
return "Rail";
|
||||
}
|
||||
public function getName(){
|
||||
return "Rail";
|
||||
}
|
||||
}
|
||||
|
@ -23,13 +23,13 @@ namespace pocketmine\block;
|
||||
|
||||
class RedstoneLamp extends Solid {
|
||||
|
||||
protected $id = self::REDSTONE_LAMP;
|
||||
protected $id = self::REDSTONE_LAMP;
|
||||
|
||||
public function __construct($meta = 0){
|
||||
$this->meta = $meta;
|
||||
}
|
||||
public function __construct($meta = 0){
|
||||
$this->meta = $meta;
|
||||
}
|
||||
|
||||
public function getName(){
|
||||
return "Redstone Lamp";
|
||||
}
|
||||
public function getName(){
|
||||
return "Redstone Lamp";
|
||||
}
|
||||
}
|
||||
|
@ -23,13 +23,13 @@ namespace pocketmine\block;
|
||||
|
||||
class RedstoneTorch extends Solid {
|
||||
|
||||
protected $id = self::REDSTONE_TORCH;
|
||||
protected $id = self::REDSTONE_TORCH;
|
||||
|
||||
public function __construct($meta = 0){
|
||||
$this->meta = $meta;
|
||||
}
|
||||
public function __construct($meta = 0){
|
||||
$this->meta = $meta;
|
||||
}
|
||||
|
||||
public function getName(){
|
||||
return "Redstone Torch";
|
||||
}
|
||||
public function getName(){
|
||||
return "Redstone Torch";
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ class StoneBricks extends Solid{
|
||||
];
|
||||
return $names[$this->meta & 0x03];
|
||||
}
|
||||
|
||||
|
||||
public function getDrops(Item $item){
|
||||
if($item->isPickaxe() >= Tool::TIER_WOODEN){
|
||||
return [
|
||||
|
@ -23,13 +23,13 @@ namespace pocketmine\block;
|
||||
|
||||
class StoneButton extends Solid {
|
||||
|
||||
protected $id = self::STONE_BUTTON;
|
||||
protected $id = self::STONE_BUTTON;
|
||||
|
||||
public function __construct($meta = 0){
|
||||
$this->meta = $meta;
|
||||
}
|
||||
public function __construct($meta = 0){
|
||||
$this->meta = $meta;
|
||||
}
|
||||
|
||||
public function getName(){
|
||||
return "Stone Button";
|
||||
}
|
||||
public function getName(){
|
||||
return "Stone Button";
|
||||
}
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ class TallGrass extends Flowable{
|
||||
];
|
||||
return $names[$this->meta & 0x03];
|
||||
}
|
||||
|
||||
|
||||
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
||||
$down = $this->getSide(0);
|
||||
if($down->getId() === self::GRASS){
|
||||
|
@ -22,9 +22,9 @@
|
||||
namespace pocketmine\block;
|
||||
|
||||
class TrappedChest extends Chest{
|
||||
|
||||
|
||||
//TODO: Redstone!
|
||||
|
||||
|
||||
protected $id = self::TRAPPED_CHEST;
|
||||
|
||||
public function getName(){
|
||||
|
@ -23,13 +23,13 @@ namespace pocketmine\block;
|
||||
|
||||
class Tripwire extends Solid {
|
||||
|
||||
protected $id = self::TRIPWIRE;
|
||||
protected $id = self::TRIPWIRE;
|
||||
|
||||
public function __construct($meta = 0){
|
||||
$this->meta = $meta;
|
||||
}
|
||||
public function __construct($meta = 0){
|
||||
$this->meta = $meta;
|
||||
}
|
||||
|
||||
public function getName(){
|
||||
return "Tripwire";
|
||||
}
|
||||
public function getName(){
|
||||
return "Tripwire";
|
||||
}
|
||||
}
|
||||
|
@ -23,13 +23,13 @@ namespace pocketmine\block;
|
||||
|
||||
class TripwireHook extends Solid {
|
||||
|
||||
protected $id = self::TRIPWIRE_HOOK;
|
||||
protected $id = self::TRIPWIRE_HOOK;
|
||||
|
||||
public function __construct($meta = 0){
|
||||
$this->meta = $meta;
|
||||
}
|
||||
public function __construct($meta = 0){
|
||||
$this->meta = $meta;
|
||||
}
|
||||
|
||||
public function getName(){
|
||||
return "Tripwire Hook";
|
||||
}
|
||||
public function getName(){
|
||||
return "Tripwire Hook";
|
||||
}
|
||||
}
|
||||
|
@ -23,13 +23,13 @@ namespace pocketmine\block;
|
||||
|
||||
class WeightedPressurePlateHeavy extends Solid {
|
||||
|
||||
protected $id = self::WEIGHTED_PRESSURE_PLATE_HEAVY;
|
||||
protected $id = self::WEIGHTED_PRESSURE_PLATE_HEAVY;
|
||||
|
||||
public function __construct($meta = 0){
|
||||
$this->meta = $meta;
|
||||
}
|
||||
public function __construct($meta = 0){
|
||||
$this->meta = $meta;
|
||||
}
|
||||
|
||||
public function getName(){
|
||||
return "Weighted Pressure Plate Heavy";
|
||||
}
|
||||
public function getName(){
|
||||
return "Weighted Pressure Plate Heavy";
|
||||
}
|
||||
}
|
||||
|
@ -23,13 +23,13 @@ namespace pocketmine\block;
|
||||
|
||||
class WeightedPressurePlateLight extends Solid {
|
||||
|
||||
protected $id = self::WEIGHTED_PRESSURE_PLATE_LIGHT;
|
||||
protected $id = self::WEIGHTED_PRESSURE_PLATE_LIGHT;
|
||||
|
||||
public function __construct($meta = 0){
|
||||
$this->meta = $meta;
|
||||
}
|
||||
public function __construct($meta = 0){
|
||||
$this->meta = $meta;
|
||||
}
|
||||
|
||||
public function getName(){
|
||||
return "Weighted Pressure Plate Light";
|
||||
}
|
||||
public function getName(){
|
||||
return "Weighted Pressure Plate Light";
|
||||
}
|
||||
}
|
||||
|
@ -23,13 +23,13 @@ namespace pocketmine\block;
|
||||
|
||||
class WoodenButton extends Solid {
|
||||
|
||||
protected $id = self::WOODEN_BUTTON;
|
||||
protected $id = self::WOODEN_BUTTON;
|
||||
|
||||
public function __construct($meta = 0){
|
||||
$this->meta = $meta;
|
||||
}
|
||||
public function __construct($meta = 0){
|
||||
$this->meta = $meta;
|
||||
}
|
||||
|
||||
public function getName(){
|
||||
return "Wooden Button";
|
||||
}
|
||||
public function getName(){
|
||||
return "Wooden Button";
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
namespace pocketmine\block;
|
||||
|
||||
class WoodenPressurePlate extends Solid{
|
||||
|
||||
|
||||
protected $id = self::WOODEN_PRESSURE_PLATE;
|
||||
|
||||
public function __construct($meta = 0) {
|
||||
|
@ -52,7 +52,7 @@ class PlayerInteractEvent extends PlayerEvent implements Cancellable{
|
||||
|
||||
/** @var \pocketmine\item\Item */
|
||||
protected $item;
|
||||
|
||||
|
||||
protected $action;
|
||||
|
||||
public function __construct(Player $player, Item $item, Vector3 $block, $face, $action = PlayerInteractEvent::RIGHT_CLICK_BLOCK){
|
||||
|
@ -52,7 +52,7 @@ class CraftingManager{
|
||||
if(count($recipe["Result"]) == 1){
|
||||
$first = $recipe["Result"][0];
|
||||
$result = new ShapelessRecipe(Item::get($first["ID"], $first["Damage"], $first["Count"]));
|
||||
|
||||
|
||||
foreach($recipe["Ingredients"] as $ingredient){
|
||||
$result->addIngredient(Item::get($ingredient["ID"], $ingredient["Damage"], $ingredient["Count"]));
|
||||
}
|
||||
|
@ -399,7 +399,7 @@ class PlayerInventory extends BaseInventory{
|
||||
$index = $this->getHotbarSlotIndex($i);
|
||||
$pk->hotbar[] = $index <= -1 ? -1 : $index + $this->getHotbarSize();
|
||||
}
|
||||
|
||||
|
||||
if($player->getGamemode() & 0x01 === 0x01){ //Send special inventory for creative or spectator
|
||||
$pk2 = new ContainerSetContentPacket();
|
||||
$pk2->windowid = ContainerSetContentPacket::SPECIAL_CREATIVE;
|
||||
|
@ -226,7 +226,7 @@ class Item implements ItemIds{
|
||||
self::clearCreativeItems();
|
||||
|
||||
$creativeItems = new Config(Server::getInstance()->getFilePath() . "src/pocketmine/resources/creativeitems.json", Config::JSON, []);
|
||||
|
||||
|
||||
foreach($creativeItems->getAll() as $item){
|
||||
self::addCreativeItem(Item::get($item["ID"], $item["Damage"]));
|
||||
}
|
||||
|
@ -18,13 +18,13 @@
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
namespace pocketmine\item;
|
||||
|
||||
|
||||
use pocketmine\block\BlockIds;
|
||||
|
||||
interface ItemIds extends BlockIds{
|
||||
|
||||
|
||||
//All BlockIds are also accessible through this interface.
|
||||
const IRON_SHOVEL = 256;
|
||||
const IRON_PICKAXE = 257;
|
||||
@ -105,7 +105,7 @@ interface ItemIds extends BlockIds{
|
||||
const SNOWBALL = 332;
|
||||
const BOAT = 333;
|
||||
const LEATHER = 334;
|
||||
|
||||
|
||||
const BRICK = 336;
|
||||
const CLAY = 337;
|
||||
const SUGARCANE = 338; const SUGAR_CANE = 338; const SUGAR_CANES = 338;
|
||||
@ -113,7 +113,7 @@ interface ItemIds extends BlockIds{
|
||||
const BOOK = 340;
|
||||
const SLIMEBALL = 341;
|
||||
const MINECART_WITH_CHEST = 342;
|
||||
|
||||
|
||||
const EGG = 344;
|
||||
const COMPASS = 345;
|
||||
const FISHING_ROD = 346;
|
||||
@ -156,7 +156,7 @@ interface ItemIds extends BlockIds{
|
||||
const SPAWN_EGG = 383;
|
||||
const BOTTLE_O_ENCHANTING = 384; const ENCHANTING_BOTTLE = 384;
|
||||
const FIRE_CHARGE = 385;
|
||||
|
||||
|
||||
const EMERALD = 388;
|
||||
const ITEM_FRAME = 389;
|
||||
const FLOWER_POT = 390;
|
||||
@ -168,7 +168,7 @@ interface ItemIds extends BlockIds{
|
||||
const GOLDEN_CARROT = 396;
|
||||
const MOB_HEAD = 397; const SKULL = 397;
|
||||
const CARROT_ON_A_STICK = 398;
|
||||
|
||||
|
||||
const PUMPKIN_PIE = 400;
|
||||
|
||||
const ENCHANTED_BOOK = 403;
|
||||
@ -178,7 +178,7 @@ interface ItemIds extends BlockIds{
|
||||
const NETHER_QUARTZ = 406;
|
||||
const MINECART_WITH_TNT = 407;
|
||||
const MINECART_WITH_HOPPER = 408;
|
||||
|
||||
|
||||
const HOPPER = 410;
|
||||
const RAW_RABBIT = 411;
|
||||
const COOKED_RABBIT = 412;
|
||||
@ -191,18 +191,18 @@ interface ItemIds extends BlockIds{
|
||||
const DIAMOND_HORSE_ARMOR = 419;
|
||||
const LEAD = 420; const LEASH = 420;
|
||||
const NAMETAG = 421;
|
||||
|
||||
|
||||
const RAW_MUTTON = 423;
|
||||
const COOKED_MUTTON = 424;
|
||||
|
||||
|
||||
const SPRUCE_DOOR = 427;
|
||||
const BIRCH_DOOR = 428;
|
||||
const JUNGLE_DOOR = 429;
|
||||
const ACACIA_DOOR = 430;
|
||||
const DARK_OAK_DOOR = 431;
|
||||
|
||||
|
||||
const SPLASH_POTION = 438;
|
||||
|
||||
|
||||
const BEETROOT = 457;
|
||||
const BEETROOT_SEEDS = 458; const BEETROOT_SEED = 458;
|
||||
const BEETROOT_SOUP = 459;
|
||||
|
@ -426,7 +426,7 @@ class Level implements ChunkManager, Metadatable{
|
||||
$this->blockCache = [];
|
||||
$this->temporalPosition = null;
|
||||
}
|
||||
|
||||
|
||||
public function addSound(Sound $sound, array $players = null){
|
||||
$pk = $sound->encode();
|
||||
|
||||
@ -450,7 +450,7 @@ class Level implements ChunkManager, Metadatable{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function addParticle(Particle $particle, array $players = null){
|
||||
$pk = $particle->encode();
|
||||
|
||||
@ -1065,7 +1065,7 @@ class Level implements ChunkManager, Metadatable{
|
||||
$maxX = Math::ceilFloat($bb->maxX);
|
||||
$maxY = Math::ceilFloat($bb->maxY);
|
||||
$maxZ = Math::ceilFloat($bb->maxZ);
|
||||
|
||||
|
||||
$collides = [];
|
||||
|
||||
if($targetFirst){
|
||||
@ -1581,9 +1581,9 @@ class Level implements ChunkManager, Metadatable{
|
||||
|
||||
$this->addParticle(new DestroyBlockParticle($target->add(0.5), $target), $players);
|
||||
}
|
||||
|
||||
|
||||
$target->onBreak($item);
|
||||
|
||||
|
||||
$tile = $this->getTile($target);
|
||||
if($tile !== null){
|
||||
if($tile instanceof InventoryHolder){
|
||||
|
@ -46,7 +46,7 @@ class Chunk extends BaseFullChunk{
|
||||
$this->nbt = new CompoundTag("Level", []);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$this->nbt = $nbt;
|
||||
|
||||
if(isset($this->nbt->Entities) and $this->nbt->Entities instanceof ListTag){
|
||||
@ -313,7 +313,7 @@ class Chunk extends BaseFullChunk{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static function fromFastBinary($data, LevelProvider $provider = null){
|
||||
|
||||
try{
|
||||
@ -351,7 +351,7 @@ class Chunk extends BaseFullChunk{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function toFastBinary(){
|
||||
return
|
||||
Binary::writeInt($this->x) .
|
||||
|
@ -39,7 +39,7 @@ class SpruceTree extends Tree{
|
||||
$this->treeHeight = $random->nextBoundedInt(4) + 6;
|
||||
|
||||
$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));
|
||||
|
||||
@ -54,7 +54,7 @@ class SpruceTree extends Tree{
|
||||
$xOff = abs($xx - $x);
|
||||
for($zz = $z - $radius; $zz <= $z + $radius; ++$zz){
|
||||
$zOff = abs($zz - $z);
|
||||
if($xOff === $radius and $zOff === $radius and $radius > 0){
|
||||
if($xOff === $radius and $zOff === $radius and $radius > 0){
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -62,10 +62,10 @@ class SpruceTree extends Tree{
|
||||
$level->setBlockIdAt($xx, $yyy, $zz, $this->leafBlock);
|
||||
$level->setBlockDataAt($xx, $yyy, $zz, $this->type);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($radius >= $maxR){
|
||||
if($radius >= $maxR){
|
||||
$radius = $minR;
|
||||
$minR = 1;
|
||||
if(++$maxR > $lRadius){
|
||||
|
@ -26,14 +26,14 @@ use pocketmine\math\Vector3;
|
||||
use pocketmine\network\protocol\LevelEventPacket;
|
||||
|
||||
class DestroyBlockParticle extends Particle{
|
||||
|
||||
|
||||
protected $data;
|
||||
|
||||
public function __construct(Vector3 $pos, Block $b){
|
||||
parent::__construct($pos->x, $pos->y, $pos->z);
|
||||
$this->data = $b->getId() + ($b->getDamage() << 12);
|
||||
}
|
||||
|
||||
|
||||
public function encode(){
|
||||
$pk = new LevelEventPacket;
|
||||
$pk->evid = LevelEventPacket::EVENT_PARTICLE_DESTROY;
|
||||
@ -41,7 +41,7 @@ class DestroyBlockParticle extends Particle{
|
||||
$pk->y = $this->y;
|
||||
$pk->z = $this->z;
|
||||
$pk->data = $this->data;
|
||||
|
||||
|
||||
return $pk;
|
||||
}
|
||||
}
|
||||
|
@ -53,11 +53,11 @@ class FloatingTextParticle extends Particle{
|
||||
public function setTitle($title){
|
||||
$this->title = $title;
|
||||
}
|
||||
|
||||
|
||||
public function isInvisible(){
|
||||
return $this->invisible;
|
||||
}
|
||||
|
||||
|
||||
public function setInvisible($value = true){
|
||||
$this->invisible = (bool) $value;
|
||||
}
|
||||
@ -75,7 +75,7 @@ class FloatingTextParticle extends Particle{
|
||||
}
|
||||
|
||||
if(!$this->invisible){
|
||||
|
||||
|
||||
$pk = new AddEntityPacket();
|
||||
$pk->eid = $this->entityId;
|
||||
$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_SHOW_NAMETAG => [Entity::DATA_TYPE_BYTE, 1],
|
||||
Entity::DATA_NO_AI => [Entity::DATA_TYPE_BYTE, 1]
|
||||
];
|
||||
];
|
||||
|
||||
$p[] = $pk;
|
||||
}
|
||||
|
||||
|
||||
return $p;
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ use pocketmine\math\Vector3;
|
||||
use pocketmine\network\protocol\LevelEventPacket;
|
||||
|
||||
class GenericParticle extends Particle{
|
||||
|
||||
|
||||
protected $id;
|
||||
protected $data;
|
||||
|
||||
@ -34,7 +34,7 @@ class GenericParticle extends Particle{
|
||||
$this->id = $id & 0xFFF;
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
|
||||
public function encode(){
|
||||
$pk = new LevelEventPacket;
|
||||
$pk->evid = LevelEventPacket::EVENT_ADD_PARTICLE_MASK | $this->id;
|
||||
@ -42,7 +42,7 @@ class GenericParticle extends Particle{
|
||||
$pk->y = $this->y;
|
||||
$pk->z = $this->z;
|
||||
$pk->data = $this->data;
|
||||
|
||||
|
||||
return $pk;
|
||||
}
|
||||
}
|
||||
|
@ -25,16 +25,16 @@ use pocketmine\math\Vector3;
|
||||
use pocketmine\network\protocol\LevelEventPacket;
|
||||
|
||||
class MobSpawnParticle extends Particle{
|
||||
|
||||
|
||||
protected $width;
|
||||
protected $height;
|
||||
|
||||
|
||||
public function __construct(Vector3 $pos, $width = 0, $height = 0){
|
||||
parent::__construct($pos->x, $pos->y, $pos->z);
|
||||
$this->width = $width;
|
||||
$this->height = $height;
|
||||
}
|
||||
|
||||
|
||||
public function encode(){
|
||||
$pk = new LevelEventPacket;
|
||||
$pk->evid = LevelEventPacket::EVENT_PARTICLE_SPAWN;
|
||||
@ -42,7 +42,7 @@ class MobSpawnParticle extends Particle{
|
||||
$pk->y = $this->y;
|
||||
$pk->z = $this->z;
|
||||
$pk->data = ($this->width & 0xff) + (($this->height & 0xff) << 8);
|
||||
|
||||
|
||||
return $pk;
|
||||
}
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ abstract class Particle extends Vector3{
|
||||
const TYPE_VILLAGER_ANGRY = 30;
|
||||
const TYPE_VILLAGER_HAPPY = 31;
|
||||
const TYPE_ENCHANTMENT_TABLE = 32;
|
||||
|
||||
|
||||
/**
|
||||
* @return DataPacket|DataPacket[]
|
||||
*/
|
||||
|
@ -25,25 +25,25 @@ use pocketmine\math\Vector3;
|
||||
use pocketmine\network\protocol\LevelEventPacket;
|
||||
|
||||
class GenericSound extends Sound{
|
||||
|
||||
|
||||
public function __construct(Vector3 $pos, $id, $pitch = 0){
|
||||
parent::__construct($pos->x, $pos->y, $pos->z);
|
||||
$this->id = (int) $id;
|
||||
$this->pitch = (float) $pitch * 1000;
|
||||
}
|
||||
|
||||
|
||||
protected $pitch = 0;
|
||||
protected $id;
|
||||
|
||||
|
||||
public function getPitch(){
|
||||
return $this->pitch / 1000;
|
||||
}
|
||||
|
||||
|
||||
public function setPitch($pitch){
|
||||
$this->pitch = (float) $pitch * 1000;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function encode(){
|
||||
$pk = new LevelEventPacket;
|
||||
$pk->evid = $this->id;
|
||||
@ -51,7 +51,7 @@ class GenericSound extends Sound{
|
||||
$pk->y = $this->y;
|
||||
$pk->z = $this->z;
|
||||
$pk->data = (int) $this->pitch;
|
||||
|
||||
|
||||
return $pk;
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ use pocketmine\math\Vector3;
|
||||
use pocketmine\network\protocol\DataPacket;
|
||||
|
||||
abstract class Sound extends Vector3{
|
||||
|
||||
|
||||
/**
|
||||
* @return DataPacket|DataPacket[]
|
||||
*/
|
||||
|
@ -108,7 +108,7 @@ class NBT{
|
||||
}
|
||||
|
||||
$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){
|
||||
$item->setNamedTag($tag->tag);
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ use pocketmine\nbt\NBT;
|
||||
#include <rules/NBT.h>
|
||||
|
||||
class StringTag extends NamedTag{
|
||||
|
||||
|
||||
public function getType(){
|
||||
return NBT::TAG_String;
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ namespace pocketmine\network\protocol;
|
||||
|
||||
class FullChunkDataPacket extends DataPacket{
|
||||
const NETWORK_ID = Info::FULL_CHUNK_DATA_PACKET;
|
||||
|
||||
|
||||
const ORDER_COLUMNS = 0;
|
||||
const ORDER_LAYERED = 1;
|
||||
|
||||
@ -41,9 +41,9 @@ class FullChunkDataPacket extends DataPacket{
|
||||
|
||||
public function encode(){
|
||||
$this->reset();
|
||||
$this->putInt($this->chunkX);
|
||||
$this->putInt($this->chunkZ);
|
||||
$this->putByte($this->order);
|
||||
$this->putInt($this->chunkX);
|
||||
$this->putInt($this->chunkZ);
|
||||
$this->putByte($this->order);
|
||||
$this->putInt(strlen($this->data));
|
||||
$this->put($this->data);
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ namespace pocketmine\network\protocol;
|
||||
|
||||
class PlayStatusPacket extends DataPacket{
|
||||
const NETWORK_ID = Info::PLAY_STATUS_PACKET;
|
||||
|
||||
|
||||
const LOGIN_SUCCESS = 0;
|
||||
const LOGIN_FAILED_CLIENT = 1;
|
||||
const LOGIN_FAILED_SERVER = 2;
|
||||
|
@ -29,7 +29,7 @@ class UpdateBlockPacket extends DataPacket{
|
||||
|
||||
const FLAG_NONE = 0b0000;
|
||||
const FLAG_NEIGHBORS = 0b0001;
|
||||
const FLAG_NETWORK = 0b0010;
|
||||
const FLAG_NETWORK = 0b0010;
|
||||
const FLAG_NOGRAPHIC = 0b0100;
|
||||
const FLAG_PRIORITY = 0b1000;
|
||||
|
||||
|
@ -44,7 +44,7 @@ class QueryHandler{
|
||||
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,
|
||||
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
|
||||
packets can conflict with the MCPE ones.
|
||||
*/
|
||||
|
@ -39,7 +39,7 @@ class FlowerPot extends Spawnable{
|
||||
}
|
||||
parent::__construct($chunk, $nbt);
|
||||
}
|
||||
|
||||
|
||||
public function canAddItem(Item $item): bool{
|
||||
if(!$this->isEmpty()){
|
||||
return false;
|
||||
@ -61,11 +61,11 @@ class FlowerPot extends Spawnable{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function getItem(): Item{
|
||||
return Item::get((int) ($this->namedtag["item"] ?? 0), (int) ($this->namedtag["mData"] ?? 0), 1);
|
||||
}
|
||||
|
||||
|
||||
public function setItem(Item $item){
|
||||
$this->namedtag["item"] = $item->getId();
|
||||
$this->namedtag["mData"] = $item->getDamage();
|
||||
@ -76,15 +76,15 @@ class FlowerPot extends Spawnable{
|
||||
$this->level->clearChunkCache($this->chunk->getX(), $this->chunk->getZ());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function removeItem(){
|
||||
$this->setItem(Item::get(Item::AIR));
|
||||
}
|
||||
|
||||
|
||||
public function isEmpty(): bool{
|
||||
return $this->getItem()->getId() === Item::AIR;
|
||||
}
|
||||
|
||||
|
||||
public function getSpawnCompound(): CompoundTag{
|
||||
return new CompoundTag("", [
|
||||
new StringTag("id", Tile::FLOWER_POT),
|
||||
|
@ -33,7 +33,7 @@ class BinaryStream extends \stdClass{
|
||||
|
||||
public $offset;
|
||||
public $buffer;
|
||||
|
||||
|
||||
public function __construct($buffer = "", $offset = 0){
|
||||
$this->buffer = $buffer;
|
||||
$this->offset = $offset;
|
||||
@ -196,19 +196,19 @@ class BinaryStream extends \stdClass{
|
||||
|
||||
public function getSlot(){
|
||||
$id = $this->getSignedShort();
|
||||
|
||||
|
||||
if($id <= 0){
|
||||
return Item::get(0, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
$cnt = $this->getByte();
|
||||
|
||||
|
||||
$data = $this->getShort();
|
||||
|
||||
|
||||
$nbtLen = $this->getLShort();
|
||||
|
||||
|
||||
$nbt = "";
|
||||
|
||||
|
||||
if($nbtLen > 0){
|
||||
$nbt = $this->get($nbtLen);
|
||||
}
|
||||
@ -226,14 +226,14 @@ class BinaryStream extends \stdClass{
|
||||
$this->putShort(0);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$this->putShort($item->getId());
|
||||
$this->putByte($item->getCount());
|
||||
$this->putShort($item->getDamage() === null ? -1 : $item->getDamage());
|
||||
$nbt = $item->getCompoundTag();
|
||||
$this->putLShort(strlen($nbt));
|
||||
$this->put($nbt);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function getString(){
|
||||
|
@ -26,7 +26,7 @@ namespace pocketmine\utils;
|
||||
*/
|
||||
abstract class TextFormat{
|
||||
const ESCAPE = "\xc2\xa7"; //§
|
||||
|
||||
|
||||
const BLACK = TextFormat::ESCAPE . "0";
|
||||
const DARK_BLUE = TextFormat::ESCAPE . "1";
|
||||
const DARK_GREEN = TextFormat::ESCAPE . "2";
|
||||
|
Loading…
x
Reference in New Issue
Block a user