mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-14 09:49:50 +00:00
Fixed ExplodePacket
fixed-float my ass!
This commit is contained in:
parent
2024e9ecdf
commit
61b857a81c
@ -35,6 +35,7 @@ class ExplodePacket extends DataPacket{
|
|||||||
public $x;
|
public $x;
|
||||||
public $y;
|
public $y;
|
||||||
public $z;
|
public $z;
|
||||||
|
/** @var float */
|
||||||
public $radius;
|
public $radius;
|
||||||
/** @var Vector3[] */
|
/** @var Vector3[] */
|
||||||
public $records = [];
|
public $records = [];
|
||||||
@ -46,7 +47,7 @@ class ExplodePacket extends DataPacket{
|
|||||||
|
|
||||||
public function decode(){
|
public function decode(){
|
||||||
$this->getVector3f($this->x, $this->y, $this->z);
|
$this->getVector3f($this->x, $this->y, $this->z);
|
||||||
$this->radius = $this->getLFloat();
|
$this->radius = (float) ($this->getVarInt() / 32);
|
||||||
$count = $this->getUnsignedVarInt();
|
$count = $this->getUnsignedVarInt();
|
||||||
for($i = 0; $i < $count; ++$i){
|
for($i = 0; $i < $count; ++$i){
|
||||||
$x = $y = $z = null;
|
$x = $y = $z = null;
|
||||||
@ -58,7 +59,7 @@ class ExplodePacket extends DataPacket{
|
|||||||
public function encode(){
|
public function encode(){
|
||||||
$this->reset();
|
$this->reset();
|
||||||
$this->putVector3f($this->x, $this->y, $this->z);
|
$this->putVector3f($this->x, $this->y, $this->z);
|
||||||
$this->putLFloat($this->radius);
|
$this->putVarInt((int) ($this->radius * 32));
|
||||||
$this->putUnsignedVarInt(count($this->records));
|
$this->putUnsignedVarInt(count($this->records));
|
||||||
if(count($this->records) > 0){
|
if(count($this->records) > 0){
|
||||||
foreach($this->records as $record){
|
foreach($this->records as $record){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user