mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-30 23:29:54 +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->setHealth(1);
|
||||||
$this->damage = $this->namedtag->getDouble("damage", $this->damage);
|
$this->damage = $this->namedtag->getDouble("damage", $this->damage);
|
||||||
|
|
||||||
do{
|
(function() : void{
|
||||||
$blockHit = null;
|
|
||||||
$blockId = null;
|
|
||||||
$blockData = null;
|
|
||||||
|
|
||||||
if($this->namedtag->hasTag("tileX", IntTag::class) and $this->namedtag->hasTag("tileY", IntTag::class) and $this->namedtag->hasTag("tileZ", IntTag::class)){
|
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"));
|
$blockHit = new Vector3($this->namedtag->getInt("tileX"), $this->namedtag->getInt("tileY"), $this->namedtag->getInt("tileZ"));
|
||||||
}else{
|
}else{
|
||||||
break;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->namedtag->hasTag("blockId", IntTag::class)){
|
if($this->namedtag->hasTag("blockId", IntTag::class)){
|
||||||
$blockId = $this->namedtag->getInt("blockId");
|
$blockId = $this->namedtag->getInt("blockId");
|
||||||
}else{
|
}else{
|
||||||
break;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->namedtag->hasTag("blockData", ByteTag::class)){
|
if($this->namedtag->hasTag("blockData", ByteTag::class)){
|
||||||
$blockData = $this->namedtag->getByte("blockData");
|
$blockData = $this->namedtag->getByte("blockData");
|
||||||
}else{
|
}else{
|
||||||
break;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->blockHit = $blockHit;
|
$this->blockHit = $blockHit;
|
||||||
$this->blockHitId = $blockId;
|
$this->blockHitId = $blockId;
|
||||||
$this->blockHitData = $blockData;
|
$this->blockHitData = $blockData;
|
||||||
}while(false);
|
})();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function canCollideWith(Entity $entity) : bool{
|
public function canCollideWith(Entity $entity) : bool{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user