Moved network ids to constants, improved some entity methods, more performance

This commit is contained in:
Shoghi Cervantes
2015-05-30 23:59:24 +02:00
parent 32680843fa
commit 9e14435dbb
58 changed files with 197 additions and 436 deletions

View File

@ -220,7 +220,7 @@ class Network{
try{
while($offset < $len){
if(($pk = $this->getPacket(ord($str{$offset++}))) !== null){
if($pk->pid() === Info::BATCH_PACKET){
if($pk::NETWORK_ID === Info::BATCH_PACKET){
throw new \InvalidStateException("Invalid BatchPacket inside BatchPacket");
}
$pk->setBuffer($str, $offset);

View File

@ -25,7 +25,6 @@ use pocketmine\event\player\PlayerCreationEvent;
use pocketmine\network\protocol\DataPacket;
use pocketmine\network\protocol\Info as ProtocolInfo;
use pocketmine\network\protocol\Info;
use pocketmine\network\protocol\UnknownPacket;
use pocketmine\Player;
use pocketmine\Server;
use pocketmine\utils\MainLogger;
@ -136,8 +135,10 @@ class RakLibInterface implements ServerInstance, AdvancedSourceInterface{
try{
if($packet->buffer !== ""){
$pk = $this->getPacket($packet->buffer);
$pk->decode();
$this->players[$identifier]->handleDataPacket($pk);
if($pk !== null){
$pk->decode();
$this->players[$identifier]->handleDataPacket($pk);
}
}
}catch(\Exception $e){
if(\pocketmine\DEBUG > 1 and isset($pk)){
@ -216,7 +217,7 @@ class RakLibInterface implements ServerInstance, AdvancedSourceInterface{
$pk = $packet->__encapsulatedPacket;
}
if(!$immediate and !$needACK and $packet->pid() !== ProtocolInfo::BATCH_PACKET
if(!$immediate and !$needACK and $packet::NETWORK_ID !== ProtocolInfo::BATCH_PACKET
and Network::$BATCH_THRESHOLD >= 0
and strlen($packet->buffer) >= Network::$BATCH_THRESHOLD){
$this->server->batchPackets([$player], [$packet], true, $packet->getChannel());
@ -251,8 +252,7 @@ class RakLibInterface implements ServerInstance, AdvancedSourceInterface{
$pid = ord($buffer{0});
if(($data = $this->network->getPacket($pid)) === null){
$data = new UnknownPacket();
$data->packetID = $pid;
return null;
}
$data->setBuffer($buffer, 1);

View File

@ -29,8 +29,7 @@ use pocketmine\utils\Binary;
#endif
class AddEntityPacket extends DataPacket{
public static $pool = [];
public static $next = 0;
const NETWORK_ID = Info::ADD_ENTITY_PACKET;
public $eid;
public $type;
@ -45,10 +44,6 @@ class AddEntityPacket extends DataPacket{
public $metadata;
public $links = [];
public function pid(){
return Info::ADD_ENTITY_PACKET;
}
public function decode(){
}

View File

@ -25,8 +25,7 @@ namespace pocketmine\network\protocol;
class AddItemEntityPacket extends DataPacket{
public static $pool = [];
public static $next = 0;
const NETWORK_ID = Info::ADD_ITEM_ENTITY_PACKET;
public $eid;
public $item;
@ -37,10 +36,6 @@ class AddItemEntityPacket extends DataPacket{
public $speedY;
public $speedZ;
public function pid(){
return Info::ADD_ITEM_ENTITY_PACKET;
}
public function decode(){
}

View File

@ -25,8 +25,7 @@ namespace pocketmine\network\protocol;
class AddPaintingPacket extends DataPacket{
public static $pool = [];
public static $next = 0;
const NETWORK_ID = Info::ADD_PAINTING_PACKET;
public $eid;
public $x;
@ -35,10 +34,6 @@ class AddPaintingPacket extends DataPacket{
public $direction;
public $title;
public function pid(){
return Info::ADD_PAINTING_PACKET;
}
public function decode(){
}

View File

@ -29,10 +29,7 @@ use pocketmine\utils\Binary;
#endif
class AddPlayerPacket extends DataPacket{
public static $pool = [];
public static $next = 0;
const NETWORK_ID = Info::ADD_PLAYER_PACKET;
public $clientID;
public $username;
@ -52,10 +49,6 @@ class AddPlayerPacket extends DataPacket{
public $slim = false;
public $skin = null;
public function pid(){
return Info::ADD_PLAYER_PACKET;
}
public function decode(){
}

View File

@ -25,15 +25,10 @@ namespace pocketmine\network\protocol;
class AdventureSettingsPacket extends DataPacket{
public static $pool = [];
public static $next = 0;
const NETWORK_ID = Info::ADVENTURE_SETTINGS_PACKET;
public $flags;
public function pid(){
return Info::ADVENTURE_SETTINGS_PACKET;
}
public function decode(){
}

View File

@ -25,16 +25,11 @@ namespace pocketmine\network\protocol;
class AnimatePacket extends DataPacket{
public static $pool = [];
public static $next = 0;
const NETWORK_ID = Info::ANIMATE_PACKET;
public $action;
public $eid;
public function pid(){
return Info::ANIMATE_PACKET;
}
public function decode(){
$this->action = $this->getByte();
$this->eid = $this->getLong();

View File

@ -25,15 +25,10 @@ namespace pocketmine\network\protocol;
class BatchPacket extends DataPacket{
public static $pool = [];
public static $next = 0;
const NETWORK_ID = Info::BATCH_PACKET;
public $payload;
public function pid(){
return Info::BATCH_PACKET;
}
public function decode(){
$size = $this->getInt();
$this->payload = $this->get($size);

View File

@ -25,15 +25,10 @@ namespace pocketmine\network\protocol;
class ContainerClosePacket extends DataPacket{
public static $pool = [];
public static $next = 0;
const NETWORK_ID = Info::CONTAINER_CLOSE_PACKET;
public $windowid;
public function pid(){
return Info::CONTAINER_CLOSE_PACKET;
}
public function decode(){
$this->windowid = $this->getByte();
}

View File

@ -25,8 +25,7 @@ namespace pocketmine\network\protocol;
class ContainerOpenPacket extends DataPacket{
public static $pool = [];
public static $next = 0;
const NETWORK_ID = Info::CONTAINER_OPEN_PACKET;
public $windowid;
public $type;
@ -35,10 +34,6 @@ class ContainerOpenPacket extends DataPacket{
public $y;
public $z;
public function pid(){
return Info::CONTAINER_OPEN_PACKET;
}
public function decode(){
}

View File

@ -25,8 +25,7 @@ namespace pocketmine\network\protocol;
class ContainerSetContentPacket extends DataPacket{
public static $pool = [];
public static $next = 0;
const NETWORK_ID = Info::CONTAINER_SET_CONTENT_PACKET;
const SPECIAL_INVENTORY = 0;
const SPECIAL_ARMOR = 0x78;
@ -37,10 +36,6 @@ class ContainerSetContentPacket extends DataPacket{
public $slots = [];
public $hotbar = [];
public function pid(){
return Info::CONTAINER_SET_CONTENT_PACKET;
}
public function clean(){
$this->slots = [];
$this->hotbar = [];

View File

@ -25,17 +25,12 @@ namespace pocketmine\network\protocol;
class ContainerSetDataPacket extends DataPacket{
public static $pool = [];
public static $next = 0;
const NETWORK_ID = Info::CONTAINER_SET_DATA_PACKET;
public $windowid;
public $property;
public $value;
public function pid(){
return Info::CONTAINER_SET_DATA_PACKET;
}
public function decode(){
}

View File

@ -26,18 +26,13 @@ namespace pocketmine\network\protocol;
use pocketmine\item\Item;
class ContainerSetSlotPacket extends DataPacket{
public static $pool = [];
public static $next = 0;
const NETWORK_ID = Info::CONTAINER_SET_SLOT_PACKET;
public $windowid;
public $slot;
/** @var Item */
public $item;
public function pid(){
return Info::CONTAINER_SET_SLOT_PACKET;
}
public function decode(){
$this->windowid = $this->getByte();
$this->slot = $this->getShort();

View File

@ -32,19 +32,23 @@ use pocketmine\item\Item;
abstract class DataPacket extends \stdClass{
private $offset = 0;
const NETWORK_ID = 0;
public $offset = 0;
public $buffer = "";
public $isEncoded = false;
private $channel = 0;
abstract public function pid();
public function pid(){
return $this::NETWORK_ID;
}
abstract public function encode();
abstract public function decode();
protected function reset(){
$this->buffer = chr($this->pid());
$this->buffer = chr($this::NETWORK_ID);
$this->offset = 0;
}

View File

@ -25,15 +25,10 @@ namespace pocketmine\network\protocol;
class DisconnectPacket extends DataPacket{
public static $pool = [];
public static $next = 0;
const NETWORK_ID = Info::DISCONNECT_PACKET;
public $message;
public function pid(){
return Info::DISCONNECT_PACKET;
}
public function decode(){
$this->message = $this->getString();
}

View File

@ -25,17 +25,12 @@ namespace pocketmine\network\protocol;
class DropItemPacket extends DataPacket{
public static $pool = [];
public static $next = 0;
const NETWORK_ID = Info::DROP_ITEM_PACKET;
public $eid;
public $unknown;
public $item;
public function pid(){
return Info::DROP_ITEM_PACKET;
}
public function decode(){
$this->eid = $this->getLong();
$this->unknown = $this->getByte();

View File

@ -25,6 +25,7 @@ namespace pocketmine\network\protocol;
class EntityEventPacket extends DataPacket{
const NETWORK_ID = Info::ENTITY_EVENT_PACKET;
const HURT_ANIMATION = 2;
const DEATH_ANIMATION = 3;
@ -42,16 +43,9 @@ class EntityEventPacket extends DataPacket{
const AMBIENT_SOUND = 16;
const RESPAWN = 17;
public static $pool = [];
public static $next = 0;
public $eid;
public $event;
public function pid(){
return Info::ENTITY_EVENT_PACKET;
}
public function decode(){
$this->eid = $this->getLong();
$this->event = $this->getByte();

View File

@ -25,8 +25,7 @@ namespace pocketmine\network\protocol;
class ExplodePacket extends DataPacket{
public static $pool = [];
public static $next = 0;
const NETWORK_ID = Info::EXPLODE_PACKET;
public $x;
public $y;
@ -34,10 +33,6 @@ class ExplodePacket extends DataPacket{
public $radius;
public $records = [];
public function pid(){
return Info::EXPLODE_PACKET;
}
public function clean(){
$this->records = [];
return parent::clean();

View File

@ -25,17 +25,12 @@ namespace pocketmine\network\protocol;
class FullChunkDataPacket extends DataPacket{
public static $pool = [];
public static $next = 0;
const NETWORK_ID = Info::FULL_CHUNK_DATA_PACKET;
public $chunkX;
public $chunkZ;
public $data;
public function pid(){
return Info::FULL_CHUNK_DATA_PACKET;
}
public function decode(){
}

View File

@ -25,15 +25,10 @@ namespace pocketmine\network\protocol;
class HurtArmorPacket extends DataPacket{
public static $pool = [];
public static $next = 0;
const NETWORK_ID = Info::HURT_ARMOR_PACKET;
public $health;
public function pid(){
return Info::HURT_ARMOR_PACKET;
}
public function decode(){
}

View File

@ -25,17 +25,12 @@ namespace pocketmine\network\protocol;
class InteractPacket extends DataPacket{
public static $pool = [];
public static $next = 0;
const NETWORK_ID = Info::INTERACT_PACKET;
public $action;
public $eid;
public $target;
public function pid(){
return Info::INTERACT_PACKET;
}
public function decode(){
$this->action = $this->getByte();
$this->target = $this->getLong();

View File

@ -25,8 +25,7 @@ namespace pocketmine\network\protocol;
class LevelEventPacket extends DataPacket{
public static $pool = [];
public static $next = 0;
const NETWORK_ID = Info::LEVEL_EVENT_PACKET;
public $evid;
public $x;
@ -34,10 +33,6 @@ class LevelEventPacket extends DataPacket{
public $z;
public $data;
public function pid(){
return Info::LEVEL_EVENT_PACKET;
}
public function decode(){
}

View File

@ -25,8 +25,7 @@ namespace pocketmine\network\protocol;
class LoginPacket extends DataPacket{
public static $pool = [];
public static $next = 0;
const NETWORK_ID = Info::LOGIN_PACKET;
public $username;
public $protocol1;
@ -36,10 +35,6 @@ class LoginPacket extends DataPacket{
public $slim = false;
public $skin = null;
public function pid(){
return Info::LOGIN_PACKET;
}
public function decode(){
$this->username = $this->getString();
$this->protocol1 = $this->getInt();

View File

@ -25,8 +25,7 @@ namespace pocketmine\network\protocol;
class MobEffectPacket extends DataPacket{
public static $pool = [];
public static $next = 0;
const NETWORK_ID = Info::MOB_EFFECT_PACKET;
const EVENT_ADD = 1;
const EVENT_MODIFY = 2;
@ -39,10 +38,6 @@ class MobEffectPacket extends DataPacket{
public $particles = true;
public $duration;
public function pid(){
return Info::MOB_EFFECT_PACKET;
}
public function decode(){
}

View File

@ -25,18 +25,13 @@ namespace pocketmine\network\protocol;
class MoveEntityPacket extends DataPacket{
public static $pool = [];
public static $next = 0;
const NETWORK_ID = Info::MOVE_ENTITY_PACKET;
// eid, x, y, z, yaw, pitch
/** @var array[] */
public $entities = [];
public function pid(){
return Info::MOVE_ENTITY_PACKET;
}
public function clean(){
$this->entities = [];
return parent::clean();

View File

@ -25,8 +25,7 @@ namespace pocketmine\network\protocol;
class MovePlayerPacket extends DataPacket{
public static $pool = [];
public static $next = 0;
const NETWORK_ID = Info::MOVE_PLAYER_PACKET;
public $eid;
public $x;
@ -38,10 +37,6 @@ class MovePlayerPacket extends DataPacket{
public $mode = 0;
public $onGround;
public function pid(){
return Info::MOVE_PLAYER_PACKET;
}
public function clean(){
$this->teleport = false;
return parent::clean();

View File

@ -25,21 +25,15 @@ namespace pocketmine\network\protocol;
class PlayStatusPacket extends DataPacket{
const NETWORK_ID = Info::PLAY_STATUS_PACKET;
const LOGIN_SUCCESS = 0;
const LOGIN_FAILED_CLIENT = 1;
const LOGIN_FAILED_SERVER = 2;
const PLAYER_SPAWN = 3;
public static $pool = [];
public static $next = 0;
public $status;
public function pid(){
return Info::PLAY_STATUS_PACKET;
}
public function decode(){
}

View File

@ -25,8 +25,7 @@ namespace pocketmine\network\protocol;
class PlayerActionPacket extends DataPacket{
public static $pool = [];
public static $next = 0;
const NETWORK_ID = Info::PLAYER_ACTION_PACKET;
public $eid;
public $action;
@ -35,10 +34,6 @@ class PlayerActionPacket extends DataPacket{
public $z;
public $face;
public function pid(){
return Info::PLAYER_ACTION_PACKET;
}
public function decode(){
$this->eid = $this->getLong();
$this->action = $this->getInt();

View File

@ -25,16 +25,11 @@ namespace pocketmine\network\protocol;
class PlayerArmorEquipmentPacket extends DataPacket{
public static $pool = [];
public static $next = 0;
const NETWORK_ID = Info::PLAYER_ARMOR_EQUIPMENT_PACKET;
public $eid;
public $slots = [];
public function pid(){
return Info::PLAYER_ARMOR_EQUIPMENT_PACKET;
}
public function decode(){
$this->eid = $this->getLong();
$this->slots[0] = $this->getByte();

View File

@ -25,8 +25,7 @@ namespace pocketmine\network\protocol;
class PlayerEquipmentPacket extends DataPacket{
public static $pool = [];
public static $next = 0;
const NETWORK_ID = Info::PLAYER_EQUIPMENT_PACKET;
public $eid;
public $item;
@ -34,10 +33,6 @@ class PlayerEquipmentPacket extends DataPacket{
public $slot;
public $selectedSlot;
public function pid(){
return Info::PLAYER_EQUIPMENT_PACKET;
}
public function decode(){
$this->eid = $this->getLong();
$this->item = $this->getShort();

View File

@ -25,18 +25,13 @@ namespace pocketmine\network\protocol;
class RemoveBlockPacket extends DataPacket{
public static $pool = [];
public static $next = 0;
const NETWORK_ID = Info::REMOVE_BLOCK_PACKET;
public $eid;
public $x;
public $y;
public $z;
public function pid(){
return Info::REMOVE_BLOCK_PACKET;
}
public function decode(){
$this->eid = $this->getLong();
$this->x = $this->getInt();

View File

@ -25,15 +25,10 @@ namespace pocketmine\network\protocol;
class RemoveEntityPacket extends DataPacket{
public static $pool = [];
public static $next = 0;
const NETWORK_ID = Info::REMOVE_ENTITY_PACKET;
public $eid;
public function pid(){
return Info::REMOVE_ENTITY_PACKET;
}
public function decode(){
}

View File

@ -25,16 +25,11 @@ namespace pocketmine\network\protocol;
class RemovePlayerPacket extends DataPacket{
public static $pool = [];
public static $next = 0;
const NETWORK_ID = Info::REMOVE_PLAYER_PACKET;
public $eid;
public $clientID;
public function pid(){
return Info::REMOVE_PLAYER_PACKET;
}
public function decode(){
}

View File

@ -25,17 +25,12 @@ namespace pocketmine\network\protocol;
class RespawnPacket extends DataPacket{
public static $pool = [];
public static $next = 0;
const NETWORK_ID = Info::RESPAWN_PACKET;
public $x;
public $y;
public $z;
public function pid(){
return Info::RESPAWN_PACKET;
}
public function decode(){
$this->x = $this->getFloat();
$this->y = $this->getFloat();

View File

@ -25,15 +25,10 @@ namespace pocketmine\network\protocol;
class SetDifficultyPacket extends DataPacket{
public static $pool = [];
public static $next = 0;
const NETWORK_ID = Info::SET_DIFFICULTY_PACKET;
public $difficulty;
public function pid(){
return Info::SET_DIFFICULTY_PACKET;
}
public function decode(){
$this->difficulty = $this->getInt();
}

View File

@ -29,16 +29,11 @@ use pocketmine\utils\Binary;
#endif
class SetEntityDataPacket extends DataPacket{
public static $pool = [];
public static $next = 0;
const NETWORK_ID = Info::SET_ENTITY_DATA_PACKET;
public $eid;
public $metadata;
public function pid(){
return Info::SET_ENTITY_DATA_PACKET;
}
public function decode(){
}

View File

@ -25,17 +25,12 @@ namespace pocketmine\network\protocol;
class SetEntityLinkPacket extends DataPacket{
public static $pool = [];
public static $next = 0;
const NETWORK_ID = Info::SET_ENTITY_LINK_PACKET;
public $from;
public $to;
public $type;
public function pid(){
return Info::SET_ENTITY_LINK_PACKET;
}
public function decode(){
}

View File

@ -25,18 +25,13 @@ namespace pocketmine\network\protocol;
class SetEntityMotionPacket extends DataPacket{
public static $pool = [];
public static $next = 0;
const NETWORK_ID = Info::SET_ENTITY_MOTION_PACKET;
// eid, motX, motY, motZ
/** @var array[] */
public $entities = [];
public function pid(){
return Info::SET_ENTITY_MOTION_PACKET;
}
public function clean(){
$this->entities = [];
return parent::clean();

View File

@ -25,15 +25,10 @@ namespace pocketmine\network\protocol;
class SetHealthPacket extends DataPacket{
public static $pool = [];
public static $next = 0;
const NETWORK_ID = Info::SET_HEALTH_PACKET;
public $health;
public function pid(){
return Info::SET_HEALTH_PACKET;
}
public function decode(){
$this->health = $this->getInt();
}

View File

@ -25,17 +25,12 @@ namespace pocketmine\network\protocol;
class SetSpawnPositionPacket extends DataPacket{
public static $pool = [];
public static $next = 0;
const NETWORK_ID = Info::SET_SPAWN_POSITION_PACKET;
public $x;
public $z;
public $y;
public function pid(){
return Info::SET_SPAWN_POSITION_PACKET;
}
public function decode(){
}

View File

@ -27,16 +27,11 @@ namespace pocketmine\network\protocol;
use pocketmine\level\Level;
class SetTimePacket extends DataPacket{
public static $pool = [];
public static $next = 0;
const NETWORK_ID = Info::SET_TIME_PACKET;
public $time;
public $started = true;
public function pid(){
return Info::SET_TIME_PACKET;
}
public function decode(){
}

View File

@ -25,8 +25,7 @@ namespace pocketmine\network\protocol;
class StartGamePacket extends DataPacket{
public static $pool = [];
public static $next = 0;
const NETWORK_ID = Info::START_GAME_PACKET;
public $seed;
public $generator;
@ -39,10 +38,6 @@ class StartGamePacket extends DataPacket{
public $y;
public $z;
public function pid(){
return Info::START_GAME_PACKET;
}
public function decode(){
}

View File

@ -25,16 +25,11 @@ namespace pocketmine\network\protocol;
class TakeItemEntityPacket extends DataPacket{
public static $pool = [];
public static $next = 0;
const NETWORK_ID = Info::TAKE_ITEM_ENTITY_PACKET;
public $target;
public $eid;
public function pid(){
return Info::TAKE_ITEM_ENTITY_PACKET;
}
public function decode(){
}

View File

@ -25,8 +25,7 @@ namespace pocketmine\network\protocol;
class TextPacket extends DataPacket{
public static $pool = [];
public static $next = 0;
const NETWORK_ID = Info::TEXT_PACKET;
const TYPE_RAW = 0;
const TYPE_CHAT = 1;
@ -39,10 +38,6 @@ class TextPacket extends DataPacket{
public $message;
public $parameters = [];
public function pid(){
return Info::TEXT_PACKET;
}
public function decode(){
$this->type = $this->getByte();
switch($this->type){

View File

@ -25,18 +25,13 @@ namespace pocketmine\network\protocol;
class TileEntityDataPacket extends DataPacket{
public static $pool = [];
public static $next = 0;
const NETWORK_ID = Info::TILE_ENTITY_DATA_PACKET;
public $x;
public $y;
public $z;
public $namedtag;
public function pid(){
return Info::TILE_ENTITY_DATA_PACKET;
}
public function decode(){
$this->x = $this->getInt();
$this->y = $this->getByte();

View File

@ -25,8 +25,7 @@ namespace pocketmine\network\protocol;
class TileEventPacket extends DataPacket{
public static $pool = [];
public static $next = 0;
const NETWORK_ID = Info::TILE_EVENT_PACKET;
public $x;
public $y;
@ -34,10 +33,6 @@ class TileEventPacket extends DataPacket{
public $case1;
public $case2;
public function pid(){
return Info::TILE_EVENT_PACKET;
}
public function decode(){
}

View File

@ -1,46 +0,0 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\network\protocol;
#include <rules/DataPacket.h>
class UnknownPacket extends DataPacket{
public static $pool = [];
public static $next = 0;
public $packetID = -1;
public function pid(){
return $this->packetID;
}
public function decode(){
}
public function encode(){
}
}

View File

@ -25,8 +25,7 @@ namespace pocketmine\network\protocol;
class UpdateBlockPacket extends DataPacket{
public static $pool = [];
public static $next = 0;
const NETWORK_ID = Info::UPDATE_BLOCK_PACKET;
const FLAG_NONE = 0b0000;
const FLAG_NEIGHBORS = 0b0001;
@ -39,10 +38,6 @@ class UpdateBlockPacket extends DataPacket{
public $records = []; //x, z, y, blockId, blockData, flags
public function pid(){
return Info::UPDATE_BLOCK_PACKET;
}
public function decode(){
}

View File

@ -25,8 +25,7 @@ namespace pocketmine\network\protocol;
class UseItemPacket extends DataPacket{
public static $pool = [];
public static $next = 0;
const NETWORK_ID = Info::USE_ITEM_PACKET;
public $x;
public $y;
@ -42,10 +41,6 @@ class UseItemPacket extends DataPacket{
public $posY;
public $posZ;
public function pid(){
return Info::USE_ITEM_PACKET;
}
public function decode(){
$this->x = $this->getInt();
$this->y = $this->getInt();