Fix auto respawn bug in MCPE 0.3.2 - 0.5.0

This commit is contained in:
yefengeeeeeeeeeee 2025-04-12 19:13:36 +08:00
parent 7c8f32d100
commit 2712adc29f
9 changed files with 70 additions and 19 deletions

View file

@ -28,7 +28,7 @@ class ContainerOpenPacket extends RakNetDataPacket{
$this->putByte($this->windowid);
$this->putByte($this->type);
$this->putByte($this->slots);
$this->putInt($this->x);
$this->putInt($this->x);//String
$this->putInt($this->y);
$this->putInt($this->z);
}

View file

@ -36,7 +36,7 @@ class ContainerSetContentPacket extends RakNetDataPacket{
$this->putSlot($slot);
}
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){
$this->putInt($slot);
}

View file

@ -15,7 +15,7 @@ class LoginPacket extends RakNetDataPacket{
$this->username = $this->getString();
$this->protocol1 = $this->getInt();
$this->protocol2 = $this->getInt();
$this->clientId = $this->getInt();
$this->clientId = $this->getInt();//null
$this->loginData = $this->getString();
$this->PROTOCOL = $this->protocol1;
}

View 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);
}
}

View file

@ -14,7 +14,7 @@ class SetTimePacket extends RakNetDataPacket{
public function encode(){
$this->reset();
$this->putInt($this->time);
$this->putInt($this->time);//long
$this->putByte($this->started ? 0x80:0x00);
}

View file

@ -19,7 +19,7 @@ class StartGamePacket extends RakNetDataPacket{
public function encode(){
$this->reset();
$this->putInt($this->seed);
$this->putInt($this->seed);//long
$this->putInt($this->generator);
$this->putInt($this->gamemode);
$this->putInt($this->eid);