mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
Merge pull request #6 from GameHerobrine/master
Trapdoor breaks if it is the air
This commit is contained in:
commit
a32c10802e
4 changed files with 24 additions and 8 deletions
|
|
@ -59,7 +59,7 @@ class TorchBlock extends FlowableBlock{
|
|||
$this->meta = $faces[$face];
|
||||
$this->level->setBlock($block, $this, true, false, true);
|
||||
return true;
|
||||
}elseif($this->getSide(0)->isTransparent === false or $this->getSide(0)->getID() === FENCE){
|
||||
}elseif($this->getSide(0)->isTransparent === false or $this->getSide(0)->getID() === FENCE or $this->getSide(0)->getID() === STONE_WALL){
|
||||
$this->meta = 0;
|
||||
$this->level->setBlock($block, $this, true, false, true);
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -39,9 +39,6 @@ class TrapdoorBlock extends TransparentBlock{
|
|||
5 => 3,
|
||||
);
|
||||
$this->meta = $faces[$face] & 0x03;
|
||||
if($fy > 0.5){
|
||||
$this->meta |= 0x08;
|
||||
}
|
||||
$this->level->setBlock($block, $this, true, false, true);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -51,6 +48,26 @@ class TrapdoorBlock extends TransparentBlock{
|
|||
array($this->id, 0, 1),
|
||||
);
|
||||
}
|
||||
public function onUpdate($type){
|
||||
if($type === BLOCK_UPDATE_NORMAL){
|
||||
$faces = array( //meta => side
|
||||
0 => 3,
|
||||
4 => 3, //activated
|
||||
1 => 2,
|
||||
5 => 2, //activated
|
||||
2 => 5,
|
||||
6 => 5, //activated
|
||||
3 => 4,
|
||||
7 => 4, //activated
|
||||
);
|
||||
$side = $faces[$this->meta];
|
||||
if($this->getSide($side) instanceof AirBlock){ //Replace with common break method
|
||||
ServerAPI::request()->api->entity->drop($this, BlockAPI::getItem($this->id, 0, 1));
|
||||
$this->level->setBlock($this, new AirBlock(), true, false, true);
|
||||
return BLOCK_UPDATE_NORMAL;
|
||||
}
|
||||
}
|
||||
}
|
||||
public function onActivate(Item $item, Player $player){
|
||||
$this->meta ^= 0x04;
|
||||
$this->level->setBlock($this, $this, true, false, true);
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ class IceBlock extends TransparentBlock{
|
|||
public function onBreak(Item $item, Player $player){
|
||||
if(($player->gamemode & 0x01) === 0){
|
||||
$this->level->setBlock($this, new WaterBlock(), true, false, true);
|
||||
ServerAPI::request()->api->block->scheduleBlockUpdate(clone $this, 10, BLOCK_UPDATE_NORMAL);
|
||||
}else{
|
||||
$this->level->setBlock($this, new AirBlock(), true, false, true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -635,10 +635,8 @@ class Entity extends Position{
|
|||
$this->data["Color"] = mt_rand(0,15);
|
||||
}
|
||||
$d[16]["value"] = (($this->data["Sheared"] == 1 ? 1:0) << 4) | ($this->data["Color"] & 0x0F);
|
||||
}elseif($this->type === OBJECT_PRIMEDTNT){
|
||||
if(isset($this->data["fuse"])){ //ladder fix
|
||||
$d[16]["value"] = (int) max(0, $this->data["fuse"] - (microtime(true) - $this->spawntime) * 20);
|
||||
}
|
||||
}elseif($this->class === ENTITY_OBJECT && $this->type === OBJECT_PRIMEDTNT){ //ladder fix 2.0
|
||||
$d[16]["value"] = (int) max(0, $this->data["fuse"] - (microtime(true) - $this->spawntime) * 20);
|
||||
}elseif($this->class === ENTITY_PLAYER){
|
||||
if($this->player->isSleeping !== false){
|
||||
$d[16]["value"] = 2;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue