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

@ -134,6 +134,8 @@ define("COOKED_CHICKEN", 366);
define("SPAWN_EGG", 383); define("SPAWN_EGG", 383);
define("EMERALD", 388);
define("CARROT", 391); define("CARROT", 391);
define("POTATO", 392); define("POTATO", 392);
define("BAKED_POTATO", 393); define("BAKED_POTATO", 393);

View file

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

View file

@ -1,8 +1,17 @@
<?php <?php
class StoneBlock extends SolidBlock{ class StoneBlock extends SolidBlock{
public function __construct(){ public function __construct($meta = 0){
parent::__construct(STONE, 0, "Stone"); 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; $this->hardness = 30;
} }

View file

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

View file

@ -13,7 +13,7 @@ class CraftingRecipes{
"WOOD:0x1=>WOODEN_PLANKS:0x4", "WOOD:0x1=>WOODEN_PLANKS:0x4",
"WOOD:1x1=>WOODEN_PLANKS:1x4", "WOOD:1x1=>WOODEN_PLANKS:1x4",
"WOOD:2x1=>WOODEN_PLANKS:2x4", "WOOD:2x1=>WOODEN_PLANKS:2x4",
//"WOOD:3x1=>WOODEN_PLANKS:3x4", "WOOD:3x1=>WOODEN_PLANKS:3x4",
"WOOL:0x1,DYE:0x1=>WOOL:15x1", "WOOL:0x1,DYE:0x1=>WOOL:15x1",
"WOOL:0x1,DYE:1x1=>WOOL:14x1", "WOOL:0x1,DYE:1x1=>WOOL:14x1",
"WOOL:0x1,DYE:2x1=>WOOL:13x1", "WOOL:0x1,DYE:2x1=>WOOL:13x1",
@ -89,8 +89,8 @@ class CraftingRecipes{
"WOODEN_PLANKS:1x3=>WOOD_SLAB:1x6", "WOODEN_PLANKS:1x3=>WOOD_SLAB:1x6",
"WOODEN_PLANKS:2x6=>BIRCH_WOOD_STAIRS:0x4", "WOODEN_PLANKS:2x6=>BIRCH_WOOD_STAIRS:0x4",
"WOODEN_PLANKS:2x3=>WOOD_SLAB:2x6", "WOODEN_PLANKS:2x3=>WOOD_SLAB:2x6",
//"WOODEN_PLANKS:3x6=>JUNGLE_WOOD_STAIRS:0x4", "WOODEN_PLANKS:3x6=>JUNGLE_WOOD_STAIRS:0x4",
//"WOODEN_PLANKS:3x3=>WOOD_SLAB:3x6", "WOODEN_PLANKS:3x3=>WOOD_SLAB:3x6",
//Tools //Tools
"STICK:?x1,FEATHER:?x1,FLINT:?x1=>ARROW:0x4", "STICK:?x1,FEATHER:?x1,FLINT:?x1=>ARROW:0x4",
@ -168,7 +168,7 @@ class CraftingRecipes{
"IRON_INGOT:?x6=>IRON_BARS:0x16", "IRON_INGOT:?x6=>IRON_BARS:0x16",
"COAL:0x9=>COAL_BLOCK:0x1", "COAL:0x9=>COAL_BLOCK:0x1",
"COAL_BLOCK:?x1=>COAL:0x9", "COAL_BLOCK:?x1=>COAL:0x9",
"MELON_SLICE:?x9=>MELON_BLOCK:0x1", "MELON_SLICE:?x9=>MELON_BLOCK:0x1",
]; ];
private static $stone = [ private static $stone = [