Added VanillaItems::AIR()

we don't usually add VanillaItems entries for blocks since they already exist in VanillaBlocks, but air has a special use case specifically as an itemstack, so we make an exception for this case.
This commit is contained in:
Dylan K. Taylor
2021-12-07 00:41:07 +00:00
parent ce54d268f2
commit ed4978c31b
14 changed files with 32 additions and 25 deletions

View File

@ -32,7 +32,7 @@ use pocketmine\event\entity\EntityDamageByBlockEvent;
use pocketmine\event\entity\EntityDamageByEntityEvent;
use pocketmine\event\entity\EntityDamageEvent;
use pocketmine\event\entity\EntityExplodeEvent;
use pocketmine\item\ItemFactory;
use pocketmine\item\VanillaItems;
use pocketmine\math\AxisAlignedBB;
use pocketmine\math\Vector3;
use pocketmine\world\format\SubChunk;
@ -208,7 +208,7 @@ class Explosion{
}
}
$air = ItemFactory::air();
$air = VanillaItems::AIR();
$airBlock = VanillaBlocks::AIR();
foreach($this->affectedBlocks as $block){

View File

@ -52,9 +52,9 @@ use pocketmine\event\world\ChunkUnloadEvent;
use pocketmine\event\world\SpawnChangeEvent;
use pocketmine\event\world\WorldSaveEvent;
use pocketmine\item\Item;
use pocketmine\item\ItemFactory;
use pocketmine\item\ItemUseResult;
use pocketmine\item\LegacyStringToItemParser;
use pocketmine\item\VanillaItems;
use pocketmine\lang\KnownTranslationFactory;
use pocketmine\math\AxisAlignedBB;
use pocketmine\math\Vector3;
@ -1687,7 +1687,7 @@ class World implements ChunkManager{
$affectedBlocks = $target->getAffectedBlocks();
if($item === null){
$item = ItemFactory::air();
$item = VanillaItems::AIR();
}
$drops = [];