Added lily pad, checked some bounding boxes

This commit is contained in:
Shoghi Cervantes
2015-06-05 13:58:59 +02:00
parent 6e69e15dfd
commit ac4194eb3f
9 changed files with 156 additions and 43 deletions

View File

@ -25,6 +25,7 @@ use pocketmine\item\Item;
use pocketmine\level\Level;
use pocketmine\level\sound\DoorSound;
use pocketmine\math\AxisAlignedBB;
use pocketmine\math\Vector3;
use pocketmine\network\protocol\LevelEventPacket;
use pocketmine\Player;
use pocketmine\Server;
@ -42,19 +43,19 @@ abstract class Door extends Transparent{
private function getFullDamage(){
$damage = $this->getDamage();
$flag = ($damage & 0x08) > 0;
$isUp = ($damage & 0x08) > 0;
if($flag){
$first = $this->getSide(0)->getDamage();
$second = $damage;
if($isUp){
$down = $this->getSide(Vector3::SIDE_DOWN)->getDamage();
$up = $damage;
}else{
$first = $damage;
$second = $this->getSide(1)->getDamage();
$down = $damage;
$up = $this->getSide(Vector3::SIDE_UP)->getDamage();
}
$flag1 = ($second & 0x01) > 0;
$isRight = ($up & 0x01) > 0;
return $first & 0x07 | ($flag ? 8 : 0) | ($flag1 ? 0x10 : 0);
return $down & 0x07 | ($isUp ? 8 : 0) | ($isRight ? 0x10 : 0);
}
protected function recalculateBoundingBox(){
@ -72,12 +73,12 @@ abstract class Door extends Transparent{
);
$j = $damage & 0x03;
$flag = (($damage & 0x04) > 0);
$flag1 = (($damage & 0x10) > 0);
$isOpen = (($damage & 0x04) > 0);
$isRight = (($damage & 0x10) > 0);
if($j === 0){
if($flag){
if(!$flag1){
if($isOpen){
if(!$isRight){
$bb->setBounds(
$this->x,
$this->y,
@ -107,8 +108,8 @@ abstract class Door extends Transparent{
);
}
}elseif($j === 1){
if($flag){
if(!$flag1){
if($isOpen){
if(!$isRight){
$bb->setBounds(
$this->x + 1 - $f,
$this->y,
@ -138,8 +139,8 @@ abstract class Door extends Transparent{
);
}
}elseif($j === 2){
if($flag){
if(!$flag1){
if($isOpen){
if(!$isRight){
$bb->setBounds(
$this->x,
$this->y,
@ -169,8 +170,8 @@ abstract class Door extends Transparent{
);
}
}elseif($j === 3){
if($flag){
if(!$flag1){
if($isOpen){
if(!$isRight){
$bb->setBounds(
$this->x,
$this->y,