NostalgiaCore/src/material/block/solid/LitPumpkinBlock.php
2025-06-23 01:24:00 +03:00

43 lines
No EOL
1 KiB
PHP

<?php
class LitPumpkinBlock extends SolidBlock implements LightingBlock{
public static $blockID;
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;
$this->breakTime = 1.0;
$this->material = Material::$vegetable;
$this->lightBlock = 255;
$this->lightEmission = 15;
}
public function getMaxLightValue(){
return 15;
}
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
$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;
}
return false;
}
public function getDrops(Item $item, Player $player){
return [
[JACK_O_LANTERN, 0, 1]
];
}
}