mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-23 04:59:46 +00:00
fixed head rotation
This commit is contained in:
parent
153894c368
commit
5fdf1f6b75
2 changed files with 8 additions and 6 deletions
|
|
@ -1051,8 +1051,7 @@ class Entity extends Position
|
||||||
|
|
||||||
public function sendHeadYaw(){
|
public function sendHeadYaw(){
|
||||||
$pk = new RotateHeadPacket;
|
$pk = new RotateHeadPacket;
|
||||||
$pk->eid = $this->eid;
|
$pk->entities = [[$this->eid, $this->headYaw]];
|
||||||
$pk->yaw = $this->headYaw;
|
|
||||||
$this->server->api->player->broadcastPacket($this->level->players, $pk);
|
$this->server->api->player->broadcastPacket($this->level->players, $pk);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1180,6 +1179,7 @@ class Entity extends Position
|
||||||
}
|
}
|
||||||
if($this->class === ENTITY_FALLING){
|
if($this->class === ENTITY_FALLING){
|
||||||
$data["Tile"] = $this->data["Tile"];
|
$data["Tile"] = $this->data["Tile"];
|
||||||
|
$data["Metadata"] = $this->data["Metadata"];
|
||||||
}
|
}
|
||||||
if($this->class === ENTITY_ITEM){
|
if($this->class === ENTITY_ITEM){
|
||||||
$data["Item"] = [
|
$data["Item"] = [
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
class RotateHeadPacket extends RakNetDataPacket{
|
class RotateHeadPacket extends RakNetDataPacket{
|
||||||
public $eid;
|
public $entities;
|
||||||
public $yaw;
|
|
||||||
/**
|
/**
|
||||||
* Should yaw be modifed<br>
|
* Should yaw be modifed<br>
|
||||||
* false = <b>yaw / 360 / 0.0039062</b><br>
|
* false = <b>yaw / 360 / 0.0039062</b><br>
|
||||||
|
|
@ -22,8 +21,11 @@ class RotateHeadPacket extends RakNetDataPacket{
|
||||||
|
|
||||||
public function encode(){
|
public function encode(){
|
||||||
$this->reset();
|
$this->reset();
|
||||||
$this->putInt($this->eid);
|
$this->putInt(count($this->entities));
|
||||||
@$this->putByte($this->rawYaw ? $this->yaw : $this->yaw / 360 / 0.0039062); //dont ask me why does chr count float TODO find a better way
|
foreach($this->entities as $d){
|
||||||
|
$this->putInt($d[0]); //eid
|
||||||
|
$this->putByte((int) ($d[1] / 360 / 0.0039062));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue