removed useless loop + fixed explosion error

This commit is contained in:
GameHerobrine 2022-12-23 08:00:45 +03:00
parent be9a9c0c0d
commit ab0b726904
2 changed files with 6 additions and 35 deletions

View file

@ -95,8 +95,11 @@ class Explosion{
$e = $server->api->entity->add($this->level, ENTITY_OBJECT, OBJECT_PRIMEDTNT, $data);
$server->api->entity->spawnToAll($e);
}elseif(mt_rand(0, 10000) < ((1 / $this->size) * 10000)){
foreach($block->getDrops($this->air, $this->nullPlayer) as $drop){
$server->api->entity->drop(new Position($block->x + 0.5, $block->y, $block->z + 0.5, $this->level), BlockAPI::getItem($drop[0], $drop[1], $drop[2])); //id, meta, count
$dropz = $block->getDrops($this->air, $this->nullPlayer);
if(is_array($dropz)){
foreach($dropz as $drop){
$server->api->entity->drop(new Position($block->x + 0.5, $block->y, $block->z + 0.5, $this->level), BlockAPI::getItem($drop[0], $drop[1], $drop[2])); //id, meta, count
}
}
}
$this->level->setBlock($block, new AirBlock(), true);
@ -110,4 +113,4 @@ class Explosion{
$pk->records = $send;
$server->api->player->broadcastPacket($this->level->players, $pk);
}
}
}