mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39: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];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -5,7 +5,8 @@ class PumpkinBlock extends SolidBlock{
|
|||
parent::__construct(PUMPKIN, $meta, "Pumpkin");
|
||||
$this->hardness = 5;
|
||||
}
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
$faces = array(
|
||||
0 => 1,
|
||||
1 => 2,
|
||||
|
|
@ -15,6 +16,6 @@ class PumpkinBlock extends SolidBlock{
|
|||
$this->meta = $faces[$player->entity->getDirection()];
|
||||
$this->level->setBlock($block, $this, true, false, true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -60,6 +60,15 @@ class Level{
|
|||
$this->__destruct();
|
||||
}
|
||||
|
||||
public function isTopSolidBlocking($x, $y, $z){
|
||||
$idmeta = $this->level->getBlock($x, $y, $z);
|
||||
$id = $idmeta[0];
|
||||
$meta = $idmeta[1];
|
||||
if($id == 0) return false;
|
||||
if(StaticBlock::getIsTransparent($id)) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param AxisAlignedBB $aABB
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue