mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 19:49:44 +00:00
working knockback for players
This commit is contained in:
parent
5364718d13
commit
4aa120c3f2
3 changed files with 12 additions and 4 deletions
|
|
@ -1984,7 +1984,7 @@ class Player{
|
|||
}
|
||||
$this->craftingItems = [];
|
||||
$this->toCraft = [];
|
||||
$this->teleport($this->spawnPosition);
|
||||
$this->teleport($this->spawnPosition, false, false, true, false);
|
||||
if($this->entity instanceof Entity){
|
||||
$this->entity->fire = 0;
|
||||
$this->entity->air = $this->entity->maxAir;
|
||||
|
|
|
|||
|
|
@ -98,6 +98,7 @@ class Entity extends Position
|
|||
public $fireResistance = 1;
|
||||
public $inWeb;
|
||||
public $inLava;
|
||||
|
||||
function __construct(Level $level, $eid, $class, $type = 0, $data = array())
|
||||
{
|
||||
$this->random = new Random();
|
||||
|
|
@ -810,6 +811,7 @@ class Entity extends Position
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
if($this->isOnLadder()){
|
||||
$this->fallDistance = 0;
|
||||
$this->fallStart = $this->y;
|
||||
|
|
@ -853,7 +855,6 @@ class Entity extends Position
|
|||
$y = floor($this->y - 1); //TODO not 1
|
||||
$z = floor($this->z);
|
||||
$bid = $this->level->level->getBlockID($x, $y, $z);
|
||||
console($this->y.":".$y);
|
||||
if($bid > 0){
|
||||
$clz = StaticBlock::getBlock($bid);
|
||||
$clz::fallOn($this->level, $x, $y, $z, $this, ceil($this->fallStart - $this->y));
|
||||
|
|
@ -1326,6 +1327,14 @@ class Entity extends Position
|
|||
}
|
||||
|
||||
$this->knockBack($d, $d1);
|
||||
if($this->isPlayer()){
|
||||
$pk = new SetEntityMotionPacket();
|
||||
$pk->eid = 0;
|
||||
$pk->speedX = $this->speedX;
|
||||
$pk->speedY = $this->speedY;
|
||||
$pk->speedZ = $this->speedZ;
|
||||
$this->player->directDataPacket($pk, 0);
|
||||
}
|
||||
$this->knockbackTime = 10;
|
||||
|
||||
}
|
||||
|
|
@ -1365,7 +1374,7 @@ class Entity extends Position
|
|||
public function sendMoveUpdate()
|
||||
{
|
||||
if($this->class === ENTITY_PLAYER){
|
||||
$this->player->teleport(new Vector3($this->x, $this->y, $this->z));
|
||||
$this->player->teleport(new Vector3($this->x, $this->y, $this->z), false, false, true, false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,7 +67,6 @@ class MobSpawner{
|
|||
}
|
||||
|
||||
foreach($this->level->players as $player){
|
||||
|
||||
if(isset($this->playerAffectedEIDS[$player->entity->eid]) && count($this->playerAffectedEIDS[$player->entity->eid]) > $this->totalMobsPerPlayer){
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue