More protocol changes for 1.1, fixed resource packs

This commit is contained in:
Dylan K. Taylor 2017-04-11 20:09:19 +01:00
parent 894beed59b
commit cdf6d200ef
3 changed files with 15 additions and 12 deletions

View File

@ -36,6 +36,7 @@ class MoveEntityPacket extends DataPacket{
public $yaw;
public $headYaw;
public $pitch;
public $byte1;
public function decode(){
$this->eid = $this->getEntityRuntimeId();
@ -43,6 +44,7 @@ class MoveEntityPacket extends DataPacket{
$this->pitch = $this->getByte() * (360.0 / 256);
$this->yaw = $this->getByte() * (360.0 / 256);
$this->headYaw = $this->getByte() * (360.0 / 256);
$this->byte1 = $this->getByte();
}
public function encode(){
@ -52,6 +54,7 @@ class MoveEntityPacket extends DataPacket{
$this->putByte($this->pitch / (360.0 / 256));
$this->putByte($this->yaw / (360.0 / 256));
$this->putByte($this->headYaw / (360.0 / 256));
$this->putByte($this->byte1);
}
public function handle(NetworkSession $session) : bool{

View File

@ -41,14 +41,14 @@ class ResourcePackStackPacket extends DataPacket{
public function decode(){
/*$this->mustAccept = $this->getBool();
$behaviorPackCount = $this->getLShort();
$behaviorPackCount = $this->getUnsignedVarInt();
while($behaviorPackCount-- > 0){
$packId = $this->getString();
$version = $this->getString();
$this->behaviorPackStack[] = new ResourcePackInfoEntry($packId, $version);
}
$resourcePackCount = $this->getLShort();
$resourcePackCount = $this->getUnsignedVarInt();
while($resourcePackCount-- > 0){
$packId = $this->getString();
$version = $this->getString();
@ -60,13 +60,13 @@ class ResourcePackStackPacket extends DataPacket{
$this->reset();
$this->putBool($this->mustAccept);
$this->putLShort(count($this->behaviorPackStack));
$this->putUnsignedVarInt(count($this->behaviorPackStack));
foreach($this->behaviorPackStack as $entry){
$this->putString($entry->getPackId());
$this->putString($entry->getPackVersion());
}
$this->putLShort(count($this->resourcePackStack));
$this->putUnsignedVarInt(count($this->resourcePackStack));
foreach($this->resourcePackStack as $entry){
$this->putString($entry->getPackId());
$this->putString($entry->getPackVersion());

View File

@ -39,19 +39,19 @@ class ResourcePacksInfoPacket extends DataPacket{
public function decode(){
/*$this->mustAccept = $this->getBool();
$behaviorPackCount = $this->getLShort();
$behaviorPackCount = $this->getUnsignedVarInt();
while($behaviorPackCount-- > 0){
$id = $this->getString();
$version = $this->getString();
$size = $this->getLLong();
$size = $this->getUnsignedVarLong();
$this->behaviorPackEntries[] = new ResourcePackInfoEntry($id, $version, $size);
}
$resourcePackCount = $this->getLShort();
$resourcePackCount = $this->getUnsignedVarInt();
while($resourcePackCount-- > 0){
$id = $this->getString();
$version = $this->getString();
$size = $this->getLLong();
$size = $this->getUnsignedVarLong();
$this->resourcePackEntries[] = new ResourcePackInfoEntry($id, $version, $size);
}*/
}
@ -60,17 +60,17 @@ class ResourcePacksInfoPacket extends DataPacket{
$this->reset();
$this->putBool($this->mustAccept);
$this->putLShort(count($this->behaviorPackEntries));
$this->putUnsignedVarInt(count($this->behaviorPackEntries));
foreach($this->behaviorPackEntries as $entry){
$this->putString($entry->getPackId());
$this->putString($entry->getPackVersion());
$this->putLLong($entry->getPackSize());
$this->putUnsignedVarLong($entry->getPackSize());
}
$this->putLShort(count($this->resourcePackEntries));
$this->putUnsignedVarInt(count($this->resourcePackEntries));
foreach($this->resourcePackEntries as $entry){
$this->putString($entry->getPackId());
$this->putString($entry->getPackVersion());
$this->putLLong($entry->getPackSize());
$this->putUnsignedVarLong($entry->getPackSize());
}
}