Updated blocks bounding boxes

This commit is contained in:
Shoghi Cervantes 2014-08-24 16:30:56 +02:00
parent f0f9bccb4b
commit c47e359262
24 changed files with 111 additions and 6 deletions

View File

@ -44,11 +44,7 @@ class Air extends Transparent{
}
public function getBoundingBox(){
return new AxisAlignedBB(0, 0, 0, 0, 0, 0);
}
public function collidesWithBB(AxisAlignedBB $bb, &$list = []){
return null;
}
}

View File

@ -32,6 +32,10 @@ class Beetroot extends Flowable{
$this->hardness = 0;
}
public function getBoundingBox(){
return null;
}
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$down = $this->getSide(0);
if($down->getID() === self::FARMLAND){

View File

@ -54,4 +54,9 @@ class BrownMushroom extends Flowable{
return false;
}
public function getBoundingBox(){
return null;
}
}

View File

@ -32,6 +32,11 @@ class Carrot extends Flowable{
$this->hardness = 0;
}
public function getBoundingBox(){
return null;
}
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$down = $this->getSide(0);
if($down->getID() === self::FARMLAND){

View File

@ -31,6 +31,11 @@ class CyanFlower extends Flowable{
$this->hardness = 0;
}
public function getBoundingBox(){
return null;
}
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$down = $this->getSide(0);
if($down->getID() === 2 or $down->getID() === 3 or $down->getID() === 60){

View File

@ -31,6 +31,11 @@ class Dandelion extends Flowable{
$this->hardness = 0;
}
public function getBoundingBox(){
return null;
}
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$down = $this->getSide(0);
if($down->getID() === 2 or $down->getID() === 3 or $down->getID() === 60){

View File

@ -30,6 +30,11 @@ class DeadBush extends Flowable{
$this->hardness = 0;
}
public function getBoundingBox(){
return null;
}
public function onUpdate($type){
if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->isTransparent === true){ //Replace with common break method

View File

@ -33,6 +33,11 @@ class Fire extends Flowable{
$this->hardness = 0;
}
public function getBoundingBox(){
return null;
}
public function getDrops(Item $item){
return [];
}

View File

@ -33,6 +33,11 @@ class Ladder extends Transparent{
$this->hardness = 2;
}
public function getBoundingBox(){
return null;
}
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
if($target->isTransparent === false){
$faces = array(

View File

@ -33,6 +33,11 @@ class Lava extends Liquid{
$this->hardness = 0;
}
public function getBoundingBox(){
return null;
}
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$ret = $this->getLevel()->setBlock($this, $this, true, false, true);
$this->getLevel()->scheduleUpdate(clone $this, 40);

View File

@ -32,6 +32,11 @@ class MelonStem extends Flowable{
$this->hardness = 0;
}
public function getBoundingBox(){
return null;
}
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$down = $this->getSide(0);
if($down->getID() === self::FARMLAND){

View File

@ -32,6 +32,11 @@ class Potato extends Flowable{
$this->hardness = 0;
}
public function getBoundingBox(){
return null;
}
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$down = $this->getSide(0);
if($down->getID() === self::FARMLAND){

View File

@ -32,6 +32,11 @@ class PumpkinStem extends Flowable{
$this->hardness = 0;
}
public function getBoundingBox(){
return null;
}
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$down = $this->getSide(0);
if($down->getID() === self::FARMLAND){

View File

@ -31,6 +31,11 @@ class RedMushroom extends Flowable{
$this->hardness = 0;
}
public function getBoundingBox(){
return null;
}
public function onUpdate($type){
if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->isTransparent === true){ //Replace with common break method

View File

@ -49,6 +49,11 @@ class Sapling extends Flowable{
$this->hardness = 0;
}
public function getBoundingBox(){
return null;
}
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$down = $this->getSide(0);
if($down->getID() === self::GRASS or $down->getID() === self::DIRT or $down->getID() === self::FARMLAND){

View File

@ -33,6 +33,11 @@ class SignPost extends Transparent{
$this->hardness = 5;
}
public function getBoundingBox(){
return null;
}
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
if($face !== 0){
$faces = array(

View File

@ -34,6 +34,11 @@ class SnowLayer extends Flowable{
$this->hardness = 0.5;
}
public function getBoundingBox(){
return null;
}
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$down = $this->getSide(0);
if($down instanceof Solid){

View File

@ -32,6 +32,11 @@ class Sugarcane extends Flowable{
$this->hardness = 0;
}
public function getBoundingBox(){
return null;
}
public function getDrops(Item $item){
return array(
array(Item::SUGARCANE, 0, 1),

View File

@ -37,6 +37,11 @@ class TallGrass extends Flowable{
$this->hardness = 0;
}
public function getBoundingBox(){
return null;
}
public function onUpdate($type){
if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(0)->isTransparent === true){ //Replace with common break method

View File

@ -31,6 +31,11 @@ class Torch extends Flowable{
$this->hardness = 0;
}
public function getBoundingBox(){
return null;
}
public function onUpdate($type){
if($type === Level::BLOCK_UPDATE_NORMAL){
$side = $this->getDamage();

View File

@ -27,6 +27,11 @@ class WallSign extends SignPost{
Transparent::__construct(self::WALL_SIGN, $meta, "Wall Sign");
}
public function getBoundingBox(){
return null;
}
public function onUpdate($type){
return false;
}

View File

@ -33,6 +33,11 @@ class Water extends Liquid{
$this->hardness = 500;
}
public function getBoundingBox(){
return null;
}
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$ret = $this->getLevel()->setBlock($this, $this, true, false, true);
$this->getLevel()->scheduleUpdate(clone $this, 10);

View File

@ -32,6 +32,11 @@ class Wheat extends Flowable{
$this->hardness = 0;
}
public function getBoundingBox(){
return null;
}
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$down = $this->getSide(0);
if($down->getID() === self::FARMLAND){

View File

@ -960,7 +960,7 @@ class Level implements ChunkManager, Metadatable{
//$face = -1;
}
if($hand->isSolid === true and count($this->getCollidingEntities($hand->getBoundingBox())) > 0){
if($hand->isSolid === true and $hand->getBoundingBox() !== null and count($this->getCollidingEntities($hand->getBoundingBox())) > 0){
return false; //Entity in block
}