This commit is contained in:
Michael Yoo 2013-01-18 21:30:40 +09:00
commit 8c92bc7c14
2 changed files with 4 additions and 1 deletions

View File

@ -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;

View File

@ -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