mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 09:56:06 +00:00
Changed all Player packets to new network
This commit is contained in:
@ -572,7 +572,7 @@ class Entity extends Position{
|
||||
$players = $this->server->api->player->getAll($this->level);
|
||||
if($this->player instanceof Player){
|
||||
unset($players[$this->player->CID]);
|
||||
$this->server->api->player->broadcastPacket($players, MC_MOVE_PLAYER, array(
|
||||
$this->server->api->player->broadcastPacket($players, ProtocolInfo::MOVE_PLAYER_PACKET, array(
|
||||
"eid" => $this->eid,
|
||||
"x" => $this->x,
|
||||
"y" => $this->y,
|
||||
@ -582,7 +582,7 @@ class Entity extends Position{
|
||||
"bodyYaw" => $this->yaw,
|
||||
));
|
||||
}else{
|
||||
$this->server->api->player->broadcastPacket($players, MC_MOVE_ENTITY_POSROT, array(
|
||||
$this->server->api->player->broadcastPacket($players, ProtocolInfo::MOVE_ENTITY_POSROT_PACKET, array(
|
||||
"eid" => $this->eid,
|
||||
"x" => $this->x,
|
||||
"y" => $this->y,
|
||||
@ -661,7 +661,7 @@ class Entity extends Position{
|
||||
if($this->player->connected !== true or $this->player->spawned === false){
|
||||
return false;
|
||||
}
|
||||
$player->dataPacket(MC_ADD_PLAYER, array(
|
||||
$player->dataPacket(ProtocolInfo::ADD_PLAYER_PACKET, array(
|
||||
"clientID" => 0,/*$this->player->clientID,*/
|
||||
"username" => $this->player->username,
|
||||
"eid" => $this->eid,
|
||||
@ -674,7 +674,7 @@ class Entity extends Position{
|
||||
"unknown2" => 0,
|
||||
"metadata" => $this->getMetadata(),
|
||||
));
|
||||
$player->dataPacket(MC_PLAYER_EQUIPMENT, array(
|
||||
$player->dataPacket(ProtocolInfo::PLAYER_EQUIPMENT_PACKET, array(
|
||||
"eid" => $this->eid,
|
||||
"block" => $this->player->getSlot($this->player->slot)->getID(),
|
||||
"meta" => $this->player->getSlot($this->player->slot)->getMetadata(),
|
||||
@ -683,7 +683,7 @@ class Entity extends Position{
|
||||
$this->player->sendArmor($player);
|
||||
break;
|
||||
case ENTITY_ITEM:
|
||||
$player->dataPacket(MC_ADD_ITEM_ENTITY, array(
|
||||
$player->dataPacket(ProtocolInfo::ADD_ITEM_ENTITY_PACKET, array(
|
||||
"eid" => $this->eid,
|
||||
"x" => $this->x,
|
||||
"y" => $this->y,
|
||||
@ -695,7 +695,7 @@ class Entity extends Position{
|
||||
"meta" => $this->meta,
|
||||
"stack" => $this->stack,
|
||||
));
|
||||
$player->dataPacket(MC_SET_ENTITY_MOTION, array(
|
||||
$player->dataPacket(ProtocolInfo::SET_ENTITY_MOTION_PACKET, array(
|
||||
"eid" => $this->eid,
|
||||
"speedX" => (int) ($this->speedX * 400),
|
||||
"speedY" => (int) ($this->speedY * 400),
|
||||
@ -703,7 +703,7 @@ class Entity extends Position{
|
||||
));
|
||||
break;
|
||||
case ENTITY_MOB:
|
||||
$player->dataPacket(MC_ADD_MOB, array(
|
||||
$player->dataPacket(ProtocolInfo::ADD_MOB_PACKET, array(
|
||||
"type" => $this->type,
|
||||
"eid" => $this->eid,
|
||||
"x" => $this->x,
|
||||
@ -713,7 +713,7 @@ class Entity extends Position{
|
||||
"pitch" => 0,
|
||||
"metadata" => $this->getMetadata(),
|
||||
));
|
||||
$player->dataPacket(MC_SET_ENTITY_MOTION, array(
|
||||
$player->dataPacket(ProtocolInfo::SET_ENTITY_MOTION_PACKET, array(
|
||||
"eid" => $this->eid,
|
||||
"speedX" => (int) ($this->speedX * 400),
|
||||
"speedY" => (int) ($this->speedY * 400),
|
||||
@ -722,7 +722,7 @@ class Entity extends Position{
|
||||
break;
|
||||
case ENTITY_OBJECT:
|
||||
if($this->type === OBJECT_PAINTING){
|
||||
$player->dataPacket(MC_ADD_PAINTING, array(
|
||||
$player->dataPacket(ProtocolInfo::ADD_PAINTING_PACKET, array(
|
||||
"eid" => $this->eid,
|
||||
"x" => (int) $this->x,
|
||||
"y" => (int) $this->y,
|
||||
@ -731,7 +731,7 @@ class Entity extends Position{
|
||||
"title" => $this->data["Motive"],
|
||||
));
|
||||
}elseif($this->type === OBJECT_PRIMEDTNT){
|
||||
$player->dataPacket(MC_ADD_ENTITY, array(
|
||||
$player->dataPacket(ProtocolInfo::ADD_ENTITY_PACKET, array(
|
||||
"eid" => $this->eid,
|
||||
"type" => $this->type,
|
||||
"x" => $this->x,
|
||||
@ -740,7 +740,7 @@ class Entity extends Position{
|
||||
"did" => 0,
|
||||
));
|
||||
}elseif($this->type === OBJECT_ARROW){
|
||||
$player->dataPacket(MC_ADD_ENTITY, array(
|
||||
$player->dataPacket(ProtocolInfo::ADD_ENTITY_PACKET, array(
|
||||
"eid" => $this->eid,
|
||||
"type" => $this->type,
|
||||
"x" => $this->x,
|
||||
@ -748,7 +748,7 @@ class Entity extends Position{
|
||||
"z" => $this->z,
|
||||
"did" => 0,
|
||||
));
|
||||
$player->dataPacket(MC_SET_ENTITY_MOTION, array(
|
||||
$player->dataPacket(ProtocolInfo::SET_ENTITY_MOTION_PACKET, array(
|
||||
"eid" => $this->eid,
|
||||
"speedX" => (int) ($this->speedX * 400),
|
||||
"speedY" => (int) ($this->speedY * 400),
|
||||
@ -757,7 +757,7 @@ class Entity extends Position{
|
||||
}
|
||||
break;
|
||||
case ENTITY_FALLING:
|
||||
$player->dataPacket(MC_ADD_ENTITY, array(
|
||||
$player->dataPacket(ProtocolInfo::ADD_ENTITY_PACKET, array(
|
||||
"eid" => $this->eid,
|
||||
"type" => $this->type,
|
||||
"x" => $this->x,
|
||||
@ -765,7 +765,7 @@ class Entity extends Position{
|
||||
"z" => $this->z,
|
||||
"did" => -$this->data["Tile"],
|
||||
));
|
||||
$player->dataPacket(MC_SET_ENTITY_MOTION, array(
|
||||
$player->dataPacket(ProtocolInfo::SET_ENTITY_MOTION_PACKET, array(
|
||||
"eid" => $this->eid,
|
||||
"speedX" => (int) ($this->speedX * 400),
|
||||
"speedY" => (int) ($this->speedY * 400),
|
||||
@ -981,7 +981,7 @@ class Entity extends Position{
|
||||
$this->server->api->dhandle("entity.event", array("entity" => $this, "event" => 2)); //Ouch! sound
|
||||
}
|
||||
if($this->player instanceof Player){
|
||||
$this->player->dataPacket(MC_SET_HEALTH, array(
|
||||
$this->player->dataPacket(ProtocolInfo::SET_HEALTH_PACKET, array(
|
||||
"health" => $this->health,
|
||||
));
|
||||
}
|
||||
@ -995,7 +995,7 @@ class Entity extends Position{
|
||||
$this->updateMetadata();
|
||||
$this->dead = true;
|
||||
if($this->player instanceof Player){
|
||||
$this->server->api->player->broadcastPacket($this->server->api->player->getAll($this->level), MC_MOVE_ENTITY_POSROT, array(
|
||||
$this->server->api->player->broadcastPacket($this->server->api->player->getAll($this->level), ProtocolInfo::MOVE_ENTITY_POSROT_PACKET, array(
|
||||
"eid" => $this->eid,
|
||||
"x" => -256,
|
||||
"y" => 128,
|
||||
|
@ -114,7 +114,7 @@ class Explosion{
|
||||
$this->level->level->setBlockID($block->x, $block->y, $block->z, 0);
|
||||
$send[] = new Vector3($block->x - $source->x, $block->y - $source->y, $block->z - $source->z);
|
||||
}
|
||||
$server->api->player->broadcastPacket($server->api->player->getAll($this->level), MC_EXPLOSION, array(
|
||||
$server->api->player->broadcastPacket($server->api->player->getAll($this->level), ProtocolInfo::EXPLOSION_PACKET, array(
|
||||
"x" => $this->source->x,
|
||||
"y" => $this->source->y,
|
||||
"z" => $this->source->z,
|
||||
|
@ -78,7 +78,7 @@ class Level{
|
||||
}
|
||||
if($this->server->api->dhandle("time.change", array("level" => $this, "time" => $time)) !== false){
|
||||
$this->time = $time;
|
||||
$this->server->api->player->broadcastPacket($this->players, MC_SET_TIME, array(
|
||||
$this->server->api->player->broadcastPacket($this->players, ProtocolInfo::SET_TIME_PACKET, array(
|
||||
"time" => (int) $this->time,
|
||||
"started" => $this->stopTime == false,
|
||||
));
|
||||
@ -109,7 +109,7 @@ class Level{
|
||||
if(count($this->changedBlocks) > 0){
|
||||
foreach($this->changedBlocks as $blocks){
|
||||
foreach($blocks as $b){
|
||||
$this->server->api->player->broadcastPacket($this->players, MC_UPDATE_BLOCK, array(
|
||||
$this->server->api->player->broadcastPacket($this->players, ProtocolInfo::UPDATE_BLOCK_PACKET, array(
|
||||
"x" => $b->x,
|
||||
"y" => $b->y,
|
||||
"z" => $b->z,
|
||||
@ -286,7 +286,7 @@ class Level{
|
||||
public function setBlockRaw(Vector3 $pos, Block $block, $direct = true, $send = true){
|
||||
if(($ret = $this->level->setBlock($pos->x, $pos->y, $pos->z, $block->getID(), $block->getMetadata())) === true and $send !== false){
|
||||
if($direct === true){
|
||||
$this->server->api->player->broadcastPacket($this->players, MC_UPDATE_BLOCK, array(
|
||||
$this->server->api->player->broadcastPacket($this->players, ProtocolInfo::UPDATE_BLOCK_PACKET, array(
|
||||
"x" => $pos->x,
|
||||
"y" => $pos->y,
|
||||
"z" => $pos->z,
|
||||
@ -326,7 +326,7 @@ class Level{
|
||||
$block->position($pos);
|
||||
|
||||
if($direct === true){
|
||||
$this->server->api->player->broadcastPacket($this->players, MC_UPDATE_BLOCK, array(
|
||||
$this->server->api->player->broadcastPacket($this->players, ProtocolInfo::UPDATE_BLOCK_PACKET, array(
|
||||
"x" => $pos->x,
|
||||
"y" => $pos->y,
|
||||
"z" => $pos->z,
|
||||
|
@ -142,7 +142,7 @@ class Tile extends Position{
|
||||
}else{
|
||||
$player->windows[$id] = $this;
|
||||
}
|
||||
$player->dataPacket(MC_CONTAINER_OPEN, array(
|
||||
$player->dataPacket(ProtocolInfo::CONTAINER_OPEN_PACKET, array(
|
||||
"windowid" => $id,
|
||||
"type" => WINDOW_CHEST,
|
||||
"slots" => is_array($player->windows[$id]) ? CHEST_SLOTS << 1:CHEST_SLOTS,
|
||||
@ -155,7 +155,7 @@ class Tile extends Position{
|
||||
if(is_array($player->windows[$id])){
|
||||
$all = $this->server->api->player->getAll($this->level);
|
||||
foreach($player->windows[$id] as $ob){
|
||||
$this->server->api->player->broadcastPacket($all, MC_TILE_EVENT, array(
|
||||
$this->server->api->player->broadcastPacket($all, ProtocolInfo::TILE_EVENT_PACKET, array(
|
||||
"x" => $ob->x,
|
||||
"y" => $ob->y,
|
||||
"z" => $ob->z,
|
||||
@ -172,7 +172,7 @@ class Tile extends Position{
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$this->server->api->player->broadcastPacket($this->server->api->player->getAll($this->level), MC_TILE_EVENT, array(
|
||||
$this->server->api->player->broadcastPacket($this->server->api->player->getAll($this->level), ProtocolInfo::TILE_EVENT_PACKET, array(
|
||||
"x" => $this->x,
|
||||
"y" => $this->y,
|
||||
"z" => $this->z,
|
||||
@ -188,7 +188,7 @@ class Tile extends Position{
|
||||
}
|
||||
}
|
||||
}
|
||||
$player->dataPacket(MC_CONTAINER_SET_CONTENT, array(
|
||||
$player->dataPacket(ProtocolInfo::CONTAINER_SET_CONTENT_PACKET, array(
|
||||
"windowid" => $id,
|
||||
"count" => count($slots),
|
||||
"slots" => $slots,
|
||||
@ -198,7 +198,7 @@ class Tile extends Position{
|
||||
$player->windowCnt++;
|
||||
$player->windowCnt = $id = max(2, $player->windowCnt % 99);
|
||||
$player->windows[$id] = $this;
|
||||
$player->dataPacket(MC_CONTAINER_OPEN, array(
|
||||
$player->dataPacket(ProtocolInfo::CONTAINER_OPEN_PACKET, array(
|
||||
"windowid" => $id,
|
||||
"type" => WINDOW_FURNACE,
|
||||
"slots" => FURNACE_SLOTS,
|
||||
@ -215,7 +215,7 @@ class Tile extends Position{
|
||||
$slots[] = BlockAPI::getItem(AIR, 0, 0);
|
||||
}
|
||||
}
|
||||
$player->dataPacket(MC_CONTAINER_SET_CONTENT, array(
|
||||
$player->dataPacket(ProtocolInfo::CONTAINER_SET_CONTENT_PACKET, array(
|
||||
"windowid" => $id,
|
||||
"count" => count($slots),
|
||||
"slots" => $slots
|
||||
@ -383,7 +383,7 @@ class Tile extends Position{
|
||||
|
||||
$nbt->write(chr(NBT::TAG_END));
|
||||
|
||||
$player->dataPacket(MC_ENTITY_DATA, array(
|
||||
$player->dataPacket(ProtocolInfo::ENTITY_DATA_PACKET, array(
|
||||
"x" => $this->x,
|
||||
"y" => $this->y,
|
||||
"z" => $this->z,
|
||||
@ -428,7 +428,7 @@ class Tile extends Position{
|
||||
|
||||
$nbt->write(chr(NBT::TAG_END));
|
||||
|
||||
$player->dataPacket(MC_ENTITY_DATA, array(
|
||||
$player->dataPacket(ProtocolInfo::ENTITY_DATA_PACKET, array(
|
||||
"x" => $this->x,
|
||||
"y" => $this->y,
|
||||
"z" => $this->z,
|
||||
|
Reference in New Issue
Block a user