mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 19:49:44 +00:00
project uses tabs instead of spaces(as in CONTRIBUTING.md)
This commit is contained in:
parent
f00318b6ed
commit
62571f26cd
115 changed files with 2291 additions and 2364 deletions
|
|
@ -180,7 +180,7 @@ class AxisAlignedBB{
|
|||
|
||||
return $z;
|
||||
}
|
||||
|
||||
|
||||
public function intersectsWith(AxisAlignedBB $bb){
|
||||
if($bb->maxX > $this->minX and $bb->minX < $this->maxX){
|
||||
if($bb->maxY > $this->minY and $bb->minY < $this->maxY){
|
||||
|
|
@ -192,14 +192,14 @@ class AxisAlignedBB{
|
|||
}
|
||||
|
||||
public function isXYZInside($x, $y, $z){
|
||||
if($x <= $this->minX or $x >= $this->maxX){
|
||||
return false;
|
||||
}
|
||||
if($y <= $this->minY or $y >= $this->maxY){
|
||||
return false;
|
||||
}
|
||||
|
||||
return $z > $this->minZ and $z < $this->maxZ;
|
||||
if($x <= $this->minX or $x >= $this->maxX){
|
||||
return false;
|
||||
}
|
||||
if($y <= $this->minY or $y >= $this->maxY){
|
||||
return false;
|
||||
}
|
||||
|
||||
return $z > $this->minZ and $z < $this->maxZ;
|
||||
}
|
||||
public function isVectorInside(Vector3 $vector){
|
||||
if($vector->x <= $this->minX or $vector->x >= $this->maxX){
|
||||
|
|
@ -306,7 +306,7 @@ class AxisAlignedBB{
|
|||
}
|
||||
|
||||
public function __toString(){
|
||||
return "min: {$this->minX}, {$this->minY}, {$this->minZ}, max: {$this->maxX}, {$this->maxY}, {$this->maxZ}";
|
||||
return "min: {$this->minX}, {$this->minY}, {$this->minZ}, max: {$this->maxX}, {$this->maxY}, {$this->maxZ}";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -17,11 +17,11 @@ class Vector3{
|
|||
}
|
||||
|
||||
public function copy(){
|
||||
return new Vector3($this->x, $this->y, $this->z);
|
||||
return new Vector3($this->x, $this->y, $this->z);
|
||||
}
|
||||
|
||||
public function toArray(){
|
||||
return ["x" => $this->x, "y" => $this->y, "z" => $this->z];
|
||||
return ["x" => $this->x, "y" => $this->y, "z" => $this->z];
|
||||
}
|
||||
|
||||
public function getFloorX(){
|
||||
|
|
@ -72,7 +72,7 @@ class Vector3{
|
|||
if(($x instanceof Vector3) === true){
|
||||
return $this->subtract($x->x, $x->y, $x->z);
|
||||
}else{
|
||||
return new Vector3($this->x - $x, $this->y - $y, $this->z - $z);
|
||||
return new Vector3($this->x - $x, $this->y - $y, $this->z - $z);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -178,9 +178,9 @@ class Vector3{
|
|||
$this->x * $v->y - $this->y * $v->x
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
public static function fromArray($arr){
|
||||
return new Vector3($arr[0], $arr[1], $arr[2]);
|
||||
return new Vector3($arr[0], $arr[1], $arr[2]);
|
||||
}
|
||||
|
||||
public function __toString(){
|
||||
|
|
|
|||
|
|
@ -1,20 +1,20 @@
|
|||
<?php
|
||||
class Vector3Pos extends Vector3
|
||||
{
|
||||
public $x, $y, $z;
|
||||
|
||||
public function __construct(&$x, &$y, &$z){
|
||||
$this->x = &$x;
|
||||
$this->y = &$y;
|
||||
$this->z = &$z;
|
||||
}
|
||||
|
||||
public function addToValues($v){
|
||||
$this->x += $v->x;
|
||||
$this->y += $v->y;
|
||||
$this->z += $v->z;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public $x, $y, $z;
|
||||
|
||||
public function __construct(&$x, &$y, &$z){
|
||||
$this->x = &$x;
|
||||
$this->y = &$y;
|
||||
$this->z = &$z;
|
||||
}
|
||||
|
||||
public function addToValues($v){
|
||||
$this->x += $v->x;
|
||||
$this->y += $v->y;
|
||||
$this->z += $v->z;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue