some block fixes

This commit is contained in:
ArkQuark 2023-02-21 21:58:22 +03:00
parent d6cf7d2d52
commit f2c1329ce5
7 changed files with 301 additions and 294 deletions

View file

@ -20,7 +20,7 @@ class SaplingBlock extends FlowableBlock{
4 => "Acacia Sapling",
5 => "Dark Oak Sapling",
);
$this->name = $names[$this->meta & 0x03];
$this->name = $names[$this->meta & 0x05];
$this->hardness = 0;
}
@ -38,7 +38,7 @@ class SaplingBlock extends FlowableBlock{
if($item->getID() === DYE and $item->getMetadata() === 0x0F){ //Bonemeal
TreeObject::growTree($this->level, $this, new Random(), $this->meta & 0x03);
if(($player->gamemode & 0x01) === 0){
$player->removeItem(DYE,0x0F,1);
$player->removeItem(DYE, 0x0F, 1);
}
return true;
}
@ -52,7 +52,7 @@ class SaplingBlock extends FlowableBlock{
return BLOCK_UPDATE_NORMAL;
}
}elseif($type === BLOCK_UPDATE_RANDOM){ //Growth
if(mt_rand(1,7) === 1){
if(mt_rand(1, 7) === 1){
if(($this->meta & 0x08) === 0x08){
TreeObject::growTree($this->level, $this, new Random(), $this->meta & 0x03);
}else{
@ -69,7 +69,7 @@ class SaplingBlock extends FlowableBlock{
public function getDrops(Item $item, Player $player){
return array(
array($this->id, $this->meta & 0x03, 1),
array($this->id, $this->meta & 0x05, 1),
);
}
}

View file

@ -8,10 +8,10 @@ class PlanksBlock extends SolidBlock{
WoodBlock::SPRUCE => "Spruce Wooden Planks",
WoodBlock::BIRCH => "Birch Wooden Planks",
WoodBlock::JUNGLE => "Jungle Wooden Planks",
WoodBlock::ACACIA => "Acacia Wooden Planks",
WoodBlock::DARK_OAK => "Dark Oak Wooden Planks",
4 => "Acacia Wooden Planks",
5 => "Dark Oak Wooden Planks",
);
$this->name = $names[$this->meta & 0x03];
$this->name = $names[$this->meta];
$this->hardness = 15;
}

View file

@ -1,8 +1,17 @@
<?php
class StoneBlock extends SolidBlock{
public function __construct(){
parent::__construct(STONE, 0, "Stone");
public function __construct($meta = 0){
parent::__construct(STONE, $meta, "Stone");
$names = array(
1 => "Granite",
2 => "Polished Granite",
3 => "Diorite",
4 => "Polished Diorite",
5 => "Andesite",
6 => "Polished Andesite",
);
$this->name = $names[$this->meta];
$this->hardness = 30;
}

View file

@ -5,8 +5,6 @@ class WoodBlock extends SolidBlock{
const SPRUCE = 1;
const BIRCH = 2;
const JUNGLE = 3;
const ACACIA = 4;
const DARK_OAK = 5;
public function __construct($meta = 0){
parent::__construct(WOOD, $meta, "Log");
@ -15,8 +13,6 @@ class WoodBlock extends SolidBlock{
WoodBlock::SPRUCE => "Spruce Log",
WoodBlock::BIRCH => "Birch Log",
WoodBlock::JUNGLE => "Jungle Log",
WoodBlock::ACACIA => "Acacia Log",
WoodBlock::DARK_OAK => "Dark Oak Log"
);
$this->name = $names[$this->meta & 0x03];
$this->hardness = 10;