mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-07 04:17:07 +00:00
Fixed getAxis()/setAxis() not being seen by static analysers for some blocks
when using VanillaBlocks::CHISELED_QUARTZ(), VanillaBlocks::PURPUR_PILLAR() or VanillaBlocks::QUARTZ_PILLAR(), static analysis was unable to detect getAxis() and setAxis(), because these blocks were implemented using anonymous classes.
This commit is contained in:
parent
9887138ac1
commit
7c1f0ecb8b
@ -266,20 +266,14 @@ class BlockFactory{
|
|||||||
|
|
||||||
$purpurBreakInfo = new BlockBreakInfo(1.5, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel(), 30.0);
|
$purpurBreakInfo = new BlockBreakInfo(1.5, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel(), 30.0);
|
||||||
$this->register(new Opaque(new BID(Ids::PURPUR_BLOCK, Meta::PURPUR_NORMAL), "Purpur Block", $purpurBreakInfo));
|
$this->register(new Opaque(new BID(Ids::PURPUR_BLOCK, Meta::PURPUR_NORMAL), "Purpur Block", $purpurBreakInfo));
|
||||||
$this->register(new class(new BID(Ids::PURPUR_BLOCK, Meta::PURPUR_PILLAR), "Purpur Pillar", $purpurBreakInfo) extends Opaque{
|
$this->register(new SimplePillar(new BID(Ids::PURPUR_BLOCK, Meta::PURPUR_PILLAR), "Purpur Pillar", $purpurBreakInfo));
|
||||||
use PillarRotationInMetadataTrait;
|
|
||||||
});
|
|
||||||
$this->register(new Stair(new BID(Ids::PURPUR_STAIRS), "Purpur Stairs", $purpurBreakInfo));
|
$this->register(new Stair(new BID(Ids::PURPUR_STAIRS), "Purpur Stairs", $purpurBreakInfo));
|
||||||
|
|
||||||
$quartzBreakInfo = new BlockBreakInfo(0.8, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel());
|
$quartzBreakInfo = new BlockBreakInfo(0.8, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel());
|
||||||
$this->register(new Opaque(new BID(Ids::QUARTZ_BLOCK, Meta::QUARTZ_NORMAL), "Quartz Block", $quartzBreakInfo));
|
$this->register(new Opaque(new BID(Ids::QUARTZ_BLOCK, Meta::QUARTZ_NORMAL), "Quartz Block", $quartzBreakInfo));
|
||||||
$this->register(new Stair(new BID(Ids::QUARTZ_STAIRS), "Quartz Stairs", $quartzBreakInfo));
|
$this->register(new Stair(new BID(Ids::QUARTZ_STAIRS), "Quartz Stairs", $quartzBreakInfo));
|
||||||
$this->register(new class(new BID(Ids::QUARTZ_BLOCK, Meta::QUARTZ_CHISELED), "Chiseled Quartz Block", $quartzBreakInfo) extends Opaque{
|
$this->register(new SimplePillar(new BID(Ids::QUARTZ_BLOCK, Meta::QUARTZ_CHISELED), "Chiseled Quartz Block", $quartzBreakInfo));
|
||||||
use PillarRotationInMetadataTrait;
|
$this->register(new SimplePillar(new BID(Ids::QUARTZ_BLOCK, Meta::QUARTZ_PILLAR), "Quartz Pillar", $quartzBreakInfo));
|
||||||
});
|
|
||||||
$this->register(new class(new BID(Ids::QUARTZ_BLOCK, Meta::QUARTZ_PILLAR), "Quartz Pillar", $quartzBreakInfo) extends Opaque{
|
|
||||||
use PillarRotationInMetadataTrait;
|
|
||||||
});
|
|
||||||
$this->register(new Opaque(new BID(Ids::QUARTZ_BLOCK, Meta::QUARTZ_SMOOTH), "Smooth Quartz Block", $quartzBreakInfo)); //TODO: this has axis rotation in 1.9, unsure if a bug (https://bugs.mojang.com/browse/MCPE-39074)
|
$this->register(new Opaque(new BID(Ids::QUARTZ_BLOCK, Meta::QUARTZ_SMOOTH), "Smooth Quartz Block", $quartzBreakInfo)); //TODO: this has axis rotation in 1.9, unsure if a bug (https://bugs.mojang.com/browse/MCPE-39074)
|
||||||
$this->register(new Stair(new BID(Ids::SMOOTH_QUARTZ_STAIRS), "Smooth Quartz Stairs", $quartzBreakInfo));
|
$this->register(new Stair(new BID(Ids::SMOOTH_QUARTZ_STAIRS), "Smooth Quartz Stairs", $quartzBreakInfo));
|
||||||
|
|
||||||
|
34
src/block/SimplePillar.php
Normal file
34
src/block/SimplePillar.php
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* ____ _ _ __ __ _ __ __ ____
|
||||||
|
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||||
|
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||||
|
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||||
|
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* @author PocketMine Team
|
||||||
|
* @link http://www.pocketmine.net/
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace pocketmine\block;
|
||||||
|
|
||||||
|
use pocketmine\block\utils\PillarRotationInMetadataTrait;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal This class provides a general base for pillar-like blocks. It **should not** be used for contract binding
|
||||||
|
* in APIs, because not all pillar-like blocks extend this class.
|
||||||
|
*/
|
||||||
|
class SimplePillar extends Opaque{
|
||||||
|
use PillarRotationInMetadataTrait;
|
||||||
|
}
|
@ -110,7 +110,7 @@ use function assert;
|
|||||||
* @method static CarvedPumpkin CARVED_PUMPKIN()
|
* @method static CarvedPumpkin CARVED_PUMPKIN()
|
||||||
* @method static ChemicalHeat CHEMICAL_HEAT()
|
* @method static ChemicalHeat CHEMICAL_HEAT()
|
||||||
* @method static Chest CHEST()
|
* @method static Chest CHEST()
|
||||||
* @method static Opaque CHISELED_QUARTZ()
|
* @method static SimplePillar CHISELED_QUARTZ()
|
||||||
* @method static Opaque CHISELED_RED_SANDSTONE()
|
* @method static Opaque CHISELED_RED_SANDSTONE()
|
||||||
* @method static Opaque CHISELED_SANDSTONE()
|
* @method static Opaque CHISELED_SANDSTONE()
|
||||||
* @method static Opaque CHISELED_STONE_BRICKS()
|
* @method static Opaque CHISELED_STONE_BRICKS()
|
||||||
@ -513,11 +513,11 @@ use function assert;
|
|||||||
* @method static GlassPane PURPLE_STAINED_GLASS_PANE()
|
* @method static GlassPane PURPLE_STAINED_GLASS_PANE()
|
||||||
* @method static Torch PURPLE_TORCH()
|
* @method static Torch PURPLE_TORCH()
|
||||||
* @method static Opaque PURPUR()
|
* @method static Opaque PURPUR()
|
||||||
* @method static Opaque PURPUR_PILLAR()
|
* @method static SimplePillar PURPUR_PILLAR()
|
||||||
* @method static Slab PURPUR_SLAB()
|
* @method static Slab PURPUR_SLAB()
|
||||||
* @method static Stair PURPUR_STAIRS()
|
* @method static Stair PURPUR_STAIRS()
|
||||||
* @method static Opaque QUARTZ()
|
* @method static Opaque QUARTZ()
|
||||||
* @method static Opaque QUARTZ_PILLAR()
|
* @method static SimplePillar QUARTZ_PILLAR()
|
||||||
* @method static Slab QUARTZ_SLAB()
|
* @method static Slab QUARTZ_SLAB()
|
||||||
* @method static Stair QUARTZ_STAIRS()
|
* @method static Stair QUARTZ_STAIRS()
|
||||||
* @method static Rail RAIL()
|
* @method static Rail RAIL()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user