particial fix of bug 13, names fixed

This commit is contained in:
GameHerobrine 2023-02-22 11:47:57 +03:00
parent 0f6784c4f3
commit af36fb318a

View file

@ -1,13 +1,14 @@
<?php <?php
class Leaves2Block extends TransparentBlock{ class Leaves2Block extends TransparentBlock{
public function __construct($meta = 0){
parent::__construct(LEAVES2, $meta, "Leaves2"); protected static $names = [
$names = array(
0 => "Acacia Leaves", 0 => "Acacia Leaves",
1 => "Dark Oak Leaves", 1 => "Dark Oak Leaves"
); ];
$this->name = $names[$this->meta & 0x02];
public function __construct($meta = 0){
parent::__construct(LEAVES2, $meta, nullsafe(self::$names[$meta & 0x03], "Leaves"));
$this->hardness = 1; $this->hardness = 1;
} }
@ -72,7 +73,7 @@ class Leaves2Block extends TransparentBlock{
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, Player $player){
$drops = array(); $drops = array();
if($item->isShears()){ if($item->isShears()){
$drops[] = array(LEAVES2, $this->meta & 0x03, 1); $drops[] = array(LEAVES2, $this->getMetadata(), 1);
}else{ }else{
if(mt_rand(1, 20) === 1){ //Saplings if(mt_rand(1, 20) === 1){ //Saplings
$drops[] = array(SAPLING, $this->meta + 2 & 0x05, 1); $drops[] = array(SAPLING, $this->meta + 2 & 0x05, 1);