mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 12:09:43 +00:00
i hate php
This commit is contained in:
parent
629db09843
commit
19332d0ec5
3 changed files with 33 additions and 11 deletions
|
|
@ -1,6 +1,15 @@
|
|||
<?php
|
||||
|
||||
class LitPumpkinBlock extends SolidBlock implements LightingBlock{
|
||||
|
||||
protected static $faces = [
|
||||
0 => 1,
|
||||
1 => 2,
|
||||
2 => 3,
|
||||
3 => 0,
|
||||
];
|
||||
|
||||
|
||||
public function __construct($meta = 0){
|
||||
parent::__construct(LIT_PUMPKIN, $meta, "Jack o'Lantern");
|
||||
$this->hardness = 5;
|
||||
|
|
@ -11,14 +20,17 @@ class LitPumpkinBlock extends SolidBlock implements LightingBlock{
|
|||
}
|
||||
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
$faces = array(
|
||||
0 => 1,
|
||||
1 => 2,
|
||||
2 => 3,
|
||||
3 => 0,
|
||||
);
|
||||
$this->meta = $faces[$player->entity->getDirection()];
|
||||
$this->level->setBlock($block, $this, true, false, true);
|
||||
return true;
|
||||
$id = $this->level->level->getBlockID($this->x, $this->y, $this->z);
|
||||
if(($id == 0 || $id == SNOW_LAYER) && $this->level->isTopSolidBlocking($this->x, $this->y - 1, $this->z)){
|
||||
$this->meta = self::$faces[$player->entity->getDirection()];
|
||||
$this->level->setBlock($block, $this, true, false, true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public function getDrops(Item $item, Player $player){
|
||||
return [JACK_O_LANTERN, 0];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue