isPickaxe replaced with getPickaxeLevel, reactor drops correct block now

This commit is contained in:
GameHerobrine 2022-09-06 18:33:08 +03:00
parent 81d46e71aa
commit df0db01425
38 changed files with 73 additions and 60 deletions

View file

@ -245,7 +245,7 @@ class Item{
BOW => 385 //x3
);
if(($type = $this->isPickaxe()) === false){
if(($type = $this->getPickaxeLevel()) === false){
if(($type = $this->isAxe()) === false){
if(($type = $this->isSword()) === false){
if(($type = $this->isShovel()) === false){
@ -259,7 +259,7 @@ class Item{
return $levels[$type];
}
public function isPickaxe(){ //Returns false or level of the pickaxe
public function getPickaxeLevel(){ //Returns false or level of the pickaxe
switch($this->id){
case IRON_PICKAXE:
return 4;

View file

@ -50,7 +50,7 @@ class StairBlock extends TransparentBlock{
* @return array
*/
public function getDrops(Item $item, Player $player){
if($item->isPickaxe() >= 1){
if($item->getPickaxeLevel() >= 1){
return array(
array($this->id, 0, 1),
);

View file

@ -48,6 +48,15 @@ class NetherReactorBlock extends SolidBlock{
$this->decay($this->x-8, $this->y-3, $this->z-8, 6, 11, 1, 14, 34, 1, 5, 12, 16);
}
public function getDrops(Item $item, Player $player){
if($item->getPickaxeLevel() >= 1){
return array(
[DIAMOND, 0, 3],
[IRON_INGOT, 0, 6],
);
}
}
private function decay($x,$y,$z,$aOne,$aTwo,$aThree,$bOne,$bTwo,$bThree,$cOne,$cTwo,$cThree) {
for($a = $aOne; $a < $aTwo; $a += $aThree) { //wth those cycles are?
for($b = $bOne; $b < $bTwo; $b += $bThree) {

View file

@ -11,7 +11,7 @@ class IronDoorBlock extends DoorBlock{
if(($player->gamemode & 0x01) === 0x01){
return 0.20;
}
switch($item->isPickaxe()){
switch($item->getPickaxeLevel()){
case 5:
return 0.95;
case 4:
@ -28,7 +28,7 @@ class IronDoorBlock extends DoorBlock{
}
public function getDrops(Item $item, Player $player){
if($item->isPickaxe() >= 1){
if($item->getPickaxeLevel() >= 1){
return array(
array(IRON_DOOR, 0, 1),
);

View file

@ -34,7 +34,7 @@ class RailBlock extends FlowableBlock{
}
private function checkRail($rail){//fixed
if(!($rail instanceof Rail)) return null;
if(!($rail instanceof RailBlock)) return null;
$damage = $rail->meta;
if ($damage < 0 || $damage > 10) return null;
$delta = array(

View file

@ -68,7 +68,7 @@ class SlabBlock extends TransparentBlock{
if(($player->gamemode & 0x01) === 0x01){
return 0.20;
}
switch($item->isPickaxe()){
switch($item->getPickaxeLevel()){
case 5:
return 0.4;
case 4:
@ -85,7 +85,7 @@ class SlabBlock extends TransparentBlock{
}
public function getDrops(Item $item, Player $player){
if($item->isPickaxe() >= 1){
if($item->getPickaxeLevel() >= 1){
return array(
array($this->id, $this->meta & 0x07, 1),
);

View file

@ -10,7 +10,7 @@ class CoalOreBlock extends SolidBlock{
if(($player->gamemode & 0x01) === 0x01){
return 0.20;
}
switch($item->isPickaxe()){
switch($item->getPickaxeLevel()){
case 5:
return 0.6;
case 4:
@ -27,7 +27,7 @@ class CoalOreBlock extends SolidBlock{
}
public function getDrops(Item $item, Player $player){
if($item->isPickaxe() >= 1){
if($item->getPickaxeLevel() >= 1){
return array(
array(COAL, 0, 1),
);

View file

@ -10,7 +10,7 @@ class DiamondOreBlock extends SolidBlock{
if(($player->gamemode & 0x01) === 0x01){
return 0.20;
}
switch($item->isPickaxe()){
switch($item->getPickaxeLevel()){
case 5:
return 0.6;
case 4:
@ -21,7 +21,7 @@ class DiamondOreBlock extends SolidBlock{
}
public function getDrops(Item $item, Player $player){
if($item->isPickaxe() >= 4){
if($item->getPickaxeLevel() >= 4){
return array(
array(DIAMOND, 0, 1),
);

View file

@ -23,7 +23,7 @@ class GlowingRedstoneOreBlock extends SolidBlock implements LightingBlock{
if(($player->gamemode & 0x01) === 0x01){
return 0.20;
}
switch($item->isPickaxe()){
switch($item->getPickaxeLevel()){
case 5:
return 0.6;
case 4:
@ -34,7 +34,7 @@ class GlowingRedstoneOreBlock extends SolidBlock implements LightingBlock{
}
public function getDrops(Item $item, Player $player){
if($item->isPickaxe() >= 4){
if($item->getPickaxeLevel() >= 4){
return array(
array(REDSTONE_DUST, 0, mt_rand(4, 5)),
);

View file

@ -10,7 +10,7 @@ class GoldOreBlock extends SolidBlock{
if(($player->gamemode & 0x01) === 0x01){
return 0.20;
}
switch($item->isPickaxe()){
switch($item->getPickaxeLevel()){
case 5:
return 0.6;
case 4:
@ -21,7 +21,7 @@ class GoldOreBlock extends SolidBlock{
}
public function getDrops(Item $item, Player $player){
if($item->isPickaxe() >= 4){
if($item->getPickaxeLevel() >= 4){
return array(
array(GOLD_ORE, 0, 1),
);

View file

@ -10,7 +10,7 @@ class IronOreBlock extends SolidBlock{
if(($player->gamemode & 0x01) === 0x01){
return 0.20;
}
switch($item->isPickaxe()){
switch($item->getPickaxeLevel()){
case 5:
return 0.6;
case 4:
@ -23,7 +23,7 @@ class IronOreBlock extends SolidBlock{
}
public function getDrops(Item $item, Player $player){
if($item->isPickaxe() >= 3){
if($item->getPickaxeLevel() >= 3){
return array(
array(IRON_ORE, 0, 1),
);

View file

@ -10,7 +10,7 @@ class LapisOreBlock extends SolidBlock{
if(($player->gamemode & 0x01) === 0x01){
return 0.20;
}
switch($item->isPickaxe()){
switch($item->getPickaxeLevel()){
case 5:
return 0.6;
case 4:
@ -23,7 +23,7 @@ class LapisOreBlock extends SolidBlock{
}
public function getDrops(Item $item, Player $player){
if($item->isPickaxe() >= 3){
if($item->getPickaxeLevel() >= 3){
return array(
array(DYE, 4, mt_rand(4, 8)),
);

View file

@ -16,7 +16,7 @@ class RedstoneOreBlock extends SolidBlock{
}
public function getDrops(Item $item, Player $player){
if($item->isPickaxe() >= 2){
if($item->getPickaxeLevel() >= 2){
return array(
array(REDSTONE_DUST, 0, mt_rand(4, 5)),
);

View file

@ -7,7 +7,7 @@ class SaplingBlock extends FlowableBlock{
const JUNGLE = 3;
const BURN_TIME = 5;
public function __construct($meta = Sapling::OAK){
public function __construct($meta = SaplingBlock::OAK){
parent::__construct(SAPLING, $meta, "Sapling");
$this->isActivable = true;
$names = array(

View file

@ -10,7 +10,7 @@ class BricksBlock extends SolidBlock{
if(($player->gamemode & 0x01) === 0x01){
return 0.20;
}
switch($item->isPickaxe()){
switch($item->getPickaxeLevel()){
case 5:
return 0.4;
case 4:
@ -27,7 +27,7 @@ class BricksBlock extends SolidBlock{
}
public function getDrops(Item $item, Player $player){
if($item->isPickaxe() >= 1){
if($item->getPickaxeLevel() >= 1){
return array(
array(BRICKS_BLOCK, 0, 1),
);

View file

@ -55,7 +55,7 @@ class BurningFurnaceBlock extends SolidBlock implements LightingBlock{
if(($player->gamemode & 0x01) === 0x01){
return 0.20;
}
switch($item->isPickaxe()){
switch($item->getPickaxeLevel()){
case 5:
return 0.7;
case 4:
@ -73,7 +73,7 @@ class BurningFurnaceBlock extends SolidBlock implements LightingBlock{
public function getDrops(Item $item, Player $player){
$drops = array();
if($item->isPickaxe() >= 1){
if($item->getPickaxeLevel() >= 1){
$drops[] = array(FURNACE, 0, 1);
}
$t = ServerAPI::request()->api->tile->get($this);

View file

@ -10,7 +10,7 @@ class CoalBlock extends SolidBlock{
if(($player->gamemode & 0x01) === 0x01){
return 0.20;
}
switch($item->isPickaxe()){
switch($item->getPickaxeLevel()){
case 5:
return 0.95;
case 4:
@ -27,7 +27,7 @@ class CoalBlock extends SolidBlock{
}
public function getDrops(Item $item, Player $player){
if($item->isPickaxe() >= 1){
if($item->getPickaxeLevel() >= 1){
return array(
array(COAL_BLOCK, 0, 1),
);

View file

@ -10,7 +10,7 @@ class CobblestoneBlock extends SolidBlock{
if(($player->gamemode & 0x01) === 0x01){
return 0.20;
}
switch($item->isPickaxe()){
switch($item->getPickaxeLevel()){
case 5:
return 0.4;
case 4:
@ -27,7 +27,7 @@ class CobblestoneBlock extends SolidBlock{
}
public function getDrops(Item $item, Player $player){
if($item->isPickaxe() >= 1){
if($item->getPickaxeLevel() >= 1){
return array(
array(COBBLESTONE, 0, 1),
);

View file

@ -10,7 +10,7 @@ class DiamondBlock extends SolidBlock{
if(($player->gamemode & 0x01) === 0x01){
return 0.20;
}
switch($item->isPickaxe()){
switch($item->getPickaxeLevel()){
case 5:
return 0.95;
case 4:
@ -21,7 +21,7 @@ class DiamondBlock extends SolidBlock{
}
public function getDrops(Item $item, Player $player){
if($item->isPickaxe() >= 4){
if($item->getPickaxeLevel() >= 4){
return array(
array(DIAMOND_BLOCK, 0, 1),
);

View file

@ -21,7 +21,7 @@ class DoubleSlabBlock extends SolidBlock{
if(($player->gamemode & 0x01) === 0x01){
return 0.20;
}
switch($item->isPickaxe()){
switch($item->getPickaxeLevel()){
case 5:
return 0.4;
case 4:
@ -38,7 +38,7 @@ class DoubleSlabBlock extends SolidBlock{
}
public function getDrops(Item $item, Player $player){
if($item->isPickaxe() >= 1){
if($item->getPickaxeLevel() >= 1){
return array(
array(SLAB, $this->meta & 0x07, 2),
);

View file

@ -10,7 +10,7 @@ class GoldBlock extends SolidBlock{
if(($player->gamemode & 0x01) === 0x01){
return 0.20;
}
switch($item->isPickaxe()){
switch($item->getPickaxeLevel()){
case 5:
return 0.6;
case 4:
@ -21,7 +21,7 @@ class GoldBlock extends SolidBlock{
}
public function getDrops(Item $item, Player $player){
if($item->isPickaxe() >= 4){
if($item->getPickaxeLevel() >= 4){
return array(
array(GOLD_BLOCK, 0, 1),
);

View file

@ -54,7 +54,7 @@ class IceBlock extends TransparentBlock{
if(($player->gamemode & 0x01) === 0x01){
return 0.20;
}
switch($item->isPickaxe()){
switch($item->getPickaxeLevel()){
case 5:
return 0.1;
case 4:

View file

@ -10,7 +10,7 @@ class IronBlock extends SolidBlock{
if(($player->gamemode & 0x01) === 0x01){
return 0.20;
}
switch($item->isPickaxe()){
switch($item->getPickaxeLevel()){
case 5:
return 0.95;
case 4:
@ -23,7 +23,7 @@ class IronBlock extends SolidBlock{
}
public function getDrops(Item $item, Player $player){
if($item->isPickaxe() >= 3){
if($item->getPickaxeLevel() >= 3){
return array(
array(IRON_BLOCK, 0, 1),
);

View file

@ -10,7 +10,7 @@ class LapisBlock extends SolidBlock{
if(($player->gamemode & 0x01) === 0x01){
return 0.20;
}
switch($item->isPickaxe()){
switch($item->getPickaxeLevel()){
case 5:
return 0.6;
case 4:
@ -23,7 +23,7 @@ class LapisBlock extends SolidBlock{
}
public function getDrops(Item $item, Player $player){
if($item->isPickaxe() >= 3){
if($item->getPickaxeLevel() >= 3){
return array(
array(LAPIS_BLOCK, 0, 1),
);

View file

@ -10,7 +10,7 @@ class MossStoneBlock extends SolidBlock{
if(($player->gamemode & 0x01) === 0x01){
return 0.20;
}
switch($item->isPickaxe()){
switch($item->getPickaxeLevel()){
case 5:
return 0.4;
case 4:
@ -27,7 +27,7 @@ class MossStoneBlock extends SolidBlock{
}
public function getDrops(Item $item, Player $player){
if($item->isPickaxe() >= 1){
if($item->getPickaxeLevel() >= 1){
return array(
array(MOSS_STONE, 0, 1),
);

View file

@ -10,7 +10,7 @@ class NetherBricksBlock extends SolidBlock{
if(($player->gamemode & 0x01) === 0x01){
return 0.20;
}
switch($item->isPickaxe()){
switch($item->getPickaxeLevel()){
case 5:
return 0.4;
case 4:
@ -27,7 +27,7 @@ class NetherBricksBlock extends SolidBlock{
}
public function getDrops(Item $item, Player $player){
if($item->isPickaxe() >= 1){
if($item->getPickaxeLevel() >= 1){
return array(
array(NETHER_BRICKS, 0, 1),
);

View file

@ -10,7 +10,7 @@ class NetherrackBlock extends SolidBlock{
if(($player->gamemode & 0x01) === 0x01){
return 0.20;
}
switch($item->isPickaxe()){
switch($item->getPickaxeLevel()){
case 5:
return 0.1;
case 4:
@ -27,7 +27,7 @@ class NetherrackBlock extends SolidBlock{
}
public function getDrops(Item $item, Player $player){
if($item->isPickaxe() >= 1){
if($item->getPickaxeLevel() >= 1){
return array(
array(NETHERRACK, 0, 1),
);

View file

@ -10,7 +10,7 @@ class ObsidianBlock extends SolidBlock{
if(($player->gamemode & 0x01) === 0x01){
return 0.20;
}
if($item->isPickaxe() >= 5){
if($item->getPickaxeLevel() >= 5){
return 3.5;//from wiki
}else{
return 250;
@ -18,7 +18,7 @@ class ObsidianBlock extends SolidBlock{
}
public function getDrops(Item $item, Player $player){
if($item->isPickaxe() >= 5){
if($item->getPickaxeLevel() >= 5){
return array(
array(OBSIDIAN, 0, 1),
);

View file

@ -16,7 +16,7 @@ class QuartzBlock extends SolidBlock{
if(($player->gamemode & 0x01) === 0x01){
return 0.20;
}
switch($item->isPickaxe()){
switch($item->getPickaxeLevel()){
case 5:
return 0.15;
case 4:
@ -33,7 +33,7 @@ class QuartzBlock extends SolidBlock{
}
public function getDrops(Item $item, Player $player){
if($item->isPickaxe() >= 1){
if($item->getPickaxeLevel() >= 1){
return array(
array(QUARTZ_BLOCK, $this->meta & 0x03, 1),
);

View file

@ -16,7 +16,7 @@ class SandstoneBlock extends SolidBlock{
if(($player->gamemode & 0x01) === 0x01){
return 0.20;
}
switch($item->isPickaxe()){
switch($item->getPickaxeLevel()){
case 5:
return 0.15;
case 4:
@ -33,7 +33,7 @@ class SandstoneBlock extends SolidBlock{
}
public function getDrops(Item $item, Player $player){
if($item->isPickaxe() >= 1){
if($item->getPickaxeLevel() >= 1){
return array(
array(SANDSTONE, $this->meta & 0x03, 1),
);

View file

@ -10,7 +10,7 @@ class StoneBlock extends SolidBlock{
if(($player->gamemode & 0x01) === 0x01){
return 0.20;
}
switch($item->isPickaxe()){
switch($item->getPickaxeLevel()){
case 5:
return 0.4;
case 4:
@ -27,7 +27,7 @@ class StoneBlock extends SolidBlock{
}
public function getDrops(Item $item, Player $player){
if($item->isPickaxe() >= 1){
if($item->getPickaxeLevel() >= 1){
return array(
array(COBBLESTONE, 0, 1),
);

View file

@ -17,7 +17,7 @@ class StoneBricksBlock extends SolidBlock{
if(($player->gamemode & 0x01) === 0x01){
return 0.20;
}
switch($item->isPickaxe()){
switch($item->getPickaxeLevel()){
case 5:
return 0.4;
case 4:
@ -34,7 +34,7 @@ class StoneBricksBlock extends SolidBlock{
}
public function getDrops(Item $item, Player $player){
if($item->isPickaxe() >= 1){
if($item->getPickaxeLevel() >= 1){
return array(
array(STONE_BRICKS, $this->meta & 0x03, 1),
);

View file

@ -2,8 +2,8 @@
class CakeItem extends Item{
public function __construct($meta = 0, $count = 1){
parent::__construct(CAKE, 0, $count, "Cake");
$this->block = BlockAPI::get(CAKE_BLOCK);
$this->maxStackSize = 1;
parent::__construct(CAKE, 0, $count, "Cake");
}
}

View file

@ -3,6 +3,7 @@
class EggItem extends Item{
public function __construct($meta = 0, $count = 1){
parent::__construct(EGG, 0, $count, "Egg");
$this->maxStackSize = 16;
}
}

View file

@ -4,6 +4,7 @@ class MinecartItem extends Item{
public function __construct($meta = 0, $count = 1){
parent::__construct(MINECART, 0, $count, "Minecart");
$this->isActivable = true;
$this->maxStackSize = 1;
}
public function onActivate(Level $level, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
if($target->getID() !== 66 and $target->getID() !== 27){

View file

@ -3,6 +3,7 @@
class SnowballItem extends Item{
public function __construct($meta = 0, $count = 1){
parent::__construct(SNOWBALL, 0, $count, "Snowball");
$this->maxStackSize = 16;
}
}

View file

@ -3,6 +3,7 @@
class CompassItem extends Item{
public function __construct($meta = 0, $count = 1){
parent::__construct(COMPASS, 0, $count, "Compass");
$this->maxStackSize = 1;
}
}

View file

@ -10,7 +10,7 @@ class MineshaftPopulator extends Populator{
public function populate(Level $level, $chunkX, $chunkZ, Random $random){
if($random->nextRange(0, MineshaftPopulator::$ODD) === 0){
$mineshaft = new Mineshaft($random);
//$mineshaft = new Mineshaft($random);
}
}