mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
ladder breaks if it is in the air
This commit is contained in:
parent
b805470416
commit
be0ed7590b
2 changed files with 23 additions and 16 deletions
|
|
@ -27,29 +27,34 @@ class LadderBlock extends TransparentBlock{
|
|||
$this->hardness = 2;
|
||||
}
|
||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||
if($face === 0 || $face === 1){
|
||||
return false; //fix of placing invalid ids without array
|
||||
}
|
||||
if($target->isTransparent === false){
|
||||
$faces = array(
|
||||
2 => 2,
|
||||
3 => 3,
|
||||
4 => 4,
|
||||
5 => 5,
|
||||
);
|
||||
if(isset($faces[$face])){
|
||||
$this->meta = $faces[$face];
|
||||
$this->level->setBlock($block, $this, true, false, true);
|
||||
return true;
|
||||
}
|
||||
$this->meta = $face;
|
||||
$this->level->setBlock($block, $this, true, false, true);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function onUpdate($type){
|
||||
|
||||
if($type === BLOCK_UPDATE_NORMAL){
|
||||
/*if($this->getSide(0)->getID() === AIR){ //Replace with common break method
|
||||
ServerAPI::request()->api->entity->drop($this, BlockAPI::getItem(LADDER, 0, 1));
|
||||
$this->level->setBlock($this, new AirBlock(), true, true, true);
|
||||
$side = $this->getMetadata();
|
||||
$faces = array( //magical tranformation
|
||||
3 => 2,
|
||||
2 => 3,
|
||||
5 => 4,
|
||||
4 => 5,
|
||||
);
|
||||
//$b = $this->getSide($this->meta); Debug stuff
|
||||
//console($b->x . " " . $b->y . " " . $b->z . " " . $b . " meta->>" . $this->meta . "-uwu-" . $faces[$side]);
|
||||
if($this->getSide($faces[$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;
|
||||
}*/
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -636,7 +636,9 @@ class Entity extends Position{
|
|||
}
|
||||
$d[16]["value"] = (($this->data["Sheared"] == 1 ? 1:0) << 4) | ($this->data["Color"] & 0x0F);
|
||||
}elseif($this->type === OBJECT_PRIMEDTNT){
|
||||
$d[16]["value"] = (int) max(0, $this->data["fuse"] - (microtime(true) - $this->spawntime) * 20);
|
||||
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_PLAYER){
|
||||
if($this->player->isSleeping !== false){
|
||||
$d[16]["value"] = 2;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue