code style fix

This commit is contained in:
Sunch 2025-04-27 20:36:24 +08:00
parent fc5c5625cb
commit 5e8e9330e2
361 changed files with 4766 additions and 4650 deletions

View file

@ -10,15 +10,15 @@ class AddEntityPacket extends RakNetDataPacket{
public $speedX;
public $speedY;
public $speedZ;
public function pid(){
return ProtocolInfo::ADD_ENTITY_PACKET;
}
public function decode(){
}
public function encode(){
$this->reset();
$this->putInt($this->eid);
@ -28,9 +28,9 @@ class AddEntityPacket extends RakNetDataPacket{
$this->putFloat($this->z);
$this->putInt($this->did);
if($this->did > 0){
$this->putShort((int)($this->speedX * 8000));
$this->putShort((int)($this->speedY * 8000));
$this->putShort((int)($this->speedZ * 8000));
$this->putShort((int) ($this->speedX * 8000));
$this->putShort((int) ($this->speedY * 8000));
$this->putShort((int) ($this->speedZ * 8000));
}
}

View file

@ -9,15 +9,15 @@ class AddItemEntityPacket extends RakNetDataPacket{
public $yaw;
public $pitch;
public $roll;
public function pid(){
return ProtocolInfo::ADD_ITEM_ENTITY_PACKET;
}
public function decode(){
}
public function encode(){
$this->reset();
$this->putInt($this->eid);

View file

@ -9,15 +9,15 @@ class AddMobPacket extends RakNetDataPacket{
public $pitch;
public $yaw;
public $metadata;
public function pid(){
return ProtocolInfo::ADD_MOB_PACKET;
}
public function decode(){
}
public function encode(){
$this->reset();
$this->putInt($this->eid);

View file

@ -7,15 +7,15 @@ class AddPaintingPacket extends RakNetDataPacket{
public $z;
public $direction;
public $title;
public function pid(){
return ProtocolInfo::ADD_PAINTING_PACKET;
}
public function decode(){
}
public function encode(){
$this->reset();
$this->putInt($this->eid);

View file

@ -23,15 +23,15 @@ class AddPlayerPacket extends RakNetDataPacket{
*@var array
*/
public $metadata;
public function pid(){
return ProtocolInfo::ADD_PLAYER_PACKET;
}
public function decode(){
}
public function encode(){
$this->reset();
$this->putLong($this->clientID);

View file

@ -2,15 +2,15 @@
class AdventureSettingsPacket extends RakNetDataPacket{
public $flags;
public function pid(){
return ProtocolInfo::ADVENTURE_SETTINGS_PACKET;
}
public function decode(){
}
public function encode(){
$this->reset();
$this->putInt($this->flags);

View file

@ -3,19 +3,19 @@
class AnimatePacket extends RakNetDataPacket{
const ANIM_SWING_HAND = 0x1;
const ANIM_STOP_SLEEP = 0x3;
public $action;
public $eid;
public function pid(){
return ProtocolInfo::ANIMATE_PACKET;
}
public function decode(){
$this->action = $this->getByte();
$this->eid = $this->getInt();
}
public function encode(){
$this->reset();
$this->putByte($this->action);

View file

@ -2,15 +2,15 @@
class ChatPacket extends RakNetDataPacket{
public $message;
public function pid(){
return ProtocolInfo::CHAT_PACKET;
}
public function decode(){
}
public function encode(){
$this->reset();
$this->putString($this->message);

View file

@ -4,15 +4,15 @@ class ChunkDataPacket extends RakNetDataPacket{
public $chunkX;
public $chunkZ;
public $data;
public function pid(){
return ProtocolInfo::CHUNK_DATA_PACKET;
}
public function decode(){
}
public function encode(){
$this->reset();
$this->putInt($this->chunkX);

View file

@ -8,13 +8,13 @@ class ClientConnectPacket extends RakNetDataPacket{
public function pid(){
return ProtocolInfo::CLIENT_CONNECT_PACKET;
}
public function decode(){
$this->clientID = $this->getLong();
$this->session = $this->getLong();
$this->unknown1 = $this->get(1);
}
}
public function encode(){
}

View file

@ -13,7 +13,7 @@ class ClientHandshakePacket extends RakNetDataPacket{
public function pid(){
return ProtocolInfo::CLIENT_HANDSHAKE_PACKET;
}
public function decode(){
$this->cookie = $this->get(4);
$this->security = $this->get(1);
@ -23,10 +23,10 @@ class ClientHandshakePacket extends RakNetDataPacket{
$this->timestamp = $this->get(2);
$this->session2 = $this->getLong();
$this->session = $this->getLong();
}
}
public function encode(){
}
}

View file

@ -2,15 +2,15 @@
class ContainerClosePacket extends RakNetDataPacket{
public $windowid;
public function pid(){
return ProtocolInfo::CONTAINER_CLOSE_PACKET;
}
public function decode(){
$this->windowid = $this->getByte();
}
public function encode(){
$this->reset();
$this->putByte($this->windowid);

View file

@ -7,15 +7,15 @@ class ContainerOpenPacket extends RakNetDataPacket{
public $x;
public $y;
public $z;
public function pid(){
return ProtocolInfo::CONTAINER_OPEN_PACKET;
}
public function decode(){
}
public function encode(){
$this->reset();
$this->putByte($this->windowid);

View file

@ -2,13 +2,13 @@
class ContainerSetContentPacket extends RakNetDataPacket{
public $windowid;
public $slots = array();
public $hotbar = array();
public $slots = [];
public $hotbar = [];
public function pid(){
return ProtocolInfo::CONTAINER_SET_CONTENT_PACKET;
}
public function decode(){
$this->windowid = $this->getByte();
$count = $this->getShort();
@ -22,7 +22,7 @@ class ContainerSetContentPacket extends RakNetDataPacket{
}
}
}
public function encode(){
$this->reset();
$this->putByte($this->windowid);

View file

@ -4,15 +4,15 @@ class ContainerSetDataPacket extends RakNetDataPacket{
public $windowid;
public $property;
public $value;
public function pid(){
return ProtocolInfo::CONTAINER_SET_DATA_PACKET;
}
public function decode(){
}
public function encode(){
$this->reset();
$this->putByte($this->windowid);

View file

@ -4,17 +4,17 @@ class ContainerSetSlotPacket extends RakNetDataPacket{
public $windowid;
public $slot;
public $item;
public function pid(){
return ProtocolInfo::CONTAINER_SET_SLOT_PACKET;
}
public function decode(){
$this->windowid = $this->getByte();
$this->slot = $this->getShort();
$this->item = $this->getSlot();
}
public function encode(){
$this->reset();
$this->putByte($this->windowid);

View file

@ -4,13 +4,13 @@ class DisconnectPacket extends RakNetDataPacket{
public function pid(){
return ProtocolInfo::DISCONNECT_PACKET;
}
public function decode(){
}
}
public function encode(){
$this->reset();
$this->reset();
}
}

View file

@ -4,17 +4,17 @@ class DropItemPacket extends RakNetDataPacket{
public $eid;
public $unknown;
public $item;
public function pid(){
return ProtocolInfo::DROP_ITEM_PACKET;
}
public function decode(){
$this->eid = $this->getInt();
$this->unknown = $this->getByte();
$this->item = $this->getSlot();
}
public function encode(){
}

View file

@ -5,18 +5,18 @@ class EntityDataPacket extends RakNetDataPacket{
public $y;
public $z;
public $namedtag;
public function pid(){
return ProtocolInfo::ENTITY_DATA_PACKET;
}
public function decode(){
$this->x = $this->getShort();
$this->y = $this->getByte();
$this->z = $this->getShort();
$this->namedtag = $this->get(true);
}
public function encode(){
$this->reset();
$this->putShort($this->x);

View file

@ -3,25 +3,25 @@
class EntityEventPacket extends RakNetDataPacket{
public $eid;
public $event;
const ENTITY_DAMAGE = 2;
const ENTITY_DEAD = 3;
const ENTITY_ANIM_10 = 10;
public function __construct($eid = null, $event = null){
$this->eid = $eid;
$this->event = $event;
}
public function pid(){
return ProtocolInfo::ENTITY_EVENT_PACKET;
}
public function decode(){
$this->eid = $this->getInt();
$this->event = $this->getByte();
}
public function encode(){
$this->reset();
$this->putInt($this->eid);

View file

@ -6,15 +6,15 @@ class ExplodePacket extends RakNetDataPacket{
public $z;
public $radius;
public $records;
public function pid(){
return ProtocolInfo::EXPLODE_PACKET;
}
public function decode(){
}
public function encode(){
$this->reset();
$this->putFloat($this->x);

View file

@ -2,15 +2,15 @@
class HurtArmorPacket extends RakNetDataPacket{
public $health;
public function pid(){
return ProtocolInfo::HURT_ARMOR_PACKET;
}
public function decode(){
}
public function encode(){
$this->reset();
$this->putByte($this->health);

View file

@ -11,13 +11,13 @@ class InteractPacket extends RakNetDataPacket{
public function pid(){
return ProtocolInfo::INTERACT_PACKET;
}
public function decode(){
$this->action = $this->getByte();
$this->eid = $this->getInt();
$this->target = $this->getInt();
}
public function encode(){
$this->reset();
$this->putByte($this->action);

View file

@ -1,24 +1,24 @@
<?php
class LevelEventPacket extends RakNetDataPacket{
const EVENT_OPEN_DOOR_SOUND = 1003;
const EVENT_ALL_PLAYERS_SLEEPING = 9800;
public $evid;
public $x;
public $y;
public $z;
public $data;
public function pid(){
return ProtocolInfo::LEVEL_EVENT_PACKET;
}
public function decode(){
}
public function encode(){
$this->reset();
$this->putShort($this->evid);

View file

@ -6,21 +6,21 @@ class LoginPacket extends RakNetDataPacket{
public $protocol2;
public $clientId;
public $loginData;
public function pid(){
return ProtocolInfo::LOGIN_PACKET;
}
public function decode(){
$this->username = $this->getString();
$this->protocol1 = $this->getInt();
$this->protocol2 = $this->getInt();
$this->clientId = $this->getInt();
$this->loginData = $this->getString();
}
}
public function encode(){
}
}

View file

@ -2,15 +2,15 @@
class LoginStatusPacket extends RakNetDataPacket{
public $status;
public function pid(){
return ProtocolInfo::LOGIN_STATUS_PACKET;
}
public function decode(){
}
}
public function encode(){
$this->reset();
$this->putInt($this->status);

View file

@ -3,16 +3,16 @@
class MessagePacket extends RakNetDataPacket{
public $source;
public $message;
public function pid(){
return ProtocolInfo::MESSAGE_PACKET;
}
public function decode(){
$this->source = $this->getString();
$this->message = $this->getString();
}
}
public function encode(){
$this->reset();
$this->putString($this->source);

View file

@ -5,11 +5,11 @@ class MoveEntityPacket extends RakNetDataPacket{
public function pid(){
return ProtocolInfo::MOVE_ENTITY_PACKET;
}
public function decode(){
}
public function encode(){
$this->reset();
}

View file

@ -7,11 +7,11 @@ class MoveEntityPacket_PosRot extends RakNetDataPacket{
public $z;
public $yaw;
public $pitch;
public function pid(){
return ProtocolInfo::MOVE_ENTITY_PACKET_POSROT;
}
public function decode(){
$this->get(7);
$this->eid = $this->getInt();
@ -21,7 +21,7 @@ class MoveEntityPacket_PosRot extends RakNetDataPacket{
$this->yaw = $this->getFloat();
$this->pitch = $this->getFloat();
}
public function encode(){
$this->reset();
$this->putInt($this->eid);

View file

@ -8,11 +8,11 @@ class MovePlayerPacket extends RakNetDataPacket{
public $yaw;
public $pitch;
public $bodyYaw;
public function pid(){
return ProtocolInfo::MOVE_PLAYER_PACKET;
}
public function decode(){
$this->eid = $this->getInt();
$this->x = $this->getFloat();
@ -22,7 +22,7 @@ class MovePlayerPacket extends RakNetDataPacket{
$this->pitch = $this->getFloat();
$this->bodyYaw = $this->getFloat();
}
public function encode(){
$this->reset();
$this->putInt($this->eid);

View file

@ -6,11 +6,11 @@ class PingPacket extends RakNetDataPacket{
public function pid(){
return ProtocolInfo::PING_PACKET;
}
public function decode(){
$this->time = $this->getLong();
}
}
public function encode(){
$this->reset();
$this->putLong($this->time);

View file

@ -7,11 +7,11 @@ class PlayerActionPacket extends RakNetDataPacket{
public $z;
public $face;
public $eid;
public function pid(){
return ProtocolInfo::PLAYER_ACTION_PACKET;
}
public function decode(){
$this->action = $this->getInt();
$this->x = $this->getInt();
@ -20,7 +20,7 @@ class PlayerActionPacket extends RakNetDataPacket{
$this->face = $this->getInt();
$this->eid = $this->getInt();
}
public function encode(){
}

View file

@ -2,20 +2,20 @@
class PlayerArmorEquipmentPacket extends RakNetDataPacket{
public $eid;
public $slots = array();
public $slots = [];
public function pid(){
return ProtocolInfo::PLAYER_ARMOR_EQUIPMENT_PACKET;
}
public function decode(){
$this->eid = $this->getInt();
$this->eid = $this->getInt();
$this->slots[0] = $this->getByte();
$this->slots[1] = $this->getByte();
$this->slots[2] = $this->getByte();
$this->slots[3] = $this->getByte();
}
public function encode(){
$this->reset();
$this->putInt($this->eid);

View file

@ -5,18 +5,18 @@ class PlayerEquipmentPacket extends RakNetDataPacket{
public $item;
public $meta;
public $slot;
public function pid(){
return ProtocolInfo::PLAYER_EQUIPMENT_PACKET;
}
public function decode(){
$this->eid = $this->getInt();
$this->item = $this->getShort();
$this->meta = $this->getShort();
$this->slot = $this->getSignedByte();
}
public function encode(){
$this->reset();
$this->putInt($this->eid);

View file

@ -1,9 +1,10 @@
<?php
class PlayerInputPacket extends RakNetDataPacket{
public $moveStrafe, $moveForward, $isJumping, $isSneaking;
public function encode()
{
}
public function pid()
@ -18,6 +19,6 @@ class PlayerInputPacket extends RakNetDataPacket{
$this->isJumping = $this->getByte() != 0;
$this->isSneaking = $this->getByte() != 0;
}
}

View file

@ -7,12 +7,12 @@ class PongPacket extends RakNetDataPacket{
public function pid(){
return ProtocolInfo::PONG_PACKET;
}
public function decode(){
$this->ptime = $this->getLong();
$this->time = $this->getLong();
}
}
public function encode(){
$this->reset();
$this->putLong($this->ptime);

View file

@ -2,15 +2,15 @@
class ReadyPacket extends RakNetDataPacket{
public $status;
public function pid(){
return ProtocolInfo::READY_PACKET;
}
public function decode(){
$this->status = $this->getByte();
}
}
public function encode(){
}

View file

@ -5,18 +5,18 @@ class RemoveBlockPacket extends RakNetDataPacket{
public $x;
public $y;
public $z;
public function pid(){
return ProtocolInfo::REMOVE_BLOCK_PACKET;
}
public function decode(){
$this->eid = $this->getInt();
$this->x = $this->getInt();
$this->z = $this->getInt();
$this->y = $this->getByte();
}
public function encode(){
}

View file

@ -6,11 +6,11 @@ class RemoveEntityPacket extends RakNetDataPacket{
public function pid(){
return ProtocolInfo::REMOVE_ENTITY_PACKET;
}
public function decode(){
}
public function encode(){
$this->reset();
$this->putInt($this->eid);

View file

@ -3,15 +3,15 @@
class RemovePlayerPacket extends RakNetDataPacket{
public $eid;
public $clientID;
public function pid(){
return ProtocolInfo::REMOVE_PLAYER_PACKET;
}
public function decode(){
}
public function encode(){
$this->reset();
$this->putInt($this->eid);

View file

@ -3,16 +3,16 @@
class RequestChunkPacket extends RakNetDataPacket{
public $chunkX;
public $chunkZ;
public function pid(){
return ProtocolInfo::REQUEST_CHUNK_PACKET;
}
public function decode(){
$this->chunkX = $this->getInt();
$this->chunkZ = $this->getInt();
}
public function encode(){
}

View file

@ -5,18 +5,18 @@ class RespawnPacket extends RakNetDataPacket{
public $x;
public $y;
public $z;
public function pid(){
return ProtocolInfo::RESPAWN_PACKET;
}
public function decode(){
$this->eid = $this->getInt();
$this->x = $this->getFloat();
$this->y = $this->getFloat();
$this->z = $this->getFloat();
}
public function encode(){
$this->reset();
$this->putInt($this->eid);

View file

@ -13,13 +13,13 @@ class RotateHeadPacket extends RakNetDataPacket{
public function pid(){
return ProtocolInfo::ROTATE_HEAD_PACKET;
}
public function decode(){
$this->get(7); //id + data
$this->eid = $this->getInt();
$this->yaw = $this->getByte();
}
public function encode(){
$this->reset();
$this->putInt($this->eid);

View file

@ -3,13 +3,13 @@
class SendInventoryPacket extends RakNetDataPacket{
public $eid;
public $windowid;
public $slots = array();
public $armor = array();
public $slots = [];
public $armor = [];
public function pid(){
return ProtocolInfo::SEND_INVENTORY_PACKET;
}
public function decode(){
$this->eid = $this->getInt();
$this->windowid = $this->getByte();
@ -23,7 +23,7 @@ class SendInventoryPacket extends RakNetDataPacket{
}
}
}
public function encode(){
$this->reset();
$this->putInt($this->eid);

View file

@ -8,17 +8,17 @@ class ServerHandshakePacket extends RakNetDataPacket{
public function pid(){
return ProtocolInfo::SERVER_HANDSHAKE_PACKET;
}
public function decode(){
}
}
public function encode(){
$this->reset();
$this->put("\x04\x3f\x57\xfe"); //cookie
$this->put("\xcd"); //Security flags
$this->putShort($this->port);
$this->putDataArray(array(
$this->putDataArray([
"\xf5\xff\xff\xf5",
"\xff\xff\xff\xff",
"\xff\xff\xff\xff",
@ -29,7 +29,7 @@ class ServerHandshakePacket extends RakNetDataPacket{
"\xff\xff\xff\xff",
"\xff\xff\xff\xff",
"\xff\xff\xff\xff",
));
]);
$this->put("\x00\x00");
$this->putLong($this->session);
$this->putLong($this->session2);

View file

@ -3,15 +3,15 @@
class SetEntityDataPacket extends RakNetDataPacket{
public $eid;
public $metadata;
public function pid(){
return ProtocolInfo::SET_ENTITY_DATA_PACKET;
}
public function decode(){
}
public function encode(){
$this->reset();
$this->putInt($this->eid);

View file

@ -21,7 +21,6 @@ class SetEntityLinkPacket extends RakNetDataPacket{
$this->putInt($this->type);
}
public function pid(){
return ProtocolInfo::SET_ENTITY_LINK_PACKET;
}

View file

@ -5,15 +5,15 @@ class SetEntityMotionPacket extends RakNetDataPacket{
public $speedX;
public $speedY;
public $speedZ;
public function pid(){
return ProtocolInfo::SET_ENTITY_MOTION_PACKET;
}
public function decode(){
}
public function encode(){
$this->reset();
$this->putInt($this->eid);

View file

@ -2,15 +2,15 @@
class SetHealthPacket extends RakNetDataPacket{
public $health;
public function pid(){
return ProtocolInfo::SET_HEALTH_PACKET;
}
public function decode(){
$this->health = $this->getByte();
}
public function encode(){
$this->reset();
$this->putByte($this->health);

View file

@ -4,15 +4,15 @@ class SetSpawnPositionPacket extends RakNetDataPacket{
public $x;
public $z;
public $y;
public function pid(){
return ProtocolInfo::SET_SPAWN_POSITION_PACKET;
}
public function decode(){
}
public function encode(){
$this->reset();
$this->putInt($this->x);

View file

@ -3,15 +3,15 @@
class SetTimePacket extends RakNetDataPacket{
public $time;
public $started = true;
public function pid(){
return ProtocolInfo::SET_TIME_PACKET;
}
public function decode(){
}
}
public function encode(){
$this->reset();
$this->putInt($this->time);

View file

@ -8,15 +8,15 @@ class StartGamePacket extends RakNetDataPacket{
public $x;
public $y;
public $z;
public function pid(){
return ProtocolInfo::START_GAME_PACKET;
}
public function decode(){
}
}
public function encode(){
$this->reset();
$this->putInt($this->seed);

View file

@ -7,11 +7,11 @@ class TakeItemEntityPacket extends RakNetDataPacket{
public function pid(){
return ProtocolInfo::TAKE_ITEM_ENTITY_PACKET;
}
public function decode(){
}
public function encode(){
$this->reset();
$this->putInt($this->target);

View file

@ -6,15 +6,15 @@ class TileEventPacket extends RakNetDataPacket{
public $z;
public $case1;
public $case2;
public function pid(){
return ProtocolInfo::TILE_EVENT_PACKET;
}
public function decode(){
}
public function encode(){
$this->reset();
$this->putInt($this->x);

View file

@ -2,19 +2,19 @@
class UnknownPacket extends RakNetDataPacket{
public $packetID = -1;
public function __construct($pid = -1){
$this->packetID = $pid;
}
public function pid(){
return $this->packetID;
}
public function decode(){
}
public function encode(){
}

View file

@ -6,15 +6,15 @@ class UpdateBlockPacket extends RakNetDataPacket{
public $y;
public $block;
public $meta;
public function pid(){
return ProtocolInfo::UPDATE_BLOCK_PACKET;
}
public function decode(){
}
public function encode(){
$this->reset();
$this->putInt($this->x);

View file

@ -14,11 +14,11 @@ class UseItemPacket extends RakNetDataPacket{
public $posX;
public $posY;
public $posZ;
public function pid(){
return ProtocolInfo::USE_ITEM_PACKET;
}
public function decode(){
$this->x = $this->getInt();
$this->y = $this->getInt();
@ -32,9 +32,9 @@ class UseItemPacket extends RakNetDataPacket{
$this->fz = $this->getFloat();
$this->posX = $this->getFloat();
$this->posY = $this->getFloat();
$this->posZ = $this->getFloat();
$this->posZ = $this->getFloat();
}
public function encode(){
}