mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 19:49:44 +00:00
Thanks to @Gameherobrine
This commit is contained in:
parent
9903b8b31b
commit
a365acc727
14 changed files with 71 additions and 14 deletions
|
|
@ -55,7 +55,7 @@ class PacketPool{
|
|||
self::registerPacket(AdventureSettingsPacket::class, [8, 9, 10, 11, 12, 13, 14]);
|
||||
self::registerPacket(AnimatePacket::class);
|
||||
|
||||
self::registerPacket(ChatPacket::class, [7, 8, 9, 10, 11, 12, 13, 14]);
|
||||
self::registerPacket(ChatPacket::class, [6, 7, 8, 9, 10, 11, 12, 13, 14]);
|
||||
self::registerPacket(ChunkDataPacket::class);
|
||||
self::registerPacket(ClientConnectPacket::class);
|
||||
self::registerPacket(ClientHandshakePacket::class);
|
||||
|
|
@ -88,7 +88,7 @@ class PacketPool{
|
|||
|
||||
self::registerPacket(PingPacket::class);
|
||||
self::registerPacket(PlaceBlockPacket::class);
|
||||
self::registerPacket(PlayerActionPacket::class, [7, 8, 9, 10, 11, 12, 13, 14]);
|
||||
self::registerPacket(PlayerActionPacket::class, [6, 7, 8, 9, 10, 11, 12, 13, 14]);
|
||||
self::registerPacket(PlayerArmorEquipmentPacket::class, [9, 10, 11, 12, 13, 14]);
|
||||
self::registerPacket(PlayerEquipmentPacket::class);
|
||||
self::registerPacket(PlayerInputPacket::class, [8, 9, 10, 11, 12, 13, 14]);
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
class ContainerAckPacket extends RakNetDataPacket{
|
||||
public $unknwonubyte1;
|
||||
public $unknwonubyte2; // Only exist in Version 0.3.3 && 0.4.0
|
||||
public $unknownshort;
|
||||
public $write1;
|
||||
public $write0;
|
||||
|
|
@ -24,6 +25,10 @@ class ContainerAckPacket extends RakNetDataPacket{
|
|||
public function decode(){
|
||||
$this->unknwonubyte1 = $this->getByte();
|
||||
$this->unknownshort = $this->getShort();
|
||||
if($this->PROTOCOL < ProtocolInfo8::CURRENT_PROTOCOL_8){
|
||||
$this->unknwonubyte2 = $this->getByte();
|
||||
return;
|
||||
}
|
||||
$this->write1 = $this->get();
|
||||
$this->write0 = $this->get();
|
||||
ConsoleAPI::debug($this->unknwonubyte1);
|
||||
|
|
@ -33,8 +38,15 @@ class ContainerAckPacket extends RakNetDataPacket{
|
|||
}
|
||||
|
||||
public function encode(){
|
||||
if($this->PROTOCOL < ProtocolInfo8::CURRENT_PROTOCOL_8){
|
||||
$this->reset();
|
||||
}
|
||||
$this->putByte($this->unknwonubyte1);
|
||||
$this->putShort($this->unknownshort);
|
||||
if($this->PROTOCOL < ProtocolInfo8::CURRENT_PROTOCOL_8){
|
||||
$this->putByte($this->unknwonubyte2);
|
||||
return;
|
||||
}
|
||||
$this->put($this->write1);
|
||||
$this->put($this->write0);
|
||||
ConsoleAPI::debug($this->unknwonubyte1);
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ class ContainerOpenPacket extends RakNetDataPacket{
|
|||
public $x;
|
||||
public $y;
|
||||
public $z;
|
||||
public $unknownstring;
|
||||
|
||||
public function pid(){
|
||||
if($this->PROTOCOL < ProtocolInfo4::CURRENT_PROTOCOL_4){
|
||||
|
|
@ -35,7 +36,7 @@ class ContainerOpenPacket extends RakNetDataPacket{
|
|||
$this->putByte($this->type);
|
||||
$this->putByte($this->slots);
|
||||
if ($this->PROTOCOL <= ProtocolInfo9::CURRENT_PROTOCOL_9){
|
||||
$this->putString();
|
||||
$this->putString($this->unknownstring);
|
||||
}else{
|
||||
$this->putInt($this->x);
|
||||
$this->putInt($this->y);
|
||||
|
|
|
|||
|
|
@ -28,6 +28,9 @@ class ContainerSetContentPacket extends RakNetDataPacket{
|
|||
for($s = 0; $s < $count and !$this->feof(); ++$s){
|
||||
$this->slots[$s] = $this->getSlot();
|
||||
}
|
||||
if($this->PROTOCOL <= ProtocolInfo9::CURRENT_PROTOCOL_9){
|
||||
return;
|
||||
}
|
||||
if($this->windowid === 0){
|
||||
$count = $this->getShort();
|
||||
for($s = 0; $s < $count and !$this->feof(); ++$s){
|
||||
|
|
@ -43,8 +46,11 @@ class ContainerSetContentPacket extends RakNetDataPacket{
|
|||
foreach($this->slots as $slot){
|
||||
$this->putSlot($this->PROTOCOL, $slot);
|
||||
}
|
||||
if($this->PROTOCOL <= ProtocolInfo9::CURRENT_PROTOCOL_9){
|
||||
return;
|
||||
}
|
||||
if($this->windowid === 0 and count($this->hotbar) > 0){
|
||||
$this->putShort(count($this->hotbar));//null
|
||||
$this->putShort(count($this->hotbar));
|
||||
foreach($this->hotbar as $slot){
|
||||
$this->putInt($slot);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,13 +23,17 @@ class DropItemPacket extends RakNetDataPacket{
|
|||
}
|
||||
|
||||
public function decode(){
|
||||
//if($this->PROTOCOL < ProtocolInfo8::CURRENT_PROTOCOL_8)$this->reset();
|
||||
$this->eid = $this->getInt();
|
||||
$this->unknown = $this->getByte();
|
||||
$this->item = $this->getSlot();
|
||||
}
|
||||
|
||||
public function encode(){
|
||||
|
||||
/*$this->reset();
|
||||
$this->putInt($this->eid);
|
||||
$this->putByte($this->unknown);
|
||||
$this->putSlot($this->item);*/
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -12,12 +12,13 @@ class LoginPacket extends RakNetDataPacket{
|
|||
}
|
||||
|
||||
public function decode(){
|
||||
//if($this->PROTOCOL <= ProtocolInfo9::CURRENT_PROTOCOL_9)$this->reset();
|
||||
$this->username = $this->getString();
|
||||
$this->protocol1 = $this->getInt();
|
||||
$this->protocol2 = $this->getInt();
|
||||
$this->clientId = $this->getInt();//null
|
||||
$this->loginData = $this->getString();
|
||||
$this->PROTOCOL = $this->protocol1;
|
||||
$this->PROTOCOL = $this->protocol1;
|
||||
}
|
||||
|
||||
public function encode(){
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ class MoveEntityPacket extends RakNetDataPacket{
|
|||
}
|
||||
|
||||
public function encode(){
|
||||
$this->reset();
|
||||
$this->reset(); //null
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -20,6 +20,7 @@ class PlayerActionPacket extends RakNetDataPacket{
|
|||
}
|
||||
|
||||
public function decode(){
|
||||
//if($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9)$this->reset();
|
||||
$this->action = $this->getInt();
|
||||
$this->x = $this->getInt();
|
||||
$this->y = $this->getInt();
|
||||
|
|
@ -29,7 +30,13 @@ class PlayerActionPacket extends RakNetDataPacket{
|
|||
}
|
||||
|
||||
public function encode(){
|
||||
|
||||
/*$this->reset();
|
||||
$this->putInt($this->action);
|
||||
$this->putInt($this->x);
|
||||
$this->putInt($this->y);
|
||||
$this->putInt($this->z);
|
||||
$this->putInt($this->face);
|
||||
$this->putInt($this->eid);*/
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -8,11 +8,13 @@ class ReadyPacket extends RakNetDataPacket{
|
|||
}
|
||||
|
||||
public function decode(){
|
||||
//if($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9)$this->reset();
|
||||
$this->status = $this->getByte();
|
||||
}
|
||||
|
||||
public function encode(){
|
||||
|
||||
/*$this->reset();
|
||||
$this->putByte($this->status);*/
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -16,6 +16,7 @@ class RemoveBlockPacket extends RakNetDataPacket{
|
|||
}
|
||||
|
||||
public function decode(){
|
||||
//if($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9)$this->reset();
|
||||
$this->eid = $this->getInt();
|
||||
$this->x = $this->getInt();
|
||||
$this->z = $this->getInt();
|
||||
|
|
@ -23,7 +24,11 @@ class RemoveBlockPacket extends RakNetDataPacket{
|
|||
}
|
||||
|
||||
public function encode(){
|
||||
|
||||
/*$this->reset();
|
||||
$this->putInt($this->eid);
|
||||
$this->putInt($this->x);
|
||||
$this->putInt($this->z);
|
||||
$this->putInt($this->y);*/
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -18,12 +18,15 @@ class RequestChunkPacket extends RakNetDataPacket{
|
|||
}
|
||||
|
||||
public function decode(){
|
||||
//if($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9)$this->reset();
|
||||
$this->chunkX = $this->getInt();
|
||||
$this->chunkZ = $this->getInt();
|
||||
}
|
||||
|
||||
public function encode(){
|
||||
|
||||
/*$this->reset();
|
||||
$this->putInt($this->chunkX);
|
||||
$this->putInt($this->chunkZ);*/
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -25,7 +25,6 @@ class SetEntityDataPacket extends RakNetDataPacket{
|
|||
|
||||
public function encode(){
|
||||
$this->reset();
|
||||
if($this->PROTOCOL >= ProtocolInfo8::CURRENT_PROTOCOL_8)
|
||||
$this->putInt($this->eid);
|
||||
$this->put(Utils::writeMetadata($this->metadata));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,9 @@ class SetTimePacket extends RakNetDataPacket{
|
|||
public function encode(){
|
||||
$this->reset();
|
||||
$this->putInt($this->time);//long
|
||||
$this->putByte($this->started ? 0x80:0x00);
|
||||
if($this->PROTOCOL >= ProtocolInfo8::CURRENT_PROTOCOL_8){
|
||||
$this->putByte($this->started ? 0x80:0x00);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -15,6 +15,8 @@ class UseItemPacket extends RakNetDataPacket{
|
|||
public $posY;
|
||||
public $posZ;
|
||||
|
||||
public $unknownInt1;
|
||||
|
||||
public function pid(){
|
||||
if($this->PROTOCOL < ProtocolInfo4::CURRENT_PROTOCOL_4){
|
||||
return ProtocolInfo3::USE_ITEM_PACKET;
|
||||
|
|
@ -31,6 +33,7 @@ class UseItemPacket extends RakNetDataPacket{
|
|||
}
|
||||
|
||||
public function decode(){
|
||||
//if($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9)$this->reset();
|
||||
$this->x = $this->getInt();
|
||||
$this->y = $this->getInt();
|
||||
$this->z = $this->getInt();
|
||||
|
|
@ -38,6 +41,10 @@ class UseItemPacket extends RakNetDataPacket{
|
|||
$this->item = $this->getShort();
|
||||
$this->meta = $this->getByte(); //Mojang: fix this
|
||||
$this->eid = $this->getInt();
|
||||
if ($this->PROTOCOL > ProtocolInfo9::CURRENT_PROTOCOL_9) {
|
||||
$this->unknownInt1 = $this->getInt();
|
||||
return;
|
||||
}
|
||||
$this->fx = $this->getFloat();
|
||||
$this->fy = $this->getFloat();
|
||||
$this->fz = $this->getFloat();
|
||||
|
|
@ -49,7 +56,15 @@ class UseItemPacket extends RakNetDataPacket{
|
|||
}
|
||||
|
||||
public function encode(){
|
||||
|
||||
/*$this->reset();
|
||||
$this->putInt($this->x);
|
||||
$this->putInt($this->y);
|
||||
$this->putInt($this->z);
|
||||
$this->putInt($this->face);
|
||||
$this->putShort($this->item);
|
||||
$this->putByte($this->meta);
|
||||
$this->putInt($this->eid);
|
||||
$this->putInt($this->unknownInt1);*/
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue