Added Liquids properties

This commit is contained in:
Shoghi Cervantes Pueyo 2013-02-02 17:50:17 +01:00
parent 328cc968bd
commit 8d6d5306c1
7 changed files with 171 additions and 5 deletions

View File

@ -58,10 +58,10 @@ class BlockAPI{
PLANKS => "PlanksBlock",
SAPLING => "SaplingBlock",
BEDROCK => "BedrockBlock",
/*WATER => (new GenericBlock(WATER, 0, "")),
STILL_WATER => (new GenericBlock(STILL_WATER, 0, "")),
LAVA => (new GenericBlock(LAVA, 0, "")),
STILL_LAVA => (new GenericBlock(STILL_LAVA, 0, "")),*/
WATER => "WaterBlock",
STILL_WATER => "StillWaterBlock",
LAVA => "LavaBlock",
STILL_LAVA => "StillLavaBlock",
SAND => "SandBlock",
GRAVEL => "GravelBlock",
GOLD_ORE => "GoldOreBlock",

View File

@ -40,6 +40,7 @@ abstract class Block{
public $isPlaceable = true;
public $inWorld = false;
public $hasPhysics = false;
public $isLiquid = false;
public $v = false;
public function __construct($id, $meta = 0, $name = "Unknown"){
@ -63,7 +64,7 @@ abstract class Block{
final public function position(Vector3 $v){
$this->inWorld = true;
$this->position = new Vector3((int) $v->x, (int) $v->y, (int) $v->z);
$this->v = new Vector3((int) $v->x, (int) $v->y, (int) $v->z);
}
public function getDrops(Item $item, Player $player){

View File

@ -0,0 +1,33 @@
<?php
/*
-
/ \
/ \
/ PocketMine \
/ MP \
|\ @shoghicp /|
|. \ / .|
| .. \ / .. |
| .. | .. |
| .. | .. |
\ | /
\ | /
\ | /
\ | /
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
*/
class LiquidBlock extends TransparentBlock{
public function __construct($id, $meta = 0, $name = "Unknown"){
parent::__construct($id, $meta, $name);
$this->isLiquid = true;
}
}

View File

@ -0,0 +1,33 @@
<?php
/*
-
/ \
/ \
/ PocketMine \
/ MP \
|\ @shoghicp /|
|. \ / .|
| .. \ / .. |
| .. | .. |
| .. | .. |
\ | /
\ | /
\ | /
\ | /
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
*/
class LavaBlock extends LiquidBlock{
public function __construct($meta = 0){
parent::__construct(LAVA, $meta, "Lava");
}
}

View File

@ -0,0 +1,33 @@
<?php
/*
-
/ \
/ \
/ PocketMine \
/ MP \
|\ @shoghicp /|
|. \ / .|
| .. \ / .. |
| .. | .. |
| .. | .. |
\ | /
\ | /
\ | /
\ | /
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
*/
class StillLavaBlock extends LiquidBlock{
public function __construct($meta = 0){
parent::__construct(STILL_LAVA, $meta, "Still Lava");
}
}

View File

@ -0,0 +1,33 @@
<?php
/*
-
/ \
/ \
/ PocketMine \
/ MP \
|\ @shoghicp /|
|. \ / .|
| .. \ / .. |
| .. | .. |
| .. | .. |
\ | /
\ | /
\ | /
\ | /
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
*/
class StillWaterBlock extends LiquidBlock{
public function __construct($meta = 0){
parent::__construct(STILL_WATER, $meta, "Still Water");
}
}

View File

@ -0,0 +1,33 @@
<?php
/*
-
/ \
/ \
/ PocketMine \
/ MP \
|\ @shoghicp /|
|. \ / .|
| .. \ / .. |
| .. | .. |
| .. | .. |
\ | /
\ | /
\ | /
\ | /
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
*/
class WaterBlock extends LiquidBlock{
public function __construct($meta = 0){
parent::__construct(WATER, $meta, "Water");
}
}