Shut some inspections up

This commit is contained in:
Dylan K. Taylor 2017-02-13 14:27:17 +00:00
parent 8a3c30ee7e
commit 903534572d
4 changed files with 12 additions and 5 deletions

View File

@ -2680,6 +2680,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
if($recipe instanceof ShapedRecipe){
for($x = 0; $x < 3 and $canCraft; ++$x){
for($y = 0; $y < 3; ++$y){
/** @var Item $item */
$item = $packet->input[$y * 3 + $x];
$ingredient = $recipe->getIngredient($x, $y);
if($item->getCount() > 0){
@ -2695,6 +2696,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
for($x = 0; $x < 3 and $canCraft; ++$x){
for($y = 0; $y < 3; ++$y){
/** @var Item $item */
$item = clone $packet->input[$y * 3 + $x];
foreach($needed as $k => $n){
@ -2946,7 +2948,8 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
break;
}
if(($tile = $this->level->getTile($this->temporalVector->setComponents($packet->x, $packet->y, $packet->z))) instanceof ItemFrame){
$tile = $this->level->getTile($this->temporalVector->setComponents($packet->x, $packet->y, $packet->z));
if($tile instanceof ItemFrame){
if(!$tile->getItem()->equals($packet->item) and !$this->isCreative(true)){
$tile->spawnTo($this);
break;

View File

@ -101,7 +101,8 @@ class BurningFurnace extends Solid{
public function onActivate(Item $item, Player $player = null){
if($player instanceof Player){
if(!(($furnace = $this->getLevel()->getTile($this)) instanceof TileFurnace)){
$furnace = $this->getLevel()->getTile($this);
if(!($furnace instanceof TileFurnace)){
$nbt = new CompoundTag("", [
new ListTag("Items", []),
new StringTag("id", Tile::FURNACE),

View File

@ -46,7 +46,8 @@ class ItemFrame extends Flowable{
}
public function onActivate(Item $item, Player $player = null){
if(!(($tile = $this->level->getTile($this)) instanceof TileItemFrame)){
$tile = $this->level->getTile($this);
if(!($tile instanceof TileItemFrame)){
$nbt = new CompoundTag("", [
new StringTag("id", Tile::ITEM_FRAME),
new IntTag("x", $this->x),
@ -76,7 +77,8 @@ class ItemFrame extends Flowable{
}
public function onBreak(Item $item){
if(($tile = $this->level->getTile($this)) instanceof TileItemFrame){
$tile = $this->level->getTile($this);
if($tile instanceof TileItemFrame){
//TODO: add events
if(lcg_value() <= $tile->getItemDropChance() and $tile->getItem()->getId() !== Item::AIR){
$this->level->dropItem($tile->getBlock(), $tile->getItem());

View File

@ -107,7 +107,8 @@ class MobHead extends Flowable{
}
public function getDrops(Item $item){
if(($tile = $this->level->getTile($this)) instanceof SkullTile){
$tile = $this->level->getTile($this);
if($tile instanceof SkullTile){
return [
[Item::MOB_HEAD, $tile->getType(), 1]
];