Entity: Invalid blocksAround cache when something happens during onEntityInside()

this fixes TNT spawning multiple entities when lit by flaming arrows.
The problem here is a bit more complex (entities aren't immediately notified when local block updates happen, so they cache stuff that becomes unusable). The simplest option would be to just lose the cache, but that would have some impacts on performance.
Barring a rethink of the block updating mechanism, this solution seems usable for now.
This commit is contained in:
Dylan K. Taylor
2020-09-25 16:35:59 +01:00
parent ae9e931849
commit 8e12693494
12 changed files with 29 additions and 13 deletions

View File

@ -68,7 +68,7 @@ class Fire extends Flowable{
return true;
}
public function onEntityInside(Entity $entity) : void{
public function onEntityInside(Entity $entity) : bool{
$ev = new EntityDamageByBlockEvent($this, $entity, EntityDamageEvent::CAUSE_FIRE, 1);
$entity->attack($ev);
@ -80,6 +80,7 @@ class Fire extends Flowable{
if(!$ev->isCancelled()){
$entity->setOnFire($ev->getDuration());
}
return true;
}
public function getDropsForCompatibleTool(Item $item) : array{