mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-24 05:29:44 +00:00
microtweaks
This commit is contained in:
parent
6d487fb4b0
commit
102f515469
4 changed files with 20 additions and 18 deletions
|
|
@ -913,7 +913,7 @@ class Entity extends Position
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
$d[16]["value"] = $this->data["State"];
|
$d[16]["value"] = $this->data["State"];
|
||||||
if($this->class === ENTITY_PLAYER){
|
if($this->isPlayer()){
|
||||||
if($this->player->isSleeping !== false){
|
if($this->player->isSleeping !== false){
|
||||||
$d[16]["value"] = 2;
|
$d[16]["value"] = 2;
|
||||||
$d[17]["value"] = [
|
$d[17]["value"] = [
|
||||||
|
|
|
||||||
|
|
@ -129,13 +129,13 @@ class Item{
|
||||||
SHEARS => "ShearsItem",
|
SHEARS => "ShearsItem",
|
||||||
|
|
||||||
);
|
);
|
||||||
protected $block;
|
public $block;
|
||||||
protected $id;
|
public $id;
|
||||||
protected $meta;
|
public $meta;
|
||||||
public $count;
|
public $count;
|
||||||
protected $maxStackSize = 64;
|
public $maxStackSize = 64;
|
||||||
protected $durability = 0;
|
public $durability = 0;
|
||||||
protected $name;
|
public $name;
|
||||||
public $isActivable = false;
|
public $isActivable = false;
|
||||||
|
|
||||||
public function __construct($id, $meta = 0, $count = 1, $name = "Unknown"){
|
public function __construct($id, $meta = 0, $count = 1, $name = "Unknown"){
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,14 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
class LadderBlock extends TransparentBlock{
|
class LadderBlock extends TransparentBlock{
|
||||||
|
|
||||||
|
public static $faces = [
|
||||||
|
3 => 2,
|
||||||
|
2 => 3,
|
||||||
|
5 => 4,
|
||||||
|
4 => 5,
|
||||||
|
];
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct($meta = 0){
|
||||||
parent::__construct(LADDER, $meta, "Ladder");
|
parent::__construct(LADDER, $meta, "Ladder");
|
||||||
$this->isSolid = false;
|
$this->isSolid = false;
|
||||||
|
|
@ -23,13 +31,7 @@ class LadderBlock extends TransparentBlock{
|
||||||
|
|
||||||
if($type === BLOCK_UPDATE_NORMAL){
|
if($type === BLOCK_UPDATE_NORMAL){
|
||||||
$side = $this->getMetadata();
|
$side = $this->getMetadata();
|
||||||
$faces = array( //magical tranformation
|
if($this->getSide(self::$faces[$side]) instanceof AirBlock){ //Replace with common break method
|
||||||
3 => 2,
|
|
||||||
2 => 3,
|
|
||||||
5 => 4,
|
|
||||||
4 => 5,
|
|
||||||
);
|
|
||||||
if($this->getSide($faces[$side]) instanceof AirBlock){ //Replace with common break method
|
|
||||||
ServerAPI::request()->api->entity->drop($this, BlockAPI::getItem($this->id, 0, 1));
|
ServerAPI::request()->api->entity->drop($this, BlockAPI::getItem($this->id, 0, 1));
|
||||||
$this->level->setBlock($this, new AirBlock(), true, false, true);
|
$this->level->setBlock($this, new AirBlock(), true, false, true);
|
||||||
return BLOCK_UPDATE_NORMAL;
|
return BLOCK_UPDATE_NORMAL;
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,12 @@
|
||||||
|
|
||||||
class SignPostBlock extends TransparentBlock{
|
class SignPostBlock extends TransparentBlock{
|
||||||
|
|
||||||
private $faces = array(
|
public static $faces = [
|
||||||
2 => 2,
|
2 => 2,
|
||||||
3 => 3,
|
3 => 3,
|
||||||
4 => 4,
|
4 => 4,
|
||||||
5 => 5,
|
5 => 5,
|
||||||
);
|
];
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct($meta = 0){
|
||||||
parent::__construct(SIGN_POST, $meta, "Sign Post");
|
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){
|
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||||
if($target->isSolid && $face !== 0){
|
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->meta = floor((($player->entity->yaw + 180) * 16 / 360) + 0.5) & 0x0F;
|
||||||
$this->level->setBlock($block, BlockAPI::get(SIGN_POST, $this->meta), true, false, true);
|
$this->level->setBlock($block, BlockAPI::get(SIGN_POST, $this->meta), true, false, true);
|
||||||
return true;
|
return true;
|
||||||
}else{
|
}else{
|
||||||
$this->meta = $this->faces[$face];
|
$this->meta = self::$faces[$face];
|
||||||
$this->level->setBlock($block, BlockAPI::get(WALL_SIGN, $this->meta, true, false, true));
|
$this->level->setBlock($block, BlockAPI::get(WALL_SIGN, $this->meta, true, false, true));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue