Added new Block properties (Block::isSolid, Block::isFullBlock)

This commit is contained in:
Shoghi Cervantes 2013-05-30 12:47:24 +02:00
parent 8d00ef381d
commit a795b64bab
36 changed files with 57 additions and 32 deletions

View File

@ -337,7 +337,7 @@ class BlockAPI{
return $this->cancelAction($block, $player); return $this->cancelAction($block, $player);
} }
if($hand->isFlowable === false and $player->entity->inBlock($block)){ if($hand->isSolid === true and $player->entity->inBlock($block)){
return $this->cancelAction($block, $player); //Entity in block return $this->cancelAction($block, $player); //Entity in block
} }

View File

@ -140,12 +140,14 @@ abstract class Block extends Position{
public $isActivable = false; public $isActivable = false;
public $breakable = true; public $breakable = true;
public $isFlowable = false; public $isFlowable = false;
public $isSolid = true;
public $isTransparent = false; public $isTransparent = false;
public $isReplaceable = false; public $isReplaceable = false;
public $isPlaceable = true; public $isPlaceable = true;
public $level = false; public $level = false;
public $hasPhysics = false; public $hasPhysics = false;
public $isLiquid = false; public $isLiquid = false;
public $isFullBlock = true;
public $x = 0; public $x = 0;
public $y = 0; public $y = 0;
public $z = 0; public $z = 0;

View File

@ -28,6 +28,8 @@ the Free Software Foundation, either version 3 of the License, or
class DoorBlock extends TransparentBlock{ class DoorBlock extends TransparentBlock{
public function __construct($id, $meta = 0, $name = "Unknown"){ public function __construct($id, $meta = 0, $name = "Unknown"){
parent::__construct($id, $meta, $name); parent::__construct($id, $meta, $name);
$this->isSolid = false;
$this->isFullBlock = false;
} }
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

@ -29,5 +29,7 @@ class FlowableBlock extends TransparentBlock{
public function __construct($id, $meta = 0, $name = "Unknown"){ public function __construct($id, $meta = 0, $name = "Unknown"){
parent::__construct($id, $meta, $name); parent::__construct($id, $meta, $name);
$this->isFlowable = true; $this->isFlowable = true;
$this->isFullBlock = false;
$this->isSolid = false;
} }
} }

View File

@ -31,5 +31,7 @@ class LiquidBlock extends TransparentBlock{
$this->isLiquid = true; $this->isLiquid = true;
$this->breakable = false; $this->breakable = false;
$this->isReplaceable = true; $this->isReplaceable = true;
$this->isSolid = false;
$this->isFullBlock = true;
} }
} }

View File

@ -28,5 +28,7 @@ the Free Software Foundation, either version 3 of the License, or
class SolidBlock extends GenericBlock{ class SolidBlock extends GenericBlock{
public function __construct($id, $meta = 0, $name = "Unknown"){ public function __construct($id, $meta = 0, $name = "Unknown"){
parent::__construct($id, $meta, $name); parent::__construct($id, $meta, $name);
$this->isSolid = true;
$this->isFullBlock = true;
} }
} }

View File

@ -28,6 +28,7 @@ the Free Software Foundation, either version 3 of the License, or
class StairBlock extends TransparentBlock{ class StairBlock extends TransparentBlock{
public function __construct($id, $meta = 0, $name = "Unknown"){ public function __construct($id, $meta = 0, $name = "Unknown"){
parent::__construct($id, $meta, $name); parent::__construct($id, $meta, $name);
$this->isFullBlock = false;
} }
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

@ -34,5 +34,6 @@ class TransparentBlock extends GenericBlock{
$this->isTransparent = true; $this->isTransparent = true;
$this->isReplaceable = false; $this->isReplaceable = false;
$this->isPlaceable = true; $this->isPlaceable = true;
$this->isSolid = true;
} }
} }

View File

@ -28,6 +28,8 @@ the Free Software Foundation, either version 3 of the License, or
class LadderBlock extends TransparentBlock{ class LadderBlock extends TransparentBlock{
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(LADDER, $meta, "Ladder"); parent::__construct(LADDER, $meta, "Ladder");
$this->isSolid = false;
$this->isFullBlock = false;
} }
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($target->isTransparent === false){ if($target->isTransparent === false){

View File

@ -28,6 +28,8 @@ the Free Software Foundation, either version 3 of the License, or
class SignPostBlock extends TransparentBlock{ class SignPostBlock extends TransparentBlock{
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(SIGN_POST, $meta, "Sign Post"); parent::__construct(SIGN_POST, $meta, "Sign Post");
$this->isSolid = false;
$this->isFullBlock = false;
} }
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

@ -43,7 +43,7 @@ class TorchBlock extends FlowableBlock{
0 => 0, 0 => 0,
); );
if($this->getSide($faces[$side])->isFlowable === true){ //Replace wit common break method if($this->getSide($faces[$side])->isTransparent === true and !($side === 0 and $this->getSide(0)->getID() === FENCE)){ //Replace wit common break method
ServerAPI::request()->api->entity->drop($this, BlockAPI::getItem($this->id)); ServerAPI::request()->api->entity->drop($this, BlockAPI::getItem($this->id));
$this->level->setBlock($this, new AirBlock(), false); $this->level->setBlock($this, new AirBlock(), false);
return BLOCK_UPDATE_NORMAL; return BLOCK_UPDATE_NORMAL;

View File

@ -29,6 +29,7 @@ class TrapdoorBlock extends TransparentBlock{
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(TRAPDOOR, $meta, "Trapdoor"); parent::__construct(TRAPDOOR, $meta, "Trapdoor");
$this->isActivable = true; $this->isActivable = true;
$this->isFullBlock = false;
} }
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(($target->isTransparent === false or $target->getID() === SLAB) and $face !== 0 and $face !== 1){ if(($target->isTransparent === false or $target->getID() === SLAB) and $face !== 0 and $face !== 1){

View File

@ -35,6 +35,9 @@ class AirBlock extends TransparentBlock{
$this->isReplaceable = true; $this->isReplaceable = true;
$this->isPlaceable = false; $this->isPlaceable = false;
$this->hasPhysics = false; $this->hasPhysics = false;
$this->isSolid = false;
$this->isFullBlock = true;
} }
} }

View File

@ -29,6 +29,7 @@ class BedBlock extends TransparentBlock{
public function __construct($type = 0){ public function __construct($type = 0){
parent::__construct(BED_BLOCK, $type, "Bed Block"); parent::__construct(BED_BLOCK, $type, "Bed Block");
$this->isActivable = true; $this->isActivable = true;
$this->isFullBlock = false;
} }
public function onActivate(Item $item, Player $player){ public function onActivate(Item $item, Player $player){

View File

@ -30,6 +30,8 @@ class FireBlock extends FlowableBlock{
parent::__construct(FIRE, $meta, "Fire"); parent::__construct(FIRE, $meta, "Fire");
$this->isReplaceable = true; $this->isReplaceable = true;
$this->breakable = false; $this->breakable = false;
$this->isFullBlock = true;
} }
} }

View File

@ -28,12 +28,11 @@ the Free Software Foundation, either version 3 of the License, or
class BrownMushroomBlock extends FlowableBlock{ 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->isFlowable = true;
} }
public function onUpdate($type){ public function onUpdate($type){
if($type === BLOCK_UPDATE_NORMAL){ if($type === BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->isFlowable === true){ //Replace wit common break method if($this->getSide(0)->isTransparent === true){ //Replace wit common break method
ServerAPI::request()->api->entity->drop($this, BlockAPI::getItem($this->id)); ServerAPI::request()->api->entity->drop($this, BlockAPI::getItem($this->id));
$this->level->setBlock($this, new AirBlock(), false); $this->level->setBlock($this, new AirBlock(), false);
return BLOCK_UPDATE_NORMAL; return BLOCK_UPDATE_NORMAL;

View File

@ -28,6 +28,7 @@ the Free Software Foundation, either version 3 of the License, or
class CactusBlock extends TransparentBlock{ class CactusBlock extends TransparentBlock{
public function __construct(){ public function __construct(){
parent::__construct(CACTUS, 0, "Cactus"); parent::__construct(CACTUS, 0, "Cactus");
$this->isFullBlock = false;
} }
public function onUpdate($type){ public function onUpdate($type){
@ -49,7 +50,7 @@ class CactusBlock extends TransparentBlock{
$block1 = $this->getSide(3); $block1 = $this->getSide(3);
$block2 = $this->getSide(4); $block2 = $this->getSide(4);
$block3 = $this->getSide(5); $block3 = $this->getSide(5);
if($block0->isFlowable === true and $block1->isFlowable === true and $block2->isFlowable === true and $block3->isFlowable === true){ if($block0->isTransparent === true and $block1->isTransparent === true and $block2->isTransparent === true and $block3->isTransparent === true){
$this->level->setBlock($block, $this); $this->level->setBlock($block, $this);
return true; return true;
} }

View File

@ -28,7 +28,6 @@ the Free Software Foundation, either version 3 of the License, or
class CyanFlowerBlock extends FlowableBlock{ class CyanFlowerBlock extends FlowableBlock{
public function __construct(){ public function __construct(){
parent::__construct(CYAN_FLOWER, 0, "Cyan Flower"); parent::__construct(CYAN_FLOWER, 0, "Cyan Flower");
$this->isFlowable = true;
} }
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){
@ -42,7 +41,7 @@ class CyanFlowerBlock extends FlowableBlock{
public function onUpdate($type){ public function onUpdate($type){
if($type === BLOCK_UPDATE_NORMAL){ if($type === BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->isFlowable === true){ //Replace wit common break method if($this->getSide(0)->isTransparent === true){ //Replace wit common break method
ServerAPI::request()->api->entity->drop($this, BlockAPI::getItem($this->id)); ServerAPI::request()->api->entity->drop($this, BlockAPI::getItem($this->id));
$this->level->setBlock($this, new AirBlock(), false); $this->level->setBlock($this, new AirBlock(), false);
return BLOCK_UPDATE_NORMAL; return BLOCK_UPDATE_NORMAL;

View File

@ -28,7 +28,6 @@ the Free Software Foundation, either version 3 of the License, or
class DandelionBlock extends FlowableBlock{ class DandelionBlock extends FlowableBlock{
public function __construct(){ public function __construct(){
parent::__construct(DANDELION, 0, "Dandelion"); parent::__construct(DANDELION, 0, "Dandelion");
$this->isFlowable = true;
} }
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){
@ -42,7 +41,7 @@ class DandelionBlock extends FlowableBlock{
public function onUpdate($type){ public function onUpdate($type){
if($type === BLOCK_UPDATE_NORMAL){ if($type === BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->isFlowable === true){ //Replace wit common break method if($this->getSide(0)->isTransparent === true){ //Replace wit common break method
ServerAPI::request()->api->entity->drop($this, BlockAPI::getItem($this->id)); ServerAPI::request()->api->entity->drop($this, BlockAPI::getItem($this->id));
$this->level->setBlock($this, new AirBlock(), false); $this->level->setBlock($this, new AirBlock(), false);
return BLOCK_UPDATE_NORMAL; return BLOCK_UPDATE_NORMAL;

View File

@ -28,13 +28,12 @@ the Free Software Foundation, either version 3 of the License, or
class DeadBushBlock extends FlowableBlock{ class DeadBushBlock extends FlowableBlock{
public function __construct(){ public function __construct(){
parent::__construct(DEAD_BUSH, 0, "Dead Bush"); parent::__construct(DEAD_BUSH, 0, "Dead Bush");
$this->isFlowable = true;
$this->isReplaceable = true; $this->isReplaceable = true;
} }
public function onUpdate($type){ public function onUpdate($type){
if($type === BLOCK_UPDATE_NORMAL){ if($type === BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->isFlowable === true){ //Replace wit common break method if($this->getSide(0)->isTransparent === true){ //Replace wit common break method
$this->level->setBlock($this, new AirBlock(), false); $this->level->setBlock($this, new AirBlock(), false);
return BLOCK_UPDATE_NORMAL; return BLOCK_UPDATE_NORMAL;
} }

View File

@ -25,7 +25,7 @@ the Free Software Foundation, either version 3 of the License, or
*/ */
class MelonStemBlock extends TransparentBlock{ class MelonStemBlock extends FlowableBlock{
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(MELON_STEM, $meta, "Melon Stem"); parent::__construct(MELON_STEM, $meta, "Melon Stem");
$this->isActivable = true; $this->isActivable = true;
@ -41,7 +41,7 @@ class MelonStemBlock extends TransparentBlock{
public function onUpdate($type){ public function onUpdate($type){
if($type === BLOCK_UPDATE_NORMAL){ if($type === BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->isFlowable === true){ //Replace wit common break method if($this->getSide(0)->isTransparent === true){ //Replace wit common break method
ServerAPI::request()->api->entity->drop($this, BlockAPI::getItem(MELON_SEEDS, 0, mt_rand(0, 2))); ServerAPI::request()->api->entity->drop($this, BlockAPI::getItem(MELON_SEEDS, 0, mt_rand(0, 2)));
$this->level->setBlock($this, new AirBlock(), false); $this->level->setBlock($this, new AirBlock(), false);
return BLOCK_UPDATE_NORMAL; return BLOCK_UPDATE_NORMAL;

View File

@ -28,12 +28,11 @@ the Free Software Foundation, either version 3 of the License, or
class RedMushroomBlock extends FlowableBlock{ 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->isFlowable = true;
} }
public function onUpdate($type){ public function onUpdate($type){
if($type === BLOCK_UPDATE_NORMAL){ if($type === BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->isFlowable === true){ //Replace wit common break method if($this->getSide(0)->isTransparent === true){ //Replace wit common break method
ServerAPI::request()->api->entity->drop($this, BlockAPI::getItem($this->id)); ServerAPI::request()->api->entity->drop($this, BlockAPI::getItem($this->id));
$this->level->setBlock($this, new AirBlock(), false); $this->level->setBlock($this, new AirBlock(), false);
return BLOCK_UPDATE_NORMAL; return BLOCK_UPDATE_NORMAL;

View File

@ -25,7 +25,7 @@ the Free Software Foundation, either version 3 of the License, or
*/ */
class SaplingBlock extends TransparentBlock{ class SaplingBlock extends FlowableBlock{
const OAK = 0; const OAK = 0;
const SPRUCE = 1; const SPRUCE = 1;
const BIRCH = 2; const BIRCH = 2;
@ -34,7 +34,6 @@ class SaplingBlock extends TransparentBlock{
public function __construct($meta = Sapling::OAK){ public function __construct($meta = Sapling::OAK){
parent::__construct(SAPLING, $meta, "Sapling"); parent::__construct(SAPLING, $meta, "Sapling");
$this->isActivable = true; $this->isActivable = true;
$this->isFlowable = true;
$names = array( $names = array(
0 => "Oak Sapling", 0 => "Oak Sapling",
1 => "Spruce Sapling", 1 => "Spruce Sapling",
@ -61,7 +60,7 @@ class SaplingBlock extends TransparentBlock{
} }
public function onUpdate($type){ public function onUpdate($type){
if($type === BLOCK_UPDATE_NORMAL){ if($type === BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->isFlowable === true){ //Replace wit common break method if($this->getSide(0)->isTransparent === true){ //Replace wit common break method
ServerAPI::request()->api->entity->drop($this, BlockAPI::getItem($this->id)); ServerAPI::request()->api->entity->drop($this, BlockAPI::getItem($this->id));
$this->level->setBlock($this, new AirBlock(), false); $this->level->setBlock($this, new AirBlock(), false);
return BLOCK_UPDATE_NORMAL; return BLOCK_UPDATE_NORMAL;

View File

@ -25,7 +25,7 @@ the Free Software Foundation, either version 3 of the License, or
*/ */
class SugarcaneBlock extends TransparentBlock{ class SugarcaneBlock extends FlowableBlock{
public function __construct(){ public function __construct(){
parent::__construct(SUGARCANE_BLOCK, 0, "Sugarcane"); parent::__construct(SUGARCANE_BLOCK, 0, "Sugarcane");
} }
@ -38,7 +38,7 @@ class SugarcaneBlock extends TransparentBlock{
public function onUpdate($type){ public function onUpdate($type){
if($type === BLOCK_UPDATE_NORMAL){ if($type === BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->isFlowable === true){ //Replace wit common break method if($this->getSide(0)->isTransparent === true){ //Replace wit common break method
ServerAPI::request()->api->entity->drop($this, BlockAPI::getItem(SUGARCANE)); ServerAPI::request()->api->entity->drop($this, BlockAPI::getItem(SUGARCANE));
$this->level->setBlock($this, new AirBlock(), false); $this->level->setBlock($this, new AirBlock(), false);
return BLOCK_UPDATE_NORMAL; return BLOCK_UPDATE_NORMAL;

View File

@ -28,7 +28,6 @@ the Free Software Foundation, either version 3 of the License, or
class TallGrassBlock extends FlowableBlock{ class TallGrassBlock extends FlowableBlock{
public function __construct($meta = 1){ public function __construct($meta = 1){
parent::__construct(TALL_GRASS, $meta, "Tall Grass"); parent::__construct(TALL_GRASS, $meta, "Tall Grass");
$this->isFlowable = true;
$this->isReplaceable = true; $this->isReplaceable = true;
$names = array( $names = array(
0 => "Dead Shrub", 0 => "Dead Shrub",
@ -40,7 +39,7 @@ class TallGrassBlock extends FlowableBlock{
public function onUpdate($type){ public function onUpdate($type){
if($type === BLOCK_UPDATE_NORMAL){ if($type === BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->isFlowable === true){ //Replace wit common break method if($this->getSide(0)->isTransparent === true){ //Replace wit common break method
$this->level->setBlock($this, new AirBlock(), false); $this->level->setBlock($this, new AirBlock(), false);
return BLOCK_UPDATE_NORMAL; return BLOCK_UPDATE_NORMAL;
} }

View File

@ -51,7 +51,7 @@ class WheatBlock extends FlowableBlock{
public function onUpdate($type){ public function onUpdate($type){
if($type === BLOCK_UPDATE_NORMAL){ if($type === BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->isFlowable === true){ //Replace wit common break method if($this->getSide(0)->isTransparent === true){ //Replace wit common break method
ServerAPI::request()->api->entity->drop($this, BlockAPI::getItem(WHEAT_SEEDS, 0, 1)); ServerAPI::request()->api->entity->drop($this, BlockAPI::getItem(WHEAT_SEEDS, 0, 1));
$this->level->setBlock($this, new AirBlock(), false); $this->level->setBlock($this, new AirBlock(), false);
return BLOCK_UPDATE_NORMAL; return BLOCK_UPDATE_NORMAL;

View File

@ -25,7 +25,6 @@ the Free Software Foundation, either version 3 of the License, or
*/ */
class BurningFurnaceBlock extends SolidBlock{ class BurningFurnaceBlock extends SolidBlock{
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(BURNING_FURNACE, $meta, "Burning Furnace"); parent::__construct(BURNING_FURNACE, $meta, "Burning Furnace");

View File

@ -28,6 +28,7 @@ the Free Software Foundation, either version 3 of the License, or
class CakeBlock extends TransparentBlock{ class CakeBlock extends TransparentBlock{
public function __construct(){ public function __construct(){
parent::__construct(CAKE_BLOCK, 0, "Cake Block"); parent::__construct(CAKE_BLOCK, 0, "Cake Block");
$this->isFullBlock = false;
} }
} }

View File

@ -25,9 +25,11 @@ the Free Software Foundation, either version 3 of the License, or
*/ */
class CobwebBlock extends TransparentBlock{ class CobwebBlock extends FlowableBlock{
public function __construct(){ public function __construct(){
parent::__construct(COBWEB, 0, "Cobweb"); parent::__construct(COBWEB, 0, "Cobweb");
$this->isSolid = true;
$this->isFullBlock = false;
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, Player $player){
return array(); return array();

View File

@ -28,6 +28,7 @@ the Free Software Foundation, either version 3 of the License, or
class FenceBlock extends TransparentBlock{ class FenceBlock extends TransparentBlock{
public function __construct(){ public function __construct(){
parent::__construct(FENCE, 0, "Fence"); parent::__construct(FENCE, 0, "Fence");
$this->isFullBlock = false;
} }
} }

View File

@ -29,6 +29,7 @@ class FenceGateBlock extends TransparentBlock{
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(FENCE_GATE, $meta, "Fence Gate"); parent::__construct(FENCE_GATE, $meta, "Fence Gate");
$this->isActivable = true; $this->isActivable = true;
$this->isFullBlock = false;
} }
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

@ -28,6 +28,7 @@ the Free Software Foundation, either version 3 of the License, or
class GlassPaneBlock extends TransparentBlock{ class GlassPaneBlock extends TransparentBlock{
public function __construct(){ public function __construct(){
parent::__construct(GLASS_PANE, 0, "Glass Pane"); parent::__construct(GLASS_PANE, 0, "Glass Pane");
$this->isFullBlock = false;
} }
} }

View File

@ -39,6 +39,7 @@ class SlabBlock extends TransparentBlock{
7 => "Quartz", 7 => "Quartz",
); );
$this->name = (($this->meta & 0x08) === 0x08 ? "Upper ":"") . $names[$this->meta & 0x07] . " Slab"; $this->name = (($this->meta & 0x08) === 0x08 ? "Upper ":"") . $names[$this->meta & 0x07] . " Slab";
$this->isFullBlock = false;
} }
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

@ -29,6 +29,7 @@ class SnowLayerBlock extends FlowableBlock{
public function __construct($meta = 0){ public function __construct($meta = 0){
parent::__construct(SNOW_LAYER, $meta, "Snow Layer"); parent::__construct(SNOW_LAYER, $meta, "Snow Layer");
$this->isReplaceable = true; $this->isReplaceable = true;
$this->isSolid = false;
} }
} }

View File

@ -32,7 +32,7 @@ class PaintingItem extends Item{
} }
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){
if($target->isTransparent === false and $face > 1 and $block->isFlowable === true){ if($target->isTransparent === false and $face > 1 and $block->isSolid === false){
$server = ServerAPI::request(); $server = ServerAPI::request();
$faces = array( $faces = array(
2 => 1, 2 => 1,

View File

@ -352,7 +352,7 @@ class Entity extends Position{
$v = new Vector3($x, $y, $z); $v = new Vector3($x, $y, $z);
if($this->isSupport($v, $this->size)){ if($this->isSupport($v, $this->size)){
$b = $this->level->getBlock($v); $b = $this->level->getBlock($v);
if($b->isFlowable !== true){ if($b->isSolid === true){
$support = true; $support = true;
break; break;
} }
@ -383,7 +383,7 @@ class Entity extends Position{
$z = (int) ($this->z - 0.5); $z = (int) ($this->z - 0.5);
$lim = (int) floor($ny); $lim = (int) floor($ny);
for($y = (int) ceil($this->y) - 1; $y >= $lim; --$y){ for($y = (int) ceil($this->y) - 1; $y >= $lim; --$y){
if($this->level->getBlock(new Vector3($x, $y, $z))->isFlowable !== true){ if($this->level->getBlock(new Vector3($x, $y, $z))->isSolid === true){
$ny = $y + 1; $ny = $y + 1;
$this->speedY = 0; $this->speedY = 0;
$this->support = true; $this->support = true;
@ -406,7 +406,8 @@ class Entity extends Position{
} }
if($this->class === ENTITY_FALLING){ if($this->class === ENTITY_FALLING){
$fall = $this->level->getBlock(new Vector3(intval($this->x - 0.5), intval(ceil($this->y)), intval($this->z - 0.5))); $fall = $this->level->getBlock(new Vector3(intval($this->x - 0.5), intval(ceil($this->y)), intval($this->z - 0.5)));
if($fall->getID() !== AIR and $fall->isFlowable){ $down = $this->level->getBlock(new Vector3(intval($this->x - 0.5), intval(ceil($this->y)), intval($this->z - 0.5)));
if($fall->isFullBlock === false or $down->isFullBlock === false){
$this->server->api->entity->drop($this, BlockAPI::getItem($this->data["Tile"] & 0xFFFF, 0, 1), true); $this->server->api->entity->drop($this, BlockAPI::getItem($this->data["Tile"] & 0xFFFF, 0, 1), true);
}else{ }else{
$this->level->setBlock($fall, BlockAPI::get($this->data["Tile"])); $this->level->setBlock($fall, BlockAPI::get($this->data["Tile"]));