better break time checks, added block materials

This commit is contained in:
GameHerobrine 2025-06-14 07:56:10 +03:00
parent 71da620aa3
commit 625e9ca71f
143 changed files with 496 additions and 54 deletions

View file

@ -402,13 +402,37 @@ class BlockAPI{
return $this->cancelAction($target, $player, false); return $this->cancelAction($target, $player, false);
} }
} }
if((!$target->isBreakable($item, $player) and $this->server->api->dhandle("player.block.break.invalid", ["player" => $player, "target" => $target, "item" => $item]) !== true) or ($player->gamemode & 0x02) === 0x02 or (($player->lastBreak - $player->getLag() / 1000) + $target->getBreakTime($item, $player) - 0.2) >= microtime(true)){ $currentTime = microtime(true);
$isIndestructible = (!$target->isBreakable($item, $player) && $this->server->api->dhandle("player.block.break.invalid", ["player" => $player, "target" => $target, "item" => $item]) !== true);
$isAdventure = ($player->gamemode & 0x02) === 0x02;
$progress = $target->getDestroyProgress($player);
$tooFast = false;
if($progress == 0 || is_nan($progress)){
$exceptedTimeMS = INF;
$tooFast = true;
}else{
$exceptedTimeMS = ceil(1 / $progress)*0.05;
}
if($player->gamemode == 1){ //creative
$exceptedTimeMS = 0.05; //1 block/tick
$tooFast = false;
}
$exceptedTimeAfter = $player->lastBreak + $exceptedTimeMS;
if($currentTime < $exceptedTimeAfter) $tooFast = true;
if($isIndestructible || $isAdventure || $tooFast){
if($this->server->api->dhandle("player.block.break.bypass", ["player" => $player, "target" => $target, "item" => $item]) !== true){ if($this->server->api->dhandle("player.block.break.bypass", ["player" => $player, "target" => $target, "item" => $item]) !== true){
if($tooFast){
ConsoleAPI::warn("{$player->username} tried destroying block({$target->getID()} {$target->getMetadata()}) too fast($currentTime < $exceptedTimeAfter)");
}
return $this->cancelAction($target, $player, false); return $this->cancelAction($target, $player, false);
} }
} }
$player->lastBreak = microtime(true); $player->lastBreak = $currentTime;
if($this->server->api->dhandle("player.block.break", ["player" => $player, "target" => $target, "item" => $item]) !== false){ if($this->server->api->dhandle("player.block.break", ["player" => $player, "target" => $target, "item" => $item]) !== false){
$drops = $target->getDrops($item, $player); $drops = $target->getDrops($item, $player);

View file

@ -731,6 +731,17 @@ class Player{
public $currentChunk = false; public $currentChunk = false;
public function getDestroySpeed($id, $meta){
return $this->getHeldItem()->getDestroySpeed($id, $meta);
}
public function canDestroy($id, $meta){
$mat = StaticBlock::getMaterial($id);
if($mat->alwaysDestroyable) return true;
return $this->getHeldItem()->canDestroySpecial($id, $meta);
}
public function onChunkReceived($blockX, $blockZ){ public function onChunkReceived($blockX, $blockZ){
$minX = $blockX; $minX = $blockX;
$maxX = $blockX + 15; $maxX = $blockX + 15;

View file

@ -34,6 +34,7 @@ class PocketMinecraftServer{
@cli_set_process_title("NostalgiaCore ".MAJOR_VERSION); @cli_set_process_title("NostalgiaCore ".MAJOR_VERSION);
}*/ }*/
console("[INFO] Starting Minecraft PE server on " . ($this->serverip === "0.0.0.0" ? "*" : $this->serverip) . ":" . $this->port); console("[INFO] Starting Minecraft PE server on " . ($this->serverip === "0.0.0.0" ? "*" : $this->serverip) . ":" . $this->port);
Material::init();
EntityRegistry::registerEntities(); EntityRegistry::registerEntities();
PlayerNull::$INSTANCE = new PlayerNull(); PlayerNull::$INSTANCE = new PlayerNull();
Feature::init(); Feature::init();

View file

@ -105,7 +105,7 @@ define("SUGARCANE_BLOCK", 83);
define("FENCE", 85); define("FENCE", 85);
define("PUMPKIN", 86); define("PUMPKIN", 86);
define("NETHERRACK", 87); define("NETHERRACK", 87);
define("SOUL_SAND", 88); define("SOUL_SAND", 88); //doesnt exist
define("GLOWSTONE", 89); define("GLOWSTONE", 89);
define("GLOWSTONE_BLOCK", 89); define("GLOWSTONE_BLOCK", 89);
@ -136,7 +136,7 @@ define("NETHER_BRICKS", 112);
define("NETHER_BRICK_BLOCK", 112); define("NETHER_BRICK_BLOCK", 112);
define("NETHER_BRICKS_STAIRS", 114); define("NETHER_BRICKS_STAIRS", 114);
//TODO missing tile: 126 dt 0.500000 h 2.500000 b CakeTile n activatorRail, mat cake
define("SANDSTONE_STAIRS", 128); define("SANDSTONE_STAIRS", 128);
define("SPRUCE_WOOD_STAIRS", 134); define("SPRUCE_WOOD_STAIRS", 134);

View file

@ -133,12 +133,18 @@ abstract class Block extends Position{
INFO_UPDATE2 => "InfoUpdate2Block", INFO_UPDATE2 => "InfoUpdate2Block",
RESERVED6 => "Reserved6Block", RESERVED6 => "Reserved6Block",
); );
/**
* @var Material
*/
public $material;
public $id; public $id;
public $meta; public $meta;
public $name; public $name;
public $breakTime;
public $boundingBox; public $boundingBox;
public $hardness; public $hardness;
public $breakTime = 0;
public $isActivable = false; public $isActivable = false;
public $breakable = true; public $breakable = true;
public $isFlowable = false; public $isFlowable = false;
@ -259,6 +265,17 @@ abstract class Block extends Position{
return $this->meta & 0x0F; return $this->meta & 0x0F;
} }
public function getDestroyProgress(Player $player){
if($this->breakTime < 0) return 0;
$id = $this->getID();
$meta = $this->getMetadata();
if($player->canDestroy($id, $meta)){
return $player->getDestroySpeed($id, $meta) / $this->breakTime / 30;
}
if($this->breakTime == 0) return INF; //instabreak
return (1 / $this->breakTime) / 100;
}
final public function position(Position $v){ final public function position(Position $v){
$this->level = $v->level; $this->level = $v->level;
$this->x = (int) $v->x; $this->x = (int) $v->x;
@ -278,9 +295,11 @@ abstract class Block extends Position{
} }
public function getBreakTime(Item $item, Player $player){ public function getBreakTime(Item $item, Player $player){
if($this->hardness < 0) return INF;
if(($player->gamemode & 0x01) === 0x01){ if(($player->gamemode & 0x01) === 0x01){
return 0.15; return 0.15;
} }
if($player->canDestroy($this->getID(), $this->getMetadata()))
return $this->breakTime; return $this->breakTime;
} }
@ -296,7 +315,9 @@ abstract class Block extends Position{
return "Block ". $this->name ." (".$this->id.":".$this->meta.")"; return "Block ". $this->name ." (".$this->id.":".$this->meta.")";
} }
abstract function isBreakable(Item $item, Player $player); public function isBreakable(Item $item, Player $player){
return $this->hardness >= 0;
}
abstract function onBreak(Item $item, Player $player); abstract function onBreak(Item $item, Player $player);

View file

@ -157,6 +157,14 @@ class Item{
} }
} }
public function canDestroySpecial($id, $meta){
return false;
}
public function getDestroySpeed($id, $meta){
return 1.0;
}
public function isPickaxe(){ public function isPickaxe(){
return false; return false;
} }
@ -323,10 +331,6 @@ class Item{
return Item::DEF_DAMAGE; return Item::DEF_DAMAGE;
} }
public function getDestroySpeed(Block $block, Player $player){
return 1;
}
public function onActivate(Level $level, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ public function onActivate(Level $level, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
return false; return false;
} }

View file

@ -1,9 +1,84 @@
<?php <?php
/*value - durability*/
class Material{ class Material
const LEATHER = 5; //when enums {
const CHAIN = 15; public static $air, $dirt, $wood, $stone, $metal, $water, $lava, $leaves;
const GOLD = 7; public static $plant, $replaceable_plant, $sponge, $cloth, $fire, $sand;
const IRON = 15; public static $decoration, $glass, $explosive, $coral, $ice, $topSnow;
const DIAMOND = 33; public static $snow, $cactus, $clay, $vegetable, $portal, $cake, $web;
}
public $alwaysDestroyable, $flammable, $translucent, $replaceable;
public $blocksLight, $blocksMotion, $isLiquid, $isSolid;
public function __construct(){
$this->alwaysDestroyable = true;
$this->flammable = false;
$this->translucent = false;
$this->replaceable = false;
$this->blocksLight = true;
$this->blocksMotion = true;
$this->isLiquid = false;
$this->isSolid = true;
}
public function isSolidBlocking(){
if($this->translucent) return false;
return $this->blocksMotion;
}
public function letsWaterThrough(){
if($this->isLiquid) return false;
return !$this->isSolid;
}
public static function init(){
self::$air = new GasMaterial();
self::$dirt = new Material();
self::$wood = new Material();
self::$wood->flammable = true;
self::$stone = new Material();
self::$stone->alwaysDestroyable = false;
self::$metal = new Material();
self::$metal->alwaysDestroyable = false;
self::$water = new LiquidMaterial();
self::$lava = new LiquidMaterial();
self::$leaves = new Material();
self::$leaves->flammable = true;
self::$leaves->translucent = true;
self::$plant = new DecorationMaterial();
self::$replaceable_plant = new DecorationMaterial();
self::$replaceable_plant->replaceable = true;
self::$replaceable_plant->flammable = true;
self::$sponge = new Material();
self::$cloth = new Material();
self::$cloth->flammable = true;
self::$fire = new GasMaterial();
self::$fire->replaceable = true;
self::$sand = new Material();
self::$decoration = new DecorationMaterial();
self::$glass = new Material();
self::$glass->translucent = true;
self::$explosive = new Material();
self::$explosive->flammable = true;
self::$explosive->translucent = true;
self::$coral = new Material();
self::$ice = new Material();
self::$ice->translucent = true;
self::$topSnow = new DecorationMaterial();
self::$topSnow->translucent = true;
self::$topSnow->replaceable = true;
self::$topSnow->alwaysDestroyable = false;
self::$snow = new Material();
self::$snow->alwaysDestroyable = false;
self::$cactus = new Material();
self::$cactus->translucent = true;
self::$clay = new Material();
self::$vegetable = new Material();
self::$portal = new Material();
self::$cake = new Material();
self::$web = new Material();
self::$web->alwaysDestroyable = false;
self::$web->blocksMotion = false;
}
}

View file

@ -17,8 +17,9 @@ class StaticBlock
public static $hasPhysics = []; public static $hasPhysics = [];
public static $isLiquid = []; public static $isLiquid = [];
public static $isFullBlock = []; public static $isFullBlock = [];
public static $material = [];
public static $hardness = []; public static $hardness = [];
public static $destroyTime = [];
public static $slipperiness = []; public static $slipperiness = [];
public static $boundingBoxes = []; public static $boundingBoxes = [];
public static $minXs = [], $minYs = [], $minZs = [], $maxXs = [], $maxYs = [], $maxZs = []; public static $minXs = [], $minYs = [], $minZs = [], $maxXs = [], $maxYs = [], $maxZs = [];
@ -40,6 +41,8 @@ class StaticBlock
self::$slipperiness[$b->getID()] = $b->slipperiness; self::$slipperiness[$b->getID()] = $b->slipperiness;
self::$boundingBoxes[$b->getID()] = $b->boundingBox; self::$boundingBoxes[$b->getID()] = $b->boundingBox;
self::$hardness[$b->getID()] = $b->getHardness(); self::$hardness[$b->getID()] = $b->getHardness();
self::$destroyTime[$b->getID()] = $b->breakTime;
self::$material[$b->getID()] = $b->material;
self::$prealloc[$b->getID()] = $b; self::$prealloc[$b->getID()] = $b;
$b::$blockID = $b->getID(); $b::$blockID = $b->getID();
FireBlock::setFlammabilityAndCatchingChance($b->getID(), 0, 0); FireBlock::setFlammabilityAndCatchingChance($b->getID(), 0, 0);
@ -102,6 +105,10 @@ class StaticBlock
FireBlock::setFlammabilityAndCatchingChance(SPONGE, 30, 60); FireBlock::setFlammabilityAndCatchingChance(SPONGE, 30, 60);
} }
public static function getMaterial($blockID){
return self::$material[$blockID] ?? Material::$air;
}
public static function setBlockBounds($blockID, $minX, $minY, $minZ, $maxX, $maxY, $maxZ){ public static function setBlockBounds($blockID, $minX, $minY, $minZ, $maxX, $maxY, $maxZ){
self::$maxXs[$blockID] = $maxX; self::$maxXs[$blockID] = $maxX;
self::$maxYs[$blockID] = $maxY; self::$maxYs[$blockID] = $maxY;

View file

@ -28,6 +28,8 @@ class LadderBlock extends TransparentBlock{
$this->isSolid = false; $this->isSolid = false;
$this->isFullBlock = false; $this->isFullBlock = false;
$this->hardness = 2; $this->hardness = 2;
$this->breakTime = 0.4;
$this->material = Material::$decoration;
} }
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($face === 0 || $face === 1){ if($face === 0 || $face === 1){

View file

@ -16,6 +16,8 @@ class SignPostBlock extends TransparentBlock{
$this->isSolid = false; $this->isSolid = false;
$this->isFullBlock = false; $this->isFullBlock = false;
$this->hardness = 5; $this->hardness = 5;
$this->breakTime = 1;
$this->material = Material::$wood;
} }
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){

View file

@ -5,6 +5,8 @@ class TorchBlock extends FlowableBlock implements LightingBlock{
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(TORCH, $meta, "Torch"); parent::__construct(TORCH, $meta, "Torch");
$this->hardness = 0; $this->hardness = 0;
$this->breakTime = 0;
$this->material = Material::$decoration;
} }
public function getMaxLightValue(){ public function getMaxLightValue(){

View file

@ -11,6 +11,8 @@ class TrapdoorBlock extends TransparentBlock{
$this->isFullBlock = true; $this->isFullBlock = true;
} }
$this->hardness = 15; $this->hardness = 15;
$this->breakTime = 3;
$this->material = Material::$wood;
} }
public function canAttachTo(Block $target){ public function canAttachTo(Block $target){

View file

@ -9,6 +9,9 @@ class WallSignBlock extends SignPostBlock{
public function __construct($meta = 0){ public function __construct($meta = 0){
TransparentBlock::__construct(WALL_SIGN, $meta, "Wall Sign"); TransparentBlock::__construct(WALL_SIGN, $meta, "Wall Sign");
$this->isSolid = false; $this->isSolid = false;
$this->breakTime = 1;
$this->hardness = 5;
$this->material = Material::$wood;
} }
public static function neighborChanged(Level $level, $x, $y, $z, $nX, $nY, $nZ, $oldID){ public static function neighborChanged(Level $level, $x, $y, $z, $nX, $nY, $nZ, $oldID){

View file

@ -5,7 +5,9 @@ class LavaBlock extends LiquidBlockDynamic implements LightingBlock{
public static $blockID = LAVA; public static $blockID = LAVA;
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(LAVA, $meta, "Lava"); parent::__construct(LAVA, $meta, "Lava");
$this->hardness = 500; $this->hardness = 500; //0 in vanilla
$this->breakTime = -1; //in vanilla it is 0, but you cant interact with the block so it is not possible to destroy it
$this->material = Material::$lava;
} }
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){

View file

@ -6,6 +6,8 @@ class StillLavaBlock extends LiquidBlockStatic{
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(STILL_LAVA, $meta, "Still Lava"); parent::__construct(STILL_LAVA, $meta, "Still Lava");
$this->hardness = 500; $this->hardness = 500;
$this->breakTime = -1; //in vanilla it is 100, but you cant interact with the block so it is not possible to destroy it
$this->material = Material::$lava;
} }
public static function getTickDelay(){ public static function getTickDelay(){

View file

@ -12,6 +12,8 @@ class StillWaterBlock extends LiquidBlockStatic{
public function __construct($meta = 0){ public function __construct($meta = 0){
LiquidBlock::__construct(STILL_WATER, $meta, "Still Water"); LiquidBlock::__construct(STILL_WATER, $meta, "Still Water");
$this->hardness = 500; $this->hardness = 500;
$this->breakTime = -1; //in vanilla it is 100, but you cant interact with the block so it is not possible to destroy it
$this->material = Material::$water;
} }
public static function getTickDelay(){ public static function getTickDelay(){

View file

@ -7,6 +7,8 @@ class WaterBlock extends LiquidBlockDynamic{
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(WATER, $meta, "Water"); parent::__construct(WATER, $meta, "Water");
$this->hardness = 500; $this->hardness = 500;
$this->breakTime = -1; //in vanilla it is 100, but you cant interact with the block so it is not possible to destroy it
$this->material = Material::$water;
} }
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){

View file

@ -15,6 +15,7 @@ class AirBlock extends TransparentBlock{
$this->isSolid = false; $this->isSolid = false;
$this->isFullBlock = true; $this->isFullBlock = true;
$this->hardness = 0; $this->hardness = 0;
$this->material = Material::$air;
} }

View file

@ -19,6 +19,8 @@ class BedBlock extends TransparentBlock{
$this->isActivable = true; $this->isActivable = true;
$this->isFullBlock = false; $this->isFullBlock = false;
$this->hardness = 1; $this->hardness = 1;
$this->breakTime = 0.2;
$this->material = Material::$cloth;
} }
public static function getCollisionBoundingBoxes(Level $level, $x, $y, $z, Entity $entity){ public static function getCollisionBoundingBoxes(Level $level, $x, $y, $z, Entity $entity){

View file

@ -11,6 +11,8 @@ class FireBlock extends FlowableBlock implements LightingBlock{
$this->breakable = false; $this->breakable = false;
$this->isFullBlock = true; $this->isFullBlock = true;
$this->hardness = 0; $this->hardness = 0;
$this->breakTime = 0;
$this->material = Material::$fire;
} }
public static function getAABB(Level $level, $x, $y, $z){ public static function getAABB(Level $level, $x, $y, $z){
return null; return null;

View file

@ -6,6 +6,9 @@ class NetherReactorBlock extends SolidBlock{
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(NETHER_REACTOR, $meta, "Nether Reactor"); parent::__construct(NETHER_REACTOR, $meta, "Nether Reactor");
$this->isActivable = true; $this->isActivable = true;
$this->hardness = 15;
$this->breakTime = 3;
$this->material = Material::$metal;
} }
public function onActivate(Item $item, Player $player){ public function onActivate(Item $item, Player $player){

View file

@ -5,7 +5,9 @@ class TNTBlock extends SolidBlock{
public function __construct(){ public function __construct(){
parent::__construct(TNT, 0, "TNT"); parent::__construct(TNT, 0, "TNT");
$this->hardness = 0; $this->hardness = 0;
$this->breakTime = 0;
$this->isActivable = true; $this->isActivable = true;
$this->material = Material::$explosive;
} }
public function onActivate(Item $item, Player $player){ public function onActivate(Item $item, Player $player){

View file

@ -8,6 +8,8 @@ class CakeBlock extends TransparentBlock{
$this->isActivable = true; $this->isActivable = true;
$this->meta = $meta & 0x07; $this->meta = $meta & 0x07;
$this->hardness = 2.5; $this->hardness = 2.5;
$this->breakTime = 0.5;
$this->material = Material::$cake;
} }
public static function getCollisionBoundingBoxes(Level $level, $x, $y, $z, Entity $entity){ public static function getCollisionBoundingBoxes(Level $level, $x, $y, $z, Entity $entity){

View file

@ -23,9 +23,11 @@ class CarpetBlock extends FlowableBlock{
15 => "Black Carpet", 15 => "Black Carpet",
); );
$this->name = $names[$this->meta]; $this->name = $names[$this->meta];
$this->hardness = 0; $this->hardness = 0.5;
$this->breakTime = 0.1;
$this->isFullBlock = false; $this->isFullBlock = false;
$this->isSolid = true; $this->isSolid = true;
$this->material = Material::$cloth;
} }
public static function getCollisionBoundingBoxes(Level $level, $x, $y, $z, Entity $entity){ public static function getCollisionBoundingBoxes(Level $level, $x, $y, $z, Entity $entity){
return [static::getAABB($level, $x, $y, $z)]; return [static::getAABB($level, $x, $y, $z)];

View file

@ -7,6 +7,8 @@ class ChestBlock extends TransparentBlock{
$this->isActivable = true; $this->isActivable = true;
$this->isFullBlock = false; $this->isFullBlock = false;
$this->hardness = 15; $this->hardness = 15;
$this->breakTime = 2.5;
$this->material = Material::$wood;
} }
public static function getCollisionBoundingBoxes(Level $level, $x, $y, $z, Entity $entity){ public static function getCollisionBoundingBoxes(Level $level, $x, $y, $z, Entity $entity){
return [new AxisAlignedBB($x + 0.025, $y, $z + 0.025, $x + 0.975, $y + 0.95, $z + 0.975)]; return [new AxisAlignedBB($x + 0.025, $y, $z + 0.025, $x + 0.975, $y + 0.95, $z + 0.975)];

View file

@ -6,7 +6,9 @@ class CobwebBlock extends FlowableBlock{
parent::__construct(COBWEB, 0, "Cobweb"); parent::__construct(COBWEB, 0, "Cobweb");
$this->isSolid = true; $this->isSolid = true;
$this->isFullBlock = false; $this->isFullBlock = false;
$this->hardness = 25; $this->hardness = 30;
$this->breakTime = 4;
$this->material = Material::$web;
} }
public static function getAABB(Level $level, $x, $y, $z){ public static function getAABB(Level $level, $x, $y, $z){

View file

@ -5,6 +5,8 @@ class FarmlandBlock extends TransparentBlock{
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(FARMLAND, $meta, "Farmland"); parent::__construct(FARMLAND, $meta, "Farmland");
$this->hardness = 3; $this->hardness = 3;
$this->breakTime = 0.6;
$this->material = Material::$dirt;
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, Player $player){
return array( return array(

View file

@ -6,6 +6,8 @@ class FenceBlock extends TransparentBlock{
parent::__construct(FENCE, 0, "Fence"); parent::__construct(FENCE, 0, "Fence");
$this->isFullBlock = false; $this->isFullBlock = false;
$this->hardness = 15; $this->hardness = 15;
$this->breakTime = 2;
$this->material = Material::$wood;
} }
public static function canConnectTo(Level $level, $x, $y, $z){ public static function canConnectTo(Level $level, $x, $y, $z){

View file

@ -31,6 +31,8 @@ class FenceGateBlock extends TransparentBlock{
$this->isFullBlock = false; $this->isFullBlock = false;
} }
$this->hardness = 15; $this->hardness = 15;
$this->breakTime = 2;
$this->material = Material::$wood;
} }
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){
$faces = array( $faces = array(

View file

@ -6,6 +6,9 @@ class GlassPaneBlock extends TransparentBlock{
parent::__construct(GLASS_PANE, 0, "Glass Pane"); parent::__construct(GLASS_PANE, 0, "Glass Pane");
$this->isFullBlock = false; $this->isFullBlock = false;
$this->isSolid = false; $this->isSolid = false;
$this->breakTime = 0.3;
$this->hardness = 0.3*5;
$this->material = Material::$glass;
} }
public static function updateShape(Level $level, $x, $y, $z){ public static function updateShape(Level $level, $x, $y, $z){
$id = $level->level->getBlockID($x, $y, $z); $id = $level->level->getBlockID($x, $y, $z);

View file

@ -6,6 +6,9 @@ class IronBarsBlock extends TransparentBlock{
parent::__construct(IRON_BARS, 0, "Iron Bars"); parent::__construct(IRON_BARS, 0, "Iron Bars");
$this->isFullBlock = false; $this->isFullBlock = false;
$this->isSolid = false; $this->isSolid = false;
$this->breakTime = 5;
$this->hardness = 30;
$this->material = Material::$metal;
} }
public static function updateShape(Level $level, $x, $y, $z){ public static function updateShape(Level $level, $x, $y, $z){

View file

@ -6,6 +6,8 @@ class IronDoorBlock extends DoorBlock{
parent::__construct(IRON_DOOR_BLOCK, $meta, "Iron Door Block"); parent::__construct(IRON_DOOR_BLOCK, $meta, "Iron Door Block");
//$this->isActivable = true; //$this->isActivable = true;
$this->hardness = 25; $this->hardness = 25;
$this->breakTime = 5;
$this->material = Material::$metal;
} }
public function getBreakTime(Item $item, Player $player){ public function getBreakTime(Item $item, Player $player){

View file

@ -4,9 +4,11 @@ class PoweredRailBlock extends RailBaseBlock{
public static $blockID; public static $blockID;
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(POWERED_RAIL, 0, "PoweredRailBlock"); parent::__construct(POWERED_RAIL, 0, "PoweredRailBlock");
$this->hardness = 0.7;
$this->isFullBlock = false; $this->isFullBlock = false;
$this->isSolid = false; $this->isSolid = false;
$this->hardness = 3.5;
$this->breakTime = 0.7;
$this->material = Material::$decoration;
} }
} }

View file

@ -4,9 +4,11 @@ class RailBlock extends RailBaseBlock{
public static $blockID; public static $blockID;
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(RAIL, $meta, "Rail"); parent::__construct(RAIL, $meta, "Rail");
$this->hardness = 0.7; $this->hardness = 0.7*5;
$this->breakTime = 0.7;
$this->isFullBlock = false; $this->isFullBlock = false;
$this->isSolid = false; $this->isSolid = false;
$this->material = Material::$decoration;
} }
public function updateState(){ public function updateState(){

View file

@ -22,6 +22,8 @@ class SlabBlock extends TransparentBlock{
$this->isFullBlock = false; $this->isFullBlock = false;
} }
$this->hardness = 30; $this->hardness = 30;
$this->breakTime = 2;
$this->material = Material::$stone;
} }
public static function updateShape(Level $level, $x, $y, $z){ public static function updateShape(Level $level, $x, $y, $z){

View file

@ -8,6 +8,8 @@ class SnowLayerBlock extends FlowableBlock{
$this->isSolid = false; $this->isSolid = false;
$this->isFullBlock = false; $this->isFullBlock = false;
$this->hardness = 0.5; $this->hardness = 0.5;
$this->breakTime = 0.1;
$this->material = Material::$topSnow;
} }
public static function getAABB(Level $level, $x, $y, $z){ public static function getAABB(Level $level, $x, $y, $z){
return null; return null;

View file

@ -7,7 +7,9 @@ class StoneWallBlock extends TransparentBlock{
parent::__construct(STONE_WALL, $meta & 0x01, $meta === 1 ? "Mossy Cobblestone Wall" : "Cobblestone Wall"); parent::__construct(STONE_WALL, $meta & 0x01, $meta === 1 ? "Mossy Cobblestone Wall" : "Cobblestone Wall");
$this->isFullBlock = false; $this->isFullBlock = false;
$this->isSolid = false; $this->isSolid = false;
$this->hardness = 30; $this->hardness = 50;
$this->breakTime = 10;
$this->material = Material::$stone;
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, Player $player){
if($item->isPickaxe()){ if($item->isPickaxe()){

View file

@ -6,6 +6,8 @@ class WoodDoorBlock extends DoorBlock{
parent::__construct(WOOD_DOOR_BLOCK, $meta, "Wood Door Block"); parent::__construct(WOOD_DOOR_BLOCK, $meta, "Wood Door Block");
$this->isActivable = true; $this->isActivable = true;
$this->hardness = 15; $this->hardness = 15;
$this->breakTime = 3;
$this->material = Material::$wood;
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, Player $player){

View file

@ -16,7 +16,9 @@ class WoodSlabBlock extends TransparentBlock{
}else{ }else{
$this->isFullBlock = false; $this->isFullBlock = false;
} }
$this->hardness = 15; $this->hardness = 30;
$this->breakTime = 2;
$this->material = Material::$wood;
} }
public static function updateShape(Level $level, $x, $y, $z){ public static function updateShape(Level $level, $x, $y, $z){

View file

@ -4,6 +4,9 @@ class BirchWoodStairsBlock extends StairBlock{
public static $blockID; public static $blockID;
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(BIRCH_WOOD_STAIRS, $meta, "Birch Wood Stairs"); parent::__construct(BIRCH_WOOD_STAIRS, $meta, "Birch Wood Stairs");
$this->hardness = 15;
$this->breakTime = 2;
$this->material = Material::$wood;
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, Player $player){

View file

@ -4,6 +4,9 @@ class BrickStairsBlock extends StairBlock{
public static $blockID; public static $blockID;
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(BRICK_STAIRS, $meta, "Brick Stairs"); parent::__construct(BRICK_STAIRS, $meta, "Brick Stairs");
$this->breakTime = 2;
$this->hardness = 30;
$this->material = Material::$stone;
} }
} }

View file

@ -4,6 +4,9 @@ class CobblestoneStairsBlock extends StairBlock{
public static $blockID; public static $blockID;
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(COBBLESTONE_STAIRS, $meta, "Cobblestone Stairs"); parent::__construct(COBBLESTONE_STAIRS, $meta, "Cobblestone Stairs");
$this->breakTime = 2;
$this->hardness = 30;
$this->material = Material::$stone;
} }
} }

View file

@ -4,6 +4,9 @@ class JungleWoodStairsBlock extends StairBlock{
public static $blockID; public static $blockID;
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(JUNGLE_WOOD_STAIRS, $meta, "Jungle Wood Stairs"); parent::__construct(JUNGLE_WOOD_STAIRS, $meta, "Jungle Wood Stairs");
$this->hardness = 15;
$this->breakTime = 2;
$this->material = Material::$wood;
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, Player $player){

View file

@ -4,6 +4,9 @@ class NetherBricksStairsBlock extends StairBlock{
public static $blockID; public static $blockID;
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(NETHER_BRICKS_STAIRS, $meta, "Nether Bricks Stairs"); parent::__construct(NETHER_BRICKS_STAIRS, $meta, "Nether Bricks Stairs");
$this->hardness = 30;
$this->breakTime = 2;
$this->material = Material::$stone;
} }
} }

View file

@ -4,6 +4,9 @@ class QuartzStairsBlock extends StairBlock{
public static $blockID; public static $blockID;
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(QUARTZ_STAIRS, $meta, "Quartz Stairs"); parent::__construct(QUARTZ_STAIRS, $meta, "Quartz Stairs");
$this->breakTime = 0.8;
$this->hardness = 4;
$this->material = Material::$stone;
} }
} }

View file

@ -4,6 +4,9 @@ class SandstoneStairsBlock extends StairBlock{
public static $blockID; public static $blockID;
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(SANDSTONE_STAIRS, $meta, "Sandstone Stairs"); parent::__construct(SANDSTONE_STAIRS, $meta, "Sandstone Stairs");
$this->hardness = 0.8*5;
$this->breakTime = 0.8;
$this->material = Material::$stone;
} }
} }

View file

@ -4,6 +4,9 @@ class SpruceWoodStairsBlock extends StairBlock{
public static $blockID; public static $blockID;
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(SPRUCE_WOOD_STAIRS, $meta, "Spruce Wood Stairs"); parent::__construct(SPRUCE_WOOD_STAIRS, $meta, "Spruce Wood Stairs");
$this->hardness = 15;
$this->breakTime = 2;
$this->material = Material::$wood;
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, Player $player){

View file

@ -4,6 +4,9 @@ class StoneBrickStairsBlock extends StairBlock{
public static $blockID; public static $blockID;
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(STONE_BRICK_STAIRS, $meta, "Stone Brick Stairs"); parent::__construct(STONE_BRICK_STAIRS, $meta, "Stone Brick Stairs");
$this->hardness = 30;
$this->breakTime = 1.5;
$this->material = Material::$stone;
} }
} }

View file

@ -4,6 +4,8 @@ class WoodStairsBlock extends StairBlock{
public static $blockID; public static $blockID;
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(WOOD_STAIRS, $meta, "Wood Stairs"); parent::__construct(WOOD_STAIRS, $meta, "Wood Stairs");
$this->breakTime = 2;
$this->material = Material::$wood;
} }
public function getBreakTime(Item $item, Player $player){ public function getBreakTime(Item $item, Player $player){

View file

@ -5,6 +5,8 @@ class CoalOreBlock extends SolidBlock{
public function __construct(){ public function __construct(){
parent::__construct(COAL_ORE, 0, "Coal Ore"); parent::__construct(COAL_ORE, 0, "Coal Ore");
$this->hardness = 15; $this->hardness = 15;
$this->breakTime = 3.0;
$this->material = Material::$stone;
} }
public function getBreakTime(Item $item, Player $player){ public function getBreakTime(Item $item, Player $player){

View file

@ -5,6 +5,8 @@ class DiamondOreBlock extends SolidBlock{
public function __construct(){ public function __construct(){
parent::__construct(DIAMOND_ORE, 0, "Diamond Ore"); parent::__construct(DIAMOND_ORE, 0, "Diamond Ore");
$this->hardness = 15; $this->hardness = 15;
$this->breakTime = 3;
$this->material = Material::$stone;
} }
public function getBreakTime(Item $item, Player $player){ public function getBreakTime(Item $item, Player $player){

View file

@ -5,6 +5,8 @@ class GlowingRedstoneOreBlock extends SolidBlock implements LightingBlock{
public function __construct(){ public function __construct(){
parent::__construct(GLOWING_REDSTONE_ORE, 0, "Glowing Redstone Ore"); parent::__construct(GLOWING_REDSTONE_ORE, 0, "Glowing Redstone Ore");
$this->hardness = 15; $this->hardness = 15;
$this->breakTime = 3;
$this->material = Material::$stone;
} }
public static function onRandomTick(Level $level, $x, $y, $z){ public static function onRandomTick(Level $level, $x, $y, $z){

View file

@ -5,6 +5,8 @@ class GoldOreBlock extends SolidBlock{
public function __construct(){ public function __construct(){
parent::__construct(GOLD_ORE, 0, "Gold Ore"); parent::__construct(GOLD_ORE, 0, "Gold Ore");
$this->hardness = 15; $this->hardness = 15;
$this->breakTime = 3.0;
$this->material = Material::$stone;
} }
public function getBreakTime(Item $item, Player $player){ public function getBreakTime(Item $item, Player $player){

View file

@ -5,6 +5,8 @@ class IronOreBlock extends SolidBlock{
public function __construct(){ public function __construct(){
parent::__construct(IRON_ORE, 0, "Iron Ore"); parent::__construct(IRON_ORE, 0, "Iron Ore");
$this->hardness = 15; $this->hardness = 15;
$this->breakTime = 3.0;
$this->material = Material::$stone;
} }
public function getBreakTime(Item $item, Player $player){ public function getBreakTime(Item $item, Player $player){

View file

@ -5,6 +5,8 @@ class LapisOreBlock extends SolidBlock{
public function __construct(){ public function __construct(){
parent::__construct(LAPIS_ORE, 0, "Lapis Ore"); parent::__construct(LAPIS_ORE, 0, "Lapis Ore");
$this->hardness = 15; $this->hardness = 15;
$this->breakTime = 3.0;
$this->material = Material::$stone;
} }
public function getBreakTime(Item $item, Player $player){ public function getBreakTime(Item $item, Player $player){

View file

@ -5,6 +5,8 @@ class RedstoneOreBlock extends SolidBlock{
public function __construct(){ public function __construct(){
parent::__construct(REDSTONE_ORE, 0, "Redstone Ore"); parent::__construct(REDSTONE_ORE, 0, "Redstone Ore");
$this->hardness = 15; $this->hardness = 15;
$this->breakTime = 3;
$this->material = Material::$stone;
} }
public static function interact(Level $level, $x, $y, $z, Player $player){ public static function interact(Level $level, $x, $y, $z, Player $player){

View file

@ -6,6 +6,8 @@ class BeetrootBlock extends FlowableBlock{
parent::__construct(BEETROOT_BLOCK, $meta, "Beetroot Block"); parent::__construct(BEETROOT_BLOCK, $meta, "Beetroot Block");
$this->isActivable = true; $this->isActivable = true;
$this->hardness = 0; $this->hardness = 0;
$this->breakTime = 0;
$this->material = Material::$plant;
} }
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){

View file

@ -5,6 +5,8 @@ class BrownMushroomBlock extends FlowableBlock{
public function __construct(){ public function __construct(){
parent::__construct(BROWN_MUSHROOM, 0, "Brown Mushroom"); parent::__construct(BROWN_MUSHROOM, 0, "Brown Mushroom");
$this->hardness = 0; $this->hardness = 0;
$this->breakTime = 0;
$this->material = Material::$plant;
} }
public static function neighborChanged(Level $level, $x, $y, $z, $nX, $nY, $nZ, $oldID){ public static function neighborChanged(Level $level, $x, $y, $z, $nX, $nY, $nZ, $oldID){

View file

@ -6,6 +6,8 @@ class CactusBlock extends TransparentBlock{
parent::__construct(CACTUS, $meta, "Cactus"); parent::__construct(CACTUS, $meta, "Cactus");
$this->isFullBlock = false; $this->isFullBlock = false;
$this->hardness = 2; $this->hardness = 2;
$this->breakTime = 0.4;
$this->material = Material::$cactus;
} }
public static function onEntityCollidedWithBlock(Level $level, $x, $y, $z, Entity $entity){ public static function onEntityCollidedWithBlock(Level $level, $x, $y, $z, Entity $entity){

View file

@ -6,6 +6,8 @@ class CarrotBlock extends FlowableBlock{
parent::__construct(CARROT_BLOCK, $meta, "Carrot Block"); parent::__construct(CARROT_BLOCK, $meta, "Carrot Block");
$this->isActivable = true; $this->isActivable = true;
$this->hardness = 0; $this->hardness = 0;
$this->breakTime = 0;
$this->material = Material::$plant;
} }
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){

View file

@ -6,6 +6,8 @@ class CyanFlowerBlock extends FlowableBlock{
parent::__construct(CYAN_FLOWER, 0, "Cyan Flower"); parent::__construct(CYAN_FLOWER, 0, "Cyan Flower");
$this->isActivable = true; $this->isActivable = true;
$this->hardness = 0; $this->hardness = 0;
$this->breakTime = 0;
$this->material = Material::$plant;
} }
public static function getAABB(Level $level, $x, $y, $z){ public static function getAABB(Level $level, $x, $y, $z){

View file

@ -6,6 +6,8 @@ class DandelionBlock extends FlowableBlock{
parent::__construct(DANDELION, 0, "Dandelion"); parent::__construct(DANDELION, 0, "Dandelion");
$this->isActivable = true; $this->isActivable = true;
$this->hardness = 0; $this->hardness = 0;
$this->breakTime = 0;
$this->material = Material::$plant;
} }
public static function getAABB(Level $level, $x, $y, $z){ public static function getAABB(Level $level, $x, $y, $z){
return null; return null;

View file

@ -6,6 +6,8 @@ class DeadBushBlock extends FlowableBlock{
parent::__construct(DEAD_BUSH, 0, "Dead Bush"); parent::__construct(DEAD_BUSH, 0, "Dead Bush");
//$this->isReplaceable = true; //$this->isReplaceable = true;
$this->hardness = 0; $this->hardness = 0;
$this->breakTime = 0;
$this->material = Material::$replaceable_plant;
} }
public static function getAABB(Level $level, $x, $y, $z){ public static function getAABB(Level $level, $x, $y, $z){

View file

@ -6,6 +6,8 @@ class MelonStemBlock extends FlowableBlock{
parent::__construct(MELON_STEM, $meta, "Melon Stem"); parent::__construct(MELON_STEM, $meta, "Melon Stem");
$this->isActivable = true; $this->isActivable = true;
$this->hardness = 0; $this->hardness = 0;
$this->breakTime = 0;
$this->material = Material::$plant;
} }
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){
$down = $this->getSide(0); $down = $this->getSide(0);

View file

@ -6,6 +6,8 @@ class PotatoBlock extends FlowableBlock{
parent::__construct(POTATO_BLOCK, $meta, "Potato Block"); parent::__construct(POTATO_BLOCK, $meta, "Potato Block");
$this->isActivable = true; $this->isActivable = true;
$this->hardness = 0; $this->hardness = 0;
$this->breakTime = 0;
$this->material = Material::$plant;
} }
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){

View file

@ -6,6 +6,8 @@ class PumpkinStemBlock extends FlowableBlock{
parent::__construct(PUMPKIN_STEM, $meta, "Pumpkin Stem"); parent::__construct(PUMPKIN_STEM, $meta, "Pumpkin Stem");
$this->isActivable = true; $this->isActivable = true;
$this->hardness = 0; $this->hardness = 0;
$this->breakTime = 0;
$this->material = Material::$plant;
} }
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){
$down = $this->getSide(0); $down = $this->getSide(0);

View file

@ -5,6 +5,8 @@ class RedMushroomBlock extends FlowableBlock{
public function __construct(){ public function __construct(){
parent::__construct(RED_MUSHROOM, 0, "Red Mushroom"); parent::__construct(RED_MUSHROOM, 0, "Red Mushroom");
$this->hardness = 0; $this->hardness = 0;
$this->breakTime = 0;
$this->material = Material::$plant;
} }
public static function neighborChanged(Level $level, $x, $y, $z, $nX, $nY, $nZ, $oldID){ public static function neighborChanged(Level $level, $x, $y, $z, $nX, $nY, $nZ, $oldID){

View file

@ -19,6 +19,8 @@ class SaplingBlock extends FlowableBlock{
); );
$this->name = $names[$this->meta & 0x03]; $this->name = $names[$this->meta & 0x03];
$this->hardness = 0; $this->hardness = 0;
$this->breakTime = 0;
$this->material = Material::$plant;
} }
public static function getAABB(Level $level, $x, $y, $z){ public static function getAABB(Level $level, $x, $y, $z){
return null; return null;

View file

@ -6,6 +6,8 @@ class SugarcaneBlock extends FlowableBlock{
parent::__construct(SUGARCANE_BLOCK, $meta, "Sugarcane"); parent::__construct(SUGARCANE_BLOCK, $meta, "Sugarcane");
$this->isActivable = true; $this->isActivable = true;
$this->hardness = 0; $this->hardness = 0;
$this->breakTime = 0;
$this->material = Material::$plant;
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, Player $player){

View file

@ -12,6 +12,8 @@ class TallGrassBlock extends FlowableBlock{
); );
$this->name = $names[$this->meta & 0x03]; $this->name = $names[$this->meta & 0x03];
$this->hardness = 0; $this->hardness = 0;
$this->breakTime = 0;
$this->material = Material::$replaceable_plant;
} }
public static function neighborChanged(Level $level, $x, $y, $z, $nX, $nY, $nZ, $oldID){ public static function neighborChanged(Level $level, $x, $y, $z, $nX, $nY, $nZ, $oldID){

View file

@ -6,6 +6,8 @@ class WheatBlock extends FlowableBlock{
parent::__construct(WHEAT_BLOCK, $meta, "Wheat Block"); parent::__construct(WHEAT_BLOCK, $meta, "Wheat Block");
$this->isActivable = true; $this->isActivable = true;
$this->hardness = 0; $this->hardness = 0;
$this->breakTime = 0;
$this->material = Material::$plant;
} }
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){

View file

@ -6,6 +6,8 @@ class BedrockBlock extends SolidBlock{
parent::__construct(BEDROCK, 0, "Bedrock"); parent::__construct(BEDROCK, 0, "Bedrock");
$this->breakable = false; $this->breakable = false;
$this->hardness = 18000000; $this->hardness = 18000000;
$this->breakTime = -1;
$this->material = Material::$stone;
} }
public function isBreakable(Item $item, Player $player){ public function isBreakable(Item $item, Player $player){

View file

@ -5,6 +5,8 @@ class BookshelfBlock extends SolidBlock{
public function __construct(){ public function __construct(){
parent::__construct(BOOKSHELF, 0, "Bookshelf"); parent::__construct(BOOKSHELF, 0, "Bookshelf");
$this->hardness = 7.5; $this->hardness = 7.5;
$this->breakTime = 1.5;
$this->material = Material::$wood;
} }
} }

View file

@ -5,6 +5,8 @@ class BricksBlock extends SolidBlock{
public function __construct(){ public function __construct(){
parent::__construct(BRICKS_BLOCK, 0, "Bricks"); parent::__construct(BRICKS_BLOCK, 0, "Bricks");
$this->hardness = 30; $this->hardness = 30;
$this->breakTime = 2;
$this->material = Material::$stone;
} }
public function getBreakTime(Item $item, Player $player){ public function getBreakTime(Item $item, Player $player){

View file

@ -6,6 +6,8 @@ class BurningFurnaceBlock extends SolidBlock implements LightingBlock{
parent::__construct(BURNING_FURNACE, $meta, "Burning Furnace"); parent::__construct(BURNING_FURNACE, $meta, "Burning Furnace");
$this->isActivable = true; $this->isActivable = true;
$this->hardness = 17.5; $this->hardness = 17.5;
$this->breakTime = 3.5;
$this->material = Material::$stone;
} }
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){

View file

@ -5,6 +5,8 @@ class ClayBlock extends SolidBlock{
public function __construct(){ public function __construct(){
parent::__construct(CLAY_BLOCK, 0, "Clay Block"); parent::__construct(CLAY_BLOCK, 0, "Clay Block");
$this->hardness = 3; $this->hardness = 3;
$this->breakTime = 0.6;
$this->material = Material::$clay;
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, Player $player){

View file

@ -5,6 +5,8 @@ class CoalBlock extends SolidBlock{
public function __construct(){ public function __construct(){
parent::__construct(COAL_BLOCK, 0, "Coal Block"); parent::__construct(COAL_BLOCK, 0, "Coal Block");
$this->hardness = 30; $this->hardness = 30;
$this->breakTime = 5;
$this->material = Material::$metal;
} }
public function getBreakTime(Item $item, Player $player){ public function getBreakTime(Item $item, Player $player){

View file

@ -5,6 +5,8 @@ class CobblestoneBlock extends SolidBlock{
public function __construct(){ public function __construct(){
parent::__construct(COBBLESTONE, 0, "Cobblestone"); parent::__construct(COBBLESTONE, 0, "Cobblestone");
$this->hardness = 30; $this->hardness = 30;
$this->breakTime = 2;
$this->material = Material::$stone;
} }
public function getBreakTime(Item $item, Player $player){ public function getBreakTime(Item $item, Player $player){

View file

@ -5,6 +5,8 @@ class DiamondBlock extends SolidBlock{
public function __construct(){ public function __construct(){
parent::__construct(DIAMOND_BLOCK, 0, "Diamond Block"); parent::__construct(DIAMOND_BLOCK, 0, "Diamond Block");
$this->hardness = 30; $this->hardness = 30;
$this->breakTime = 5;
$this->material = Material::$metal;
} }
public function getBreakTime(Item $item, Player $player){ public function getBreakTime(Item $item, Player $player){

View file

@ -6,6 +6,8 @@ class DirtBlock extends SolidBlock{
parent::__construct(DIRT, 0, "Dirt"); parent::__construct(DIRT, 0, "Dirt");
$this->isActivable = true; $this->isActivable = true;
$this->hardness = 2.5; $this->hardness = 2.5;
$this->breakTime = 0.5;
$this->material = Material::$dirt;
} }
public function onActivate(Item $item, Player $player){ public function onActivate(Item $item, Player $player){

View file

@ -16,6 +16,8 @@ class DoubleSlabBlock extends SolidBlock{
); );
$this->name = "Double " . $names[$this->meta & 0x07] . " Slab"; $this->name = "Double " . $names[$this->meta & 0x07] . " Slab";
$this->hardness = 30; $this->hardness = 30;
$this->breakTime = 2;
$this->material = Material::$stone;
} }
public function getBreakTime(Item $item, Player $player){ public function getBreakTime(Item $item, Player $player){

View file

@ -11,7 +11,9 @@ class DoubleWoodSlabBlock extends SolidBlock{
3 => "Jungle", 3 => "Jungle",
); );
$this->name = "Double " . $names[$this->meta & 0x07] . " Wooden Slab"; $this->name = "Double " . $names[$this->meta & 0x07] . " Wooden Slab";
$this->hardness = 15; $this->hardness = 30;
$this->breakTime = 2;
$this->material = Material::$wood;
} }
public function getBreakTime(Item $item, Player $player){ public function getBreakTime(Item $item, Player $player){

View file

@ -12,5 +12,6 @@ class FurnaceBlock extends BurningFurnaceBlock{
$this->id = FURNACE; $this->id = FURNACE;
$this->name = "Furnace"; $this->name = "Furnace";
$this->isActivable = true; $this->isActivable = true;
$this->material = Material::$stone;
} }
} }

View file

@ -5,6 +5,8 @@ class GlassBlock extends TransparentBlock{
public function __construct(){ public function __construct(){
parent::__construct(GLASS, 0, "Glass"); parent::__construct(GLASS, 0, "Glass");
$this->hardness = 1.5; $this->hardness = 1.5;
$this->breakTime = 0.3;
$this->material = Material::$glass;
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, Player $player){

View file

@ -4,6 +4,9 @@ class GlowingObsidianBlock extends SolidBlock implements LightingBlock{
public static $blockID; public static $blockID;
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(GLOWING_OBSIDIAN, $meta, "Glowing Obsidian"); parent::__construct(GLOWING_OBSIDIAN, $meta, "Glowing Obsidian");
$this->hardness = 6000;
$this->breakTime = 10;
$this->material = Material::$stone;
} }
public function getMaxLightValue(){ public function getMaxLightValue(){

View file

@ -5,6 +5,8 @@ class GlowstoneBlock extends TransparentBlock implements LightingBlock{
public function __construct(){ public function __construct(){
parent::__construct(GLOWSTONE_BLOCK, 0, "Glowstone"); parent::__construct(GLOWSTONE_BLOCK, 0, "Glowstone");
$this->hardness = 1.5; $this->hardness = 1.5;
$this->breakTime = 0.3;
$this->material = Material::$glass;
} }
public function getMaxLightValue(){ public function getMaxLightValue(){

View file

@ -5,6 +5,8 @@ class GoldBlock extends SolidBlock{
public function __construct(){ public function __construct(){
parent::__construct(GOLD_BLOCK, 0, "Gold Block"); parent::__construct(GOLD_BLOCK, 0, "Gold Block");
$this->hardness = 30; $this->hardness = 30;
$this->breakTime = 3;
$this->material = Material::$metal;
} }
public function getBreakTime(Item $item, Player $player){ public function getBreakTime(Item $item, Player $player){

View file

@ -6,6 +6,8 @@ class GrassBlock extends SolidBlock{
parent::__construct(GRASS, 0, "Grass"); parent::__construct(GRASS, 0, "Grass");
$this->isActivable = true; $this->isActivable = true;
$this->hardness = 3; $this->hardness = 3;
$this->breakTime = 0.6;
$this->material = Material::$dirt;
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, Player $player){

View file

@ -5,6 +5,8 @@ class GravelBlock extends FallableBlock{
public function __construct(){ public function __construct(){
parent::__construct(GRAVEL, 0, "Gravel"); parent::__construct(GRAVEL, 0, "Gravel");
$this->hardness = 3; $this->hardness = 3;
$this->breakTime = 0.6;
$this->material = Material::$sand;
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, Player $player){

View file

@ -4,7 +4,9 @@ class HayBaleBlock extends SolidBlock{
public static $blockID; public static $blockID;
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(HAY_BALE, $meta, "Hay Bale"); parent::__construct(HAY_BALE, $meta, "Hay Bale");
$this->hardness = 10; $this->hardness = 2.5;
$this->breakTime = 0.5;
$this->material = Material::$dirt;
} }
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){

View file

@ -5,7 +5,9 @@ class IceBlock extends TransparentBlock{
public function __construct(){ public function __construct(){
parent::__construct(ICE, 0, "Ice"); parent::__construct(ICE, 0, "Ice");
$this->hardness = 2.5; $this->hardness = 2.5;
$this->breakTime = 0.5;
$this->slipperiness = 0.98; $this->slipperiness = 0.98;
$this->material = Material::$ice;
} }
public static function getCollisionBoundingBoxes(Level $level, $x, $y, $z, Entity $entity){ public static function getCollisionBoundingBoxes(Level $level, $x, $y, $z, Entity $entity){

View file

@ -5,7 +5,9 @@ class InfoUpdate2Block extends SolidBlock{
public function __construct(){ public function __construct(){
parent::__construct(INFO_UPDATE2, 0, "tile.info_update2.name<"); parent::__construct(INFO_UPDATE2, 0, "tile.info_update2.name<");
$this->breakable = true; $this->breakable = true;
$this->hardness = 0; $this->hardness = 5;
$this->breakTime = 1;
$this->material = Material::$dirt;
} }
} }

View file

@ -5,7 +5,9 @@ class InfoUpdateBlock extends SolidBlock{
public function __construct(){ public function __construct(){
parent::__construct(INFO_UPDATE, 0, "tile.info_update.name<"); parent::__construct(INFO_UPDATE, 0, "tile.info_update.name<");
$this->breakable = true; $this->breakable = true;
$this->hardness = 0; $this->hardness = 5;
$this->breakTime = 1;
$this->material = Material::$dirt;
} }
} }

View file

@ -5,7 +5,9 @@ class InvisibleBedrockBlock extends SolidBlock{
public function __construct(){ public function __construct(){
parent::__construct(INVISIBLE_BEDROCK, 0, ".name<"); parent::__construct(INVISIBLE_BEDROCK, 0, ".name<");
$this->breakable = false; $this->breakable = false;
$this->hardness = 3600000; $this->hardness = 18000000;
$this->breakTime = -1;
$this->material = Material::$stone;
} }
public function isBreakable(Item $item, Player $player){ public function isBreakable(Item $item, Player $player){

View file

@ -5,6 +5,8 @@ class IronBlock extends SolidBlock{
public function __construct(){ public function __construct(){
parent::__construct(IRON_BLOCK, 0, "Iron Block"); parent::__construct(IRON_BLOCK, 0, "Iron Block");
$this->hardness = 30; $this->hardness = 30;
$this->breakTime = 5;
$this->material = Material::$metal;
} }
public function getBreakTime(Item $item, Player $player){ public function getBreakTime(Item $item, Player $player){

View file

@ -5,6 +5,8 @@ class LapisBlock extends SolidBlock{
public function __construct(){ public function __construct(){
parent::__construct(LAPIS_BLOCK, 0, "Lapis Block"); parent::__construct(LAPIS_BLOCK, 0, "Lapis Block");
$this->hardness = 15; $this->hardness = 15;
$this->breakTime = 3.0;
$this->material = Material::$stone;
} }
public function getBreakTime(Item $item, Player $player){ public function getBreakTime(Item $item, Player $player){

View file

@ -15,6 +15,8 @@ class LeavesBlock extends TransparentBlock{
); );
$this->name = $names[$this->meta & 0x03]; $this->name = $names[$this->meta & 0x03];
$this->hardness = 1; $this->hardness = 1;
$this->breakTime = 0.2;
$this->material = Material::$leaves;
} }
public static function getCollisionBoundingBoxes(Level $level, $x, $y, $z, Entity $entity){ public static function getCollisionBoundingBoxes(Level $level, $x, $y, $z, Entity $entity){

View file

@ -13,6 +13,8 @@ class LitPumpkinBlock extends SolidBlock implements LightingBlock{
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(LIT_PUMPKIN, $meta, "Jack o'Lantern"); parent::__construct(LIT_PUMPKIN, $meta, "Jack o'Lantern");
$this->hardness = 5; $this->hardness = 5;
$this->breakTime = 1.0;
$this->material = Material::$vegetable;
} }
public function getMaxLightValue(){ public function getMaxLightValue(){

View file

@ -5,6 +5,8 @@ class MelonBlock extends TransparentBlock{
public function __construct(){ public function __construct(){
parent::__construct(MELON_BLOCK, 0, "Melon Block"); parent::__construct(MELON_BLOCK, 0, "Melon Block");
$this->hardness = 5; $this->hardness = 5;
$this->breakTime = 1;
$this->material = Material::$vegetable;
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, Player $player){
return array( return array(

View file

@ -5,6 +5,8 @@ class MossStoneBlock extends SolidBlock{
public function __construct(){ public function __construct(){
parent::__construct(MOSS_STONE, 0, "Moss Stone"); parent::__construct(MOSS_STONE, 0, "Moss Stone");
$this->hardness = 30; $this->hardness = 30;
$this->breakTime = 2;
$this->material = Material::$stone;
} }
public function getBreakTime(Item $item, Player $player){ public function getBreakTime(Item $item, Player $player){

Some files were not shown because too many files have changed in this diff Show more