mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-06 01:51:51 +00:00
Merge branch 'master' of https://github.com/shoghicp/PocketMine-MP
This commit is contained in:
commit
fbc1873e06
@ -1,6 +1,6 @@
|
|||||||

|

|
||||||
|
|
||||||
# PocketMine-MP
|
# PocketMine-MP [](https://travis-ci.org/shoghicp/PocketMine-MP)
|
||||||
|
|
||||||
```
|
```
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
@ -12,40 +12,40 @@ CURL_VERSION="curl-7_29_0"
|
|||||||
|
|
||||||
echo "[PocketMine] PHP installer and compiler for Linux & Mac - by @shoghicp v$COMPILER_VERSION"
|
echo "[PocketMine] PHP installer and compiler for Linux & Mac - by @shoghicp v$COMPILER_VERSION"
|
||||||
DIR=`pwd`
|
DIR=`pwd`
|
||||||
date > $DIR/install.log 2>&1
|
date > "$DIR/install.log" 2>&1
|
||||||
uname -a >> $DIR/install.log 2>&1
|
uname -a >> "$DIR/install.log" 2>&1
|
||||||
echo "[INFO] Checking dependecies"
|
echo "[INFO] Checking dependecies"
|
||||||
type make >> $DIR/install.log 2>&1 || { echo >&2 "[ERROR] Please install \"make\""; exit 1; }
|
type make >> "$DIR/install.log" 2>&1 || { echo >&2 "[ERROR] Please install \"make\""; exit 1; }
|
||||||
type autoconf >> $DIR/install.log 2>&1 || { echo >&2 "[ERROR] Please install \"autoconf\""; exit 1; }
|
type autoconf >> "$DIR/install.log" 2>&1 || { echo >&2 "[ERROR] Please install \"autoconf\""; exit 1; }
|
||||||
type automake >> $DIR/install.log 2>&1 || { echo >&2 "[ERROR] Please install \"automake\""; exit 1; }
|
type automake >> "$DIR/install.log" 2>&1 || { echo >&2 "[ERROR] Please install \"automake\""; exit 1; }
|
||||||
type gcc >> $DIR/install.log 2>&1 || { echo >&2 "[ERROR] Please install \"gcc\""; exit 1; }
|
type gcc >> "$DIR/install.log" 2>&1 || { echo >&2 "[ERROR] Please install \"gcc\""; exit 1; }
|
||||||
type m4 >> $DIR/install.log 2>&1 || { echo >&2 "[ERROR] Please install \"m4\""; exit 1; }
|
type m4 >> "$DIR/install.log" 2>&1 || { echo >&2 "[ERROR] Please install \"m4\""; exit 1; }
|
||||||
|
|
||||||
rm -r -f install_data/ >> $DIR/install.log 2>&1
|
rm -r -f install_data/ >> "$DIR/install.log" 2>&1
|
||||||
rm -r -f php5/ >> $DIR/install.log 2>&1
|
rm -r -f php5/ >> "$DIR/install.log" 2>&1
|
||||||
mkdir -m 0777 install_data >> $DIR/install.log 2>&1
|
mkdir -m 0777 install_data >> "$DIR/install.log" 2>&1
|
||||||
mkdir -m 0777 php5 >> $DIR/install.log 2>&1
|
mkdir -m 0777 php5 >> "$DIR/install.log" 2>&1
|
||||||
cd install_data
|
cd install_data
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
#PHP 5
|
#PHP 5
|
||||||
echo -n "[PHP] downloading $PHP_VERSION..."
|
echo -n "[PHP] downloading $PHP_VERSION..."
|
||||||
wget http://php.net/get/php-$PHP_VERSION.tar.gz/from/this/mirror -q -O - | tar -zx >> $DIR/install.log 2>&1
|
wget http://php.net/get/php-$PHP_VERSION.tar.gz/from/this/mirror -q -O - | tar -zx >> "$DIR/install.log" 2>&1
|
||||||
mv php-$PHP_VERSION php
|
mv php-$PHP_VERSION php
|
||||||
echo " done!"
|
echo " done!"
|
||||||
|
|
||||||
#zlib
|
#zlib
|
||||||
echo -n "[zlib] downloading $ZLIB_VERSION..."
|
echo -n "[zlib] downloading $ZLIB_VERSION..."
|
||||||
wget http://zlib.net/zlib-$ZLIB_VERSION.tar.gz -q -O - | tar -zx >> $DIR/install.log 2>&1
|
wget http://zlib.net/zlib-$ZLIB_VERSION.tar.gz -q -O - | tar -zx >> "$DIR/install.log" 2>&1
|
||||||
mv zlib-$ZLIB_VERSION zlib
|
mv zlib-$ZLIB_VERSION zlib
|
||||||
echo -n " checking..."
|
echo -n " checking..."
|
||||||
cd zlib
|
cd zlib
|
||||||
./configure --prefix=$DIR/install_data/php/ext/zlib \
|
./configure --prefix="$DIR/install_data/php/ext/zlib" \
|
||||||
--static >> $DIR/install.log 2>&1
|
--static >> "$DIR/install.log" 2>&1
|
||||||
echo -n " compiling..."
|
echo -n " compiling..."
|
||||||
make >> $DIR/install.log 2>&1
|
make >> "$DIR/install.log" 2>&1
|
||||||
echo -n " installing..."
|
echo -n " installing..."
|
||||||
make install >> $DIR/install.log 2>&1
|
make install >> "$DIR/install.log" 2>&1
|
||||||
echo -n " cleaning..."
|
echo -n " cleaning..."
|
||||||
cd ..
|
cd ..
|
||||||
rm -r -f ./zlib
|
rm -r -f ./zlib
|
||||||
@ -53,16 +53,16 @@ echo " done!"
|
|||||||
|
|
||||||
#Readline
|
#Readline
|
||||||
#echo -n "[Readline] downloading $READLINE_VERSION..."
|
#echo -n "[Readline] downloading $READLINE_VERSION..."
|
||||||
#wget ftp://ftp.cwru.edu/pub/bash/readline-$READLINE_VERSION.tar.gz -q -O - | tar -xz >> $DIR/install.log 2>&1
|
#wget ftp://ftp.cwru.edu/pub/bash/readline-$READLINE_VERSION.tar.gz -q -O - | tar -xz >> "$DIR/install.log" 2>&1
|
||||||
#mv readline-$READLINE_VERSION readline
|
#mv readline-$READLINE_VERSION readline
|
||||||
#echo -n " checking..."
|
#echo -n " checking..."
|
||||||
#cd readline
|
#cd readline
|
||||||
#./configure --prefix=$DIR/install_data/php/ext/readline \
|
#./configure --prefix="$DIR/install_data/php/ext/readline" \
|
||||||
#--disable-shared >> $DIR/install.log 2>&1
|
#--disable-shared >> "$DIR/install.log" 2>&1
|
||||||
#echo -n " compiling..."
|
#echo -n " compiling..."
|
||||||
#make >> $DIR/install.log 2>&1
|
#make >> "$DIR/install.log" 2>&1
|
||||||
#echo -n " installing..."
|
#echo -n " installing..."
|
||||||
#make install >> $DIR/install.log 2>&1
|
#make install >> "$DIR/install.log" 2>&1
|
||||||
#echo -n " cleaning..."
|
#echo -n " cleaning..."
|
||||||
#cd ..
|
#cd ..
|
||||||
#rm -r -f ./readine
|
#rm -r -f ./readine
|
||||||
@ -72,17 +72,17 @@ echo " done!"
|
|||||||
|
|
||||||
#GMP
|
#GMP
|
||||||
echo -n "[GMP] downloading $GMP_VERSION..."
|
echo -n "[GMP] downloading $GMP_VERSION..."
|
||||||
wget ftp://ftp.gmplib.org/pub/gmp-$GMP_VERSION/gmp-$GMP_VERSION.tar.bz2 -q -O - | tar -xj >> $DIR/install.log 2>&1
|
wget ftp://ftp.gmplib.org/pub/gmp-$GMP_VERSION/gmp-$GMP_VERSION.tar.bz2 -q -O - | tar -xj >> "$DIR/install.log" 2>&1
|
||||||
mv gmp-$GMP_VERSION gmp
|
mv gmp-$GMP_VERSION gmp
|
||||||
echo -n " checking..."
|
echo -n " checking..."
|
||||||
cd gmp
|
cd gmp
|
||||||
./configure --prefix=$DIR/install_data/php/ext/gmp \
|
./configure --prefix="$DIR/install_data/php/ext/gmp" \
|
||||||
--disable-assembly \
|
--disable-assembly \
|
||||||
--disable-shared >> $DIR/install.log 2>&1
|
--disable-shared >> "$DIR/install.log" 2>&1
|
||||||
echo -n " compiling..."
|
echo -n " compiling..."
|
||||||
make >> $DIR/install.log 2>&1
|
make >> "$DIR/install.log" 2>&1
|
||||||
echo -n " installing..."
|
echo -n " installing..."
|
||||||
make install >> $DIR/install.log 2>&1
|
make install >> "$DIR/install.log" 2>&1
|
||||||
echo -n " cleaning..."
|
echo -n " cleaning..."
|
||||||
cd ..
|
cd ..
|
||||||
rm -r -f ./gmp
|
rm -r -f ./gmp
|
||||||
@ -90,17 +90,17 @@ echo " done!"
|
|||||||
|
|
||||||
|
|
||||||
echo -n "[cURL] downloading $CURL_VERSION..."
|
echo -n "[cURL] downloading $CURL_VERSION..."
|
||||||
wget https://github.com/bagder/curl/archive/$CURL_VERSION.tar.gz --no-check-certificate -q -O - | tar -zx >> $DIR/install.log 2>&1
|
wget https://github.com/bagder/curl/archive/$CURL_VERSION.tar.gz --no-check-certificate -q -O - | tar -zx >> "$DIR/install.log" 2>&1
|
||||||
mv curl-$CURL_VERSION curl
|
mv curl-$CURL_VERSION curl
|
||||||
echo -n " checking..."
|
echo -n " checking..."
|
||||||
cd curl
|
cd curl
|
||||||
./buildconf >> $DIR/install.log 2>&1
|
./buildconf >> "$DIR/install.log" 2>&1
|
||||||
./configure --prefix=$DIR/install_data/php/ext/curl \
|
./configure --prefix="$DIR/install_data/php/ext/curl" \
|
||||||
--disable-shared >> $DIR/install.log 2>&1
|
--disable-shared >> "$DIR/install.log" 2>&1
|
||||||
echo -n " compiling..."
|
echo -n " compiling..."
|
||||||
make >> $DIR/install.log 2>&1
|
make >> "$DIR/install.log" 2>&1
|
||||||
echo -n " installing..."
|
echo -n " installing..."
|
||||||
make install >> $DIR/install.log 2>&1
|
make install >> "$DIR/install.log" 2>&1
|
||||||
echo -n " cleaning..."
|
echo -n " cleaning..."
|
||||||
cd ..
|
cd ..
|
||||||
rm -r -f ./curl
|
rm -r -f ./curl
|
||||||
@ -108,10 +108,11 @@ echo " done!"
|
|||||||
|
|
||||||
#pthreads
|
#pthreads
|
||||||
echo -n "[PHP pthreads] downloading $PTHREADS_VERSION..."
|
echo -n "[PHP pthreads] downloading $PTHREADS_VERSION..."
|
||||||
wget https://github.com/krakjoe/pthreads/archive/$PTHREADS_VERSION.tar.gz --no-check-certificate -q -O - | tar -zx >> $DIR/install.log 2>&1
|
wget https://github.com/krakjoe/pthreads/archive/$PTHREADS_VERSION.tar.gz --no-check-certificate -q -O - | tar -zx >> "$DIR/install.log" 2>&1
|
||||||
mv pthreads-$PTHREADS_VERSION $DIR/install_data/php/ext/pthreads
|
mv pthreads-$PTHREADS_VERSION "$DIR/install_data/php/ext/pthreads"
|
||||||
echo " done!"
|
echo " done!"
|
||||||
|
|
||||||
|
echo -n "[PHP]"
|
||||||
set +e
|
set +e
|
||||||
if which free >/dev/null; then
|
if which free >/dev/null; then
|
||||||
MAX_MEMORY=$(free -m | awk '/^Mem:/{print $2}')
|
MAX_MEMORY=$(free -m | awk '/^Mem:/{print $2}')
|
||||||
@ -126,16 +127,16 @@ else
|
|||||||
OPTIMIZATION=""
|
OPTIMIZATION=""
|
||||||
fi
|
fi
|
||||||
set -e
|
set -e
|
||||||
echo -n "[PHP] checking..."
|
echo -n " checking..."
|
||||||
cd php
|
cd php
|
||||||
./buildconf --force >> $DIR/install.log 2>&1
|
./buildconf --force >> ""$DIR/install.log"" 2>&1
|
||||||
./configure $OPTIMIZATION--prefix=$DIR/php5 \
|
./configure $OPTIMIZATION--prefix="$DIR/php5" \
|
||||||
--exec-prefix=$DIR/php5 \
|
--exec-prefix="$DIR/php5" \
|
||||||
--enable-embedded-mysqli \
|
--enable-embedded-mysqli \
|
||||||
--enable-bcmath \
|
--enable-bcmath \
|
||||||
--with-gmp=$DIR/install_data/php/ext/gmp \
|
--with-gmp="$DIR/install_data/php/ext/gmp" \
|
||||||
--with-curl=$DIR/install_data/php/ext/curl \
|
--with-curl="$DIR/install_data/php/ext/curl" \
|
||||||
--with-zlib=$DIR/install_data/php/ext/zlib \
|
--with-zlib="$DIR/install_data/php/ext/zlib" \
|
||||||
--disable-libxml \
|
--disable-libxml \
|
||||||
--disable-xml \
|
--disable-xml \
|
||||||
--disable-dom \
|
--disable-dom \
|
||||||
@ -156,16 +157,16 @@ cd php
|
|||||||
--enable-maintainer-zts \
|
--enable-maintainer-zts \
|
||||||
--enable-zend-signals \
|
--enable-zend-signals \
|
||||||
--with-zend-vm=$ZEND_VM \
|
--with-zend-vm=$ZEND_VM \
|
||||||
--enable-cli >> $DIR/install.log 2>&1
|
--enable-cli >> "$DIR/install.log" 2>&1
|
||||||
echo -n " compiling..."
|
echo -n " compiling..."
|
||||||
make >> $DIR/install.log 2>&1
|
make >> "$DIR/install.log" 2>&1
|
||||||
echo -n " installing..."
|
echo -n " installing..."
|
||||||
make install >> $DIR/install.log 2>&1
|
make install >> "$DIR/install.log" 2>&1
|
||||||
echo " done!"
|
echo " done!"
|
||||||
cd $DIR
|
cd "$DIR"
|
||||||
echo -n "[INFO] Cleaning up..."
|
echo -n "[INFO] Cleaning up..."
|
||||||
rm -r -f install_data/ >> $DIR/install.log 2>&1
|
rm -r -f install_data/ >> "$DIR/install.log" 2>&1
|
||||||
date >> $DIR/install.log 2>&1
|
date >> "$DIR/install.log" 2>&1
|
||||||
echo " done!"
|
echo " done!"
|
||||||
echo "[PocketMine] You should start the server now using \"./start.sh\""
|
echo "[PocketMine] You should start the server now using \"./start.sh\""
|
||||||
echo "[PocketMine] If it doesn't works, please send the \"install.log\" file to the Bug Tracker"
|
echo "[PocketMine] If it doesn't works, please send the \"install.log\" file to the Bug Tracker"
|
||||||
|
@ -167,7 +167,7 @@ class PlayerAPI{
|
|||||||
|
|
||||||
public function teleport($name, $target){
|
public function teleport($name, $target){
|
||||||
$target = $this->get($target);
|
$target = $this->get($target);
|
||||||
if($target !== false){
|
if(($target instanceof Player) and ($target->entity instanceof Entity)){
|
||||||
return $this->tppos($name, $target->entity->x, $target->entity->y, $target->entity->z);
|
return $this->tppos($name, $target->entity->x, $target->entity->y, $target->entity->z);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -175,7 +175,7 @@ class PlayerAPI{
|
|||||||
|
|
||||||
public function tppos($name, $x, $y, $z){
|
public function tppos($name, $x, $y, $z){
|
||||||
$player = $this->get($name);
|
$player = $this->get($name);
|
||||||
if($player !== false){
|
if(($player instanceof Player) and ($player->entity instanceof Entity)){
|
||||||
$player->entity->setPosition($x, $y, $z, 0, 0);
|
$player->entity->setPosition($x, $y, $z, 0, 0);
|
||||||
$player->fallY = false;
|
$player->fallY = false;
|
||||||
$player->fallStart = false;
|
$player->fallStart = false;
|
||||||
@ -273,8 +273,8 @@ class PlayerAPI{
|
|||||||
"y" => $this->server->spawn["y"],
|
"y" => $this->server->spawn["y"],
|
||||||
"z" => $this->server->spawn["z"],
|
"z" => $this->server->spawn["z"],
|
||||||
),
|
),
|
||||||
"inventory" => array_fill(0, 36, array(0, 0, 0)),
|
"inventory" => array_fill(0, 36, array(AIR, 0, 0)),
|
||||||
"armor" => array(0, 0, 0, 0),
|
"armor" => array_fill(0, 4, array(AIR, 0, 0)),
|
||||||
"health" => 20,
|
"health" => 20,
|
||||||
"lastIP" => "",
|
"lastIP" => "",
|
||||||
"lastID" => 0,
|
"lastID" => 0,
|
||||||
|
@ -352,6 +352,9 @@ class ServerAPI{
|
|||||||
if(file_exists($dir."level.dat")){
|
if(file_exists($dir."level.dat")){
|
||||||
$nbt = new NBT();
|
$nbt = new NBT();
|
||||||
$level = parseNBTData($nbt->loadFile($dir."level.dat"));
|
$level = parseNBTData($nbt->loadFile($dir."level.dat"));
|
||||||
|
if($level["LevelName"] == ""){
|
||||||
|
$level["LevelName"] = "world".time();
|
||||||
|
}
|
||||||
console("[DEBUG] Importing map \"".$level["LevelName"]."\" gamemode ".$level["GameType"]." with seed ".$level["RandomSeed"], true, true, 2);
|
console("[DEBUG] Importing map \"".$level["LevelName"]."\" gamemode ".$level["GameType"]." with seed ".$level["RandomSeed"], true, true, 2);
|
||||||
unset($level["Player"]);
|
unset($level["Player"]);
|
||||||
$lvName = $level["LevelName"]."/";
|
$lvName = $level["LevelName"]."/";
|
||||||
|
@ -47,7 +47,7 @@ class Player{
|
|||||||
var $spawned = false;
|
var $spawned = false;
|
||||||
var $inventory;
|
var $inventory;
|
||||||
public $equipment;
|
public $equipment;
|
||||||
var $armor = array(0, 0, 0, 0);
|
public $armor;
|
||||||
var $loggedIn = false;
|
var $loggedIn = false;
|
||||||
public $gamemode;
|
public $gamemode;
|
||||||
private $chunksLoaded = array();
|
private $chunksLoaded = array();
|
||||||
@ -62,6 +62,7 @@ class Player{
|
|||||||
$this->port = $port;
|
$this->port = $port;
|
||||||
$this->timeout = microtime(true) + 20;
|
$this->timeout = microtime(true) + 20;
|
||||||
$this->inventory = array_fill(0, 36, array(AIR, 0, 0));
|
$this->inventory = array_fill(0, 36, array(AIR, 0, 0));
|
||||||
|
$this->armor = array_fill(0, 4, array(AIR, 0, 0));
|
||||||
$this->gamemode = $this->server->gamemode;
|
$this->gamemode = $this->server->gamemode;
|
||||||
if($this->gamemode === 0 or $this->gamemode === 2){
|
if($this->gamemode === 0 or $this->gamemode === 2){
|
||||||
$this->equipment = BlockAPI::getItem(AIR);
|
$this->equipment = BlockAPI::getItem(AIR);
|
||||||
@ -267,7 +268,14 @@ class Player{
|
|||||||
case "player.armor":
|
case "player.armor":
|
||||||
if($data["eid"] === $this->eid){
|
if($data["eid"] === $this->eid){
|
||||||
$data["eid"] = 0;
|
$data["eid"] = 0;
|
||||||
$this->armor = array($data["slot0"], $data["slot1"], $data["slot2"], $data["slot3"]);
|
$this->armor = array();
|
||||||
|
for($i = 0; $i < 4; ++$i){
|
||||||
|
if($data["slot".$i] > 0){
|
||||||
|
$this->armor[$i] = array($data["slot".$i] + 256, 0, 1);
|
||||||
|
}else{
|
||||||
|
$this->armor[$i] = array(AIR, 0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
$this->dataPacket(MC_PLAYER_ARMOR_EQUIPMENT, $data);
|
$this->dataPacket(MC_PLAYER_ARMOR_EQUIPMENT, $data);
|
||||||
}else{
|
}else{
|
||||||
$this->dataPacket(MC_PLAYER_ARMOR_EQUIPMENT, $data);
|
$this->dataPacket(MC_PLAYER_ARMOR_EQUIPMENT, $data);
|
||||||
@ -581,25 +589,13 @@ class Player{
|
|||||||
$this->evid[] = $this->server->event("player.pickup", array($this, "eventHandler"));
|
$this->evid[] = $this->server->event("player.pickup", array($this, "eventHandler"));
|
||||||
$this->evid[] = $this->server->event("block.change", array($this, "eventHandler"));
|
$this->evid[] = $this->server->event("block.change", array($this, "eventHandler"));
|
||||||
$this->evid[] = $this->server->event("player.block.place", array($this, "eventHandler"));
|
$this->evid[] = $this->server->event("player.block.place", array($this, "eventHandler"));
|
||||||
$this->server->api->dhandle("player.armor", array("eid" => $this->eid, "slot0" => $this->armor[0], "slot1" => $this->armor[1], "slot2" => $this->armor[2], "slot3" => $this->armor[3]));
|
$this->server->api->dhandle("player.armor", array("eid" => $this->eid, "slot0" => ($this->armor[0][0] > 0 ? ($this->armor[0][0] - 256):AIR), "slot1" => ($this->armor[1][0] > 0 ? ($this->armor[1][0] - 256):AIR), "slot2" => ($this->armor[2][0] > 0 ? ($this->armor[2][0] - 256):AIR), "slot3" => ($this->armor[3][0] > 0 ? ($this->armor[3][0] - 256):AIR)));
|
||||||
console("[DEBUG] Player \"".$this->username."\" EID ".$this->eid." spawned at X ".$this->entity->x." Y ".$this->entity->y." Z ".$this->entity->z, true, true, 2);
|
console("[DEBUG] Player \"".$this->username."\" EID ".$this->eid." spawned at X ".$this->entity->x." Y ".$this->entity->y." Z ".$this->entity->z, true, true, 2);
|
||||||
$this->eventHandler(new Container($this->server->motd), "server.chat");
|
$this->eventHandler(new Container($this->server->motd), "server.chat");
|
||||||
if($this->MTU <= 548){
|
if($this->MTU <= 548){
|
||||||
$this->eventHandler("Your connection is bad, you may experience lag and slow map loading.", "server.chat");
|
$this->eventHandler("Your connection is bad, you may experience lag and slow map loading.", "server.chat");
|
||||||
}
|
}
|
||||||
foreach($this->inventory as $s => $data){
|
$this->sendInventory();
|
||||||
if($data[0] > 0 and $data[2] >= 0){
|
|
||||||
$e = $this->server->api->entity->add(ENTITY_ITEM, $data[0], array(
|
|
||||||
"x" => $this->entity->x + 0.5,
|
|
||||||
"y" => $this->entity->y + 0.19,
|
|
||||||
"z" => $this->entity->z + 0.5,
|
|
||||||
"meta" => $data[1],
|
|
||||||
"stack" => $data[2],
|
|
||||||
));
|
|
||||||
$this->server->api->entity->spawnTo($e->eid, $this);
|
|
||||||
}
|
|
||||||
$this->inventory[$s] = array(0, 0, 0);
|
|
||||||
}
|
|
||||||
$this->entity->setPosition($this->entity->x, $this->entity->y, $this->entity->z, 0, 0);
|
$this->entity->setPosition($this->entity->x, $this->entity->y, $this->entity->z, 0, 0);
|
||||||
/*
|
/*
|
||||||
0x01 world_inmutable
|
0x01 world_inmutable
|
||||||
@ -794,6 +790,45 @@ class Player{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function sendInventory(){
|
||||||
|
foreach($this->inventory as $s => $data){
|
||||||
|
if($data[0] > 0 and $data[2] >= 0){
|
||||||
|
$e = $this->server->api->entity->add(ENTITY_ITEM, $data[0], array(
|
||||||
|
"x" => $this->entity->x + 0.5,
|
||||||
|
"y" => $this->entity->y + 0.19,
|
||||||
|
"z" => $this->entity->z + 0.5,
|
||||||
|
"meta" => $data[1],
|
||||||
|
"stack" => $data[2],
|
||||||
|
));
|
||||||
|
$this->server->api->entity->spawnTo($e->eid, $this);
|
||||||
|
}
|
||||||
|
$this->inventory[$s] = array(AIR, 0, 0);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
//Future
|
||||||
|
$inv = array();
|
||||||
|
foreach($this->inventory as $s => $data){
|
||||||
|
if($data[0] > 0 and $data[2] >= 0){
|
||||||
|
$inv[] = BlockAPI::getItem($data[0], $data[1], $data[2]);
|
||||||
|
}else{
|
||||||
|
$inv[] = BlockAPI::getItem(AIR, 0, 0);
|
||||||
|
$this->inventory[$s] = array(AIR, 0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->dataPacket(MC_SEND_INVENTORY, array(
|
||||||
|
"eid" => 0,
|
||||||
|
"windowid" => 0,
|
||||||
|
"slots" => $inv,
|
||||||
|
"armor" => array(
|
||||||
|
0 => BlockAPI::getItem($this->armor[0][0], $this->armor[0][1], $this->armor[0][2], $this->armor[0][3]),
|
||||||
|
1 => BlockAPI::getItem($this->armor[1][0], $this->armor[1][1], $this->armor[1][2], $this->armor[1][3]),
|
||||||
|
2 => BlockAPI::getItem($this->armor[2][0], $this->armor[2][1], $this->armor[2][2], $this->armor[2][3]),
|
||||||
|
3 => BlockAPI::getItem($this->armor[3][0], $this->armor[3][1], $this->armor[3][2], $this->armor[3][3]),
|
||||||
|
),
|
||||||
|
));
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
public function send($pid, $data = array(), $raw = false){
|
public function send($pid, $data = array(), $raw = false){
|
||||||
if($this->connected === true){
|
if($this->connected === true){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user