mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-22 20:49:43 +00:00
Update FenceGate.php
This commit is contained in:
parent
5e523a66ec
commit
c812ae0488
1 changed files with 13 additions and 15 deletions
|
|
@ -46,20 +46,18 @@ class FenceGateBlock extends TransparentBlock{
|
||||||
array($this->id, 0, 1),
|
array($this->id, 0, 1),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
public function onActivate(Item $item, Player $player){
|
public function onActivate(Item $item, Player $player){
|
||||||
$faces = array(
|
$this->meta ^= 0x04;
|
||||||
0 => 3,
|
$this->level->setBlock($this, $this, true, false, true);
|
||||||
1 => 0,
|
$players = ServerAPI::request()->api->player->getAll($this->level);
|
||||||
2 => 1,
|
unset($players[$player->CID]);
|
||||||
3 => 2,
|
$pk = new LevelEventPacket;
|
||||||
);
|
$pk->x = $this->x;
|
||||||
$this->meta = ($faces[$player->entity->getDirection()] & 0x03) | ((~$this->meta) & 0x04);
|
$pk->y = $this->y;
|
||||||
if(($this->meta & 0x04) === 0x04){
|
$pk->z = $this->z;
|
||||||
$this->isFullBlock = true;
|
$pk->evid = 1003;
|
||||||
}else{
|
$pk->data = 0;
|
||||||
$this->isFullBlock = false;
|
ServerAPI::request()->api->player->broadcastPacket($players, $pk);
|
||||||
}
|
|
||||||
$this->level->setBlock($this, $this, true, false, true);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue