entity collisions

This commit is contained in:
GameHerobrine 2024-03-24 01:52:15 +03:00
parent 2ce333af5e
commit 3b15c26b0c
13 changed files with 104 additions and 34 deletions

View file

@ -10,7 +10,6 @@ class Entity extends Position
public $counter = 0;
public $fallDistance = 0;
public static $updateOnTick, $allowedAI;
public $isCollidable;
public $canBeAttacked;
public $moveTime, $lookTime, $idleTime, $knockbackTime = 0;
public $needsUpdate = true;
@ -167,6 +166,7 @@ class Entity extends Position
$this->hasGravity = true;
$this->canBeAttacked = true;
$this->fireResistance = 20;
break;
case ENTITY_OBJECT:
$this->x = isset($this->data["TileX"]) ? $this->data["TileX"] : $this->x;
@ -367,6 +367,14 @@ class Entity extends Position
}
}
/**
* Can entity be collided with or not
* @return boolean
*/
public function isPickable(){
return $this->isPlayer() ? !$this->dead : false;
}
public function handleLavaMovement(){ //TODO maybe try merging with water?
$this->inLava = $this->level->isLavaInBB($this->boundingBox->expand(-0.1, -0.4, -0.1));
return $this->inLava;