mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-05 09:26:06 +00:00
replace some hardcoded values with Vec3 constants
This commit is contained in:
@ -72,10 +72,10 @@ class ItemFrame extends Flowable{
|
|||||||
public function onUpdate(int $type){
|
public function onUpdate(int $type){
|
||||||
if($type === Level::BLOCK_UPDATE_NORMAL){
|
if($type === Level::BLOCK_UPDATE_NORMAL){
|
||||||
$sides = [
|
$sides = [
|
||||||
0 => 4,
|
0 => Vector3::SIDE_WEST,
|
||||||
1 => 5,
|
1 => Vector3::SIDE_EAST,
|
||||||
2 => 2,
|
2 => Vector3::SIDE_NORTH,
|
||||||
3 => 3
|
3 => Vector3::SIDE_SOUTH
|
||||||
];
|
];
|
||||||
if(!$this->getSide($sides[$this->meta])->isSolid()){
|
if(!$this->getSide($sides[$this->meta])->isSolid()){
|
||||||
$this->level->useBreakOn($this);
|
$this->level->useBreakOn($this);
|
||||||
|
@ -50,15 +50,15 @@ class Torch extends Flowable{
|
|||||||
$below = $this->getSide(Vector3::SIDE_DOWN);
|
$below = $this->getSide(Vector3::SIDE_DOWN);
|
||||||
$side = $this->getDamage();
|
$side = $this->getDamage();
|
||||||
$faces = [
|
$faces = [
|
||||||
0 => 0,
|
0 => Vector3::SIDE_DOWN,
|
||||||
1 => 4,
|
1 => Vector3::SIDE_WEST,
|
||||||
2 => 5,
|
2 => Vector3::SIDE_EAST,
|
||||||
3 => 2,
|
3 => Vector3::SIDE_NORTH,
|
||||||
4 => 3,
|
4 => Vector3::SIDE_SOUTH,
|
||||||
5 => 0
|
5 => Vector3::SIDE_DOWN
|
||||||
];
|
];
|
||||||
|
|
||||||
if($this->getSide($faces[$side])->isTransparent() === true and !($side === 0 and ($below->getId() === self::FENCE or $below->getId() === self::COBBLESTONE_WALL))){
|
if($this->getSide($faces[$side])->isTransparent() === true and !($side === Vector3::SIDE_DOWN and ($below->getId() === self::FENCE or $below->getId() === self::COBBLESTONE_WALL))){
|
||||||
$this->getLevel()->useBreakOn($this);
|
$this->getLevel()->useBreakOn($this);
|
||||||
|
|
||||||
return Level::BLOCK_UPDATE_NORMAL;
|
return Level::BLOCK_UPDATE_NORMAL;
|
||||||
|
Reference in New Issue
Block a user