mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-23 04:59:46 +00:00
fence gate aabb fix
This commit is contained in:
parent
51c894d4a5
commit
518f6a99a7
1 changed files with 21 additions and 3 deletions
|
|
@ -2,7 +2,25 @@
|
||||||
|
|
||||||
class FenceGateBlock extends TransparentBlock{
|
class FenceGateBlock extends TransparentBlock{
|
||||||
|
|
||||||
//TODO public static function getCollisionBoundingBoxes(Level $level, $x, $y, $z, Entity $entity)
|
public static function getCollisionBoundingBoxes(Level $level, $x, $y, $z, Entity $entity){
|
||||||
|
$aabb = static::getAABB($level, $x, $y, $z);
|
||||||
|
if($aabb == null) return [];
|
||||||
|
return [$aabb];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getAABB(Level $level, $x, $y, $z){
|
||||||
|
$data = $level->level->getBlockDamage($x, $y, $z);
|
||||||
|
|
||||||
|
if($data & 4){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($data != 2 && $data != 0){
|
||||||
|
return new AxisAlignedBB($x + 0.375, $y, $z, $x + 0.625, $y + 1.5, $z + 1.0);
|
||||||
|
}else{
|
||||||
|
return new AxisAlignedBB($x, $y, $z + 0.375, $x + 1, $y + 1.5, $z + 0.625);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function __construct($meta = 0){
|
public function __construct($meta = 0){
|
||||||
parent::__construct(FENCE_GATE, $meta, "Fence Gate");
|
parent::__construct(FENCE_GATE, $meta, "Fence Gate");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue