mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-22 20:49:43 +00:00
code style fix
This commit is contained in:
parent
fc5c5625cb
commit
5e8e9330e2
361 changed files with 4766 additions and 4650 deletions
|
|
@ -7,21 +7,21 @@ class FenceGateBlock extends TransparentBlock{
|
|||
if($aabb == null) return [];
|
||||
return [$aabb];
|
||||
}
|
||||
|
||||
|
||||
public static function getAABB(Level $level, $x, $y, $z){
|
||||
$data = $level->level->getBlockDamage($x, $y, $z);
|
||||
|
||||
|
||||
if($data & 4){
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
if($data != 2 && $data != 0){
|
||||
return new AxisAlignedBB($x + 0.375, $y, $z, $x + 0.625, $y + 1.5, $z + 1.0);
|
||||
}else{
|
||||
return new AxisAlignedBB($x, $y, $z + 0.375, $x + 1, $y + 1.5, $z + 0.625);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function __construct($meta = 0){
|
||||
parent::__construct(FENCE_GATE, $meta, "Fence Gate");
|
||||
$this->isActivable = true;
|
||||
|
|
@ -33,29 +33,29 @@ class FenceGateBlock extends TransparentBlock{
|
|||
$this->hardness = 15;
|
||||
}
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
$faces = array(
|
||||
$faces = [
|
||||
0 => 3,
|
||||
1 => 0,
|
||||
2 => 1,
|
||||
3 => 2,
|
||||
);
|
||||
];
|
||||
$this->meta = $faces[$player->entity->getDirection()] & 0x03;
|
||||
$this->level->setBlock($block, $this, true, false, true);
|
||||
return true;
|
||||
}
|
||||
public function getDrops(Item $item, Player $player){
|
||||
return array(
|
||||
array($this->id, 0, 1),
|
||||
);
|
||||
return [
|
||||
[$this->id, 0, 1],
|
||||
];
|
||||
}
|
||||
public function onActivate(Item $item, Player $player){
|
||||
|
||||
|
||||
$meta = $this->meta;
|
||||
if(($meta & 4) != 0){
|
||||
$meta ^= 4;
|
||||
}else{
|
||||
$direction = ($player->entity->yaw * 4 / 360) + 0.5;
|
||||
$blockDirection = (int)$direction;
|
||||
$blockDirection = (int) $direction;
|
||||
if($direction < $blockDirection) --$blockDirection;
|
||||
$blockDirection &= 3;
|
||||
if(($meta & 3) == (($blockDirection + 2) & 3)){
|
||||
|
|
@ -63,7 +63,7 @@ class FenceGateBlock extends TransparentBlock{
|
|||
}
|
||||
$meta |= 4;
|
||||
}
|
||||
|
||||
|
||||
$this->level->fastSetBlockUpdate($this->x, $this->y, $this->z, $this->id, $meta);
|
||||
$players = $this->level->players;
|
||||
unset($players[$player->CID]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue