microtweaks

This commit is contained in:
GameHerobrine 2023-10-09 21:01:50 +03:00
parent 6d487fb4b0
commit 102f515469
4 changed files with 20 additions and 18 deletions

View file

@ -913,7 +913,7 @@ class Entity extends Position
]
];
$d[16]["value"] = $this->data["State"];
if($this->class === ENTITY_PLAYER){
if($this->isPlayer()){
if($this->player->isSleeping !== false){
$d[16]["value"] = 2;
$d[17]["value"] = [

View file

@ -129,13 +129,13 @@ class Item{
SHEARS => "ShearsItem",
);
protected $block;
protected $id;
protected $meta;
public $block;
public $id;
public $meta;
public $count;
protected $maxStackSize = 64;
protected $durability = 0;
protected $name;
public $maxStackSize = 64;
public $durability = 0;
public $name;
public $isActivable = false;
public function __construct($id, $meta = 0, $count = 1, $name = "Unknown"){

View file

@ -1,6 +1,14 @@
<?php
class LadderBlock extends TransparentBlock{
public static $faces = [
3 => 2,
2 => 3,
5 => 4,
4 => 5,
];
public function __construct($meta = 0){
parent::__construct(LADDER, $meta, "Ladder");
$this->isSolid = false;
@ -23,13 +31,7 @@ class LadderBlock extends TransparentBlock{
if($type === BLOCK_UPDATE_NORMAL){
$side = $this->getMetadata();
$faces = array( //magical tranformation
3 => 2,
2 => 3,
5 => 4,
4 => 5,
);
if($this->getSide($faces[$side]) instanceof AirBlock){ //Replace with common break method
if($this->getSide(self::$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;

View file

@ -2,12 +2,12 @@
class SignPostBlock extends TransparentBlock{
private $faces = array(
public static $faces = [
2 => 2,
3 => 3,
4 => 4,
5 => 5,
);
];
public function __construct($meta = 0){
parent::__construct(SIGN_POST, $meta, "Sign Post");
@ -18,12 +18,12 @@ class SignPostBlock extends TransparentBlock{
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
if($target->isSolid && $face !== 0){
if(!isset($this->faces[$face])){
if(!isset(self::$faces[$face])){
$this->meta = floor((($player->entity->yaw + 180) * 16 / 360) + 0.5) & 0x0F;
$this->level->setBlock($block, BlockAPI::get(SIGN_POST, $this->meta), true, false, true);
return true;
}else{
$this->meta = $this->faces[$face];
$this->meta = self::$faces[$face];
$this->level->setBlock($block, BlockAPI::get(WALL_SIGN, $this->meta, true, false, true));
return true;
}