mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 03:59:43 +00:00
fixed item and tnt movement(kinda)
This commit is contained in:
parent
2636aa985d
commit
403eb71aa6
3 changed files with 72 additions and 5 deletions
|
|
@ -24,4 +24,38 @@ class ItemEntity extends Entity{
|
|||
$this->delayBeforePickup = 20;
|
||||
$this->stepHeight = 0;
|
||||
}
|
||||
|
||||
public function updateEntityMovement(){
|
||||
//TODO it is weird on client side for some reason
|
||||
if(abs($this->speedX) < self::MIN_POSSIBLE_SPEED) $this->speedX = 0;
|
||||
if(abs($this->speedZ) < self::MIN_POSSIBLE_SPEED) $this->speedZ = 0;
|
||||
if(abs($this->speedY) < self::MIN_POSSIBLE_SPEED) $this->speedY = 0;
|
||||
|
||||
$this->speedY -= 0.04;
|
||||
$this->noClip = false; //TODO pushOutofBlocks
|
||||
$this->move($this->speedX, $this->speedY, $this->speedZ);
|
||||
|
||||
$var1 = (int)$this->x != (int)$this->lastX || (int)$this->y != (int)$this->lastY || (int)$this->z != (int)$this->lastZ;
|
||||
if($var1/* || $this->ticksExisted % 25 == 0*/){ //TODO ticksExisted(should be alternative in nc already)
|
||||
//TODO check material
|
||||
|
||||
//TODO search for other items
|
||||
}
|
||||
|
||||
$friction = 0.98;
|
||||
|
||||
if($this->onGround){
|
||||
$friction = 0.588;
|
||||
$v3 = $this->level->level->getBlockID($this->x, floor($this->boundingBox->minY) - 1, $this->z);
|
||||
if($v3 > 0) $friction = StaticBlock::getSlipperiness($v3);
|
||||
}
|
||||
|
||||
$this->speedX *= $friction;
|
||||
$this->speedY *= 0.98;
|
||||
$this->speedZ *= $friction;
|
||||
|
||||
//if($this->onGround) $this->speedY *= -0.5;
|
||||
|
||||
//TODO ++age; despawn after age >= 6000;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue