mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 12:09:43 +00:00
tweaked minecarts + AddEntityPacket
This commit is contained in:
parent
f8c3f9cae3
commit
3b65160552
7 changed files with 17 additions and 32 deletions
|
|
@ -2271,9 +2271,9 @@ class Player{
|
|||
if($this->entity->linkedEntity instanceof Entity){
|
||||
$pk = new SetEntityMotionPacket;
|
||||
$pk->eid = $this->entity->linkedEntity->eid;
|
||||
$pk->speedX = ($this->entity->x - $this->entity->linkedEntity->x)*30;
|
||||
$pk->speedY = ($this->entity->y - $this->entity->linkedEntity->y)*30;
|
||||
$pk->speedZ = ($this->entity->z - $this->entity->linkedEntity->z)*30;
|
||||
$pk->speedX = ($this->entity->x - $this->entity->linkedEntity->x)*1.2;
|
||||
$pk->speedY = ($this->entity->y - $this->entity->linkedEntity->y)*1.2;
|
||||
$pk->speedZ = ($this->entity->z - $this->entity->linkedEntity->z)*1.2;
|
||||
foreach($this->level->players as $p){
|
||||
if($p->entity->eid != $this->entity->eid){
|
||||
$p->dataPacket(clone $pk);
|
||||
|
|
|
|||
|
|
@ -1016,16 +1016,11 @@ class Entity extends Position
|
|||
$pk->x = $this->x;
|
||||
$pk->y = $this->y;
|
||||
$pk->z = $this->z;
|
||||
$pk->did = - $this->data["Tile"];
|
||||
$player->dataPacket($pk);
|
||||
|
||||
$pk = new SetEntityMotionPacket();
|
||||
$pk->eid = $this->eid;
|
||||
$pk->speedX = $this->speedX;
|
||||
$pk->speedY = $this->speedY;
|
||||
$pk->speedZ = $this->speedZ;
|
||||
$pk->did = -$this->data["Tile"];
|
||||
$player->dataPacket($pk);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -144,13 +144,6 @@ class Arrow extends Projectile{
|
|||
$pk->speedY = $this->speedY;
|
||||
$pk->speedZ = $this->speedZ;
|
||||
$player->dataPacket($pk);
|
||||
|
||||
$pk = new SetEntityMotionPacket;
|
||||
$pk->eid = $this->eid;
|
||||
$pk->speedX = $this->speedX;
|
||||
$pk->speedY = $this->speedY;
|
||||
$pk->speedZ = $this->speedZ;
|
||||
$player->dataPacket($pk);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -48,10 +48,7 @@ class PrimedTNT extends Entity{
|
|||
$pk->x = $this->x;
|
||||
$pk->y = $this->y;
|
||||
$pk->z = $this->z;
|
||||
$pk->did = 0;
|
||||
$player->dataPacket($pk);
|
||||
$pk = new SetEntityMotionPacket;
|
||||
$pk->eid = $this->eid;
|
||||
$pk->did = 1;
|
||||
$pk->speedX = $this->speedX;
|
||||
$pk->speedY = $this->speedY;
|
||||
$pk->speedZ = $this->speedZ;
|
||||
|
|
|
|||
|
|
@ -9,10 +9,10 @@ class RailBlock extends RailBaseBlock{
|
|||
}
|
||||
|
||||
public function updateState(){
|
||||
//$logic = (new RailLogic($this));
|
||||
//if($logic->countPotentialConnections() == 3){
|
||||
// $logic->place(false, false);
|
||||
//}
|
||||
$logic = (new RailLogic($this));
|
||||
if($logic->countPotentialConnections() == 3){
|
||||
$logic->place(false, false);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -28,9 +28,9 @@ class AddEntityPacket extends RakNetDataPacket{
|
|||
$this->putFloat($this->z);
|
||||
$this->putInt($this->did);
|
||||
if($this->did > 0){
|
||||
$this->putShort($this->speedX);
|
||||
$this->putShort($this->speedY);
|
||||
$this->putShort($this->speedZ);
|
||||
$this->putShort((int)($this->speedX * 8000));
|
||||
$this->putShort((int)($this->speedY * 8000));
|
||||
$this->putShort((int)($this->speedZ * 8000));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
class PlayerInputPacket extends RakNetDataPacket{
|
||||
public $unk1, $unk2, $sneaking, $unk4;
|
||||
public $moveStrafe, $moveForward, $isJumping, $isSneaking;
|
||||
public function encode()
|
||||
{
|
||||
|
||||
|
|
@ -13,10 +13,10 @@ class PlayerInputPacket extends RakNetDataPacket{
|
|||
|
||||
public function decode()
|
||||
{
|
||||
$this->unk1 = $this->getFloat();
|
||||
$this->unk2 = $this->getFloat();
|
||||
$this->sneaking = bin2hex($this->buffer)[$this->getOffset()] === 4;
|
||||
$this->unk4 = bin2hex($this->buffer)[$this->getOffset()+1] === 4;
|
||||
$this->moveStrafe = $this->getFloat();
|
||||
$this->moveForward = $this->getFloat();
|
||||
$this->isJumping = $this->getByte() != 0;
|
||||
$this->isSneaking = $this->getByte() != 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue