mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-06 20:07:09 +00:00
Replaced array() with []
This commit is contained in:
parent
2f2afe2336
commit
eab86f5f90
@ -30,78 +30,78 @@ abstract class Achievement{
|
||||
/**
|
||||
* @var array[]
|
||||
*/
|
||||
public static $list = array(
|
||||
public static $list = [
|
||||
/*"openInventory" => array(
|
||||
"name" => "Taking Inventory",
|
||||
"requires" => [],
|
||||
),*/
|
||||
"mineWood" => array(
|
||||
"mineWood" => [
|
||||
"name" => "Getting Wood",
|
||||
"requires" => array( //"openInventory",
|
||||
),
|
||||
),
|
||||
"buildWorkBench" => array(
|
||||
"requires" => [ //"openInventory",
|
||||
],
|
||||
],
|
||||
"buildWorkBench" => [
|
||||
"name" => "Benchmarking",
|
||||
"requires" => array(
|
||||
"requires" => [
|
||||
"mineWood",
|
||||
),
|
||||
),
|
||||
"buildPickaxe" => array(
|
||||
],
|
||||
],
|
||||
"buildPickaxe" => [
|
||||
"name" => "Time to Mine!",
|
||||
"requires" => array(
|
||||
"requires" => [
|
||||
"buildWorkBench",
|
||||
),
|
||||
),
|
||||
"buildFurnace" => array(
|
||||
],
|
||||
],
|
||||
"buildFurnace" => [
|
||||
"name" => "Hot Topic",
|
||||
"requires" => array(
|
||||
"requires" => [
|
||||
"buildPickaxe",
|
||||
),
|
||||
),
|
||||
"acquireIron" => array(
|
||||
],
|
||||
],
|
||||
"acquireIron" => [
|
||||
"name" => "Acquire hardware",
|
||||
"requires" => array(
|
||||
"requires" => [
|
||||
"buildFurnace",
|
||||
),
|
||||
),
|
||||
"buildHoe" => array(
|
||||
],
|
||||
],
|
||||
"buildHoe" => [
|
||||
"name" => "Time to Farm!",
|
||||
"requires" => array(
|
||||
"requires" => [
|
||||
"buildWorkBench",
|
||||
),
|
||||
),
|
||||
"makeBread" => array(
|
||||
],
|
||||
],
|
||||
"makeBread" => [
|
||||
"name" => "Bake Bread",
|
||||
"requires" => array(
|
||||
"requires" => [
|
||||
"buildHoe",
|
||||
),
|
||||
),
|
||||
"bakeCake" => array(
|
||||
],
|
||||
],
|
||||
"bakeCake" => [
|
||||
"name" => "The Lie",
|
||||
"requires" => array(
|
||||
"requires" => [
|
||||
"buildHoe",
|
||||
),
|
||||
),
|
||||
"buildBetterPickaxe" => array(
|
||||
],
|
||||
],
|
||||
"buildBetterPickaxe" => [
|
||||
"name" => "Getting an Upgrade",
|
||||
"requires" => array(
|
||||
"requires" => [
|
||||
"buildPickaxe",
|
||||
),
|
||||
),
|
||||
"buildSword" => array(
|
||||
],
|
||||
],
|
||||
"buildSword" => [
|
||||
"name" => "Time to Strike!",
|
||||
"requires" => array(
|
||||
"requires" => [
|
||||
"buildWorkBench",
|
||||
),
|
||||
),
|
||||
"diamonds" => array(
|
||||
],
|
||||
],
|
||||
"diamonds" => [
|
||||
"name" => "DIAMONDS!",
|
||||
"requires" => array(
|
||||
"requires" => [
|
||||
"acquireIron",
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
|
||||
);
|
||||
];
|
||||
|
||||
|
||||
public static function broadcast(Player $player, $achievementId){
|
||||
@ -120,10 +120,10 @@ abstract class Achievement{
|
||||
|
||||
public static function add($achievementId, $achievementName, array $requires = []){
|
||||
if(!isset(Achievement::$list[$achievementId])){
|
||||
Achievement::$list[$achievementId] = array(
|
||||
Achievement::$list[$achievementId] = [
|
||||
"name" => $achievementName,
|
||||
"requires" => $requires,
|
||||
);
|
||||
];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ class CrashDump{
|
||||
}else{
|
||||
$error = (array) error_get_last();
|
||||
$error["trace"] = getTrace(4);
|
||||
$errorConversion = array(
|
||||
$errorConversion = [
|
||||
E_ERROR => "E_ERROR",
|
||||
E_WARNING => "E_WARNING",
|
||||
E_PARSE => "E_PARSE",
|
||||
@ -153,7 +153,7 @@ class CrashDump{
|
||||
E_RECOVERABLE_ERROR => "E_RECOVERABLE_ERROR",
|
||||
E_DEPRECATED => "E_DEPRECATED",
|
||||
E_USER_DEPRECATED => "E_USER_DEPRECATED",
|
||||
);
|
||||
];
|
||||
$error["fullFile"] = $error["file"];
|
||||
$error["file"] = cleanPath($error["file"]);
|
||||
$error["type"] = isset($errorConversion[$error["type"]]) ? $errorConversion[$error["type"]] : $error["type"];
|
||||
|
@ -809,7 +809,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
|
||||
$this->sendMetadata($this);
|
||||
|
||||
$this->setSpawn($pos);
|
||||
$this->tasks[] = $this->server->getScheduler()->scheduleDelayedTask(new CallbackTask(array($this, "checkSleep")), 60);
|
||||
$this->tasks[] = $this->server->getScheduler()->scheduleDelayedTask(new CallbackTask([$this, "checkSleep"]), 60);
|
||||
|
||||
|
||||
return true;
|
||||
@ -1135,7 +1135,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
|
||||
$this->displayName = $this->username;
|
||||
$this->nameTag = $this->username;
|
||||
$this->iusername = strtolower($this->username);
|
||||
$this->loginData = array("clientId" => $packet->clientId, "loginData" => $packet->loginData);
|
||||
$this->loginData = ["clientId" => $packet->clientId, "loginData" => $packet->loginData];
|
||||
|
||||
if(count($this->server->getOnlinePlayers()) > $this->server->getMaxPlayers()){
|
||||
if($this->kick("server full") === true){
|
||||
@ -1297,9 +1297,9 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
|
||||
|
||||
|
||||
$this->orderChunks();
|
||||
$this->tasks[] = $this->server->getScheduler()->scheduleDelayedRepeatingTask(new CallbackTask(array($this, "orderChunks")), 10, 40);
|
||||
$this->tasks[] = $this->server->getScheduler()->scheduleDelayedRepeatingTask(new CallbackTask([$this, "orderChunks"]), 10, 40);
|
||||
$this->sendNextChunk();
|
||||
$this->tasks[] = $this->chunkLoadTask = $this->server->getScheduler()->scheduleRepeatingTask(new CallbackTask(array($this, "sendNextChunk")), 1);
|
||||
$this->tasks[] = $this->chunkLoadTask = $this->server->getScheduler()->scheduleRepeatingTask(new CallbackTask([$this, "sendNextChunk"]), 1);
|
||||
|
||||
break;
|
||||
case ProtocolInfo::ROTATE_HEAD_PACKET:
|
||||
@ -1790,7 +1790,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
|
||||
}
|
||||
switch($packet->event){
|
||||
case 9: //Eating
|
||||
$items = array(
|
||||
$items = [
|
||||
Item::APPLE => 4,
|
||||
Item::MUSHROOM_STEW => 10,
|
||||
Item::BEETROOT_SOUP => 10,
|
||||
@ -1810,7 +1810,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
|
||||
//Item::COOKIE => 2,
|
||||
//Item::COOKED_FISH => 5,
|
||||
//Item::RAW_FISH => 2,
|
||||
);
|
||||
];
|
||||
$slot = $this->inventory->getItemInHand();
|
||||
if($this->getHealth() < 20 and isset($items[$slot->getID()])){
|
||||
$this->server->getPluginManager()->callEvent($ev = new PlayerItemConsumeEvent($this, $slot));
|
||||
@ -2309,17 +2309,17 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
|
||||
$flags |= $this->fireTicks > 0 ? 1 : 0;
|
||||
//$flags |= ($this->crouched === true ? 0b10:0) << 1;
|
||||
$flags |= ($this->inAction === true ? 0b10000:0);
|
||||
$d = array(
|
||||
0 => array("type" => 0, "value" => $flags),
|
||||
1 => array("type" => 1, "value" => $this->airTicks),
|
||||
16 => array("type" => 0, "value" => 0),
|
||||
17 => array("type" => 6, "value" => array(0, 0, 0)),
|
||||
);
|
||||
$d = [
|
||||
0 => ["type" => 0, "value" => $flags],
|
||||
1 => ["type" => 1, "value" => $this->airTicks],
|
||||
16 => ["type" => 0, "value" => 0],
|
||||
17 => ["type" => 6, "value" => [0, 0, 0]],
|
||||
];
|
||||
|
||||
|
||||
if($this->sleeping !== false){
|
||||
$d[16]["value"] = 2;
|
||||
$d[17]["value"] = array($this->sleeping->x, $this->sleeping->y, $this->sleeping->z);
|
||||
$d[17]["value"] = [$this->sleeping->x, $this->sleeping->y, $this->sleeping->z];
|
||||
}
|
||||
|
||||
|
||||
|
@ -148,7 +148,7 @@ namespace pocketmine {
|
||||
ini_set("memory_limit", "256M"); //Default
|
||||
define("pocketmine\\START_TIME", microtime(true));
|
||||
|
||||
$opts = getopt("", array("enable-ansi", "disable-ansi", "data:", "plugins:", "no-wizard", "enable-profiler"));
|
||||
$opts = getopt("", ["enable-ansi", "disable-ansi", "data:", "plugins:", "no-wizard", "enable-profiler"]);
|
||||
|
||||
define("pocketmine\\DATA", isset($opts["data"]) ? realpath($opts["data"]) . DIRECTORY_SEPARATOR : \getcwd() . DIRECTORY_SEPARATOR);
|
||||
define("pocketmine\\PLUGIN_PATH", isset($opts["plugins"]) ? realpath($opts["plugins"]) . DIRECTORY_SEPARATOR : \getcwd() . DIRECTORY_SEPARATOR . "plugins" . DIRECTORY_SEPARATOR);
|
||||
@ -217,7 +217,7 @@ namespace pocketmine {
|
||||
if(error_reporting() === 0){ //@ error-control
|
||||
return false;
|
||||
}
|
||||
$errorConversion = array(
|
||||
$errorConversion = [
|
||||
E_ERROR => "E_ERROR",
|
||||
E_WARNING => "E_WARNING",
|
||||
E_PARSE => "E_PARSE",
|
||||
@ -233,7 +233,7 @@ namespace pocketmine {
|
||||
E_RECOVERABLE_ERROR => "E_RECOVERABLE_ERROR",
|
||||
E_DEPRECATED => "E_DEPRECATED",
|
||||
E_USER_DEPRECATED => "E_USER_DEPRECATED",
|
||||
);
|
||||
];
|
||||
$type = ($errno === E_ERROR or $errno === E_WARNING or $errno === E_USER_ERROR or $errno === E_USER_WARNING) ? LogLevel::ERROR : LogLevel::NOTICE;
|
||||
$errno = isset($errorConversion[$errno]) ? $errorConversion[$errno] : $errno;
|
||||
if(($pos = strpos($errstr, "\n")) !== false){
|
||||
|
@ -626,14 +626,14 @@ class Server{
|
||||
$path = $this->getDataPath() . "players/";
|
||||
if(!file_exists($path . "$name.dat")){
|
||||
$spawn = $this->getDefaultLevel()->getSafeSpawn();
|
||||
$nbt = new Compound(false, array(
|
||||
$nbt = new Compound(false, [
|
||||
new Long("firstPlayed", floor(microtime(true) * 1000)),
|
||||
new Long("lastPlayed", floor(microtime(true) * 1000)),
|
||||
new Enum("Pos", array(
|
||||
new Enum("Pos", [
|
||||
new Double(0, $spawn->x),
|
||||
new Double(1, $spawn->y),
|
||||
new Double(2, $spawn->z)
|
||||
)),
|
||||
]),
|
||||
new String("Level", $this->getDefaultLevel()->getName()),
|
||||
//new String("SpawnLevel", $this->getDefaultLevel()->getName()),
|
||||
//new Int("SpawnX", (int) $spawn->x),
|
||||
@ -643,22 +643,22 @@ class Server{
|
||||
new Enum("Inventory", []),
|
||||
new Compound("Achievements", []),
|
||||
new Int("playerGameType", $this->getGamemode()),
|
||||
new Enum("Motion", array(
|
||||
new Enum("Motion", [
|
||||
new Double(0, 0.0),
|
||||
new Double(1, 0.0),
|
||||
new Double(2, 0.0)
|
||||
)),
|
||||
new Enum("Rotation", array(
|
||||
]),
|
||||
new Enum("Rotation", [
|
||||
new Float(0, 0.0),
|
||||
new Float(1, 0.0)
|
||||
)),
|
||||
]),
|
||||
new Float("FallDistance", 0.0),
|
||||
new Short("Fire", 0),
|
||||
new Short("Air", 0),
|
||||
new Byte("OnGround", 1),
|
||||
new Byte("Invulnerable", 0),
|
||||
new String("NameTag", $name),
|
||||
));
|
||||
]);
|
||||
$nbt->Pos->setTagType(NBT::TAG_Double);
|
||||
$nbt->Inventory->setTagType(NBT::TAG_Compound);
|
||||
$nbt->Motion->setTagType(NBT::TAG_Double);
|
||||
@ -678,35 +678,35 @@ class Server{
|
||||
$this->logger->notice("Old Player data found for \"" . $name . "\", upgrading profile");
|
||||
foreach($data->get("inventory") as $slot => $item){
|
||||
if(count($item) === 3){
|
||||
$nbt->Inventory[$slot + 9] = new Compound(false, array(
|
||||
$nbt->Inventory[$slot + 9] = new Compound(false, [
|
||||
new Short("id", $item[0]),
|
||||
new Short("Damage", $item[1]),
|
||||
new Byte("Count", $item[2]),
|
||||
new Byte("Slot", $slot + 9),
|
||||
new Byte("TrueSlot", $slot + 9)
|
||||
));
|
||||
]);
|
||||
}
|
||||
}
|
||||
foreach($data->get("hotbar") as $slot => $itemSlot){
|
||||
if(isset($nbt->Inventory[$itemSlot + 9])){
|
||||
$item = $nbt->Inventory[$itemSlot + 9];
|
||||
$nbt->Inventory[$slot] = new Compound(false, array(
|
||||
$nbt->Inventory[$slot] = new Compound(false, [
|
||||
new Short("id", $item["id"]),
|
||||
new Short("Damage", $item["Damage"]),
|
||||
new Byte("Count", $item["Count"]),
|
||||
new Byte("Slot", $slot),
|
||||
new Byte("TrueSlot", $item["TrueSlot"])
|
||||
));
|
||||
]);
|
||||
}
|
||||
}
|
||||
foreach($data->get("armor") as $slot => $item){
|
||||
if(count($item) === 2){
|
||||
$nbt->Inventory[$slot + 100] = new Compound(false, array(
|
||||
$nbt->Inventory[$slot + 100] = new Compound(false, [
|
||||
new Short("id", $item[0]),
|
||||
new Short("Damage", $item[1]),
|
||||
new Byte("Count", 1),
|
||||
new Byte("Slot", $slot + 100)
|
||||
));
|
||||
]);
|
||||
}
|
||||
}
|
||||
foreach($data->get("achievements") as $achievement => $status){
|
||||
@ -788,7 +788,7 @@ class Server{
|
||||
$matchedPlayers = [];
|
||||
foreach($this->getOnlinePlayers() as $player){
|
||||
if(strtolower($player->getName()) === $partialName){
|
||||
$matchedPlayers = array($player);
|
||||
$matchedPlayers = [$player];
|
||||
break;
|
||||
}elseif(stripos($player->getName(), $partialName) !== false){
|
||||
$matchedPlayers[] = $player;
|
||||
@ -1142,7 +1142,7 @@ class Server{
|
||||
* @return string
|
||||
*/
|
||||
public function getConfigString($variable, $defaultValue = ""){
|
||||
$v = getopt("", array("$variable::"));
|
||||
$v = getopt("", ["$variable::"]);
|
||||
if(isset($v[$variable])){
|
||||
return (string) $v[$variable];
|
||||
}
|
||||
@ -1192,7 +1192,7 @@ class Server{
|
||||
* @return int
|
||||
*/
|
||||
public function getConfigInt($variable, $defaultValue = 0){
|
||||
$v = getopt("", array("$variable::"));
|
||||
$v = getopt("", ["$variable::"]);
|
||||
if(isset($v[$variable])){
|
||||
return (int) $v[$variable];
|
||||
}
|
||||
@ -1215,7 +1215,7 @@ class Server{
|
||||
* @return boolean
|
||||
*/
|
||||
public function getConfigBoolean($variable, $defaultValue = false){
|
||||
$v = getopt("", array("$variable::"));
|
||||
$v = getopt("", ["$variable::"]);
|
||||
if(isset($v[$variable])){
|
||||
$value = $v[$variable];
|
||||
}else{
|
||||
@ -1427,7 +1427,7 @@ class Server{
|
||||
$this->config = new Config($this->dataPath . "pocketmine.yml", Config::YAML, []);
|
||||
|
||||
$this->logger->info("Loading server properties...");
|
||||
$this->properties = new Config($this->dataPath . "server.properties", Config::PROPERTIES, array(
|
||||
$this->properties = new Config($this->dataPath . "server.properties", Config::PROPERTIES, [
|
||||
"motd" => "Minecraft: PE Server",
|
||||
"server-port" => 19132,
|
||||
"memory-limit" => "256M",
|
||||
@ -1451,7 +1451,7 @@ class Server{
|
||||
"enable-rcon" => false,
|
||||
"rcon.password" => substr(base64_encode(Utils::getRandomBytes(20, false)), 3, 10),
|
||||
"auto-save" => true,
|
||||
));
|
||||
]);
|
||||
|
||||
ServerScheduler::$WORKERS = $this->getProperty("settings.async-workers", ServerScheduler::$WORKERS);
|
||||
|
||||
@ -1464,7 +1464,7 @@ class Server{
|
||||
$this->maxPlayers = $this->getConfigInt("max-players", 20);
|
||||
|
||||
if(($memory = str_replace("B", "", strtoupper($this->getConfigString("memory-limit", "256M")))) !== false){
|
||||
$value = array("M" => 1, "G" => 1024);
|
||||
$value = ["M" => 1, "G" => 1024];
|
||||
$real = ((int) substr($memory, 0, -1)) * $value[substr($memory, -1)];
|
||||
if($real < 128){
|
||||
$this->logger->warning($this->getName() . " may not work right with less than 128MB of RAM", true, true, 0);
|
||||
@ -1582,7 +1582,7 @@ class Server{
|
||||
|
||||
$this->scheduler->scheduleDelayedRepeatingTask(new CallbackTask("pocketmine\\utils\\Cache::cleanup"), $this->getProperty("ticks-per.cache-cleanup", 900), $this->getProperty("ticks-per.cache-cleanup", 900));
|
||||
if($this->getConfigBoolean("auto-save", true) === true and $this->getProperty("ticks-per.autosave", 6000) > 0){
|
||||
$this->scheduler->scheduleDelayedRepeatingTask(new CallbackTask(array($this, "doAutoSave")), $this->getProperty("ticks-per.autosave", 6000), $this->getProperty("ticks-per.autosave", 6000));
|
||||
$this->scheduler->scheduleDelayedRepeatingTask(new CallbackTask([$this, "doAutoSave"]), $this->getProperty("ticks-per.autosave", 6000), $this->getProperty("ticks-per.autosave", 6000));
|
||||
}
|
||||
|
||||
if($this->getProperty("chunk-gc.period-in-ticks", 600) > 0){
|
||||
@ -1725,7 +1725,7 @@ class Server{
|
||||
$this->maxPlayers = $this->getConfigInt("max-players", 20);
|
||||
|
||||
if(($memory = str_replace("B", "", strtoupper($this->getConfigString("memory-limit", "256M")))) !== false){
|
||||
$value = array("M" => 1, "G" => 1024);
|
||||
$value = ["M" => 1, "G" => 1024];
|
||||
$real = ((int) substr($memory, 0, -1)) * $value[substr($memory, -1)];
|
||||
if($real < 256){
|
||||
$this->logger->warning($this->getName() . " may not work right with less than 256MB of RAM", true, true, 0);
|
||||
@ -1809,7 +1809,7 @@ class Server{
|
||||
|
||||
|
||||
if($this->getProperty("settings.send-usage", true) !== false){
|
||||
$this->scheduler->scheduleDelayedRepeatingTask(new CallbackTask(array($this, "sendUsage")), 6000, 6000);
|
||||
$this->scheduler->scheduleDelayedRepeatingTask(new CallbackTask([$this, "sendUsage"]), 6000, 6000);
|
||||
$this->sendUsage();
|
||||
}
|
||||
|
||||
@ -2014,11 +2014,11 @@ class Server{
|
||||
$plist = "";
|
||||
foreach($this->getPluginManager()->getPlugins() as $p){
|
||||
$d = $p->getDescription();
|
||||
$plist .= str_replace(array(";", ":"), "", $d->getName()) . ":" . str_replace(array(";", ":"), "", $d->getVersion()) . ";";
|
||||
$plist .= str_replace([";", ":"], "", $d->getName()) . ":" . str_replace([";", ":"], "", $d->getVersion()) . ";";
|
||||
}
|
||||
|
||||
$version = new VersionString();
|
||||
$this->lastSendUsage = new SendUsageTask("http://stats.pocketmine.net/usage.php", array(
|
||||
$this->lastSendUsage = new SendUsageTask("http://stats.pocketmine.net/usage.php", [
|
||||
"serverid" => Binary::readLong(substr(Utils::getUniqueID(true, $this->getIp() . ":" . $this->getPort()), 0, 8)),
|
||||
"port" => $this->getPort(),
|
||||
"os" => Utils::getOS(),
|
||||
@ -2032,7 +2032,7 @@ class Server{
|
||||
"online" => count($this->players),
|
||||
"max" => $this->getMaxPlayers(),
|
||||
"plugins" => $plist,
|
||||
));
|
||||
]);
|
||||
|
||||
$this->scheduler->scheduleAsyncTask($this->lastSendUsage);
|
||||
}
|
||||
|
@ -29,8 +29,8 @@ class AcaciaWoodStairs extends Stair{
|
||||
}
|
||||
|
||||
public function getDrops(Item $item){
|
||||
return array(
|
||||
array($this->id, 0, 1),
|
||||
);
|
||||
return [
|
||||
[$this->id, 0, 1],
|
||||
];
|
||||
}
|
||||
}
|
@ -86,12 +86,12 @@ class Bed extends Transparent{
|
||||
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
||||
$down = $this->getSide(0);
|
||||
if($down->isTransparent === false){
|
||||
$faces = array(
|
||||
$faces = [
|
||||
0 => 3,
|
||||
1 => 4,
|
||||
2 => 2,
|
||||
3 => 5,
|
||||
);
|
||||
];
|
||||
$d = $player instanceof Player ? $player->getDirection() : 0;
|
||||
$next = $this->getSide($faces[(($d + 3) % 4)]);
|
||||
$downNext = $this->getSide(0);
|
||||
@ -140,9 +140,9 @@ class Bed extends Transparent{
|
||||
}
|
||||
|
||||
public function getDrops(Item $item){
|
||||
return array(
|
||||
array(Item::BED, 0, 1),
|
||||
);
|
||||
return [
|
||||
[Item::BED, 0, 1],
|
||||
];
|
||||
}
|
||||
|
||||
}
|
@ -86,10 +86,10 @@ class Beetroot extends Flowable{
|
||||
public function getDrops(Item $item){
|
||||
$drops = [];
|
||||
if($this->meta >= 0x07){
|
||||
$drops[] = array(Item::BEETROOT, 0, 1);
|
||||
$drops[] = array(Item::BEETROOT_SEEDS, 0, mt_rand(0, 3));
|
||||
$drops[] = [Item::BEETROOT, 0, 1];
|
||||
$drops[] = [Item::BEETROOT_SEEDS, 0, mt_rand(0, 3)];
|
||||
}else{
|
||||
$drops[] = array(Item::BEETROOT_SEEDS, 0, 1);
|
||||
$drops[] = [Item::BEETROOT_SEEDS, 0, 1];
|
||||
}
|
||||
|
||||
return $drops;
|
||||
|
@ -29,8 +29,8 @@ class BirchWoodStairs extends Stair{
|
||||
}
|
||||
|
||||
public function getDrops(Item $item){
|
||||
return array(
|
||||
array($this->id, 0, 1),
|
||||
);
|
||||
return [
|
||||
[$this->id, 0, 1],
|
||||
];
|
||||
}
|
||||
}
|
@ -230,7 +230,7 @@ abstract class Block extends Position implements Metadatable{
|
||||
const GLOWING_OBSIDIAN = 246;
|
||||
const NETHER_REACTOR = 247;
|
||||
|
||||
public static $creative = array(
|
||||
public static $creative = [
|
||||
//Building
|
||||
[Item::COBBLESTONE, 0],
|
||||
[Item::STONE_BRICKS, 0],
|
||||
@ -500,7 +500,7 @@ abstract class Block extends Position implements Metadatable{
|
||||
[Item::DYE, 9],
|
||||
[Item::DYE, 8],
|
||||
|
||||
);
|
||||
];
|
||||
|
||||
/** @var Block[] */
|
||||
public static $list = [];
|
||||
@ -526,7 +526,7 @@ abstract class Block extends Position implements Metadatable{
|
||||
|
||||
public static function init(){
|
||||
if(count(self::$list) === 0){
|
||||
self::$list = array(
|
||||
self::$list = [
|
||||
self::AIR => Air::class,
|
||||
self::STONE => Stone::class,
|
||||
self::GRASS => Grass::class,
|
||||
@ -663,7 +663,7 @@ abstract class Block extends Position implements Metadatable{
|
||||
self::STONECUTTER => Stonecutter::class,
|
||||
self::GLOWING_OBSIDIAN => GlowingObsidian::class,
|
||||
self::NETHER_REACTOR => NetherReactor::class,
|
||||
);
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@ -759,7 +759,7 @@ abstract class Block extends Position implements Metadatable{
|
||||
return [];
|
||||
}else{
|
||||
return [
|
||||
array($this->id, $this->meta, 1),
|
||||
[$this->id, $this->meta, 1],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -48,9 +48,9 @@ class Bricks extends Solid{
|
||||
|
||||
public function getDrops(Item $item){
|
||||
if($item->isPickaxe() >= 1){
|
||||
return array(
|
||||
array(Item::BRICKS_BLOCK, 0, 1),
|
||||
);
|
||||
return [
|
||||
[Item::BRICKS_BLOCK, 0, 1],
|
||||
];
|
||||
}else{
|
||||
return [];
|
||||
}
|
||||
|
@ -39,21 +39,21 @@ class BurningFurnace extends Solid{
|
||||
}
|
||||
|
||||
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
||||
$faces = array(
|
||||
$faces = [
|
||||
0 => 4,
|
||||
1 => 2,
|
||||
2 => 5,
|
||||
3 => 3,
|
||||
);
|
||||
];
|
||||
$this->meta = $faces[$player instanceof Player ? $player->getDirection() : 0];
|
||||
$this->getLevel()->setBlock($block, $this, true, false, true);
|
||||
$nbt = new Compound(false, array(
|
||||
$nbt = new Compound(false, [
|
||||
new Enum("Items", []),
|
||||
new String("id", Tile::FURNACE),
|
||||
new Int("x", $this->x),
|
||||
new Int("y", $this->y),
|
||||
new Int("z", $this->z)
|
||||
));
|
||||
]);
|
||||
$nbt->Items->setTagType(NBT::TAG_Compound);
|
||||
new Furnace($this->getLevel()->getChunkAt($this->x >> 4, $this->z >> 4), $nbt);
|
||||
|
||||
@ -73,13 +73,13 @@ class BurningFurnace extends Solid{
|
||||
if($t instanceof Furnace){
|
||||
$furnace = $t;
|
||||
}else{
|
||||
$nbt = new Compound(false, array(
|
||||
$nbt = new Compound(false, [
|
||||
new Enum("Items", []),
|
||||
new String("id", Tile::FURNACE),
|
||||
new Int("x", $this->x),
|
||||
new Int("y", $this->y),
|
||||
new Int("z", $this->z)
|
||||
));
|
||||
]);
|
||||
$nbt->Items->setTagType(NBT::TAG_Compound);
|
||||
$furnace = new Furnace($this->getLevel()->getChunkAt($this->x >> 4, $this->z >> 4), $nbt);
|
||||
}
|
||||
@ -114,14 +114,14 @@ class BurningFurnace extends Solid{
|
||||
public function getDrops(Item $item){
|
||||
$drops = [];
|
||||
if($item->isPickaxe() >= 1){
|
||||
$drops[] = array(Item::FURNACE, 0, 1);
|
||||
$drops[] = [Item::FURNACE, 0, 1];
|
||||
}
|
||||
$t = $this->getLevel()->getTile($this);
|
||||
if($t instanceof Furnace){
|
||||
for($s = 0; $s < $t->getInventory()->getSize(); ++$s){
|
||||
$slot = $t->getInventory()->getItem($s);
|
||||
if($slot->getID() > Item::AIR and $slot->getCount() > 0){
|
||||
$drops[] = array($slot->getID(), $slot->getDamage(), $slot->getCount());
|
||||
$drops[] = [$slot->getID(), $slot->getDamage(), $slot->getCount()];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -84,8 +84,8 @@ class Cactus extends Transparent{
|
||||
}
|
||||
|
||||
public function getDrops(Item $item){
|
||||
return array(
|
||||
array($this->id, 0, 1),
|
||||
);
|
||||
return [
|
||||
[$this->id, 0, 1],
|
||||
];
|
||||
}
|
||||
}
|
@ -28,7 +28,7 @@ use pocketmine\Player;
|
||||
class Carpet extends Flowable{
|
||||
public function __construct($meta = 0){
|
||||
parent::__construct(self::CARPET, $meta, "Carpet");
|
||||
$names = array(
|
||||
$names = [
|
||||
0 => "White Carpet",
|
||||
1 => "Orange Carpet",
|
||||
2 => "Magenta Carpet",
|
||||
@ -45,7 +45,7 @@ class Carpet extends Flowable{
|
||||
13 => "Green Carpet",
|
||||
14 => "Red Carpet",
|
||||
15 => "Black Carpet",
|
||||
);
|
||||
];
|
||||
$this->name = $names[$this->meta];
|
||||
$this->hardness = 0;
|
||||
$this->isFullBlock = false;
|
||||
|
@ -88,9 +88,9 @@ class Carrot extends Flowable{
|
||||
public function getDrops(Item $item){
|
||||
$drops = [];
|
||||
if($this->meta >= 0x07){
|
||||
$drops[] = array(Item::CARROT, 0, mt_rand(1, 4));
|
||||
$drops[] = [Item::CARROT, 0, mt_rand(1, 4)];
|
||||
}else{
|
||||
$drops[] = array(Item::CARROT, 0, 1);
|
||||
$drops[] = [Item::CARROT, 0, 1];
|
||||
}
|
||||
|
||||
return $drops;
|
||||
|
@ -42,12 +42,12 @@ class Chest extends Transparent{
|
||||
}
|
||||
|
||||
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
||||
$faces = array(
|
||||
$faces = [
|
||||
0 => 4,
|
||||
1 => 2,
|
||||
2 => 5,
|
||||
3 => 3,
|
||||
);
|
||||
];
|
||||
|
||||
$chest = false;
|
||||
$this->meta = $faces[$player instanceof Player ? $player->getDirection() : 0];
|
||||
@ -69,13 +69,13 @@ class Chest extends Transparent{
|
||||
}
|
||||
|
||||
$this->getLevel()->setBlock($block, $this, true, false, true);
|
||||
$nbt = new Compound(false, array(
|
||||
$nbt = new Compound(false, [
|
||||
new Enum("Items", []),
|
||||
new String("id", Tile::CHEST),
|
||||
new Int("x", $this->x),
|
||||
new Int("y", $this->y),
|
||||
new Int("z", $this->z)
|
||||
));
|
||||
]);
|
||||
$nbt->Items->setTagType(NBT::TAG_Compound);
|
||||
$tile = new TileChest($this->getLevel()->getChunkAt($this->x >> 4, $this->z >> 4), $nbt);
|
||||
|
||||
@ -109,13 +109,13 @@ class Chest extends Transparent{
|
||||
if($t instanceof TileChest){
|
||||
$chest = $t;
|
||||
}else{
|
||||
$nbt = new Compound(false, array(
|
||||
$nbt = new Compound(false, [
|
||||
new Enum("Items", []),
|
||||
new String("id", Tile::CHEST),
|
||||
new Int("x", $this->x),
|
||||
new Int("y", $this->y),
|
||||
new Int("z", $this->z)
|
||||
));
|
||||
]);
|
||||
$nbt->Items->setTagType(NBT::TAG_Compound);
|
||||
$chest = new TileChest($this->getLevel()->getChunkAt($this->x >> 4, $this->z >> 4), $nbt);
|
||||
}
|
||||
@ -131,15 +131,15 @@ class Chest extends Transparent{
|
||||
}
|
||||
|
||||
public function getDrops(Item $item){
|
||||
$drops = array(
|
||||
array($this->id, 0, 1),
|
||||
);
|
||||
$drops = [
|
||||
[$this->id, 0, 1],
|
||||
];
|
||||
$t = $this->getLevel()->getTile($this);
|
||||
if($t instanceof TileChest){
|
||||
for($s = 0; $s < $t->getRealInventory()->getSize(); ++$s){
|
||||
$slot = $t->getRealInventory()->getItem($s);
|
||||
if($slot->getID() > Item::AIR and $slot->getCount() > 0){
|
||||
$drops[] = array($slot->getID(), $slot->getDamage(), $slot->getCount());
|
||||
$drops[] = [$slot->getID(), $slot->getDamage(), $slot->getCount()];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,8 +30,8 @@ class Clay extends Solid{
|
||||
}
|
||||
|
||||
public function getDrops(Item $item){
|
||||
return array(
|
||||
array(Item::CLAY, 0, 4),
|
||||
);
|
||||
return [
|
||||
[Item::CLAY, 0, 4],
|
||||
];
|
||||
}
|
||||
}
|
@ -48,9 +48,9 @@ class Coal extends Solid{
|
||||
|
||||
public function getDrops(Item $item){
|
||||
if($item->isPickaxe() >= 1){
|
||||
return array(
|
||||
array(Item::COAL_BLOCK, 0, 1),
|
||||
);
|
||||
return [
|
||||
[Item::COAL_BLOCK, 0, 1],
|
||||
];
|
||||
}else{
|
||||
return [];
|
||||
}
|
||||
|
@ -48,9 +48,9 @@ class CoalOre extends Solid{
|
||||
|
||||
public function getDrops(Item $item){
|
||||
if($item->isPickaxe() >= 1){
|
||||
return array(
|
||||
array(Item::COAL, 0, 1),
|
||||
);
|
||||
return [
|
||||
[Item::COAL, 0, 1],
|
||||
];
|
||||
}else{
|
||||
return [];
|
||||
}
|
||||
|
@ -48,9 +48,9 @@ class Cobblestone extends Solid{
|
||||
|
||||
public function getDrops(Item $item){
|
||||
if($item->isPickaxe() >= 1){
|
||||
return array(
|
||||
array(Item::COBBLESTONE, 0, 1),
|
||||
);
|
||||
return [
|
||||
[Item::COBBLESTONE, 0, 1],
|
||||
];
|
||||
}else{
|
||||
return [];
|
||||
}
|
||||
|
@ -29,8 +29,8 @@ class DarkOakWoodStairs extends Stair{
|
||||
}
|
||||
|
||||
public function getDrops(Item $item){
|
||||
return array(
|
||||
array($this->id, 0, 1),
|
||||
);
|
||||
return [
|
||||
[$this->id, 0, 1],
|
||||
];
|
||||
}
|
||||
}
|
@ -42,9 +42,9 @@ class Diamond extends Solid{
|
||||
|
||||
public function getDrops(Item $item){
|
||||
if($item->isPickaxe() >= 4){
|
||||
return array(
|
||||
array(Item::DIAMOND_BLOCK, 0, 1),
|
||||
);
|
||||
return [
|
||||
[Item::DIAMOND_BLOCK, 0, 1],
|
||||
];
|
||||
}else{
|
||||
return [];
|
||||
}
|
||||
|
@ -42,9 +42,9 @@ class DiamondOre extends Solid{
|
||||
|
||||
public function getDrops(Item $item){
|
||||
if($item->isPickaxe() >= 4){
|
||||
return array(
|
||||
array(Item::DIAMOND, 0, 1),
|
||||
);
|
||||
return [
|
||||
[Item::DIAMOND, 0, 1],
|
||||
];
|
||||
}else{
|
||||
return [];
|
||||
}
|
||||
|
@ -57,12 +57,12 @@ abstract class Door extends Transparent{
|
||||
return false;
|
||||
}
|
||||
$direction = $player instanceof Player ? $player->getDirection() : 0;
|
||||
$face = array(
|
||||
$face = [
|
||||
0 => 3,
|
||||
1 => 4,
|
||||
2 => 2,
|
||||
3 => 5,
|
||||
);
|
||||
];
|
||||
$next = $this->getSide($face[(($direction + 2) % 4)]);
|
||||
$next2 = $this->getSide($face[$direction]);
|
||||
$metaUp = 0x08;
|
||||
|
@ -26,7 +26,7 @@ use pocketmine\item\Item;
|
||||
class DoubleSlab extends Solid{
|
||||
public function __construct($meta = 0){
|
||||
parent::__construct(self::DOUBLE_SLAB, $meta, "Double Slab");
|
||||
$names = array(
|
||||
$names = [
|
||||
0 => "Stone",
|
||||
1 => "Sandstone",
|
||||
2 => "Wooden",
|
||||
@ -34,7 +34,7 @@ class DoubleSlab extends Solid{
|
||||
4 => "Brick",
|
||||
5 => "Stone Brick",
|
||||
6 => "Quartz",
|
||||
);
|
||||
];
|
||||
$this->name = "Double " . $names[$this->meta & 0x07] . " Slab";
|
||||
$this->hardness = 30;
|
||||
}
|
||||
@ -58,9 +58,9 @@ class DoubleSlab extends Solid{
|
||||
|
||||
public function getDrops(Item $item){
|
||||
if($item->isPickaxe() >= 1){
|
||||
return array(
|
||||
array(Item::SLAB, $this->meta & 0x07, 2),
|
||||
);
|
||||
return [
|
||||
[Item::SLAB, $this->meta & 0x07, 2],
|
||||
];
|
||||
}else{
|
||||
return [];
|
||||
}
|
||||
|
@ -26,14 +26,14 @@ use pocketmine\item\Item;
|
||||
class DoubleWoodSlab extends Solid{
|
||||
public function __construct($meta = 0){
|
||||
parent::__construct(self::DOUBLE_WOOD_SLAB, $meta, "Double Wooden Slab");
|
||||
$names = array(
|
||||
$names = [
|
||||
0 => "Oak",
|
||||
1 => "Spruce",
|
||||
2 => "Birch",
|
||||
3 => "Jungle",
|
||||
4 => "Acacia",
|
||||
5 => "Dark Oak",
|
||||
);
|
||||
];
|
||||
$this->name = "Double " . $names[$this->meta & 0x07] . " Wooden Slab";
|
||||
$this->hardness = 15;
|
||||
}
|
||||
@ -56,9 +56,9 @@ class DoubleWoodSlab extends Solid{
|
||||
}
|
||||
|
||||
public function getDrops(Item $item){
|
||||
return array(
|
||||
array(Item::WOOD_SLAB, $this->meta & 0x07, 2),
|
||||
);
|
||||
return [
|
||||
[Item::WOOD_SLAB, $this->meta & 0x07, 2],
|
||||
];
|
||||
}
|
||||
|
||||
}
|
@ -42,9 +42,9 @@ class Emerald extends Solid{
|
||||
|
||||
public function getDrops(Item $item){
|
||||
if($item->isPickaxe() >= 4){
|
||||
return array(
|
||||
array(Item::EMERALD_BLOCK, 0, 1),
|
||||
);
|
||||
return [
|
||||
[Item::EMERALD_BLOCK, 0, 1],
|
||||
];
|
||||
}else{
|
||||
return [];
|
||||
}
|
||||
|
@ -42,9 +42,9 @@ class EmeraldOre extends Solid{
|
||||
|
||||
public function getDrops(Item $item){
|
||||
if($item->isPickaxe() >= 4){
|
||||
return array(
|
||||
array(Item::EMERALD, 0, 1),
|
||||
);
|
||||
return [
|
||||
[Item::EMERALD, 0, 1],
|
||||
];
|
||||
}else{
|
||||
return [];
|
||||
}
|
||||
|
@ -30,8 +30,8 @@ class Farmland extends Solid{
|
||||
}
|
||||
|
||||
public function getDrops(Item $item){
|
||||
return array(
|
||||
array(Item::DIRT, 0, 1),
|
||||
);
|
||||
return [
|
||||
[Item::DIRT, 0, 1],
|
||||
];
|
||||
}
|
||||
}
|
@ -37,12 +37,12 @@ class FenceGate extends Transparent{
|
||||
}
|
||||
|
||||
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
||||
$faces = array(
|
||||
$faces = [
|
||||
0 => 3,
|
||||
1 => 0,
|
||||
2 => 1,
|
||||
3 => 2,
|
||||
);
|
||||
];
|
||||
$this->meta = $faces[$player instanceof Player ? $player->getDirection() : 0] & 0x03;
|
||||
$this->getLevel()->setBlock($block, $this, true, false, true);
|
||||
|
||||
@ -50,18 +50,18 @@ class FenceGate extends Transparent{
|
||||
}
|
||||
|
||||
public function getDrops(Item $item){
|
||||
return array(
|
||||
array($this->id, 0, 1),
|
||||
);
|
||||
return [
|
||||
[$this->id, 0, 1],
|
||||
];
|
||||
}
|
||||
|
||||
public function onActivate(Item $item, Player $player = null){
|
||||
$faces = array(
|
||||
$faces = [
|
||||
0 => 3,
|
||||
1 => 0,
|
||||
2 => 1,
|
||||
3 => 2,
|
||||
);
|
||||
];
|
||||
$this->meta = ($faces[$player instanceof Player ? $player->getDirection() : 0] & 0x03) | ((~$this->meta) & 0x04);
|
||||
if(($this->meta & 0x04) === 0x04){
|
||||
$this->isFullBlock = true;
|
||||
|
@ -43,12 +43,12 @@ class Generic extends Block{
|
||||
if($this->hasPhysics === true and $type === Level::BLOCK_UPDATE_NORMAL){
|
||||
$down = $this->getSide(0);
|
||||
if($down->getID() === self::AIR or ($down instanceof Liquid)){
|
||||
$data = array(
|
||||
$data = [
|
||||
"x" => $this->x + 0.5,
|
||||
"y" => $this->y + 0.5,
|
||||
"z" => $this->z + 0.5,
|
||||
"Tile" => $this->id,
|
||||
);
|
||||
];
|
||||
/*$this->getLevel()->setBlock($this, new Air(), false, false, true);
|
||||
//TODO
|
||||
//$e = $server->api->entity->add($this->getLevel(), ENTITY_FALLING, FALLING_SAND, $data);
|
||||
|
@ -54,9 +54,9 @@ class GlowingRedstoneOre extends Solid{
|
||||
|
||||
public function getDrops(Item $item){
|
||||
if($item->isPickaxe() >= 4){
|
||||
return array(
|
||||
array(Item::REDSTONE_DUST, 0, mt_rand(4, 5)),
|
||||
);
|
||||
return [
|
||||
[Item::REDSTONE_DUST, 0, mt_rand(4, 5)],
|
||||
];
|
||||
}else{
|
||||
return [];
|
||||
}
|
||||
|
@ -30,8 +30,8 @@ class Glowstone extends Transparent{
|
||||
}
|
||||
|
||||
public function getDrops(Item $item){
|
||||
return array(
|
||||
array(Item::GLOWSTONE_DUST, 0, mt_rand(2, 4)),
|
||||
);
|
||||
return [
|
||||
[Item::GLOWSTONE_DUST, 0, mt_rand(2, 4)],
|
||||
];
|
||||
}
|
||||
}
|
@ -42,9 +42,9 @@ class Gold extends Solid{
|
||||
|
||||
public function getDrops(Item $item){
|
||||
if($item->isPickaxe() >= 4){
|
||||
return array(
|
||||
array(Item::GOLD_BLOCK, 0, 1),
|
||||
);
|
||||
return [
|
||||
[Item::GOLD_BLOCK, 0, 1],
|
||||
];
|
||||
}else{
|
||||
return [];
|
||||
}
|
||||
|
@ -42,9 +42,9 @@ class GoldOre extends Solid{
|
||||
|
||||
public function getDrops(Item $item){
|
||||
if($item->isPickaxe() >= 4){
|
||||
return array(
|
||||
array(Item::GOLD_ORE, 0, 1),
|
||||
);
|
||||
return [
|
||||
[Item::GOLD_ORE, 0, 1],
|
||||
];
|
||||
}else{
|
||||
return [];
|
||||
}
|
||||
|
@ -31,14 +31,14 @@ class Gravel extends Fallable{
|
||||
|
||||
public function getDrops(Item $item){
|
||||
if(mt_rand(1, 10) === 1){
|
||||
return array(
|
||||
array(Item::FLINT, 0, 1),
|
||||
);
|
||||
return [
|
||||
[Item::FLINT, 0, 1],
|
||||
];
|
||||
}
|
||||
|
||||
return array(
|
||||
array(Item::GRAVEL, 0, 1),
|
||||
);
|
||||
return [
|
||||
[Item::GRAVEL, 0, 1],
|
||||
];
|
||||
}
|
||||
|
||||
}
|
@ -31,14 +31,14 @@ class HayBale extends Solid{
|
||||
}
|
||||
|
||||
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
||||
$faces = array(
|
||||
$faces = [
|
||||
0 => 0,
|
||||
1 => 0,
|
||||
2 => 0b1000,
|
||||
3 => 0b1000,
|
||||
4 => 0b0100,
|
||||
5 => 0b0100,
|
||||
);
|
||||
];
|
||||
|
||||
$this->meta = ($this->meta & 0x03) | $faces[$face];
|
||||
$this->getLevel()->setBlock($block, $this, true, false, true);
|
||||
@ -47,9 +47,9 @@ class HayBale extends Solid{
|
||||
}
|
||||
|
||||
public function getDrops(Item $item){
|
||||
return array(
|
||||
array($this->id, 0, 1),
|
||||
);
|
||||
return [
|
||||
[$this->id, 0, 1],
|
||||
];
|
||||
}
|
||||
|
||||
}
|
@ -44,9 +44,9 @@ class Iron extends Solid{
|
||||
|
||||
public function getDrops(Item $item){
|
||||
if($item->isPickaxe() >= 3){
|
||||
return array(
|
||||
array(Item::IRON_BLOCK, 0, 1),
|
||||
);
|
||||
return [
|
||||
[Item::IRON_BLOCK, 0, 1],
|
||||
];
|
||||
}else{
|
||||
return [];
|
||||
}
|
||||
|
@ -49,9 +49,9 @@ class IronDoor extends Door{
|
||||
|
||||
public function getDrops(Item $item){
|
||||
if($item->isPickaxe() >= 1){
|
||||
return array(
|
||||
array(Item::IRON_DOOR, 0, 1),
|
||||
);
|
||||
return [
|
||||
[Item::IRON_DOOR, 0, 1],
|
||||
];
|
||||
}else{
|
||||
return [];
|
||||
}
|
||||
|
@ -44,9 +44,9 @@ class IronOre extends Solid{
|
||||
|
||||
public function getDrops(Item $item){
|
||||
if($item->isPickaxe() >= 3){
|
||||
return array(
|
||||
array(Item::IRON_ORE, 0, 1),
|
||||
);
|
||||
return [
|
||||
[Item::IRON_ORE, 0, 1],
|
||||
];
|
||||
}else{
|
||||
return [];
|
||||
}
|
||||
|
@ -29,8 +29,8 @@ class JungleWoodStairs extends Stair{
|
||||
}
|
||||
|
||||
public function getDrops(Item $item){
|
||||
return array(
|
||||
array($this->id, 0, 1),
|
||||
);
|
||||
return [
|
||||
[$this->id, 0, 1],
|
||||
];
|
||||
}
|
||||
}
|
@ -40,12 +40,12 @@ class Ladder extends Transparent{
|
||||
|
||||
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
||||
if($target->isTransparent === false){
|
||||
$faces = array(
|
||||
$faces = [
|
||||
2 => 2,
|
||||
3 => 3,
|
||||
4 => 4,
|
||||
5 => 5,
|
||||
);
|
||||
];
|
||||
if(isset($faces[$face])){
|
||||
$this->meta = $faces[$face];
|
||||
$this->getLevel()->setBlock($block, $this, true, false, true);
|
||||
@ -70,8 +70,8 @@ class Ladder extends Transparent{
|
||||
}
|
||||
|
||||
public function getDrops(Item $item){
|
||||
return array(
|
||||
array($this->id, 0, 1),
|
||||
);
|
||||
return [
|
||||
[$this->id, 0, 1],
|
||||
];
|
||||
}
|
||||
}
|
@ -44,9 +44,9 @@ class Lapis extends Solid{
|
||||
|
||||
public function getDrops(Item $item){
|
||||
if($item->isPickaxe() >= 3){
|
||||
return array(
|
||||
array(Item::LAPIS_BLOCK, 0, 1),
|
||||
);
|
||||
return [
|
||||
[Item::LAPIS_BLOCK, 0, 1],
|
||||
];
|
||||
}else{
|
||||
return [];
|
||||
}
|
||||
|
@ -45,9 +45,9 @@ class LapisOre extends Solid{
|
||||
|
||||
public function getDrops(Item $item){
|
||||
if($item->isPickaxe() >= 3){
|
||||
return array(
|
||||
array(Item::DYE, 4, mt_rand(4, 8)),
|
||||
);
|
||||
return [
|
||||
[Item::DYE, 4, mt_rand(4, 8)],
|
||||
];
|
||||
}else{
|
||||
return [];
|
||||
}
|
||||
|
@ -35,12 +35,12 @@ class Leaves extends Transparent{
|
||||
|
||||
public function __construct($meta = 0){
|
||||
parent::__construct(self::LEAVES, $meta, "Leaves");
|
||||
$names = array(
|
||||
$names = [
|
||||
self::OAK => "Oak Leaves",
|
||||
self::SPRUCE => "Spruce Leaves",
|
||||
self::BIRCH => "Birch Leaves",
|
||||
self::JUNGLE => "Jungle Leaves",
|
||||
);
|
||||
];
|
||||
$this->name = $names[$this->meta & 0x03];
|
||||
$this->hardness = 1;
|
||||
}
|
||||
@ -148,13 +148,13 @@ class Leaves extends Transparent{
|
||||
public function getDrops(Item $item){
|
||||
$drops = [];
|
||||
if($item->isShears()){
|
||||
$drops[] = array(Item::LEAVES, $this->meta & 0x03, 1);
|
||||
$drops[] = [Item::LEAVES, $this->meta & 0x03, 1];
|
||||
}else{
|
||||
if(mt_rand(1, 20) === 1){ //Saplings
|
||||
$drops[] = array(Item::SAPLING, $this->meta & 0x03, 1);
|
||||
$drops[] = [Item::SAPLING, $this->meta & 0x03, 1];
|
||||
}
|
||||
if(($this->meta & 0x03) === self::OAK and mt_rand(1, 200) === 1){ //Apples
|
||||
$drops[] = array(Item::APPLE, 0, 1);
|
||||
$drops[] = [Item::APPLE, 0, 1];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,10 +29,10 @@ class Leaves2 extends Leaves{
|
||||
|
||||
public function __construct($meta = 0){
|
||||
Transparent::__construct(self::LEAVES, $meta, "Leaves");
|
||||
$names = array(
|
||||
$names = [
|
||||
self::ACACIA => "Acacia Leaves",
|
||||
self::DARK_OAK => "Dark Oak Leaves",
|
||||
);
|
||||
];
|
||||
$this->name = $names[$this->meta & 0x03];
|
||||
$this->hardness = 1;
|
||||
}
|
||||
@ -137,10 +137,10 @@ class Leaves2 extends Leaves{
|
||||
public function getDrops(Item $item){
|
||||
$drops = [];
|
||||
if($item->isShears()){
|
||||
$drops[] = array(Item::LEAVES2, $this->meta & 0x03, 1);
|
||||
$drops[] = [Item::LEAVES2, $this->meta & 0x03, 1];
|
||||
}else{
|
||||
if(mt_rand(1, 20) === 1){ //Saplings
|
||||
$drops[] = array(Item::SAPLING, $this->meta & 0x03, 1);
|
||||
$drops[] = [Item::SAPLING, $this->meta & 0x03, 1];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,8 +30,8 @@ class Melon extends Transparent{
|
||||
}
|
||||
|
||||
public function getDrops(Item $item){
|
||||
return array(
|
||||
array(Item::MELON_SLICE, 0, mt_rand(3, 7)),
|
||||
);
|
||||
return [
|
||||
[Item::MELON_SLICE, 0, mt_rand(3, 7)],
|
||||
];
|
||||
}
|
||||
}
|
@ -99,8 +99,8 @@ class MelonStem extends Flowable{
|
||||
}
|
||||
|
||||
public function getDrops(Item $item){
|
||||
return array(
|
||||
array(Item::MELON_SEEDS, 0, mt_rand(0, 2)),
|
||||
);
|
||||
return [
|
||||
[Item::MELON_SEEDS, 0, mt_rand(0, 2)],
|
||||
];
|
||||
}
|
||||
}
|
@ -49,9 +49,9 @@ class MossStone extends Solid{
|
||||
|
||||
public function getDrops(Item $item){
|
||||
if($item->isPickaxe() >= 1){
|
||||
return array(
|
||||
array(Item::MOSS_STONE, $this->meta, 1),
|
||||
);
|
||||
return [
|
||||
[Item::MOSS_STONE, $this->meta, 1],
|
||||
];
|
||||
}else{
|
||||
return [];
|
||||
}
|
||||
|
@ -49,9 +49,9 @@ class NetherBrick extends Solid{
|
||||
|
||||
public function getDrops(Item $item){
|
||||
if($item->isPickaxe() >= 1){
|
||||
return array(
|
||||
array(Item::NETHER_BRICKS, 0, 1),
|
||||
);
|
||||
return [
|
||||
[Item::NETHER_BRICKS, 0, 1],
|
||||
];
|
||||
}else{
|
||||
return [];
|
||||
}
|
||||
|
@ -49,9 +49,9 @@ class Netherrack extends Solid{
|
||||
|
||||
public function getDrops(Item $item){
|
||||
if($item->isPickaxe() >= 1){
|
||||
return array(
|
||||
array(Item::NETHERRACK, 0, 1),
|
||||
);
|
||||
return [
|
||||
[Item::NETHERRACK, 0, 1],
|
||||
];
|
||||
}else{
|
||||
return [];
|
||||
}
|
||||
|
@ -40,9 +40,9 @@ class Obsidian extends Solid{
|
||||
|
||||
public function getDrops(Item $item){
|
||||
if($item->isPickaxe() >= 5){
|
||||
return array(
|
||||
array(Item::OBSIDIAN, 0, 1),
|
||||
);
|
||||
return [
|
||||
[Item::OBSIDIAN, 0, 1],
|
||||
];
|
||||
}else{
|
||||
return [];
|
||||
}
|
||||
|
@ -32,14 +32,14 @@ class Planks extends Solid{
|
||||
|
||||
public function __construct($meta = 0){
|
||||
parent::__construct(self::PLANKS, $meta, "Wood Planks");
|
||||
$names = array(
|
||||
$names = [
|
||||
self::OAK => "Oak Wood Planks",
|
||||
self::SPRUCE => "Spruce Wood Planks",
|
||||
self::BIRCH => "Birch Wood Planks",
|
||||
self::JUNGLE => "Jungle Wood Planks",
|
||||
self::ACACIA => "Acacia Wood Planks",
|
||||
self::DARK_OAK => "Jungle Wood Planks",
|
||||
);
|
||||
];
|
||||
$this->name = $names[$this->meta & 0x07];
|
||||
$this->hardness = 15;
|
||||
}
|
||||
|
@ -89,9 +89,9 @@ class Potato extends Flowable{
|
||||
public function getDrops(Item $item){
|
||||
$drops = [];
|
||||
if($this->meta >= 0x07){
|
||||
$drops[] = array(Item::POTATO, 0, mt_rand(1, 4));
|
||||
$drops[] = [Item::POTATO, 0, mt_rand(1, 4)];
|
||||
}else{
|
||||
$drops[] = array(Item::POTATO, 0, 1);
|
||||
$drops[] = [Item::POTATO, 0, 1];
|
||||
}
|
||||
|
||||
return $drops;
|
||||
|
@ -100,8 +100,8 @@ class PumpkinStem extends Flowable{
|
||||
}
|
||||
|
||||
public function getDrops(Item $item){
|
||||
return array(
|
||||
array(Item::PUMPKIN_SEEDS, 0, mt_rand(0, 2)),
|
||||
);
|
||||
return [
|
||||
[Item::PUMPKIN_SEEDS, 0, mt_rand(0, 2)],
|
||||
];
|
||||
}
|
||||
}
|
@ -26,12 +26,12 @@ use pocketmine\item\Item;
|
||||
class Quartz extends Solid{
|
||||
public function __construct($meta = 0){
|
||||
parent::__construct(self::QUARTZ_BLOCK, $meta, "Quartz Block");
|
||||
$names = array(
|
||||
$names = [
|
||||
0 => "Quartz Block",
|
||||
1 => "Chiseled Quartz Block",
|
||||
2 => "Quartz Pillar",
|
||||
3 => "Quartz Pillar",
|
||||
);
|
||||
];
|
||||
$this->name = $names[$this->meta & 0x03];
|
||||
}
|
||||
|
||||
@ -55,9 +55,9 @@ class Quartz extends Solid{
|
||||
|
||||
public function getDrops(Item $item){
|
||||
if($item->isPickaxe() >= 1){
|
||||
return array(
|
||||
array(Item::QUARTZ_BLOCK, $this->meta & 0x03, 1),
|
||||
);
|
||||
return [
|
||||
[Item::QUARTZ_BLOCK, $this->meta & 0x03, 1],
|
||||
];
|
||||
}else{
|
||||
return [];
|
||||
}
|
||||
|
@ -42,9 +42,9 @@ class RedstoneOre extends Solid{
|
||||
|
||||
public function getDrops(Item $item){
|
||||
if($item->isPickaxe() >= 2){
|
||||
return array(
|
||||
array(Item::REDSTONE_DUST, 0, mt_rand(4, 5)),
|
||||
);
|
||||
return [
|
||||
[Item::REDSTONE_DUST, 0, mt_rand(4, 5)],
|
||||
];
|
||||
}else{
|
||||
return [];
|
||||
}
|
||||
|
@ -26,11 +26,11 @@ use pocketmine\item\Item;
|
||||
class Sandstone extends Solid{
|
||||
public function __construct($meta = 0){
|
||||
parent::__construct(self::SANDSTONE, $meta, "Sandstone");
|
||||
$names = array(
|
||||
$names = [
|
||||
0 => "Sandstone",
|
||||
1 => "Chiseled Sandstone",
|
||||
2 => "Smooth Sandstone",
|
||||
);
|
||||
];
|
||||
$this->name = $names[$this->meta & 0x03];
|
||||
$this->hardness = 4;
|
||||
}
|
||||
@ -55,9 +55,9 @@ class Sandstone extends Solid{
|
||||
|
||||
public function getDrops(Item $item){
|
||||
if($item->isPickaxe() >= 1){
|
||||
return array(
|
||||
array(Item::SANDSTONE, $this->meta & 0x03, 1),
|
||||
);
|
||||
return [
|
||||
[Item::SANDSTONE, $this->meta & 0x03, 1],
|
||||
];
|
||||
}else{
|
||||
return [];
|
||||
}
|
||||
|
@ -37,14 +37,14 @@ class Sapling extends Flowable{
|
||||
public function __construct($meta = Sapling::OAK){
|
||||
parent::__construct(self::SAPLING, $meta, "Sapling");
|
||||
$this->isActivable = true;
|
||||
$names = array(
|
||||
$names = [
|
||||
0 => "Oak Sapling",
|
||||
1 => "Spruce Sapling",
|
||||
2 => "Birch Sapling",
|
||||
3 => "Jungle Sapling",
|
||||
4 => "Acacia Sapling",
|
||||
5 => "Dark Oak Sapling",
|
||||
);
|
||||
];
|
||||
$this->name = $names[$this->meta & 0x07];
|
||||
$this->hardness = 0;
|
||||
}
|
||||
@ -107,8 +107,8 @@ class Sapling extends Flowable{
|
||||
}
|
||||
|
||||
public function getDrops(Item $item){
|
||||
return array(
|
||||
array($this->id, $this->meta & 0x07, 1),
|
||||
);
|
||||
return [
|
||||
[$this->id, $this->meta & 0x07, 1],
|
||||
];
|
||||
}
|
||||
}
|
@ -40,12 +40,12 @@ class SignPost extends Transparent{
|
||||
|
||||
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
||||
if($face !== 0){
|
||||
$faces = array(
|
||||
$faces = [
|
||||
2 => 2,
|
||||
3 => 3,
|
||||
4 => 4,
|
||||
5 => 5,
|
||||
);
|
||||
];
|
||||
if(!isset($faces[$face])){
|
||||
$this->meta = floor((($player->yaw + 180) * 16 / 360) + 0.5) & 0x0F;
|
||||
$this->getLevel()->setBlock($block, Block::get(Item::SIGN_POST, $this->meta), true, false, true);
|
||||
@ -83,8 +83,8 @@ class SignPost extends Transparent{
|
||||
}
|
||||
|
||||
public function getDrops(Item $item){
|
||||
return array(
|
||||
array(Item::SIGN, 0, 1),
|
||||
);
|
||||
return [
|
||||
[Item::SIGN, 0, 1],
|
||||
];
|
||||
}
|
||||
}
|
@ -27,7 +27,7 @@ use pocketmine\Player;
|
||||
class Slab extends Transparent{
|
||||
public function __construct($meta = 0){
|
||||
parent::__construct(self::SLAB, $meta, "Slab");
|
||||
$names = array(
|
||||
$names = [
|
||||
0 => "Stone",
|
||||
1 => "Sandstone",
|
||||
2 => "Wooden",
|
||||
@ -36,7 +36,7 @@ class Slab extends Transparent{
|
||||
5 => "Stone Brick",
|
||||
6 => "Quartz",
|
||||
7 => "",
|
||||
);
|
||||
];
|
||||
$this->name = (($this->meta & 0x08) === 0x08 ? "Upper " : "") . $names[$this->meta & 0x07] . " Slab";
|
||||
if(($this->meta & 0x08) === 0x08){
|
||||
$this->isFullBlock = true;
|
||||
@ -116,9 +116,9 @@ class Slab extends Transparent{
|
||||
|
||||
public function getDrops(Item $item){
|
||||
if($item->isPickaxe() >= 1){
|
||||
return array(
|
||||
array($this->id, $this->meta & 0x07, 1),
|
||||
);
|
||||
return [
|
||||
[$this->id, $this->meta & 0x07, 1],
|
||||
];
|
||||
}else{
|
||||
return [];
|
||||
}
|
||||
|
@ -64,9 +64,9 @@ class SnowLayer extends Flowable{
|
||||
|
||||
public function getDrops(Item $item){
|
||||
if($item->isShovel() !== false){
|
||||
return array(
|
||||
array(Item::SNOWBALL, 0, 1),
|
||||
);
|
||||
return [
|
||||
[Item::SNOWBALL, 0, 1],
|
||||
];
|
||||
}
|
||||
|
||||
return [];
|
||||
|
@ -29,8 +29,8 @@ class SpruceWoodStairs extends Stair{
|
||||
}
|
||||
|
||||
public function getDrops(Item $item){
|
||||
return array(
|
||||
array($this->id, 0, 1),
|
||||
);
|
||||
return [
|
||||
[$this->id, 0, 1],
|
||||
];
|
||||
}
|
||||
}
|
@ -26,7 +26,7 @@ use pocketmine\item\Item;
|
||||
class StainedClay extends Solid{
|
||||
public function __construct($meta = 0){
|
||||
parent::__construct(self::STAINED_CLAY, $meta, "Stained Clay");
|
||||
$names = array(
|
||||
$names = [
|
||||
0 => "White Stained Clay",
|
||||
1 => "Orange Stained Clay",
|
||||
2 => "Magenta Stained Clay",
|
||||
@ -43,7 +43,7 @@ class StainedClay extends Solid{
|
||||
13 => "Green Stained Clay",
|
||||
14 => "Red Stained Clay",
|
||||
15 => "Black Stained Clay",
|
||||
);
|
||||
];
|
||||
$this->name = $names[$this->meta];
|
||||
$this->hardness = 30;
|
||||
}
|
||||
|
@ -37,12 +37,12 @@ class Stair extends Transparent{
|
||||
}
|
||||
|
||||
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
||||
$faces = array(
|
||||
$faces = [
|
||||
0 => 0,
|
||||
1 => 2,
|
||||
2 => 1,
|
||||
3 => 3,
|
||||
);
|
||||
];
|
||||
$this->meta = $faces[$player->getDirection()] & 0x03;
|
||||
if(($fy > 0.5 and $face !== 1) or $face === 0){
|
||||
$this->meta |= 0x04; //Upside-down stairs
|
||||
@ -54,9 +54,9 @@ class Stair extends Transparent{
|
||||
|
||||
public function getDrops(Item $item){
|
||||
if($item->isPickaxe() >= 1){
|
||||
return array(
|
||||
array($this->id, 0, 1),
|
||||
);
|
||||
return [
|
||||
[$this->id, 0, 1],
|
||||
];
|
||||
}else{
|
||||
return [];
|
||||
}
|
||||
|
@ -68,9 +68,9 @@ class Stone extends Solid{
|
||||
|
||||
public function getDrops(Item $item){
|
||||
if($item->isPickaxe() >= 1){
|
||||
return array(
|
||||
array(Item::COBBLESTONE, 0, 1),
|
||||
);
|
||||
return [
|
||||
[Item::COBBLESTONE, 0, 1],
|
||||
];
|
||||
}else{
|
||||
return [];
|
||||
}
|
||||
|
@ -26,12 +26,12 @@ use pocketmine\item\Item;
|
||||
class StoneBricks extends Solid{
|
||||
public function __construct($meta = 0){
|
||||
parent::__construct(self::STONE_BRICKS, $meta, "Stone Bricks");
|
||||
$names = array(
|
||||
$names = [
|
||||
0 => "Stone Bricks",
|
||||
1 => "Mossy Stone Bricks",
|
||||
2 => "Cracked Stone Bricks",
|
||||
3 => "Chiseled Stone Bricks",
|
||||
);
|
||||
];
|
||||
$this->name = $names[$this->meta & 0x03];
|
||||
$this->hardness = 30;
|
||||
}
|
||||
@ -56,9 +56,9 @@ class StoneBricks extends Solid{
|
||||
|
||||
public function getDrops(Item $item){
|
||||
if($item->isPickaxe() >= 1){
|
||||
return array(
|
||||
array(Item::STONE_BRICKS, $this->meta & 0x03, 1),
|
||||
);
|
||||
return [
|
||||
[Item::STONE_BRICKS, $this->meta & 0x03, 1],
|
||||
];
|
||||
}else{
|
||||
return [];
|
||||
}
|
||||
|
@ -40,8 +40,8 @@ class Stonecutter extends Solid{
|
||||
}
|
||||
|
||||
public function getDrops(Item $item){
|
||||
return array(
|
||||
array($this->id, 0, 1),
|
||||
);
|
||||
return [
|
||||
[$this->id, 0, 1],
|
||||
];
|
||||
}
|
||||
}
|
@ -38,9 +38,9 @@ class Sugarcane extends Flowable{
|
||||
|
||||
|
||||
public function getDrops(Item $item){
|
||||
return array(
|
||||
array(Item::SUGARCANE, 0, 1),
|
||||
);
|
||||
return [
|
||||
[Item::SUGARCANE, 0, 1],
|
||||
];
|
||||
}
|
||||
|
||||
public function onActivate(Item $item, Player $player = null){
|
||||
|
@ -36,13 +36,13 @@ class TNT extends Solid{
|
||||
if(($player->gamemode & 0x01) === 0){
|
||||
$item->useOn($this);
|
||||
}
|
||||
$data = array(
|
||||
$data = [
|
||||
"x" => $this->x + 0.5,
|
||||
"y" => $this->y + 0.5,
|
||||
"z" => $this->z + 0.5,
|
||||
"power" => 4,
|
||||
"fuse" => 20 * 4, //4 seconds
|
||||
);
|
||||
];
|
||||
$this->getLevel()->setBlock($this, new Air(), false, false, true);
|
||||
//TODO
|
||||
//$e = Server::getInstance()->api->entity->add($this->level, ENTITY_OBJECT, OBJECT_PRIMEDTNT, $data);
|
||||
|
@ -28,11 +28,11 @@ class TallGrass extends Flowable{
|
||||
public function __construct($meta = 1){
|
||||
parent::__construct(self::TALL_GRASS, $meta, "Tall Grass");
|
||||
$this->isReplaceable = true;
|
||||
$names = array(
|
||||
$names = [
|
||||
0 => "Dead Shrub",
|
||||
1 => "Tall Grass",
|
||||
2 => "Fern",
|
||||
);
|
||||
];
|
||||
$this->name = $names[$this->meta & 0x03];
|
||||
$this->hardness = 0;
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ class Torch extends Flowable{
|
||||
public function onUpdate($type){
|
||||
if($type === Level::BLOCK_UPDATE_NORMAL){
|
||||
$side = $this->getDamage();
|
||||
$faces = array(
|
||||
$faces = [
|
||||
1 => 4,
|
||||
2 => 5,
|
||||
3 => 2,
|
||||
@ -47,7 +47,7 @@ class Torch extends Flowable{
|
||||
5 => 0,
|
||||
6 => 0,
|
||||
0 => 0,
|
||||
);
|
||||
];
|
||||
|
||||
if($this->getSide($faces[$side])->isTransparent === true and !($side === 0 and $this->getSide(0)->getID() === self::FENCE)){ //Replace with common break method
|
||||
//TODO
|
||||
@ -63,13 +63,13 @@ class Torch extends Flowable{
|
||||
|
||||
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
||||
if($target->isTransparent === false and $face !== 0){
|
||||
$faces = array(
|
||||
$faces = [
|
||||
1 => 5,
|
||||
2 => 4,
|
||||
3 => 3,
|
||||
4 => 2,
|
||||
5 => 1,
|
||||
);
|
||||
];
|
||||
$this->meta = $faces[$face];
|
||||
$this->getLevel()->setBlock($block, $this, true, false, true);
|
||||
|
||||
@ -85,8 +85,8 @@ class Torch extends Flowable{
|
||||
}
|
||||
|
||||
public function getDrops(Item $item){
|
||||
return array(
|
||||
array($this->id, 0, 1),
|
||||
);
|
||||
return [
|
||||
[$this->id, 0, 1],
|
||||
];
|
||||
}
|
||||
}
|
@ -38,12 +38,12 @@ class Trapdoor extends Transparent{
|
||||
|
||||
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
||||
if(($target->isTransparent === false or $target->getID() === self::SLAB) and $face !== 0 and $face !== 1){
|
||||
$faces = array(
|
||||
$faces = [
|
||||
2 => 0,
|
||||
3 => 1,
|
||||
4 => 2,
|
||||
5 => 3,
|
||||
);
|
||||
];
|
||||
$this->meta = $faces[$face] & 0x03;
|
||||
if($fy > 0.5){
|
||||
$this->meta |= 0x08;
|
||||
@ -57,9 +57,9 @@ class Trapdoor extends Transparent{
|
||||
}
|
||||
|
||||
public function getDrops(Item $item){
|
||||
return array(
|
||||
array($this->id, 0, 1),
|
||||
);
|
||||
return [
|
||||
[$this->id, 0, 1],
|
||||
];
|
||||
}
|
||||
|
||||
public function onActivate(Item $item, Player $player = null){
|
||||
|
@ -86,10 +86,10 @@ class Wheat extends Flowable{
|
||||
public function getDrops(Item $item){
|
||||
$drops = [];
|
||||
if($this->meta >= 0x07){
|
||||
$drops[] = array(Item::WHEAT, 0, 1);
|
||||
$drops[] = array(Item::WHEAT_SEEDS, 0, mt_rand(0, 3));
|
||||
$drops[] = [Item::WHEAT, 0, 1];
|
||||
$drops[] = [Item::WHEAT_SEEDS, 0, mt_rand(0, 3)];
|
||||
}else{
|
||||
$drops[] = array(Item::WHEAT_SEEDS, 0, 1);
|
||||
$drops[] = [Item::WHEAT_SEEDS, 0, 1];
|
||||
}
|
||||
|
||||
return $drops;
|
||||
|
@ -34,25 +34,25 @@ class Wood extends Solid{
|
||||
|
||||
public function __construct($meta = 0){
|
||||
parent::__construct(self::WOOD, $meta, "Wood");
|
||||
$names = array(
|
||||
$names = [
|
||||
self::OAK => "Oak Wood",
|
||||
self::SPRUCE => "Spruce Wood",
|
||||
self::BIRCH => "Birch Wood",
|
||||
self::JUNGLE => "Jungle Wood",
|
||||
);
|
||||
];
|
||||
$this->name = $names[$this->meta & 0x03];
|
||||
$this->hardness = 10;
|
||||
}
|
||||
|
||||
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
||||
$faces = array(
|
||||
$faces = [
|
||||
0 => 0,
|
||||
1 => 0,
|
||||
2 => 0b1000,
|
||||
3 => 0b1000,
|
||||
4 => 0b0100,
|
||||
5 => 0b0100,
|
||||
);
|
||||
];
|
||||
|
||||
$this->meta = ($this->meta & 0x03) | $faces[$face];
|
||||
$this->getLevel()->setBlock($block, $this, true, false, true);
|
||||
@ -61,8 +61,8 @@ class Wood extends Solid{
|
||||
}
|
||||
|
||||
public function getDrops(Item $item){
|
||||
return array(
|
||||
array($this->id, $this->meta & 0x03, 1),
|
||||
);
|
||||
return [
|
||||
[$this->id, $this->meta & 0x03, 1],
|
||||
];
|
||||
}
|
||||
}
|
@ -26,10 +26,10 @@ class Wood2 extends Wood{
|
||||
|
||||
public function __construct($meta = 0){
|
||||
Solid::__construct(self::WOOD2, $meta, "Wood");
|
||||
$names = array(
|
||||
$names = [
|
||||
0 => "Acacia Wood",
|
||||
1 => "Dark Oak Wood"
|
||||
);
|
||||
];
|
||||
$this->name = $names[$this->meta & 0x03];
|
||||
$this->hardness = 10;
|
||||
}
|
||||
|
@ -31,8 +31,8 @@ class WoodDoor extends Door{
|
||||
}
|
||||
|
||||
public function getDrops(Item $item){
|
||||
return array(
|
||||
array(Item::WOODEN_DOOR, 0, 1),
|
||||
);
|
||||
return [
|
||||
[Item::WOODEN_DOOR, 0, 1],
|
||||
];
|
||||
}
|
||||
}
|
@ -27,14 +27,14 @@ use pocketmine\Player;
|
||||
class WoodSlab extends Transparent{
|
||||
public function __construct($meta = 0){
|
||||
parent::__construct(self::WOOD_SLAB, $meta, "Wooden Slab");
|
||||
$names = array(
|
||||
$names = [
|
||||
0 => "Oak",
|
||||
1 => "Spruce",
|
||||
2 => "Birch",
|
||||
3 => "Jungle",
|
||||
4 => "Acacia",
|
||||
5 => "Dark Oak",
|
||||
);
|
||||
];
|
||||
$this->name = (($this->meta & 0x08) === 0x08 ? "Upper " : "") . $names[$this->meta & 0x07] . " Wooden Slab";
|
||||
if(($this->meta & 0x08) === 0x08){
|
||||
$this->isFullBlock = true;
|
||||
@ -112,8 +112,8 @@ class WoodSlab extends Transparent{
|
||||
}
|
||||
|
||||
public function getDrops(Item $item){
|
||||
return array(
|
||||
array($this->id, $this->meta & 0x07, 1),
|
||||
);
|
||||
return [
|
||||
[$this->id, $this->meta & 0x07, 1],
|
||||
];
|
||||
}
|
||||
}
|
@ -47,8 +47,8 @@ class WoodStairs extends Stair{
|
||||
}
|
||||
|
||||
public function getDrops(Item $item){
|
||||
return array(
|
||||
array($this->id, 0, 1),
|
||||
);
|
||||
return [
|
||||
[$this->id, 0, 1],
|
||||
];
|
||||
}
|
||||
}
|
@ -25,7 +25,7 @@ namespace pocketmine\block;
|
||||
class Wool extends Solid{
|
||||
public function __construct($meta = 0){
|
||||
parent::__construct(self::WOOL, $meta, "Wool");
|
||||
$names = array(
|
||||
$names = [
|
||||
0 => "White Wool",
|
||||
1 => "Orange Wool",
|
||||
2 => "Magenta Wool",
|
||||
@ -42,7 +42,7 @@ class Wool extends Solid{
|
||||
13 => "Green Wool",
|
||||
14 => "Red Wool",
|
||||
15 => "Black Wool",
|
||||
);
|
||||
];
|
||||
$this->name = $names[$this->meta];
|
||||
$this->hardness = 4;
|
||||
}
|
||||
|
@ -41,8 +41,8 @@ class Workbench extends Solid{
|
||||
}
|
||||
|
||||
public function getDrops(Item $item){
|
||||
return array(
|
||||
array($this->id, 0, 1),
|
||||
);
|
||||
return [
|
||||
[$this->id, 0, 1],
|
||||
];
|
||||
}
|
||||
}
|
@ -108,7 +108,7 @@ class Arrow extends Projectile{
|
||||
$flags |= $this->fireTicks > 0 ? 1 : 0;
|
||||
|
||||
return [
|
||||
0 => array("type" => 0, "value" => $flags)
|
||||
0 => ["type" => 0, "value" => $flags]
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -142,7 +142,7 @@ class DroppedItem extends Entity{
|
||||
$flags |= $this->fireTicks > 0 ? 1 : 0;
|
||||
|
||||
return [
|
||||
0 => array("type" => 0, "value" => $flags)
|
||||
0 => ["type" => 0, "value" => $flags]
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -989,7 +989,7 @@ abstract class Entity extends Position implements Metadatable{
|
||||
|
||||
public function setMotion(Vector3 $motion){
|
||||
if(!$this->justCreated){
|
||||
Server::getInstance()->getPluginManager()->callEvent($ev = new EntityMotionEvent($this, $motion));
|
||||
$this->server->getPluginManager()->callEvent($ev = new EntityMotionEvent($this, $motion));
|
||||
if($ev->isCancelled()){
|
||||
return false;
|
||||
}
|
||||
@ -1007,6 +1007,8 @@ abstract class Entity extends Position implements Metadatable{
|
||||
}
|
||||
$this->updateMovement();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function isOnGround(){
|
||||
|
@ -104,23 +104,23 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
|
||||
if($hotbarSlot !== -1){
|
||||
$item = $this->inventory->getItem($hotbarSlot);
|
||||
if($item->getID() !== 0 and $item->getCount() > 0){
|
||||
$this->namedtag->Inventory[$slot] = new Compound(false, array(
|
||||
$this->namedtag->Inventory[$slot] = new Compound(false, [
|
||||
new Byte("Count", $item->getCount()),
|
||||
new Short("Damage", $item->getDamage()),
|
||||
new Byte("Slot", $slot),
|
||||
new Byte("TrueSlot", $hotbarSlot),
|
||||
new Short("id", $item->getID()),
|
||||
));
|
||||
]);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
$this->namedtag->Inventory[$slot] = new Compound(false, array(
|
||||
$this->namedtag->Inventory[$slot] = new Compound(false, [
|
||||
new Byte("Count", 0),
|
||||
new Short("Damage", 0),
|
||||
new Byte("Slot", $slot),
|
||||
new Byte("TrueSlot", -1),
|
||||
new Short("id", 0),
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
//Normal inventory
|
||||
@ -128,24 +128,24 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
|
||||
//$slotCount = (($this instanceof Player and ($this->gamemode & 0x01) === 1) ? Player::CREATIVE_SLOTS : Player::SURVIVAL_SLOTS) + 9;
|
||||
for($slot = 9; $slot < $slotCount; ++$slot){
|
||||
$item = $this->inventory->getItem($slot - 9);
|
||||
$this->namedtag->Inventory[$slot] = new Compound(false, array(
|
||||
$this->namedtag->Inventory[$slot] = new Compound(false, [
|
||||
new Byte("Count", $item->getCount()),
|
||||
new Short("Damage", $item->getDamage()),
|
||||
new Byte("Slot", $slot),
|
||||
new Short("id", $item->getID()),
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
//Armor
|
||||
for($slot = 100; $slot < 104; ++$slot){
|
||||
$item = $this->inventory->getItem($this->inventory->getSize() + $slot - 100);
|
||||
if($item instanceof Item and $item->getID() !== Item::AIR){
|
||||
$this->namedtag->Inventory[$slot] = new Compound(false, array(
|
||||
$this->namedtag->Inventory[$slot] = new Compound(false, [
|
||||
new Byte("Count", $item->getCount()),
|
||||
new Short("Damage", $item->getDamage()),
|
||||
new Byte("Slot", $slot),
|
||||
new Short("id", $item->getID()),
|
||||
));
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -200,12 +200,12 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
|
||||
$flags |= $this->fireTicks > 0 ? 1 : 0;
|
||||
//$flags |= ($this->crouched === true ? 0b10:0) << 1;
|
||||
//$flags |= ($this->inAction === true ? 0b10000:0);
|
||||
$d = array(
|
||||
0 => array("type" => 0, "value" => $flags),
|
||||
1 => array("type" => 1, "value" => $this->airTicks),
|
||||
16 => array("type" => 0, "value" => 0),
|
||||
17 => array("type" => 6, "value" => array(0, 0, 0)),
|
||||
);
|
||||
$d = [
|
||||
0 => ["type" => 0, "value" => $flags],
|
||||
1 => ["type" => 1, "value" => $this->airTicks],
|
||||
16 => ["type" => 0, "value" => 0],
|
||||
17 => ["type" => 6, "value" => [0, 0, 0]],
|
||||
];
|
||||
|
||||
/*if($this->class === ENTITY_MOB and $this->type === MOB_SHEEP){
|
||||
if(!isset($this->data["Sheared"])){
|
||||
|
@ -80,12 +80,12 @@ class Villager extends Creature implements NPC, Ageable{
|
||||
$flags |= $this->fireTicks > 0 ? 1 : 0;
|
||||
//$flags |= ($this->crouched === true ? 0b10:0) << 1;
|
||||
//$flags |= ($this->inAction === true ? 0b10000:0);
|
||||
$d = array(
|
||||
0 => array("type" => 0, "value" => $flags),
|
||||
1 => array("type" => 1, "value" => $this->airTicks),
|
||||
16 => array("type" => 0, "value" => 0),
|
||||
17 => array("type" => 6, "value" => array(0, 0, 0)),
|
||||
);
|
||||
$d = [
|
||||
0 => ["type" => 0, "value" => $flags],
|
||||
1 => ["type" => 1, "value" => $this->airTicks],
|
||||
16 => ["type" => 0, "value" => 0],
|
||||
17 => ["type" => 6, "value" => [0, 0, 0]],
|
||||
];
|
||||
|
||||
return $d;
|
||||
}
|
||||
|
@ -71,12 +71,12 @@ class Zombie extends Monster{
|
||||
$flags |= $this->fireTicks > 0 ? 1 : 0;
|
||||
//$flags |= ($this->crouched === true ? 0b10:0) << 1;
|
||||
//$flags |= ($this->inAction === true ? 0b10000:0);
|
||||
$d = array(
|
||||
0 => array("type" => 0, "value" => $flags),
|
||||
1 => array("type" => 1, "value" => $this->airTicks),
|
||||
16 => array("type" => 0, "value" => 0),
|
||||
17 => array("type" => 6, "value" => array(0, 0, 0)),
|
||||
);
|
||||
$d = [
|
||||
0 => ["type" => 0, "value" => $flags],
|
||||
1 => ["type" => 1, "value" => $this->airTicks],
|
||||
16 => ["type" => 0, "value" => 0],
|
||||
17 => ["type" => 6, "value" => [0, 0, 0]],
|
||||
];
|
||||
|
||||
return $d;
|
||||
}
|
||||
|
@ -69,14 +69,14 @@ class HandlerList{
|
||||
}
|
||||
|
||||
public function __construct(){
|
||||
$this->handlerSlots = array(
|
||||
$this->handlerSlots = [
|
||||
EventPriority::LOWEST => [],
|
||||
EventPriority::LOW => [],
|
||||
EventPriority::NORMAL => [],
|
||||
EventPriority::HIGH => [],
|
||||
EventPriority::HIGHEST => [],
|
||||
EventPriority::MONITOR => []
|
||||
);
|
||||
];
|
||||
self::$allLists[] = $this;
|
||||
}
|
||||
|
||||
|
@ -343,7 +343,7 @@ class CraftingManager{
|
||||
$this->recipes[spl_object_hash($recipe)] = $recipe;
|
||||
$hash = "";
|
||||
$ingredients = $recipe->getIngredientList();
|
||||
usort($ingredients, array($this, "sort"));
|
||||
usort($ingredients, [$this, "sort"]);
|
||||
foreach($ingredients as $item){
|
||||
$hash .= $item->getID() . ":" . ($item->getDamage() === null ? "?" : $item->getDamage()) . "x" . $item->getCount() . ",";
|
||||
}
|
||||
@ -376,7 +376,7 @@ class CraftingManager{
|
||||
}
|
||||
$hash = "";
|
||||
$input = $ts->getRecipe();
|
||||
usort($input, array($this, "sort"));
|
||||
usort($input, [$this, "sort"]);
|
||||
$inputCount = 0;
|
||||
foreach($input as $item){
|
||||
$inputCount += $item->getCount();
|
||||
|
@ -25,7 +25,7 @@ use pocketmine\item\Item;
|
||||
|
||||
//TODO: remove this
|
||||
abstract class Fuel{
|
||||
public static $duration = array(
|
||||
public static $duration = [
|
||||
Item::COAL => 80,
|
||||
Item::COAL_BLOCK => 800,
|
||||
Item::TRUNK => 15,
|
||||
@ -49,6 +49,6 @@ abstract class Fuel{
|
||||
Item::CHEST => 15,
|
||||
Item::BUCKET => 1000,
|
||||
|
||||
);
|
||||
];
|
||||
|
||||
}
|
@ -392,7 +392,7 @@ class Item{
|
||||
|
||||
public static function init(){
|
||||
if(count(self::$list) === 0){
|
||||
self::$list = array(
|
||||
self::$list = [
|
||||
self::SUGARCANE => Sugarcane::class,
|
||||
self::WHEAT_SEEDS => WheatSeeds::class,
|
||||
self::PUMPKIN_SEEDS => PumpkinSeeds::class,
|
||||
@ -447,7 +447,7 @@ class Item{
|
||||
self::FLINT_STEEL => FlintSteel::class,
|
||||
self::SHEARS => Shears::class,
|
||||
self::BOW => Bow::class,
|
||||
);
|
||||
];
|
||||
foreach(Block::$list as $id => $class){
|
||||
self::$list[$id] = $class;
|
||||
}
|
||||
|
@ -34,50 +34,50 @@ class Painting extends Item{
|
||||
|
||||
public function onActivate(Level $level, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
if($target->isTransparent === false and $face > 1 and $block->isSolid === false){
|
||||
$faces = array(
|
||||
$faces = [
|
||||
2 => 1,
|
||||
3 => 3,
|
||||
4 => 0,
|
||||
5 => 2,
|
||||
|
||||
);
|
||||
$motives = array(
|
||||
];
|
||||
$motives = [
|
||||
// Motive Width Height
|
||||
array("Kebab", 1, 1),
|
||||
array("Aztec", 1, 1),
|
||||
array("Alban", 1, 1),
|
||||
array("Aztec2", 1, 1),
|
||||
array("Bomb", 1, 1),
|
||||
array("Plant", 1, 1),
|
||||
array("Wasteland", 1, 1),
|
||||
array("Wanderer", 1, 2),
|
||||
array("Graham", 1, 2),
|
||||
array("Pool", 2, 1),
|
||||
array("Courbet", 2, 1),
|
||||
array("Sunset", 2, 1),
|
||||
array("Sea", 2, 1),
|
||||
array("Creebet", 2, 1),
|
||||
array("Match", 2, 2),
|
||||
array("Bust", 2, 2),
|
||||
array("Stage", 2, 2),
|
||||
array("Void", 2, 2),
|
||||
array("SkullAndRoses", 2, 2),
|
||||
["Kebab", 1, 1],
|
||||
["Aztec", 1, 1],
|
||||
["Alban", 1, 1],
|
||||
["Aztec2", 1, 1],
|
||||
["Bomb", 1, 1],
|
||||
["Plant", 1, 1],
|
||||
["Wasteland", 1, 1],
|
||||
["Wanderer", 1, 2],
|
||||
["Graham", 1, 2],
|
||||
["Pool", 2, 1],
|
||||
["Courbet", 2, 1],
|
||||
["Sunset", 2, 1],
|
||||
["Sea", 2, 1],
|
||||
["Creebet", 2, 1],
|
||||
["Match", 2, 2],
|
||||
["Bust", 2, 2],
|
||||
["Stage", 2, 2],
|
||||
["Void", 2, 2],
|
||||
["SkullAndRoses", 2, 2],
|
||||
//array("Wither", 2, 2),
|
||||
array("Fighters", 4, 2),
|
||||
array("Skeleton", 4, 3),
|
||||
array("DonkeyKong", 4, 3),
|
||||
array("Pointer", 4, 4),
|
||||
array("Pigscene", 4, 4),
|
||||
array("Flaming Skull", 4, 4),
|
||||
);
|
||||
["Fighters", 4, 2],
|
||||
["Skeleton", 4, 3],
|
||||
["DonkeyKong", 4, 3],
|
||||
["Pointer", 4, 4],
|
||||
["Pigscene", 4, 4],
|
||||
["Flaming Skull", 4, 4],
|
||||
];
|
||||
$motive = $motives[mt_rand(0, count($motives) - 1)];
|
||||
$data = array(
|
||||
$data = [
|
||||
"x" => $target->x,
|
||||
"y" => $target->y,
|
||||
"z" => $target->z,
|
||||
"yaw" => $faces[$face] * 90,
|
||||
"Motive" => $motive[0],
|
||||
);
|
||||
];
|
||||
//TODO
|
||||
//$e = $server->api->entity->add($level, ENTITY_OBJECT, OBJECT_PAINTING, $data);
|
||||
//$e->spawnToAll();
|
||||
|
@ -60,7 +60,7 @@ abstract class Tool extends Item{
|
||||
*/
|
||||
public function getMaxDurability(){
|
||||
|
||||
$levels = array(
|
||||
$levels = [
|
||||
2 => 33,
|
||||
1 => 60,
|
||||
3 => 132,
|
||||
@ -69,7 +69,7 @@ abstract class Tool extends Item{
|
||||
self::FLINT_STEEL => 65,
|
||||
self::SHEARS => 239,
|
||||
self::BOW => 385,
|
||||
);
|
||||
];
|
||||
|
||||
if(($type = $this->isPickaxe()) === false){
|
||||
if(($type = $this->isAxe()) === false){
|
||||
|
@ -31,13 +31,13 @@ use pocketmine\network\protocol\ExplodePacket;
|
||||
use pocketmine\Server;
|
||||
|
||||
class Explosion{
|
||||
public static $specialDrops = array(
|
||||
public static $specialDrops = [
|
||||
Item::GRASS => Item::DIRT,
|
||||
Item::STONE => Item::COBBLESTONE,
|
||||
Item::COAL_ORE => Item::COAL,
|
||||
Item::DIAMOND_ORE => Item::DIAMOND,
|
||||
Item::REDSTONE_ORE => Item::REDSTONE,
|
||||
);
|
||||
];
|
||||
private $rays = 16; //Rays
|
||||
public $level;
|
||||
public $source;
|
||||
@ -119,13 +119,13 @@ class Explosion{
|
||||
|
||||
foreach($this->affectedBlocks as $block){
|
||||
if($block instanceof TNT){
|
||||
$data = array(
|
||||
$data = [
|
||||
"x" => $block->x + 0.5,
|
||||
"y" => $block->y + 0.5,
|
||||
"z" => $block->z + 0.5,
|
||||
"power" => 4,
|
||||
"fuse" => mt_rand(10, 30), //0.5 to 1.5 seconds
|
||||
);
|
||||
];
|
||||
//TODO
|
||||
//$e = $server->api->entity->add($this->level, ENTITY_OBJECT, OBJECT_PRIMEDTNT, $data);
|
||||
//$e->spawnToAll();
|
||||
|
@ -1038,16 +1038,16 @@ class Level implements ChunkManager, Metadatable{
|
||||
}
|
||||
|
||||
if($hand->getID() === Item::SIGN_POST or $hand->getID() === Item::WALL_SIGN){
|
||||
$tile = new Sign($this->getChunkAt($block->x >> 4, $block->z >> 4), new Compound(false, array(
|
||||
new String("id", Tile::SIGN),
|
||||
new Int("x", $block->x),
|
||||
new Int("y", $block->y),
|
||||
new Int("z", $block->z),
|
||||
new String("Text1", ""),
|
||||
new String("Text2", ""),
|
||||
new String("Text3", ""),
|
||||
new String("Text4", "")
|
||||
)));
|
||||
$tile = new Sign($this->getChunkAt($block->x >> 4, $block->z >> 4), new Compound(false, [
|
||||
"id" => new String("id", Tile::SIGN),
|
||||
"x" => new Int("x", $block->x),
|
||||
"y" => new Int("y", $block->y),
|
||||
"z" => new Int("z", $block->z),
|
||||
"Text1" => new String("Text1", ""),
|
||||
"Text2" => new String("Text2", ""),
|
||||
"Text3" => new String("Text3", ""),
|
||||
"Text4" => new String("Text4", "")
|
||||
]));
|
||||
if($player instanceof Player){
|
||||
$tile->namedtag->Creator = new String("Creator", $player->getName());
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ class LevelImport{
|
||||
return false;
|
||||
}
|
||||
|
||||
$pmf = new LevelFormat($this->path . "level.pmf", array(
|
||||
$pmf = new LevelFormat($this->path . "level.pmf", [
|
||||
"name" => $level->LevelName,
|
||||
"seed" => $level->RandomSeed,
|
||||
"time" => $level->Time,
|
||||
@ -77,13 +77,13 @@ class LevelImport{
|
||||
"generator" => "default",
|
||||
"generatorSettings" => "",
|
||||
"extra" => ""
|
||||
));
|
||||
]);
|
||||
$chunks = new PocketChunkParser();
|
||||
$chunks->loadFile($this->path . "chunks.dat");
|
||||
$chunks->loadMap();
|
||||
for($Z = 0; $Z < 16; ++$Z){
|
||||
for($X = 0; $X < 16; ++$X){
|
||||
$chunk = array(
|
||||
$chunk = [
|
||||
0 => "",
|
||||
1 => "",
|
||||
2 => "",
|
||||
@ -92,7 +92,7 @@ class LevelImport{
|
||||
5 => "",
|
||||
6 => "",
|
||||
7 => ""
|
||||
);
|
||||
];
|
||||
|
||||
$pmf->initCleanChunk($X, $Z);
|
||||
for($z = 0; $z < 16; ++$z){
|
||||
|
@ -188,10 +188,10 @@ class LevelFormat extends PMF{
|
||||
|
||||
private function upgrade_From1_To2(){
|
||||
MainLogger::getLogger()->notice("Old PMF Level format version #1 detected, upgrading to version #2");
|
||||
$nbt = new Compound("", array(
|
||||
$nbt = new Compound("", [
|
||||
new Enum("Entities", []),
|
||||
new Enum("TileEntities", [])
|
||||
));
|
||||
]);
|
||||
$nbt->Entities->setTagType(NBT::TAG_Compound);
|
||||
$nbt->TileEntities->setTagType(NBT::TAG_Compound);
|
||||
$nbtCodec = new NBT(NBT::BIG_ENDIAN);
|
||||
@ -217,7 +217,7 @@ class LevelFormat extends PMF{
|
||||
$Z = $index >> 16;
|
||||
$X = ($index & 0x8000) === 0x8000 ? -($index & 0x7fff) : $index & 0x7fff;
|
||||
|
||||
return array($X, $Z);
|
||||
return [$X, $Z];
|
||||
}
|
||||
|
||||
private function getChunkPath($X, $Z){
|
||||
@ -290,10 +290,10 @@ class LevelFormat extends PMF{
|
||||
$chunk = zlib_decode($chunk);
|
||||
$offset = 0;
|
||||
|
||||
$this->chunkInfo[$index] = array(
|
||||
$this->chunkInfo[$index] = [
|
||||
0 => ord($chunk{0}),
|
||||
1 => Binary::readInt(substr($chunk, 1, 4)),
|
||||
);
|
||||
];
|
||||
$offset += 5;
|
||||
$len = Binary::readInt(substr($chunk, $offset, 4));
|
||||
$offset += 4;
|
||||
@ -302,7 +302,7 @@ class LevelFormat extends PMF{
|
||||
$this->chunkInfo[$index][2] = $nbt->getData();
|
||||
$offset += $len;
|
||||
$this->chunks[$index] = [];
|
||||
$this->chunkChange[$index] = array(-1 => false);
|
||||
$this->chunkChange[$index] = [-1 => false];
|
||||
$this->chunkInfo[$index][3] = substr($chunk, $offset, 256); //Biome data
|
||||
$offset += 256;
|
||||
for($Y = 0; $Y < 8; ++$Y){
|
||||
@ -399,7 +399,7 @@ class LevelFormat extends PMF{
|
||||
public function initCleanChunk($X, $Z){
|
||||
$index = self::getIndex($X, $Z);
|
||||
if(!isset($this->chunks[$index])){
|
||||
$this->chunks[$index] = array(
|
||||
$this->chunks[$index] = [
|
||||
0 => false,
|
||||
1 => false,
|
||||
2 => false,
|
||||
@ -408,8 +408,8 @@ class LevelFormat extends PMF{
|
||||
5 => false,
|
||||
6 => false,
|
||||
7 => false,
|
||||
);
|
||||
$this->chunkChange[$index] = array(
|
||||
];
|
||||
$this->chunkChange[$index] = [
|
||||
-1 => true,
|
||||
0 => 8192,
|
||||
1 => 8192,
|
||||
@ -419,19 +419,19 @@ class LevelFormat extends PMF{
|
||||
5 => 8192,
|
||||
6 => 8192,
|
||||
7 => 8192,
|
||||
);
|
||||
$nbt = new Compound("", array(
|
||||
];
|
||||
$nbt = new Compound("", [
|
||||
new Enum("Entities", []),
|
||||
new Enum("TileEntities", [])
|
||||
));
|
||||
]);
|
||||
$nbt->Entities->setTagType(NBT::TAG_Compound);
|
||||
$nbt->TileEntities->setTagType(NBT::TAG_Compound);
|
||||
$this->chunkInfo[$index] = array(
|
||||
$this->chunkInfo[$index] = [
|
||||
0 => 0,
|
||||
1 => 0,
|
||||
2 => $nbt,
|
||||
3 => str_repeat("\x00", 256),
|
||||
);
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@ -593,13 +593,13 @@ class LevelFormat extends PMF{
|
||||
$Z = $z >> 4;
|
||||
$Y = $y >> 4;
|
||||
if($y < 0 or $y > 127){
|
||||
return array(0, 0);
|
||||
return [0, 0];
|
||||
}
|
||||
$index = self::getIndex($X, $Z);
|
||||
if(!isset($this->chunks[$index]) and $this->loadChunk($X, $Z) === false){
|
||||
return array(0, 0);
|
||||
return [0, 0];
|
||||
}elseif($this->chunks[$index][$Y] === false){
|
||||
return array(0, 0);
|
||||
return [0, 0];
|
||||
}
|
||||
$aX = $x - ($X << 4);
|
||||
$aZ = $z - ($Z << 4);
|
||||
@ -612,7 +612,7 @@ class LevelFormat extends PMF{
|
||||
$m = $m >> 4;
|
||||
}
|
||||
|
||||
return array($b, $m);
|
||||
return [$b, $m];
|
||||
}
|
||||
|
||||
public function setBlock($x, $y, $z, $block, $meta = 0){
|
||||
|
@ -113,12 +113,12 @@ class PocketChunkParser{
|
||||
$offset = $this->getOffset($X, $Z);
|
||||
$len = Binary::readLInt(substr($this->raw, $offset, 4));
|
||||
$offset += 4;
|
||||
$chunk = array(
|
||||
$chunk = [
|
||||
0 => [], //Block
|
||||
1 => [], //Data
|
||||
2 => [], //SkyLight
|
||||
3 => [], //BlockLight
|
||||
);
|
||||
];
|
||||
foreach($chunk as $section => &$data){
|
||||
$l = $section === 0 ? 128 : 64;
|
||||
for($i = 0; $i < 256; ++$i){
|
||||
@ -198,7 +198,7 @@ class PocketChunkParser{
|
||||
$meta = $meta >> 4;
|
||||
}
|
||||
|
||||
return array($block, $meta);
|
||||
return [$block, $meta];
|
||||
}
|
||||
|
||||
public function getChunkColumn($X, $Z, $x, $z, $type = 0){
|
||||
|
@ -192,7 +192,7 @@ class Chunk extends BaseChunk{
|
||||
$nbt->Entities->setTagType(NBT::TAG_Compound);
|
||||
$writer = new NBT(NBT::BIG_ENDIAN);
|
||||
$nbt->setName("Level");
|
||||
$writer->setData(new Compound("", array("Level" => $nbt)));
|
||||
$writer->setData(new Compound("", ["Level" => $nbt]));
|
||||
|
||||
return $writer->writeCompressed(ZLIB_ENCODING_DEFLATE, RegionLoader::$COMPRESSION_LEVEL);
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ class RegionLoader extends \pocketmine\level\format\mcregion\RegionLoader{
|
||||
$nbt->TileTicks->setTagType(NBT::TAG_Compound);
|
||||
$writer = new NBT(NBT::BIG_ENDIAN);
|
||||
$nbt->setName("Level");
|
||||
$writer->setData(new Compound("", array("Level" => $nbt)));
|
||||
$writer->setData(new Compound("", ["Level" => $nbt]));
|
||||
$chunkData = $writer->writeCompressed(ZLIB_ENCODING_DEFLATE, RegionLoader::$COMPRESSION_LEVEL);
|
||||
$this->saveChunk($x, $z, $chunkData);
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user