GenisysPro  for Minecraft PE/Windows 10 v1.1.x
Feature-rich server software for Minecraft PE and Windows 10 Edition
Block Class Reference

Public Member Functions

 __construct ($id, $meta=0)
 
 place (Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player=null)
 
 isBreakable (Item $item)
 
 tickRate ()
 
 onBreak (Item $item)
 
 onUpdate ($type)
 
 onActivate (Item $item, Player $player=null)
 
 getHardness ()
 
 getResistance ()
 
 getBurnChance ()
 
 getBurnAbility ()
 
 isTopFacingSurfaceSolid ()
 
 canNeighborBurn ()
 
 getToolType ()
 
 getFrictionFactor ()
 
 getLightLevel ()
 
 canBePlaced ()
 
 isPlaceable ()
 
 canBeReplaced ()
 
 isTransparent ()
 
 isSolid ()
 
 canBeFlowedInto ()
 
 canBeActivated ()
 
 activate ()
 
 deactivate ()
 
 isActivated (Block $from=null)
 
 hasEntityCollision ()
 
 canPassThrough ()
 
 getName ()
 
 getId ()
 
 addVelocityToEntity (Entity $entity, Vector3 $vector)
 
 getDamage ()
 
 setDamage ($meta)
 
 position (Position $v)
 
 getDrops (Item $item)
 
 getBreakTime (Item $item)
 
 canBeBrokenWith (Item $item)
 
 getSide ($side, $step=1)
 
 __toString ()
 
 collidesWithBB (AxisAlignedBB $bb)
 
 onEntityCollide (Entity $entity)
 
 getBoundingBox ()
 
 calculateIntercept (Vector3 $pos1, Vector3 $pos2)
 
 setMetadata ($metadataKey, MetadataValue $metadataValue)
 
 getMetadata ($metadataKey)
 
 hasMetadata ($metadataKey)
 
 removeMetadata ($metadataKey, Plugin $plugin)
 
- Public Member Functions inherited from Position
 __construct ($x=0, $y=0, $z=0, Level $level=null)
 
 asPosition ()
 
 add ($x, $y=0, $z=0)
 
 getLevel ()
 
 setLevel (Level $level=null)
 
 isValid ()
 
 getSide ($side, $step=1)
 
 __toString ()
 
 setComponents ($x, $y, $z)
 
 fromObjectAdd (Vector3 $pos, $x, $y, $z)
 
- Public Member Functions inherited from Vector3
 __construct ($x=0, $y=0, $z=0)
 
 getX ()
 
 getY ()
 
 getZ ()
 
 getFloorX ()
 
 getFloorY ()
 
 getFloorZ ()
 
 getRight ()
 
 getUp ()
 
 getForward ()
 
 getSouth ()
 
 getWest ()
 
 add ($x, $y=0, $z=0)
 
 subtract ($x=0, $y=0, $z=0)
 
 multiply ($number)
 
 divide ($number)
 
 ceil ()
 
 floor ()
 
 round ()
 
 abs ()
 
 getSide ($side, $step=1)
 
 asVector3 ()
 
 distance (Vector3 $pos)
 
 distanceSquared (Vector3 $pos)
 
 maxPlainDistance ($x=0, $z=0)
 
 length ()
 
 lengthSquared ()
 
 normalize ()
 
 dot (Vector3 $v)
 
 cross (Vector3 $v)
 
 equals (Vector3 $v)
 
 getIntermediateWithXValue (Vector3 $v, $x)
 
 getIntermediateWithYValue (Vector3 $v, $y)
 
 getIntermediateWithZValue (Vector3 $v, $z)
 
 setComponents ($x, $y, $z)
 
 fromObjectAdd (Vector3 $pos, $x, $y, $z)
 
 __toString ()
 

Static Public Member Functions

static get ($id, $meta=0, Position $pos=null)
 
- Static Public Member Functions inherited from Position
static fromObject (Vector3 $pos, Level $level=null)
 
- Static Public Member Functions inherited from Vector3
static getOppositeSide ($side)
 
static createRandomDirection (Random $random)
 

Data Fields

 $boundingBox = null
 
- Data Fields inherited from Position
 $level = null
 
- Data Fields inherited from Vector3
const SIDE_DOWN = 0
 
const SIDE_UP = 1
 
const SIDE_NORTH = 2
 
const SIDE_SOUTH = 3
 
const SIDE_WEST = 4
 
const SIDE_EAST = 5
 
 $x
 
 $y
 
 $z
 
- Data Fields inherited from BlockIds
const AIR = 0
 
const STONE = 1
 
const GRASS = 2
 
const DIRT = 3
 
const COBBLESTONE = 4
 
const COBBLE = 4
 
const PLANK = 5
 
const PLANKS = 5
 
const WOODEN_PLANK = 5
 
const WOODEN_PLANKS = 5
 
const SAPLING = 6
 
const SAPLINGS = 6
 
const BEDROCK = 7
 
const WATER = 8
 
const STILL_WATER = 9
 
const LAVA = 10
 
const STILL_LAVA = 11
 
const SAND = 12
 
const GRAVEL = 13
 
const GOLD_ORE = 14
 
const IRON_ORE = 15
 
const COAL_ORE = 16
 
const LOG = 17
 
const WOOD = 17
 
const TRUNK = 17
 
const LEAVES = 18
 
const SPONGE = 19
 
const GLASS = 20
 
const LAPIS_ORE = 21
 
const LAPIS_BLOCK = 22
 
const DISPENSER = 23
 
const SANDSTONE = 24
 
const NOTEBLOCK = 25
 
const BED_BLOCK = 26
 
const POWERED_RAIL = 27
 
const DETECTOR_RAIL = 28
 
const STICKY_PISTON = 29
 
const COBWEB = 30
 
const TALL_GRASS = 31
 
const BUSH = 32
 
const DEAD_BUSH = 32
 
const PISTON = 33
 
const PISTON_HEAD = 34
 
const WOOL = 35
 
const DANDELION = 37
 
const POPPY = 38
 
const ROSE = 38
 
const RED_FLOWER = 38
 
const BROWN_MUSHROOM = 39
 
const RED_MUSHROOM = 40
 
const GOLD_BLOCK = 41
 
const IRON_BLOCK = 42
 
const DOUBLE_SLAB = 43
 
const DOUBLE_SLABS = 43
 
const SLAB = 44
 
const SLABS = 44
 
const STONE_SLAB = 44
 
const BRICKS = 45
 
const BRICKS_BLOCK = 45
 
const TNT = 46
 
const BOOKSHELF = 47
 
const MOSS_STONE = 48
 
const MOSSY_STONE = 48
 
const OBSIDIAN = 49
 
const TORCH = 50
 
const FIRE = 51
 
const MONSTER_SPAWNER = 52
 
const WOOD_STAIRS = 53
 
const WOODEN_STAIRS = 53
 
const OAK_WOOD_STAIRS = 53
 
const OAK_WOODEN_STAIRS = 53
 
const CHEST = 54
 
const REDSTONE_WIRE = 55
 
const DIAMOND_ORE = 56
 
const DIAMOND_BLOCK = 57
 
const CRAFTING_TABLE = 58
 
const WORKBENCH = 58
 
const WHEAT_BLOCK = 59
 
const FARMLAND = 60
 
const FURNACE = 61
 
const BURNING_FURNACE = 62
 
const LIT_FURNACE = 62
 
const SIGN_POST = 63
 
const DOOR_BLOCK = 64
 
const WOODEN_DOOR_BLOCK = 64
 
const WOOD_DOOR_BLOCK = 64
 
const LADDER = 65
 
const RAIL = 66
 
const COBBLESTONE_STAIRS = 67
 
const COBBLE_STAIRS = 67
 
const WALL_SIGN = 68
 
const LEVER = 69
 
const STONE_PRESSURE_PLATE = 70
 
const IRON_DOOR_BLOCK = 71
 
const WOODEN_PRESSURE_PLATE = 72
 
const REDSTONE_ORE = 73
 
const GLOWING_REDSTONE_ORE = 74
 
const UNLIT_REDSTONE_TORCH = 75
 
const REDSTONE_TORCH = 76
 
const LIT_REDSTONE_TORCH = 76
 
const STONE_BUTTON = 77
 
const SNOW = 78
 
const SNOW_LAYER = 78
 
const ICE = 79
 
const SNOW_BLOCK = 80
 
const CACTUS = 81
 
const CLAY_BLOCK = 82
 
const REEDS = 83
 
const SUGARCANE_BLOCK = 83
 
const FENCE = 85
 
const PUMPKIN = 86
 
const NETHERRACK = 87
 
const SOUL_SAND = 88
 
const GLOWSTONE = 89
 
const GLOWSTONE_BLOCK = 89
 
const PORTAL_BLOCK = 90
 
const PORTAL = 90
 
const JACK_O_LANTERN = 91
 
const LIT_PUMPKIN = 91
 
const CAKE_BLOCK = 92
 
const UNPOWERED_REPEATER_BLOCK = 93
 
const POWERED_REPEATER_BLOCK = 94
 
const INVISIBLE_BEDROCK = 95
 
const TRAPDOOR = 96
 
const WOODEN_TRAPDOOR = 96
 
const MONSTER_EGG_BLOCK = 97
 
const STONE_BRICKS = 98
 
const STONE_BRICK = 98
 
const BROWN_MUSHROOM_BLOCK = 99
 
const RED_MUSHROOM_BLOCK = 100
 
const IRON_BARS = 101
 
const IRON_BAR = 101
 
const GLASS_PANE = 102
 
const GLASS_PANEL = 102
 
const MELON_BLOCK = 103
 
const PUMPKIN_STEM = 104
 
const MELON_STEM = 105
 
const VINES = 106
 
const VINE = 106
 
const FENCE_GATE = 107
 
const OAK_FENCE_GATE = 107
 
const BRICK_STAIRS = 108
 
const STONE_BRICK_STAIRS = 109
 
const MYCELIUM = 110
 
const LILY_PAD = 111
 
const WATER_LILY = 111
 
const NETHER_BRICKS = 112
 
const NETHER_BRICK_BLOCK = 112
 
const NETHER_BRICK_FENCE = 113
 
const NETHER_BRICK_STAIRS = 114
 
const NETHER_BRICKS_STAIRS = 114
 
const NETHER_WART_BLOCK = 115
 
const ENCHANTING_TABLE = 116
 
const ENCHANT_TABLE = 116
 
const ENCHANTMENT_TABLE = 116
 
const BREWING_STAND_BLOCK = 117
 
const CAULDRON_BLOCK = 118
 
const END_PORTAL = 119
 
const END_PORTAL_FRAME = 120
 
const END_STONE = 121
 
const DRAGON_EGG = 122
 
const REDSTONE_LAMP = 123
 
const INACTIVE_REDSTONE_LAMP = 123
 
const LIT_REDSTONE_LAMP = 124
 
const ACTIVE_REDSTONE_LAMP = 124
 
const DROPPER = 125
 
const ACTIVATOR_RAIL = 126
 
const COCOA_BLOCK = 127
 
const COCOA_PODS = 127
 
const SANDSTONE_STAIRS = 128
 
const EMERALD_ORE = 129
 
const ENDER_CHEST = 130
 
const TRIPWIRE_HOOK = 131
 
const TRIPWIRE = 132
 
const EMERALD_BLOCK = 133
 
const SPRUCE_WOOD_STAIRS = 134
 
const SPRUCE_WOODEN_STAIRS = 134
 
const BIRCH_WOOD_STAIRS = 135
 
const BIRCH_WOODEN_STAIRS = 135
 
const JUNGLE_WOOD_STAIRS = 136
 
const JUNGLE_WOODEN_STAIRS = 136
 
const COMMAND_BLOCK = 137
 
const BEACON = 138
 
const COBBLESTONE_WALL = 139
 
const COBBLE_WALL = 139
 
const STONE_WALL = 139
 
const FLOWER_POT_BLOCK = 140
 
const CARROT_BLOCK = 141
 
const POTATO_BLOCK = 142
 
const WOODEN_BUTTON = 143
 
const MOB_HEAD_BLOCK = 144
 
const SKULL_BLOCK = 144
 
const ANVIL = 145
 
const TRAPPED_CHEST = 146
 
const WEIGHTED_PRESSURE_PLATE_LIGHT = 147
 
const LIGHT_WEIGHTED_PRESSURE_PLATE = 147
 
const GOLD_PRESSURE_PLATE = 147
 
const WEIGHTED_PRESSURE_PLATE_HEAVY = 148
 
const HEAVY_WEIGHTED_PRESSURE_PLATE = 148
 
const IRON_PRESSURE_PLATE = 148
 
const COMPARATOR_BLOCK = 149
 
const UNPOWERED_COMPARATOR_BLOCK = 149
 
const POWERED_COMPARATOR_BLOCK = 150
 
const DAYLIGHT_SENSOR = 151
 
const REDSTONE_BLOCK = 152
 
const NETHER_QUARTZ_ORE = 153
 
const HOPPER_BLOCK = 154
 
const QUARTZ_BLOCK = 155
 
const QUARTZ_STAIRS = 156
 
const DOUBLE_WOOD_SLAB = 157
 
const DOUBLE_WOODEN_SLAB = 157
 
const DOUBLE_WOOD_SLABS = 157
 
const DOUBLE_WOODEN_SLABS = 157
 
const WOOD_SLAB = 158
 
const WOODEN_SLAB = 158
 
const WOOD_SLABS = 158
 
const WOODEN_SLABS = 158
 
const STAINED_CLAY = 159
 
const STAINED_HARDENED_CLAY = 159
 
const STAINED_GLASS_PANE = 160
 
const STAINED_GLASS_PANEL = 160
 
const LEAVES2 = 161
 
const WOOD2 = 162
 
const TRUNK2 = 162
 
const LOG2 = 162
 
const ACACIA_WOOD_STAIRS = 163
 
const ACACIA_WOODEN_STAIRS = 163
 
const DARK_OAK_WOOD_STAIRS = 164
 
const DARK_OAK_WOODEN_STAIRS = 164
 
const SLIME_BLOCK = 165
 
const IRON_TRAPDOOR = 167
 
const PRISMARINE = 168
 
const SEA_LANTERN = 169
 
const HAY_BALE = 170
 
const CARPET = 171
 
const HARDENED_CLAY = 172
 
const COAL_BLOCK = 173
 
const PACKED_ICE = 174
 
const DOUBLE_PLANT = 175
 
const INVERTED_DAYLIGHT_SENSOR = 178
 
const DAYLIGHT_SENSOR_INVERTED = 178
 
const RED_SANDSTONE = 179
 
const RED_SANDSTONE_STAIRS = 180
 
const DOUBLE_RED_SANDSTONE_SLAB = 181
 
const DOUBLE_PURPUR_SLAB = 181
 
const RED_SANDSTONE_SLAB = 182
 
const PURPUR_SLAB = 182
 
const SPRUCE_FENCE_GATE = 183
 
const FENCE_GATE_SPRUCE = 183
 
const BIRCH_FENCE_GATE = 184
 
const FENCE_GATE_BIRCH = 184
 
const JUNGLE_FENCE_GATE = 185
 
const FENCE_GATE_JUNGLE = 185
 
const DARK_OAK_FENCE_GATE = 186
 
const FENCE_GATE_DARK_OAK = 186
 
const ACACIA_FENCE_GATE = 187
 
const FENCE_GATE_ACACIA = 187
 
const REPEATING_COMMAND_BLOCK = 188
 
const CHAIN_COMMAND_BLOCK = 189
 
const SPRUCE_DOOR_BLOCK = 193
 
const BIRCH_DOOR_BLOCK = 194
 
const JUNGLE_DOOR_BLOCK = 195
 
const ACACIA_DOOR_BLOCK = 196
 
const DARK_OAK_DOOR_BLOCK = 197
 
const GRASS_PATH = 198
 
const ITEM_FRAME_BLOCK = 199
 
const CHORUS_FLOWER = 200
 
const PURPUR = 201
 
const PURPUR_STAIRS = 203
 
const END_STONE_BRICKS = 206
 
const FROSTED_ICE = 207
 
const END_ROD = 208
 
const SHULKER_BOX = 218
 
const PURPLE_GLAZED_TERRACOTTA = 219
 
const WHITE_GLAZED_TERRACOTTA = 220
 
const ORANGE_GLAZED_TERRACOTTA = 221
 
const MAGENTA_GLAZED_TERRACOTTA = 222
 
const LIGHT_BLUE_GLAZED_TERRACOTTA = 223
 
const YELLOW_GLAZED_TERRACOTTA = 224
 
const LIME_GLAZED_TERRACOTTA = 225
 
const PINK_GLAZED_TERRACOTTA = 226
 
const GRAY_GLAZED_TERRACOTTA = 227
 
const SILVER_GLAZED_TERRACOTTA = 228
 
const CYAN_GLAZED_TERRACOTTA = 229
 
const BLUE_GLAZED_TERRACOTTA = 231
 
const BROWN_GLAZED_TERRACOTTA = 232
 
const GREEN_GLAZED_TERRACOTTA = 233
 
const RED_GLAZED_TERRACOTTA = 234
 
const BLACK_GLAZED_TERRACOTTA = 235
 
const CONCRETE = 236
 
const CONCRETE_POWDER = 237
 
const CHORUS_PLANT = 240
 
const STAINED_GLASS = 241
 
const PODZOL = 243
 
const BEETROOT_BLOCK = 244
 
const STONECUTTER = 245
 
const GLOWING_OBSIDIAN = 246
 
const NETHER_REACTOR = 247
 
const UPDATE_BLOCK = 248
 
const ATEUPD_BLOCK = 249
 
const BLOCK_MOVED_BY_PISTON = 250
 
const OBSERVER = 251
 
const INFO_RESERVED6 = 255
 

Static Public Attributes

static $list = null
 
static $fullList = null
 
static $light = null
 
static $lightFilter = null
 
static $solid = null
 
static $hardness = null
 
static $transparent = null
 
static $diffusesSkyLight = null
 

Protected Member Functions

 recalculateBoundingBox ()
 

Protected Attributes

 $id
 
 $meta = 0
 

Constructor & Destructor Documentation

◆ __construct()

__construct (   $id,
  $meta = 0 
)
Parameters
int$id
int$meta
400  {
401  $this->id = (int) $id;
402  $this->meta = (int) $meta;
403  }

Member Function Documentation

◆ __toString()

__toString ( )
Returns
string
747  {
748  return "Block[" . $this->getName() . "] (" . $this->getId() . ":" . $this->getDamage() . ")";
749  }

◆ activate()

activate ( )
596  {
597  return false;
598  }

◆ addVelocityToEntity()

addVelocityToEntity ( Entity  $entity,
Vector3  $vector 
)
630  {
631 
632  }

◆ calculateIntercept()

calculateIntercept ( Vector3  $pos1,
Vector3  $pos2 
)
Parameters
Vector3$pos1
Vector3$pos2
Returns
MovingObjectPosition
801  {
802  $bb = $this->getBoundingBox();
803  if($bb === null){
804  return null;
805  }
806 
807  $v1 = $pos1->getIntermediateWithXValue($pos2, $bb->minX);
808  $v2 = $pos1->getIntermediateWithXValue($pos2, $bb->maxX);
809  $v3 = $pos1->getIntermediateWithYValue($pos2, $bb->minY);
810  $v4 = $pos1->getIntermediateWithYValue($pos2, $bb->maxY);
811  $v5 = $pos1->getIntermediateWithZValue($pos2, $bb->minZ);
812  $v6 = $pos1->getIntermediateWithZValue($pos2, $bb->maxZ);
813 
814  if($v1 !== null and !$bb->isVectorInYZ($v1)){
815  $v1 = null;
816  }
817 
818  if($v2 !== null and !$bb->isVectorInYZ($v2)){
819  $v2 = null;
820  }
821 
822  if($v3 !== null and !$bb->isVectorInXZ($v3)){
823  $v3 = null;
824  }
825 
826  if($v4 !== null and !$bb->isVectorInXZ($v4)){
827  $v4 = null;
828  }
829 
830  if($v5 !== null and !$bb->isVectorInXY($v5)){
831  $v5 = null;
832  }
833 
834  if($v6 !== null and !$bb->isVectorInXY($v6)){
835  $v6 = null;
836  }
837 
838  $vector = $v1;
839 
840  if($v2 !== null and ($vector === null or $pos1->distanceSquared($v2) < $pos1->distanceSquared($vector))){
841  $vector = $v2;
842  }
843 
844  if($v3 !== null and ($vector === null or $pos1->distanceSquared($v3) < $pos1->distanceSquared($vector))){
845  $vector = $v3;
846  }
847 
848  if($v4 !== null and ($vector === null or $pos1->distanceSquared($v4) < $pos1->distanceSquared($vector))){
849  $vector = $v4;
850  }
851 
852  if($v5 !== null and ($vector === null or $pos1->distanceSquared($v5) < $pos1->distanceSquared($vector))){
853  $vector = $v5;
854  }
855 
856  if($v6 !== null and ($vector === null or $pos1->distanceSquared($v6) < $pos1->distanceSquared($vector))){
857  $vector = $v6;
858  }
859 
860  if($vector === null){
861  return null;
862  }
863 
864  $f = -1;
865 
866  if($vector === $v1){
867  $f = 4;
868  }elseif($vector === $v2){
869  $f = 5;
870  }elseif($vector === $v3){
871  $f = 0;
872  }elseif($vector === $v4){
873  $f = 1;
874  }elseif($vector === $v5){
875  $f = 2;
876  }elseif($vector === $v6){
877  $f = 3;
878  }
879 
880  return MovingObjectPosition::fromBlock($this->x, $this->y, $this->z, $f, $vector->add($this->x, $this->y, $this->z));
881  }

◆ canBeActivated()

canBeActivated ( )

AKA: Block->isActivable

Returns
bool
592  : bool{
593  return false;
594  }

◆ canBeBrokenWith()

canBeBrokenWith ( Item  $item)
724  {
725  return $this->getHardness() !== -1;
726  }

◆ canBeFlowedInto()

canBeFlowedInto ( )

AKA: Block->isFlowable

Returns
bool
583  {
584  return false;
585  }

◆ canBePlaced()

canBePlaced ( )

AKA: Block->isPlaceable

Returns
bool
550  {
551  return true;
552  }

◆ canBeReplaced()

canBeReplaced ( )

AKA: Block->canBeReplaced()

Returns
bool
563  {
564  return false;
565  }

◆ canNeighborBurn()

canNeighborBurn ( )
515  {
516  for($face = 0; $face < 5; $face++){
517  if($this->getSide($face)->getBurnChance() > 0){
518  return true;
519  }
520  }
521  return false;
522  }

◆ canPassThrough()

canPassThrough ( )
612  {
613  return false;
614  }

◆ collidesWithBB()

collidesWithBB ( AxisAlignedBB  $bb)

Checks for collision against an AxisAlignedBB

Parameters
AxisAlignedBB$bb
Returns
bool
758  {
759  $bb2 = $this->getBoundingBox();
760 
761  return $bb2 !== null and $bb->intersectsWith($bb2);
762  }

◆ deactivate()

deactivate ( )
600  {
601  return false;
602  }

◆ get()

static get (   $id,
  $meta = 0,
Position  $pos = null 
)
static
Parameters
int$id
int$meta
Position$pos
Returns
Block
370  {
371  if($id > 0xff){
372  trigger_error("BlockID cannot be higher than 255, defaulting to 0", E_USER_NOTICE);
373  $id = 0;
374  }
375  try{
376  $block = self::$list[$id];
377  if($block !== null){
378  $block = new $block($meta);
379  }else{
380  $block = new Block($id, $meta);
381  }
382  }catch(\RuntimeException $e){
383  $block = new Block($id, $meta);
384  }
385 
386  if($pos !== null){
387  $block->x = $pos->x;
388  $block->y = $pos->y;
389  $block->z = $pos->z;
390  $block->level = $pos->level;
391  }
392 
393  return $block;
394  }

◆ getBoundingBox()

getBoundingBox ( )
Returns
AxisAlignedBB
774  {
775  if($this->boundingBox === null){
776  $this->boundingBox = $this->recalculateBoundingBox();
777  }
778  return $this->boundingBox;
779  }

◆ getBreakTime()

getBreakTime ( Item  $item)

Returns the seconds that this block takes to be broken using an specific Item

Parameters
Item$item
Returns
float
685  {
686  $base = $this->getHardness() * 1.5;
687  if($this->canBeBrokenWith($item)){
688  if($this->getToolType() === Tool::TYPE_SHEARS and $item->isShears()){
689  $base /= 15;
690  }elseif(
691  ($this->getToolType() === Tool::TYPE_PICKAXE and ($tier = $item->isPickaxe()) !== false) or
692  ($this->getToolType() === Tool::TYPE_AXE and ($tier = $item->isAxe()) !== false) or
693  ($this->getToolType() === Tool::TYPE_SHOVEL and ($tier = $item->isShovel()) !== false)
694  ){
695  switch($tier){
696  case Tool::TIER_WOODEN:
697  $base /= 2;
698  break;
699  case Tool::TIER_STONE:
700  $base /= 4;
701  break;
702  case Tool::TIER_IRON:
703  $base /= 6;
704  break;
705  case Tool::TIER_DIAMOND:
706  $base /= 8;
707  break;
708  case Tool::TIER_GOLD:
709  $base /= 12;
710  break;
711  }
712  }
713  }else{
714  $base *= 3.33;
715  }
716 
717  if($item->isSword()){
718  $base *= 0.5;
719  }
720 
721  return $base;
722  }

◆ getBurnAbility()

getBurnAbility ( )
Returns
int
496  : int{
497  return 0;
498  }

◆ getBurnChance()

getBurnChance ( )
Returns
int
489  : int{
490  return 0;
491  }

◆ getDamage()

getDamage ( )
final
Returns
int
637  {
638  return $this->meta;
639  }

◆ getDrops()

getDrops ( Item  $item)

Returns an array of Item objects to be dropped

Parameters
Item$item
Returns
array
668  : array{
669  if(!isset(self::$list[$this->getId()])){ //Unknown blocks
670  return [];
671  }else{
672  return [
673  [$this->getId(), $this->getDamage(), 1],
674  ];
675  }
676  }

◆ getFrictionFactor()

getFrictionFactor ( )
Returns
float
534  {
535  return 0.6;
536  }

◆ getHardness()

getHardness ( )
Returns
int
475  {
476  return 10;
477  }

◆ getId()

getId ( )
final
Returns
int
626  {
627  return $this->id;
628  }

◆ getLightLevel()

getLightLevel ( )
Returns
int 0-15
541  {
542  return 0;
543  }

◆ getMetadata()

getMetadata (   $metadataKey)

Returns a list of previously set metadata values from the implementing object's metadata store.

Parameters
string$metadataKey
Returns
MetadataValue[]

Implements Metadatable.

889  {
890  if($this->getLevel() instanceof Level){
891  return $this->getLevel()->getBlockMetadata()->getMetadata($this, $metadataKey);
892  }
893 
894  return null;
895  }

◆ getName()

getName ( )
Returns
string
619  {
620  return "Unknown";
621  }

◆ getResistance()

getResistance ( )
Returns
int
482  {
483  return $this->getHardness() * 5;
484  }

◆ getSide()

getSide (   $side,
  $step = 1 
)

Returns the Block on the side $side, works like Vector3::side()

Parameters
int$side
int$step
Returns
Block
736  {
737  if($this->isValid()){
738  return $this->getLevel()->getBlock(Vector3::getSide($side, $step));
739  }
740 
741  return Block::get(Item::AIR, 0, Position::fromObject(Vector3::getSide($side, $step)));
742  }

◆ getToolType()

getToolType ( )
Returns
int
527  {
528  return Tool::TYPE_NONE;
529  }

◆ hasEntityCollision()

hasEntityCollision ( )
608  {
609  return false;
610  }

◆ hasMetadata()

hasMetadata (   $metadataKey)

Tests to see whether the implementing object contains the given metadata value in its metadata store.

Parameters
string$metadataKey
Returns
bool

Implements Metadatable.

897  {
898  if($this->getLevel() instanceof Level){
899  $this->getLevel()->getBlockMetadata()->hasMetadata($this, $metadataKey);
900  }
901  }

◆ isActivated()

isActivated ( Block  $from = null)
604  {
605  return false;
606  }

◆ isBreakable()

isBreakable ( Item  $item)

Returns if the item can be broken with an specific Item

Parameters
Item$item
Returns
bool
430  {
431  return true;
432  }

◆ isPlaceable()

isPlaceable ( )
554  {
555  return $this->canBePlaced();
556  }

◆ isSolid()

isSolid ( )
574  {
575  return true;
576  }

◆ isTopFacingSurfaceSolid()

isTopFacingSurfaceSolid ( )
500  {
501  if($this->isSolid()){
502  return true;
503  }else{
504  if($this instanceof Stair and ($this->getDamage() &4) == 4){
505  return true;
506  }elseif($this instanceof Slab and ($this->getDamage() & 8) == 8){
507  return true;
508  }elseif($this instanceof SnowLayer and ($this->getDamage() & 7) == 7){
509  return true;
510  }
511  }
512  return false;
513  }

◆ isTransparent()

isTransparent ( )
Returns
bool
570  {
571  return false;
572  }

◆ onActivate()

onActivate ( Item  $item,
Player  $player = null 
)

Do actions when activated by Item. Returns if it has done anything

Parameters
Item$item
Player$player
Returns
bool
468  {
469  return false;
470  }

◆ onBreak()

onBreak ( Item  $item)

Do the actions needed so the block is broken with the Item

Parameters
Item$item
Returns
mixed
445  {
446  return $this->getLevel()->setBlock($this, new Air(), true, true);
447  }

◆ onEntityCollide()

onEntityCollide ( Entity  $entity)
Parameters
Entity$entity
767  {
768 
769  }

◆ onUpdate()

onUpdate (   $type)

Fires a block update on the Block

Parameters
int$type
Returns
void
456  {
457 
458  }

◆ place()

place ( Item  $item,
Block  $block,
Block  $target,
  $face,
  $fx,
  $fy,
  $fz,
Player  $player = null 
)

Places the Block, using block space and block target, and side. Returns if the block has been placed.

Parameters
Item$item
Block$block
Block$target
int$face
float$fx
float$fy
float$fz
Player$player= null
Returns
bool
419  {
420  return $this->getLevel()->setBlock($this, $this, true, true);
421  }

◆ position()

position ( Position  $v)
final

Sets the block position to a new Position object

Parameters
Position$v
653  {
654  $this->x = (int) $v->x;
655  $this->y = (int) $v->y;
656  $this->z = (int) $v->z;
657  $this->level = $v->level;
658  $this->boundingBox = null;
659  }

◆ recalculateBoundingBox()

recalculateBoundingBox ( )
protected
Returns
AxisAlignedBB
784  {
785  return new AxisAlignedBB(
786  $this->x,
787  $this->y,
788  $this->z,
789  $this->x + 1,
790  $this->y + 1,
791  $this->z + 1
792  );
793  }

◆ removeMetadata()

removeMetadata (   $metadataKey,
Plugin  $owningPlugin 
)

Removes the given metadata value from the implementing object's metadata store.

Parameters
string$metadataKey
Plugin$owningPlugin
Returns
void

Implements Metadatable.

903  {
904  if($this->getLevel() instanceof Level){
905  $this->getLevel()->getBlockMetadata()->removeMetadata($this, $metadataKey, $plugin);
906  }
907  }

◆ setDamage()

setDamage (   $meta)
final
Parameters
int$meta
644  {
645  $this->meta = $meta & 0x0f;
646  }

◆ setMetadata()

setMetadata (   $metadataKey,
MetadataValue  $newMetadataValue 
)

Sets a metadata value in the implementing object's metadata store.

Parameters
string$metadataKey
MetadataValue$newMetadataValue
Returns
void

Implements Metadatable.

883  {
884  if($this->getLevel() instanceof Level){
885  $this->getLevel()->getBlockMetadata()->setMetadata($this, $metadataKey, $metadataValue);
886  }
887  }

◆ tickRate()

tickRate ( )
434  : int{
435  return 10;
436  }

Field Documentation

◆ $boundingBox

$boundingBox = null

◆ $diffusesSkyLight

$diffusesSkyLight = null
static

◆ $fullList

$fullList = null
static

◆ $hardness

$hardness = null
static

◆ $id

$id
protected

◆ $light

$light = null
static

◆ $lightFilter

$lightFilter = null
static

◆ $list

$list = null
static

◆ $meta

$meta = 0
protected

◆ $solid

$solid = null
static

◆ $transparent

$transparent = null
static

The documentation for this class was generated from the following file: