mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-22 20:49:43 +00:00
fixed a rare warning in console
This commit is contained in:
parent
eb8a11739a
commit
0cfc1e9587
3 changed files with 15 additions and 2 deletions
|
|
@ -219,6 +219,10 @@ class Entity extends Position
|
||||||
$this->speedZ += $vZ;
|
$this->speedZ += $vZ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isPushable(){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public function applyCollision(Entity $collided){
|
public function applyCollision(Entity $collided){
|
||||||
if(!($this->isPlayer() && $collided->isPlayer()) && $this->eid != $collided->eid){
|
if(!($this->isPlayer() && $collided->isPlayer()) && $this->eid != $collided->eid){
|
||||||
$diffX = $collided->x - $this->x;
|
$diffX = $collided->x - $this->x;
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,11 @@ abstract class Living extends Entity implements Pathfindable{
|
||||||
public function canBeShot(){
|
public function canBeShot(){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isPushable(){
|
||||||
|
return !$this->dead;
|
||||||
|
}
|
||||||
|
|
||||||
public function collideHandler(){
|
public function collideHandler(){
|
||||||
$bb = $this->boundingBox->expand(0.2, 0, 0.2);
|
$bb = $this->boundingBox->expand(0.2, 0, 0.2);
|
||||||
$minChunkX = ((int)($bb->minX)) >> 4;
|
$minChunkX = ((int)($bb->minX)) >> 4;
|
||||||
|
|
@ -92,8 +97,8 @@ abstract class Living extends Entity implements Pathfindable{
|
||||||
for($chunkZ = $minChunkZ; $chunkZ <= $maxChunkZ; ++$chunkZ){
|
for($chunkZ = $minChunkZ; $chunkZ <= $maxChunkZ; ++$chunkZ){
|
||||||
$ind = "$chunkX $chunkZ";
|
$ind = "$chunkX $chunkZ";
|
||||||
foreach($this->level->entityListPositioned[$ind] ?? [] as $entid){
|
foreach($this->level->entityListPositioned[$ind] ?? [] as $entid){
|
||||||
if($this->level->entityList[$entid] instanceof Entity){
|
if(($this->level->entityList[$entid] ?? null) instanceof Entity){
|
||||||
if($bb->intersectsWith($this->level->entityList[$entid]->boundingBox)){
|
if($this->level->entityList[$entid]->isPushable() && $bb->intersectsWith($this->level->entityList[$entid]->boundingBox)){
|
||||||
$this->level->entityList[$entid]->applyCollision($this);
|
$this->level->entityList[$entid]->applyCollision($this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -78,6 +78,10 @@ class Minecart extends Vehicle{
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isPushable(){
|
||||||
|
return false; //TODO replace with true
|
||||||
|
}
|
||||||
|
|
||||||
public function spawn($player){
|
public function spawn($player){
|
||||||
$pk = new AddEntityPacket;
|
$pk = new AddEntityPacket;
|
||||||
$pk->eid = $this->eid;
|
$pk->eid = $this->eid;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue