Changed all Player packets to new network

This commit is contained in:
Shoghi Cervantes 2014-02-07 16:44:10 +01:00
parent eb375be550
commit 95bff304e4
15 changed files with 548 additions and 474 deletions

View File

@ -317,7 +317,7 @@ class BlockAPI{
} }
private function cancelAction(Block $block, Player $player, $send = true){ private function cancelAction(Block $block, Player $player, $send = true){
$player->dataPacket(MC_UPDATE_BLOCK, array( $player->dataPacket(ProtocolInfo::UPDATE_BLOCK_PACKET, array(
"x" => $block->x, "x" => $block->x,
"y" => $block->y, "y" => $block->y,
"z" => $block->z, "z" => $block->z,

View File

@ -157,12 +157,12 @@ class EntityAPI{
$entity->closed = true; $entity->closed = true;
$this->server->query("DELETE FROM entities WHERE EID = ".$eid.";"); $this->server->query("DELETE FROM entities WHERE EID = ".$eid.";");
if($entity->class === ENTITY_PLAYER){ if($entity->class === ENTITY_PLAYER){
$this->server->api->player->broadcastPacket($this->server->api->player->getAll(), MC_REMOVE_PLAYER, array( $this->server->api->player->broadcastPacket($this->server->api->player->getAll(), ProtocolInfo::REMOVE_PLAYER_PACKET, array(
"clientID" => 0, "clientID" => 0,
"eid" => $entity->eid, "eid" => $entity->eid,
)); ));
}else{ }else{
$this->server->api->player->broadcastPacket($this->server->api->player->getAll($entity->level), MC_REMOVE_ENTITY, array( $this->server->api->player->broadcastPacket($this->server->api->player->getAll($entity->level), ProtocolInfo::REMOVE_ENTITY_PACKET, array(
"eid" => $entity->eid, "eid" => $entity->eid,
)); ));
} }

View File

@ -402,7 +402,7 @@ class PlayerAPI{
if($p !== $player and ($p->entity instanceof Entity)){ if($p !== $player and ($p->entity instanceof Entity)){
$p->entity->spawn($player); $p->entity->spawn($player);
if($p->level !== $player->level){ if($p->level !== $player->level){
$player->dataPacket(MC_MOVE_ENTITY_POSROT, array( $player->dataPacket(ProtocolInfo::MOVE_ENTITY_POSROT_PACKET, array(
"eid" => $p->entity->eid, "eid" => $p->entity->eid,
"x" => -256, "x" => -256,
"y" => 128, "y" => 128,
@ -420,7 +420,7 @@ class PlayerAPI{
if($p !== $player and ($p->entity instanceof Entity) and ($player->entity instanceof Entity)){ if($p !== $player and ($p->entity instanceof Entity) and ($player->entity instanceof Entity)){
$player->entity->spawn($p); $player->entity->spawn($p);
if($p->level !== $player->level){ if($p->level !== $player->level){
$p->dataPacket(MC_MOVE_ENTITY_POSROT, array( $p->dataPacket(ProtocolInfo::MOVE_ENTITY_POSROT_PACKET, array(
"eid" => $player->entity->eid, "eid" => $player->entity->eid,
"x" => -256, "x" => -256,
"y" => 128, "y" => 128,

View File

@ -256,7 +256,7 @@ class ServerAPI{
"memory_usage" => memory_get_usage(true), "memory_usage" => memory_get_usage(true),
"php_version" => PHP_VERSION, "php_version" => PHP_VERSION,
"version" => MAJOR_VERSION, "version" => MAJOR_VERSION,
"mc_version" => CURRENT_MINECRAFT_VERSION, "ProtocolInfo::version_PACKET" => CURRENT_MINECRAFT_VERSION,
"protocol" => ProtocolInfo::CURRENT_PROTOCOL, "protocol" => ProtocolInfo::CURRENT_PROTOCOL,
"online" => count($this->server->clients), "online" => count($this->server->clients),
"max" => $this->server->maxClients, "max" => $this->server->maxClients,

File diff suppressed because it is too large Load Diff

View File

@ -474,7 +474,7 @@ class PocketMinecraftServer{
public static function clientID($ip, $port){ public static function clientID($ip, $port){
//return crc32($ip . $port) ^ crc32($port . $ip . BOOTUP_RANDOM); //return crc32($ip . $port) ^ crc32($port . $ip . BOOTUP_RANDOM);
return md5($ip . ":" . $port . BOOTUP_RANDOM, true); return $ip . ":" . $port;
} }
public function packetHandler(Packet $packet){ public function packetHandler(Packet $packet){

View File

@ -125,7 +125,7 @@ class DoorBlock extends TransparentBlock{
$this->level->setBlock($down, BlockAPI::get($this->id, $meta), true, false, true); $this->level->setBlock($down, BlockAPI::get($this->id, $meta), true, false, true);
$players = ServerAPI::request()->api->player->getAll($this->level); $players = ServerAPI::request()->api->player->getAll($this->level);
unset($players[$player->CID]); unset($players[$player->CID]);
ServerAPI::request()->api->player->broadcastPacket($players, MC_LEVEL_EVENT, array( ServerAPI::request()->api->player->broadcastPacket($players, ProtocolInfo::LEVEL_EVENT_PACKET, array(
"x" => $this->x, "x" => $this->x,
"y" => $this->y, "y" => $this->y,
"z" => $this->z, "z" => $this->z,
@ -140,7 +140,7 @@ class DoorBlock extends TransparentBlock{
$this->level->setBlock($this, $this, true, false, true); $this->level->setBlock($this, $this, true, false, true);
$players = ServerAPI::request()->api->player->getAll($this->level); $players = ServerAPI::request()->api->player->getAll($this->level);
unset($players[$player->CID]); unset($players[$player->CID]);
ServerAPI::request()->api->player->broadcastPacket($players, MC_LEVEL_EVENT, array( ServerAPI::request()->api->player->broadcastPacket($players, ProtocolInfo::LEVEL_EVENT_PACKET, array(
"x" => $this->x, "x" => $this->x,
"y" => $this->y, "y" => $this->y,
"z" => $this->z, "z" => $this->z,

View File

@ -29,7 +29,7 @@ class BedBlock extends TransparentBlock{
public function onActivate(Item $item, Player $player){ public function onActivate(Item $item, Player $player){
if(ServerAPI::request()->api->time->getPhase($player->level) !== "night"){ if(ServerAPI::request()->api->time->getPhase($player->level) !== "night"){
$player->dataPacket(MC_CLIENT_MESSAGE, array( $player->dataPacket(ProtocolInfo::CHAT_PACKET, array(
"message" => "You can only sleep at night" "message" => "You can only sleep at night"
)); ));
return true; return true;
@ -51,7 +51,7 @@ class BedBlock extends TransparentBlock{
}elseif($blockWest->getID() === $this->id and ($blockWest->meta & 0x08) === 0x08){ }elseif($blockWest->getID() === $this->id and ($blockWest->meta & 0x08) === 0x08){
$b = $blockWest; $b = $blockWest;
}else{ }else{
$player->dataPacket(MC_CLIENT_MESSAGE, array( $player->dataPacket(ProtocolInfo::CHAT_PACKET, array(
"message" => "The bed is incomplete" "message" => "The bed is incomplete"
)); ));
return true; return true;
@ -59,7 +59,7 @@ class BedBlock extends TransparentBlock{
} }
if($player->sleepOn($b) === false){ if($player->sleepOn($b) === false){
$player->dataPacket(MC_CLIENT_MESSAGE, array( $player->dataPacket(ProtocolInfo::CHAT_PACKET, array(
"message" => "This bed is occupied" "message" => "This bed is occupied"
)); ));
} }

View File

@ -39,6 +39,7 @@ class PlayerEquipmentPacket extends RakNetDataPacket{
public function encode(){ public function encode(){
$this->reset(); $this->reset();
$this->putInt($this->eid); $this->putInt($this->eid);
$this->putShort($this->item);
$this->putShort($this->meta); $this->putShort($this->meta);
$this->putByte($this->slot); $this->putByte($this->slot);
} }

View File

@ -36,9 +36,9 @@ class SetEntityMotionPacket extends RakNetDataPacket{
public function encode(){ public function encode(){
$this->reset(); $this->reset();
$this->putInt($this->eid); $this->putInt($this->eid);
$this->putShort($this->speedX); $this->putShort((int) ($this->speedX * 400));
$this->putShort($this->speedY); $this->putShort((int) ($this->speedY * 400));
$this->putShort($this->speedZ); $this->putShort((int) ($this->speedZ * 400));
} }
} }

View File

@ -151,7 +151,7 @@ class RakNetParser{
or $reliability === 7){ or $reliability === 7){
$messageIndex = $this->getLTriad(); $messageIndex = $this->getLTriad();
}else{ }else{
$messageIndex = 0; $messageIndex = false;
} }
if($reliability === 1 if($reliability === 1
@ -161,8 +161,8 @@ class RakNetParser{
$orderIndex = $this->getLTriad(); $orderIndex = $this->getLTriad();
$orderChannel = $this->getByte(); $orderChannel = $this->getByte();
}else{ }else{
$orderIndex = 0; $orderIndex = false;
$orderChannel = 0; $orderChannel = false;
} }
if($hasSplit == true){ if($hasSplit == true){
@ -172,14 +172,14 @@ class RakNetParser{
//error! no split packets allowed! //error! no split packets allowed!
return false; return false;
}else{ }else{
$splitCount = 0; $splitCount = false;
$splitID = 0; $splitID = false;
$splitIndex = 0; $splitIndex = false;
} }
if($length <= 0 if($length <= 0
or $orderChannel >= 32 or $orderChannel >= 32
or ($hasSplit === 1 and $splitIndex >= $splitCount)){ or ($hasSplit === true and $splitIndex >= $splitCount)){
return false; return false;
} }
@ -191,7 +191,7 @@ class RakNetParser{
$data->packetID = $pid; $data->packetID = $pid;
} }
$data->reliability = $reliability; $data->reliability = $reliability;
$data->hasSplit = $hasSplit == true; $data->hasSplit = $hasSplit;
$data->messageIndex = $messageIndex; $data->messageIndex = $messageIndex;
$data->orderIndex = $orderIndex; $data->orderIndex = $orderIndex;
$data->orderChannel = $orderChannel; $data->orderChannel = $orderChannel;

View File

@ -572,7 +572,7 @@ class Entity extends Position{
$players = $this->server->api->player->getAll($this->level); $players = $this->server->api->player->getAll($this->level);
if($this->player instanceof Player){ if($this->player instanceof Player){
unset($players[$this->player->CID]); 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, "eid" => $this->eid,
"x" => $this->x, "x" => $this->x,
"y" => $this->y, "y" => $this->y,
@ -582,7 +582,7 @@ class Entity extends Position{
"bodyYaw" => $this->yaw, "bodyYaw" => $this->yaw,
)); ));
}else{ }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, "eid" => $this->eid,
"x" => $this->x, "x" => $this->x,
"y" => $this->y, "y" => $this->y,
@ -661,7 +661,7 @@ class Entity extends Position{
if($this->player->connected !== true or $this->player->spawned === false){ if($this->player->connected !== true or $this->player->spawned === false){
return false; return false;
} }
$player->dataPacket(MC_ADD_PLAYER, array( $player->dataPacket(ProtocolInfo::ADD_PLAYER_PACKET, array(
"clientID" => 0,/*$this->player->clientID,*/ "clientID" => 0,/*$this->player->clientID,*/
"username" => $this->player->username, "username" => $this->player->username,
"eid" => $this->eid, "eid" => $this->eid,
@ -674,7 +674,7 @@ class Entity extends Position{
"unknown2" => 0, "unknown2" => 0,
"metadata" => $this->getMetadata(), "metadata" => $this->getMetadata(),
)); ));
$player->dataPacket(MC_PLAYER_EQUIPMENT, array( $player->dataPacket(ProtocolInfo::PLAYER_EQUIPMENT_PACKET, array(
"eid" => $this->eid, "eid" => $this->eid,
"block" => $this->player->getSlot($this->player->slot)->getID(), "block" => $this->player->getSlot($this->player->slot)->getID(),
"meta" => $this->player->getSlot($this->player->slot)->getMetadata(), "meta" => $this->player->getSlot($this->player->slot)->getMetadata(),
@ -683,7 +683,7 @@ class Entity extends Position{
$this->player->sendArmor($player); $this->player->sendArmor($player);
break; break;
case ENTITY_ITEM: case ENTITY_ITEM:
$player->dataPacket(MC_ADD_ITEM_ENTITY, array( $player->dataPacket(ProtocolInfo::ADD_ITEM_ENTITY_PACKET, array(
"eid" => $this->eid, "eid" => $this->eid,
"x" => $this->x, "x" => $this->x,
"y" => $this->y, "y" => $this->y,
@ -695,7 +695,7 @@ class Entity extends Position{
"meta" => $this->meta, "meta" => $this->meta,
"stack" => $this->stack, "stack" => $this->stack,
)); ));
$player->dataPacket(MC_SET_ENTITY_MOTION, array( $player->dataPacket(ProtocolInfo::SET_ENTITY_MOTION_PACKET, array(
"eid" => $this->eid, "eid" => $this->eid,
"speedX" => (int) ($this->speedX * 400), "speedX" => (int) ($this->speedX * 400),
"speedY" => (int) ($this->speedY * 400), "speedY" => (int) ($this->speedY * 400),
@ -703,7 +703,7 @@ class Entity extends Position{
)); ));
break; break;
case ENTITY_MOB: case ENTITY_MOB:
$player->dataPacket(MC_ADD_MOB, array( $player->dataPacket(ProtocolInfo::ADD_MOB_PACKET, array(
"type" => $this->type, "type" => $this->type,
"eid" => $this->eid, "eid" => $this->eid,
"x" => $this->x, "x" => $this->x,
@ -713,7 +713,7 @@ class Entity extends Position{
"pitch" => 0, "pitch" => 0,
"metadata" => $this->getMetadata(), "metadata" => $this->getMetadata(),
)); ));
$player->dataPacket(MC_SET_ENTITY_MOTION, array( $player->dataPacket(ProtocolInfo::SET_ENTITY_MOTION_PACKET, array(
"eid" => $this->eid, "eid" => $this->eid,
"speedX" => (int) ($this->speedX * 400), "speedX" => (int) ($this->speedX * 400),
"speedY" => (int) ($this->speedY * 400), "speedY" => (int) ($this->speedY * 400),
@ -722,7 +722,7 @@ class Entity extends Position{
break; break;
case ENTITY_OBJECT: case ENTITY_OBJECT:
if($this->type === OBJECT_PAINTING){ if($this->type === OBJECT_PAINTING){
$player->dataPacket(MC_ADD_PAINTING, array( $player->dataPacket(ProtocolInfo::ADD_PAINTING_PACKET, array(
"eid" => $this->eid, "eid" => $this->eid,
"x" => (int) $this->x, "x" => (int) $this->x,
"y" => (int) $this->y, "y" => (int) $this->y,
@ -731,7 +731,7 @@ class Entity extends Position{
"title" => $this->data["Motive"], "title" => $this->data["Motive"],
)); ));
}elseif($this->type === OBJECT_PRIMEDTNT){ }elseif($this->type === OBJECT_PRIMEDTNT){
$player->dataPacket(MC_ADD_ENTITY, array( $player->dataPacket(ProtocolInfo::ADD_ENTITY_PACKET, array(
"eid" => $this->eid, "eid" => $this->eid,
"type" => $this->type, "type" => $this->type,
"x" => $this->x, "x" => $this->x,
@ -740,7 +740,7 @@ class Entity extends Position{
"did" => 0, "did" => 0,
)); ));
}elseif($this->type === OBJECT_ARROW){ }elseif($this->type === OBJECT_ARROW){
$player->dataPacket(MC_ADD_ENTITY, array( $player->dataPacket(ProtocolInfo::ADD_ENTITY_PACKET, array(
"eid" => $this->eid, "eid" => $this->eid,
"type" => $this->type, "type" => $this->type,
"x" => $this->x, "x" => $this->x,
@ -748,7 +748,7 @@ class Entity extends Position{
"z" => $this->z, "z" => $this->z,
"did" => 0, "did" => 0,
)); ));
$player->dataPacket(MC_SET_ENTITY_MOTION, array( $player->dataPacket(ProtocolInfo::SET_ENTITY_MOTION_PACKET, array(
"eid" => $this->eid, "eid" => $this->eid,
"speedX" => (int) ($this->speedX * 400), "speedX" => (int) ($this->speedX * 400),
"speedY" => (int) ($this->speedY * 400), "speedY" => (int) ($this->speedY * 400),
@ -757,7 +757,7 @@ class Entity extends Position{
} }
break; break;
case ENTITY_FALLING: case ENTITY_FALLING:
$player->dataPacket(MC_ADD_ENTITY, array( $player->dataPacket(ProtocolInfo::ADD_ENTITY_PACKET, array(
"eid" => $this->eid, "eid" => $this->eid,
"type" => $this->type, "type" => $this->type,
"x" => $this->x, "x" => $this->x,
@ -765,7 +765,7 @@ class Entity extends Position{
"z" => $this->z, "z" => $this->z,
"did" => -$this->data["Tile"], "did" => -$this->data["Tile"],
)); ));
$player->dataPacket(MC_SET_ENTITY_MOTION, array( $player->dataPacket(ProtocolInfo::SET_ENTITY_MOTION_PACKET, array(
"eid" => $this->eid, "eid" => $this->eid,
"speedX" => (int) ($this->speedX * 400), "speedX" => (int) ($this->speedX * 400),
"speedY" => (int) ($this->speedY * 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 $this->server->api->dhandle("entity.event", array("entity" => $this, "event" => 2)); //Ouch! sound
} }
if($this->player instanceof Player){ if($this->player instanceof Player){
$this->player->dataPacket(MC_SET_HEALTH, array( $this->player->dataPacket(ProtocolInfo::SET_HEALTH_PACKET, array(
"health" => $this->health, "health" => $this->health,
)); ));
} }
@ -995,7 +995,7 @@ class Entity extends Position{
$this->updateMetadata(); $this->updateMetadata();
$this->dead = true; $this->dead = true;
if($this->player instanceof Player){ 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, "eid" => $this->eid,
"x" => -256, "x" => -256,
"y" => 128, "y" => 128,

View File

@ -114,7 +114,7 @@ class Explosion{
$this->level->level->setBlockID($block->x, $block->y, $block->z, 0); $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); $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, "x" => $this->source->x,
"y" => $this->source->y, "y" => $this->source->y,
"z" => $this->source->z, "z" => $this->source->z,

View File

@ -78,7 +78,7 @@ class Level{
} }
if($this->server->api->dhandle("time.change", array("level" => $this, "time" => $time)) !== false){ if($this->server->api->dhandle("time.change", array("level" => $this, "time" => $time)) !== false){
$this->time = $time; $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, "time" => (int) $this->time,
"started" => $this->stopTime == false, "started" => $this->stopTime == false,
)); ));
@ -109,7 +109,7 @@ class Level{
if(count($this->changedBlocks) > 0){ if(count($this->changedBlocks) > 0){
foreach($this->changedBlocks as $blocks){ foreach($this->changedBlocks as $blocks){
foreach($blocks as $b){ 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, "x" => $b->x,
"y" => $b->y, "y" => $b->y,
"z" => $b->z, "z" => $b->z,
@ -286,7 +286,7 @@ class Level{
public function setBlockRaw(Vector3 $pos, Block $block, $direct = true, $send = true){ 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(($ret = $this->level->setBlock($pos->x, $pos->y, $pos->z, $block->getID(), $block->getMetadata())) === true and $send !== false){
if($direct === true){ 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, "x" => $pos->x,
"y" => $pos->y, "y" => $pos->y,
"z" => $pos->z, "z" => $pos->z,
@ -326,7 +326,7 @@ class Level{
$block->position($pos); $block->position($pos);
if($direct === true){ 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, "x" => $pos->x,
"y" => $pos->y, "y" => $pos->y,
"z" => $pos->z, "z" => $pos->z,

View File

@ -142,7 +142,7 @@ class Tile extends Position{
}else{ }else{
$player->windows[$id] = $this; $player->windows[$id] = $this;
} }
$player->dataPacket(MC_CONTAINER_OPEN, array( $player->dataPacket(ProtocolInfo::CONTAINER_OPEN_PACKET, array(
"windowid" => $id, "windowid" => $id,
"type" => WINDOW_CHEST, "type" => WINDOW_CHEST,
"slots" => is_array($player->windows[$id]) ? CHEST_SLOTS << 1:CHEST_SLOTS, "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])){ if(is_array($player->windows[$id])){
$all = $this->server->api->player->getAll($this->level); $all = $this->server->api->player->getAll($this->level);
foreach($player->windows[$id] as $ob){ 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, "x" => $ob->x,
"y" => $ob->y, "y" => $ob->y,
"z" => $ob->z, "z" => $ob->z,
@ -172,7 +172,7 @@ class Tile extends Position{
} }
} }
}else{ }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, "x" => $this->x,
"y" => $this->y, "y" => $this->y,
"z" => $this->z, "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, "windowid" => $id,
"count" => count($slots), "count" => count($slots),
"slots" => $slots, "slots" => $slots,
@ -198,7 +198,7 @@ class Tile extends Position{
$player->windowCnt++; $player->windowCnt++;
$player->windowCnt = $id = max(2, $player->windowCnt % 99); $player->windowCnt = $id = max(2, $player->windowCnt % 99);
$player->windows[$id] = $this; $player->windows[$id] = $this;
$player->dataPacket(MC_CONTAINER_OPEN, array( $player->dataPacket(ProtocolInfo::CONTAINER_OPEN_PACKET, array(
"windowid" => $id, "windowid" => $id,
"type" => WINDOW_FURNACE, "type" => WINDOW_FURNACE,
"slots" => FURNACE_SLOTS, "slots" => FURNACE_SLOTS,
@ -215,7 +215,7 @@ class Tile extends Position{
$slots[] = BlockAPI::getItem(AIR, 0, 0); $slots[] = BlockAPI::getItem(AIR, 0, 0);
} }
} }
$player->dataPacket(MC_CONTAINER_SET_CONTENT, array( $player->dataPacket(ProtocolInfo::CONTAINER_SET_CONTENT_PACKET, array(
"windowid" => $id, "windowid" => $id,
"count" => count($slots), "count" => count($slots),
"slots" => $slots "slots" => $slots
@ -383,7 +383,7 @@ class Tile extends Position{
$nbt->write(chr(NBT::TAG_END)); $nbt->write(chr(NBT::TAG_END));
$player->dataPacket(MC_ENTITY_DATA, array( $player->dataPacket(ProtocolInfo::ENTITY_DATA_PACKET, array(
"x" => $this->x, "x" => $this->x,
"y" => $this->y, "y" => $this->y,
"z" => $this->z, "z" => $this->z,
@ -428,7 +428,7 @@ class Tile extends Position{
$nbt->write(chr(NBT::TAG_END)); $nbt->write(chr(NBT::TAG_END));
$player->dataPacket(MC_ENTITY_DATA, array( $player->dataPacket(ProtocolInfo::ENTITY_DATA_PACKET, array(
"x" => $this->x, "x" => $this->x,
"y" => $this->y, "y" => $this->y,
"z" => $this->z, "z" => $this->z,