mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-23 00:55:57 +00:00
Projectile: use closure instead of do/while for reading id/data of block
not ideal, but whatever I guess... this at least provides scope isolation
This commit is contained in:
parent
8865bb73ba
commit
9f5c16bc46
@ -80,33 +80,29 @@ abstract class Projectile extends Entity{
|
||||
$this->setHealth(1);
|
||||
$this->damage = $this->namedtag->getDouble("damage", $this->damage);
|
||||
|
||||
do{
|
||||
$blockHit = null;
|
||||
$blockId = null;
|
||||
$blockData = null;
|
||||
|
||||
(function() : void{
|
||||
if($this->namedtag->hasTag("tileX", IntTag::class) and $this->namedtag->hasTag("tileY", IntTag::class) and $this->namedtag->hasTag("tileZ", IntTag::class)){
|
||||
$blockHit = new Vector3($this->namedtag->getInt("tileX"), $this->namedtag->getInt("tileY"), $this->namedtag->getInt("tileZ"));
|
||||
}else{
|
||||
break;
|
||||
return;
|
||||
}
|
||||
|
||||
if($this->namedtag->hasTag("blockId", IntTag::class)){
|
||||
$blockId = $this->namedtag->getInt("blockId");
|
||||
}else{
|
||||
break;
|
||||
return;
|
||||
}
|
||||
|
||||
if($this->namedtag->hasTag("blockData", ByteTag::class)){
|
||||
$blockData = $this->namedtag->getByte("blockData");
|
||||
}else{
|
||||
break;
|
||||
return;
|
||||
}
|
||||
|
||||
$this->blockHit = $blockHit;
|
||||
$this->blockHitId = $blockId;
|
||||
$this->blockHitData = $blockData;
|
||||
}while(false);
|
||||
})();
|
||||
}
|
||||
|
||||
public function canCollideWith(Entity $entity) : bool{
|
||||
|
Loading…
x
Reference in New Issue
Block a user