mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-24 05:29:44 +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){
|
if($this->entity->linkedEntity instanceof Entity){
|
||||||
$pk = new SetEntityMotionPacket;
|
$pk = new SetEntityMotionPacket;
|
||||||
$pk->eid = $this->entity->linkedEntity->eid;
|
$pk->eid = $this->entity->linkedEntity->eid;
|
||||||
$pk->speedX = ($this->entity->x - $this->entity->linkedEntity->x)*30;
|
$pk->speedX = ($this->entity->x - $this->entity->linkedEntity->x)*1.2;
|
||||||
$pk->speedY = ($this->entity->y - $this->entity->linkedEntity->y)*30;
|
$pk->speedY = ($this->entity->y - $this->entity->linkedEntity->y)*1.2;
|
||||||
$pk->speedZ = ($this->entity->z - $this->entity->linkedEntity->z)*30;
|
$pk->speedZ = ($this->entity->z - $this->entity->linkedEntity->z)*1.2;
|
||||||
foreach($this->level->players as $p){
|
foreach($this->level->players as $p){
|
||||||
if($p->entity->eid != $this->entity->eid){
|
if($p->entity->eid != $this->entity->eid){
|
||||||
$p->dataPacket(clone $pk);
|
$p->dataPacket(clone $pk);
|
||||||
|
|
|
||||||
|
|
@ -1016,16 +1016,11 @@ class Entity extends Position
|
||||||
$pk->x = $this->x;
|
$pk->x = $this->x;
|
||||||
$pk->y = $this->y;
|
$pk->y = $this->y;
|
||||||
$pk->z = $this->z;
|
$pk->z = $this->z;
|
||||||
$pk->did = - $this->data["Tile"];
|
|
||||||
$player->dataPacket($pk);
|
|
||||||
|
|
||||||
$pk = new SetEntityMotionPacket();
|
|
||||||
$pk->eid = $this->eid;
|
|
||||||
$pk->speedX = $this->speedX;
|
$pk->speedX = $this->speedX;
|
||||||
$pk->speedY = $this->speedY;
|
$pk->speedY = $this->speedY;
|
||||||
$pk->speedZ = $this->speedZ;
|
$pk->speedZ = $this->speedZ;
|
||||||
|
$pk->did = -$this->data["Tile"];
|
||||||
$player->dataPacket($pk);
|
$player->dataPacket($pk);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -144,13 +144,6 @@ class Arrow extends Projectile{
|
||||||
$pk->speedY = $this->speedY;
|
$pk->speedY = $this->speedY;
|
||||||
$pk->speedZ = $this->speedZ;
|
$pk->speedZ = $this->speedZ;
|
||||||
$player->dataPacket($pk);
|
$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->x = $this->x;
|
||||||
$pk->y = $this->y;
|
$pk->y = $this->y;
|
||||||
$pk->z = $this->z;
|
$pk->z = $this->z;
|
||||||
$pk->did = 0;
|
$pk->did = 1;
|
||||||
$player->dataPacket($pk);
|
|
||||||
$pk = new SetEntityMotionPacket;
|
|
||||||
$pk->eid = $this->eid;
|
|
||||||
$pk->speedX = $this->speedX;
|
$pk->speedX = $this->speedX;
|
||||||
$pk->speedY = $this->speedY;
|
$pk->speedY = $this->speedY;
|
||||||
$pk->speedZ = $this->speedZ;
|
$pk->speedZ = $this->speedZ;
|
||||||
|
|
|
||||||
|
|
@ -9,10 +9,10 @@ class RailBlock extends RailBaseBlock{
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updateState(){
|
public function updateState(){
|
||||||
//$logic = (new RailLogic($this));
|
$logic = (new RailLogic($this));
|
||||||
//if($logic->countPotentialConnections() == 3){
|
if($logic->countPotentialConnections() == 3){
|
||||||
// $logic->place(false, false);
|
$logic->place(false, false);
|
||||||
//}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -28,9 +28,9 @@ class AddEntityPacket extends RakNetDataPacket{
|
||||||
$this->putFloat($this->z);
|
$this->putFloat($this->z);
|
||||||
$this->putInt($this->did);
|
$this->putInt($this->did);
|
||||||
if($this->did > 0){
|
if($this->did > 0){
|
||||||
$this->putShort($this->speedX);
|
$this->putShort((int)($this->speedX * 8000));
|
||||||
$this->putShort($this->speedY);
|
$this->putShort((int)($this->speedY * 8000));
|
||||||
$this->putShort($this->speedZ);
|
$this->putShort((int)($this->speedZ * 8000));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
class PlayerInputPacket extends RakNetDataPacket{
|
class PlayerInputPacket extends RakNetDataPacket{
|
||||||
public $unk1, $unk2, $sneaking, $unk4;
|
public $moveStrafe, $moveForward, $isJumping, $isSneaking;
|
||||||
public function encode()
|
public function encode()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
@ -13,10 +13,10 @@ class PlayerInputPacket extends RakNetDataPacket{
|
||||||
|
|
||||||
public function decode()
|
public function decode()
|
||||||
{
|
{
|
||||||
$this->unk1 = $this->getFloat();
|
$this->moveStrafe = $this->getFloat();
|
||||||
$this->unk2 = $this->getFloat();
|
$this->moveForward = $this->getFloat();
|
||||||
$this->sneaking = bin2hex($this->buffer)[$this->getOffset()] === 4;
|
$this->isJumping = $this->getByte() != 0;
|
||||||
$this->unk4 = bin2hex($this->buffer)[$this->getOffset()+1] === 4;
|
$this->isSneaking = $this->getByte() != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue