mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-22 19:06:35 +00:00
Added Glass Pane bounding box
This commit is contained in:
parent
cd5e16f017
commit
edad52c6ea
@ -22,11 +22,9 @@
|
||||
namespace pocketmine\block;
|
||||
|
||||
|
||||
class GlassPane extends Transparent{
|
||||
class GlassPane extends Thin{
|
||||
public function __construct(){
|
||||
parent::__construct(self::GLASS_PANE, 0, "Glass Pane");
|
||||
$this->isFullBlock = false;
|
||||
$this->isSolid = false;
|
||||
}
|
||||
|
||||
}
|
80
src/pocketmine/block/Thin.php
Normal file
80
src/pocketmine/block/Thin.php
Normal file
@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
namespace pocketmine\block;
|
||||
|
||||
|
||||
use pocketmine\math\AxisAlignedBB;
|
||||
|
||||
class Thin extends Transparent{
|
||||
|
||||
public $isFullBlock = false;
|
||||
public $isSolid = false;
|
||||
|
||||
public function getBoundingBox(){
|
||||
$f = 0.4375;
|
||||
$f1 = 0.5625;
|
||||
$f2 = 0.4375;
|
||||
$f3 = 0.5625;
|
||||
|
||||
$flag = $this->canConnect($this->getSide(2));
|
||||
$flag1 = $this->canConnect($this->getSide(3));
|
||||
$flag2 = $this->canConnect($this->getSide(4));
|
||||
$flag3 = $this->canConnect($this->getSide(5));
|
||||
|
||||
if((!$flag2 or !$flag3) and ($flag2 or $flag3 or $flag or $flag1)){
|
||||
if($flag2 and !$flag3){
|
||||
$f = 0;
|
||||
}elseif(!$flag2 and $flag3){
|
||||
$f1 = 1;
|
||||
}
|
||||
}else{
|
||||
$f = 0;
|
||||
$f1 = 1;
|
||||
}
|
||||
|
||||
if((!$flag or !$flag1) and ($flag2 or $flag3 or $flag or $flag1)){
|
||||
if($flag and !$flag1){
|
||||
$f2 = 0;
|
||||
}elseif(!$flag and $flag1){
|
||||
$f3 = 1;
|
||||
}
|
||||
}else{
|
||||
$f2 = 0;
|
||||
$f3 = 1;
|
||||
}
|
||||
|
||||
return new AxisAlignedBB(
|
||||
$this->x + $f,
|
||||
$this->y,
|
||||
$this->z + $f2,
|
||||
$this->x + $f1,
|
||||
$this->y + 1,
|
||||
$this->z + $f3
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
public function canConnect(Block $block){
|
||||
return $block->isSolid or $block->getID() === $this->getID() or $block->getID() === self::GLASS_PANE or $block->getID() === self::GLASS;
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user