mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-14 09:49:50 +00:00
Remove some remaining hardcoded meta maps
This commit is contained in:
parent
8aab51c532
commit
31e4093882
@ -59,13 +59,7 @@ class ItemFrame extends Flowable{
|
||||
}
|
||||
|
||||
public function onNearbyBlockChange() : void{
|
||||
$sides = [
|
||||
0 => Facing::WEST,
|
||||
1 => Facing::EAST,
|
||||
2 => Facing::NORTH,
|
||||
3 => Facing::SOUTH
|
||||
];
|
||||
if(!$this->getSide($sides[$this->meta])->isSolid()){
|
||||
if(!$this->getSide(Facing::opposite(5 - $this->meta))->isSolid()){
|
||||
$this->level->useBreakOn($this);
|
||||
}
|
||||
}
|
||||
@ -75,14 +69,7 @@ class ItemFrame extends Flowable{
|
||||
return false;
|
||||
}
|
||||
|
||||
$faces = [
|
||||
Facing::NORTH => 3,
|
||||
Facing::SOUTH => 2,
|
||||
Facing::WEST => 1,
|
||||
Facing::EAST => 0
|
||||
];
|
||||
|
||||
$this->meta = $faces[$face];
|
||||
$this->meta = 5 - $face;
|
||||
|
||||
if(parent::place($item, $blockReplace, $blockClicked, $face, $clickVector, $player)){
|
||||
Tile::createTile(Tile::ITEM_FRAME, $this->getLevel(), TileItemFrame::createNBT($this, $face, $item, $player));
|
||||
|
@ -46,17 +46,9 @@ class Torch extends Flowable{
|
||||
|
||||
public function onNearbyBlockChange() : void{
|
||||
$below = $this->getSide(Facing::DOWN);
|
||||
$side = $this->getDamage();
|
||||
static $faces = [
|
||||
0 => Facing::DOWN,
|
||||
1 => Facing::WEST,
|
||||
2 => Facing::EAST,
|
||||
3 => Facing::NORTH,
|
||||
4 => Facing::SOUTH,
|
||||
5 => Facing::DOWN
|
||||
];
|
||||
$face = $this->meta === 0 ? Facing::DOWN : Facing::opposite(6 - $this->meta);
|
||||
|
||||
if($this->getSide($faces[$side])->isTransparent() and !($faces[$side] === Facing::DOWN and ($below->getId() === self::FENCE or $below->getId() === self::COBBLESTONE_WALL))){
|
||||
if($this->getSide($face)->isTransparent() and !($face === Facing::DOWN and ($below->getId() === self::FENCE or $below->getId() === self::COBBLESTONE_WALL))){
|
||||
$this->getLevel()->useBreakOn($this);
|
||||
}
|
||||
}
|
||||
@ -65,18 +57,11 @@ class Torch extends Flowable{
|
||||
$below = $this->getSide(Facing::DOWN);
|
||||
|
||||
if(!$blockClicked->isTransparent() and $face !== Facing::DOWN){
|
||||
static $faces = [
|
||||
Facing::UP => 5,
|
||||
Facing::NORTH => 4,
|
||||
Facing::SOUTH => 3,
|
||||
Facing::WEST => 2,
|
||||
Facing::EAST => 1
|
||||
];
|
||||
$this->meta = $faces[$face];
|
||||
$this->meta = 6 - $face;
|
||||
|
||||
return parent::place($item, $blockReplace, $blockClicked, $face, $clickVector, $player);
|
||||
}elseif(!$below->isTransparent() or $below->getId() === self::FENCE or $below->getId() === self::COBBLESTONE_WALL){
|
||||
$this->meta = 0;
|
||||
$this->meta = 5; //attached to block below
|
||||
return parent::place($item, $blockReplace, $blockClicked, $face, $clickVector, $player);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user