mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 08:17:34 +00:00
Inventory array
This commit is contained in:
parent
937888a655
commit
bff4d92bcd
@ -45,6 +45,7 @@ class Player{
|
||||
var $CID;
|
||||
var $MTU;
|
||||
var $spawned = false;
|
||||
var $inventory = array();
|
||||
var $equipment = array(1, 0);
|
||||
function __construct(PocketMinecraftServer $server, $clientID, $ip, $port, $MTU){
|
||||
$this->MTU = $MTU;
|
||||
@ -125,6 +126,7 @@ class Player{
|
||||
case "player.pickup":
|
||||
if($data["eid"] === $this->eid){
|
||||
$data["eid"] = 0;
|
||||
$this->inventory[] = array($data["entity"]->type, $data["entity"]->meta, $data["entity"]->stack);
|
||||
}
|
||||
$this->dataPacket(MC_TAKE_ITEM_ENTITY, $data);
|
||||
break;
|
||||
|
@ -79,12 +79,13 @@ class Entity extends stdClass{
|
||||
}
|
||||
|
||||
public function update(){
|
||||
$this->server->api->dhandle("entity.move", $this);
|
||||
if($this->class === ENTITY_ITEM and $this->closed === false){
|
||||
$this->server->api->dhandle("entity.move", $this);
|
||||
$player = $this->server->query("SELECT EID FROM entities WHERE class == ".ENTITY_PLAYER." AND abs(x - {$this->x}) <= 1.5 AND abs(y - {$this->y}) <= 1.5 AND abs(z - {$this->z}) <= 1.5 LIMIT 1;", true);
|
||||
if($player !== true and $player !== false){
|
||||
if($this->server->api->dhandle("player.pickup", array(
|
||||
"eid" => $player["EID"],
|
||||
"entity" => $this,
|
||||
"block" => $this->type,
|
||||
"meta" => $this->meta,
|
||||
"target" => $this->eid
|
||||
|
Loading…
x
Reference in New Issue
Block a user