players are now pushable, renamed 2 previously unknown variables(thanks to atipls' mcpealpha c# core)

This commit is contained in:
GameHerobrine 2022-09-25 00:08:55 +03:00
parent 1f1e1ed709
commit 53928f4e88
3 changed files with 46 additions and 29 deletions

View file

@ -25,6 +25,9 @@ class Entity extends Position{
public $class;
public $attach;
public $closed;
/**
* @var Player
*/
public $player;
public $fallY;
public $fallStart;
@ -599,8 +602,8 @@ class Entity extends Position{
$pk->z = $this->z;
$pk->yaw = 0;
$pk->pitch = 0;
$pk->unknown1 = 0;
$pk->unknown2 = 0;
$pk->itemID = 0;
$pk->itemAuxValue = 0;
$pk->metadata = $this->getMetadata();
$player->dataPacket($pk);
@ -821,6 +824,10 @@ class Entity extends Position{
}
public function sendMoveUpdate(){
if($this->class === ENTITY_PLAYER){
$this->player->teleport(new Vector3($this->x, $this->y, $this->z));
return;
}
$pk = new MoveEntityPacket_PosRot;
$pk->eid = $this->eid;
$pk->x = $this->x;
@ -837,7 +844,7 @@ class Entity extends Position{
if($health < $this->health){
$harm = true;
$dmg = $this->health - $health;
if(is_numeric($cause) && ($entity = $this->server->api->entity->get($cause)) != false && !($this->player instanceof Player)){
if(is_numeric($cause) && ($entity = $this->server->api->entity->get($cause)) != false){
$d = $entity->x - $this->x;
for($d1 = $entity->z - $this->z; $d * $d + $d1 * $d1 < 0.0001; $d1 = (Utils::randomFloat() - Utils::randomFloat()) * 0.01)
{

View file

@ -9,8 +9,19 @@ class AddPlayerPacket extends RakNetDataPacket{
public $z;
public $pitch;
public $yaw;
public $itemID;
public $itemAuxValue;
/**
*@deprecated use $itemID instead
*/
public $unknown1;
/**
*@deprecated use $itemAuxValue instead
*/
public $unknown2;
/**
*@var array
*/
public $metadata;
public function pid(){
@ -31,8 +42,8 @@ class AddPlayerPacket extends RakNetDataPacket{
$this->putFloat($this->z);
$this->putByte($this->yaw);
$this->putByte($this->pitch);
$this->putShort($this->unknown1);
$this->putShort($this->unknown2);
$this->putShort($this->itemID);
$this->putShort($this->itemAuxValue); //Example: bow shooting power
$this->put(Utils::writeMetadata($this->metadata));
}

View file

@ -1,24 +1,23 @@
<?php
class PlayerInputPacket extends RakNetDataPacket{
public $unk1, $unk2, $unk3, $unk4;
public function encode()
{
}
public function pid()
{
return ProtocolInfo::PLAYER_INPUT_PACKET;
}
public function decode()
{
$this->unk1 = $this->getFloat();
$this->unk2 = $this->getFloat();
$this->unk3 = $this->getByte();
$this->unk4 = $this->getByte();
console("values: {$this->unk1}, {$this->unk2}, {$this->unk3}, {$this->unk4}");
}
}
<?php
class PlayerInputPacket extends RakNetDataPacket{
public $unk1, $unk2, $unk3, $unk4;
public function encode()
{
}
public function pid()
{
return ProtocolInfo::PLAYER_INPUT_PACKET;
}
public function decode()
{
$this->unk1 = $this->getFloat();
$this->unk2 = $this->getFloat();
$this->unk3 = $this->getByte();
$this->unk4 = $this->getByte();
}
}