Skip to content

Commit

Permalink
fix: gravity motion
Browse files Browse the repository at this point in the history
  • Loading branch information
AIPTU committed Jul 31, 2024
1 parent b0e583b commit c62e452
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/aiptu/smaccer/entity/EntitySmaccer.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ protected function initEntity(CompoundTag $nbt) : void {
$this->setNameTagVisible((bool) $nbt->getByte(EntityTag::NAMETAG_VISIBLE, 1));
$this->initializeVisibility($nbt);
$this->setHasGravity((bool) $nbt->getByte(EntityTag::GRAVITY, 1));

$this->setNoClientPredictions();
}

public function saveNBT() : CompoundTag {
Expand All @@ -74,10 +72,18 @@ abstract public static function getNetworkTypeId() : string;
abstract public function getName() : string;

protected function getInitialDragMultiplier() : float {
return 0.00;
return 0.02;
}

protected function getInitialGravity() : float {
return 0.00;
return 0.08;
}

public function setHasGravity(bool $v = true) : void{
parent::setHasGravity($v);

$this->networkPropertiesDirty = true;

$this->setForceMovementUpdate();
}
}
8 changes: 8 additions & 0 deletions src/aiptu/smaccer/entity/HumanSmaccer.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,12 @@ public function saveNBT() : CompoundTag {
public function getName() : string {
return 'Human';
}

public function setHasGravity(bool $v = true) : void {
parent::setHasGravity($v);

$this->networkPropertiesDirty = true;

$this->setForceMovementUpdate();
}
}

0 comments on commit c62e452

Please sign in to comment.