mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-23 13:09:44 +00:00
Fix auto respawn bug in MCPE 0.3.2 - 0.5.0
This commit is contained in:
parent
7c8f32d100
commit
2712adc29f
9 changed files with 70 additions and 19 deletions
|
|
@ -1712,7 +1712,9 @@ class Player{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($packet->pid()) {
|
$internalPid = $packet->getInternalPid();
|
||||||
|
|
||||||
|
switch ($internalPid) {
|
||||||
case 0x01:
|
case 0x01:
|
||||||
break;
|
break;
|
||||||
case ProtocolInfo::PONG_PACKET:
|
case ProtocolInfo::PONG_PACKET:
|
||||||
|
|
|
||||||
|
|
@ -267,8 +267,6 @@ abstract class ProtocolInfo7{ // MCPE 0.3 - 0.5 seem using same packet id
|
||||||
const INTERACT_PACKET = 0xa0;//Change
|
const INTERACT_PACKET = 0xa0;//Change
|
||||||
const USE_ITEM_PACKET = 0xa1;
|
const USE_ITEM_PACKET = 0xa1;
|
||||||
const PLAYER_ACTION_PACKET = 0xa2;
|
const PLAYER_ACTION_PACKET = 0xa2;
|
||||||
|
|
||||||
const HURT_ARMOR_PACKET = 0xa3;
|
|
||||||
const SET_ENTITY_DATA_PACKET = 0xa3;
|
const SET_ENTITY_DATA_PACKET = 0xa3;
|
||||||
const SET_ENTITY_MOTION_PACKET = 0xa4;
|
const SET_ENTITY_MOTION_PACKET = 0xa4;
|
||||||
//const SET_ENTITY_LINK_PACKET = 0xa?;
|
//const SET_ENTITY_LINK_PACKET = 0xa?;
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ class ContainerOpenPacket extends RakNetDataPacket{
|
||||||
$this->putByte($this->windowid);
|
$this->putByte($this->windowid);
|
||||||
$this->putByte($this->type);
|
$this->putByte($this->type);
|
||||||
$this->putByte($this->slots);
|
$this->putByte($this->slots);
|
||||||
$this->putInt($this->x);
|
$this->putInt($this->x);//String
|
||||||
$this->putInt($this->y);
|
$this->putInt($this->y);
|
||||||
$this->putInt($this->z);
|
$this->putInt($this->z);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ class ContainerSetContentPacket extends RakNetDataPacket{
|
||||||
$this->putSlot($slot);
|
$this->putSlot($slot);
|
||||||
}
|
}
|
||||||
if($this->windowid === 0 and count($this->hotbar) > 0){
|
if($this->windowid === 0 and count($this->hotbar) > 0){
|
||||||
$this->putShort(count($this->hotbar));
|
$this->putShort(count($this->hotbar));//null
|
||||||
foreach($this->hotbar as $slot){
|
foreach($this->hotbar as $slot){
|
||||||
$this->putInt($slot);
|
$this->putInt($slot);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ class LoginPacket extends RakNetDataPacket{
|
||||||
$this->username = $this->getString();
|
$this->username = $this->getString();
|
||||||
$this->protocol1 = $this->getInt();
|
$this->protocol1 = $this->getInt();
|
||||||
$this->protocol2 = $this->getInt();
|
$this->protocol2 = $this->getInt();
|
||||||
$this->clientId = $this->getInt();
|
$this->clientId = $this->getInt();//null
|
||||||
$this->loginData = $this->getString();
|
$this->loginData = $this->getString();
|
||||||
$this->PROTOCOL = $this->protocol1;
|
$this->PROTOCOL = $this->protocol1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
54
src/network/protocol/packet/PlaceBlockPacket.php
Normal file
54
src/network/protocol/packet/PlaceBlockPacket.php
Normal file
|
|
@ -0,0 +1,54 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class PlaceBlockPacket extends RakNetDataPacket{
|
||||||
|
public $unknown1 = 0;
|
||||||
|
public $unknown2 = 0;
|
||||||
|
public $unknown3 = 0;
|
||||||
|
public $unknown4 = 0;
|
||||||
|
public $unknown5 = 0;
|
||||||
|
public $unknown6 = 0;
|
||||||
|
public $unknown7 = 0;
|
||||||
|
|
||||||
|
public function pid(){
|
||||||
|
if($this->PROTOCOL < ProtocolInfo9::CURRENT_PROTOCOL_9) {
|
||||||
|
return ProtocolInfo7::PLACE_BLOCK_PACKET;
|
||||||
|
}
|
||||||
|
return ProtocolInfo::PLACE_BLOCK_PACKET;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function decode(){
|
||||||
|
$this->unknown1 = $this->getInt();
|
||||||
|
$this->unknown2 = $this->getInt();
|
||||||
|
$this->unknown3 = $this->getInt();
|
||||||
|
$this->unknown4 = $this->getByte();
|
||||||
|
$this->unknown5 = $this->getByte();
|
||||||
|
$this->unknown6 = $this->getByte();
|
||||||
|
$this->unknown7 = $this->getByte();
|
||||||
|
ConsoleAPI::info("Int1:".$this->unknown1);
|
||||||
|
ConsoleAPI::info("Int2:".$this->unknown2);
|
||||||
|
ConsoleAPI::info("Int3:".$this->unknown3);
|
||||||
|
ConsoleAPI::info("Byte4:".$this->unknown4);
|
||||||
|
ConsoleAPI::info("Byte5:".$this->unknown5);
|
||||||
|
ConsoleAPI::info("Byte6:".$this->unknown6);
|
||||||
|
ConsoleAPI::info("Byte7:".$this->unknown7);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function encode(){
|
||||||
|
$this->reset();
|
||||||
|
$this->putInt($this->unknown1);
|
||||||
|
$this->putInt($this->unknown2);
|
||||||
|
$this->putInt($this->unknown3);
|
||||||
|
$this->putByte($this->unknown4);
|
||||||
|
$this->putByte($this->unknown5);
|
||||||
|
$this->putByte($this->unknown6);
|
||||||
|
$this->putByte($this->unknown7);
|
||||||
|
ConsoleAPI::info("Int1:".$this->unknown1);
|
||||||
|
ConsoleAPI::info("Int2:".$this->unknown2);
|
||||||
|
ConsoleAPI::info("Int3:".$this->unknown3);
|
||||||
|
ConsoleAPI::info("Byte4:".$this->unknown4);
|
||||||
|
ConsoleAPI::info("Byte5:".$this->unknown5);
|
||||||
|
ConsoleAPI::info("Byte6:".$this->unknown6);
|
||||||
|
ConsoleAPI::info("Byte7:".$this->unknown7);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -14,7 +14,7 @@ class SetTimePacket extends RakNetDataPacket{
|
||||||
|
|
||||||
public function encode(){
|
public function encode(){
|
||||||
$this->reset();
|
$this->reset();
|
||||||
$this->putInt($this->time);
|
$this->putInt($this->time);//long
|
||||||
$this->putByte($this->started ? 0x80:0x00);
|
$this->putByte($this->started ? 0x80:0x00);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ class StartGamePacket extends RakNetDataPacket{
|
||||||
|
|
||||||
public function encode(){
|
public function encode(){
|
||||||
$this->reset();
|
$this->reset();
|
||||||
$this->putInt($this->seed);
|
$this->putInt($this->seed);//long
|
||||||
$this->putInt($this->generator);
|
$this->putInt($this->generator);
|
||||||
$this->putInt($this->gamemode);
|
$this->putInt($this->gamemode);
|
||||||
$this->putInt($this->eid);
|
$this->putInt($this->eid);
|
||||||
|
|
|
||||||
|
|
@ -965,9 +965,9 @@ class RakNetParser{
|
||||||
case ProtocolInfo7::PLAYER_EQUIPMENT_PACKET:
|
case ProtocolInfo7::PLAYER_EQUIPMENT_PACKET:
|
||||||
$data = new PlayerEquipmentPacket;
|
$data = new PlayerEquipmentPacket;
|
||||||
break;
|
break;
|
||||||
/*case ProtocolInfo7::PLAYER_ARMOR_EQUIPMENT_PACKET:
|
case ProtocolInfo7::PLAYER_ARMOR_EQUIPMENT_PACKET:
|
||||||
$data = new PlayerArmorEquipmentPacket;
|
$data = new PlayerArmorEquipmentPacket;
|
||||||
break;*/
|
break;
|
||||||
case ProtocolInfo7::INTERACT_PACKET:
|
case ProtocolInfo7::INTERACT_PACKET:
|
||||||
$data = new InteractPacket;
|
$data = new InteractPacket;
|
||||||
break;
|
break;
|
||||||
|
|
@ -977,9 +977,6 @@ class RakNetParser{
|
||||||
case ProtocolInfo7::PLAYER_ACTION_PACKET:
|
case ProtocolInfo7::PLAYER_ACTION_PACKET:
|
||||||
$data = new PlayerActionPacket;
|
$data = new PlayerActionPacket;
|
||||||
break;
|
break;
|
||||||
/*case ProtocolInfo7::HURT_ARMOR_PACKET:
|
|
||||||
$data = new HurtArmorPacket;
|
|
||||||
break;*/
|
|
||||||
case ProtocolInfo7::SET_ENTITY_DATA_PACKET:
|
case ProtocolInfo7::SET_ENTITY_DATA_PACKET:
|
||||||
$data = new SetEntityDataPacket;
|
$data = new SetEntityDataPacket;
|
||||||
break;
|
break;
|
||||||
|
|
@ -1013,12 +1010,12 @@ class RakNetParser{
|
||||||
case ProtocolInfo7::CONTAINER_SET_SLOT_PACKET:
|
case ProtocolInfo7::CONTAINER_SET_SLOT_PACKET:
|
||||||
$data = new ContainerSetSlotPacket;
|
$data = new ContainerSetSlotPacket;
|
||||||
break;
|
break;
|
||||||
/*case ProtocolInfo7::CONTAINER_SET_DATA_PACKET:
|
case ProtocolInfo7::CONTAINER_SET_DATA_PACKET:
|
||||||
$data = new ContainerSetDataPacket;
|
$data = new ContainerSetDataPacket;
|
||||||
break;*/
|
break;
|
||||||
/*case ProtocolInfo7::CONTAINER_SET_CONTENT_PACKET:
|
case ProtocolInfo7::CONTAINER_SET_CONTENT_PACKET:
|
||||||
$data = new ContainerSetContentPacket;
|
$data = new ContainerSetContentPacket;
|
||||||
break;*/
|
break;
|
||||||
case ProtocolInfo7::CHAT_PACKET:
|
case ProtocolInfo7::CHAT_PACKET:
|
||||||
$data = new ChatPacket;
|
$data = new ChatPacket;
|
||||||
break;
|
break;
|
||||||
|
|
@ -1028,9 +1025,9 @@ class RakNetParser{
|
||||||
case ProtocolInfo7::ENTITY_DATA_PACKET:
|
case ProtocolInfo7::ENTITY_DATA_PACKET:
|
||||||
$data = new EntityDataPacket;
|
$data = new EntityDataPacket;
|
||||||
break;
|
break;
|
||||||
/*case ProtocolInfo7::PLAYER_INPUT_PACKET:
|
case ProtocolInfo7::PLAYER_INPUT_PACKET:
|
||||||
$data = new PlayerInputPacket;
|
$data = new PlayerInputPacket;
|
||||||
break;*/
|
break;
|
||||||
default:
|
default:
|
||||||
$data = new UnknownPacket();
|
$data = new UnknownPacket();
|
||||||
$data->packetID = $pid;
|
$data->packetID = $pid;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue