mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 19:49:44 +00:00
arrows test
This commit is contained in:
parent
968f3b9dd2
commit
60be9fb2da
7 changed files with 259 additions and 106 deletions
|
|
@ -82,7 +82,7 @@ class Level{
|
|||
|
||||
return true;
|
||||
}
|
||||
/* TODO neccessary for projectiles
|
||||
// TODO neccessary for projectiles
|
||||
public function rayTraceBlocks(Vector3 $start, Vector3 $end){
|
||||
|
||||
$par3 = false; //TODO move to params?
|
||||
|
|
@ -97,6 +97,8 @@ class Level{
|
|||
|
||||
[$startID, $startMeta] = $this->level->getBlock($xStart, $yStart, $zStart);
|
||||
$block = StaticBlock::getBlock($startID);
|
||||
console("($xStart, $yStart, $zStart): $startID");
|
||||
console("start end: $start $end BEFORE");
|
||||
//$block::updateShape($this, $xStart, $yStart, $zStart); //TODO better way to do it
|
||||
$aabb = $block::getAABB($this, $xStart, $yStart, $zStart);
|
||||
if($startID > 0 && $aabb != null){ //TODO also block::canColideCheck
|
||||
|
|
@ -107,7 +109,6 @@ class Level{
|
|||
for($i = 0; $i <= 200; ++$i){
|
||||
|
||||
if($xStart == $xEnd && $yStart == $yEnd && $zStart == $zEnd){ //also add checks for nan?
|
||||
console("$start $end");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
@ -135,7 +136,6 @@ class Level{
|
|||
if($v40) $v23 = ($v17 - $start->y) / $v29;
|
||||
if($v41) $v25 = ($v19 - $start->z) / $v31;
|
||||
|
||||
$v33 = false;
|
||||
if($v21 < $v23 && $v21 < $v25){
|
||||
$v42 = $xEnd > $xStart ? 4 : 5;
|
||||
|
||||
|
|
@ -151,8 +151,8 @@ class Level{
|
|||
}else{
|
||||
$v42 = $zEnd > $zStart ? 2 : 3;
|
||||
|
||||
$start->x += $v27 * $v23;
|
||||
$start->y += $v29 * $v21;
|
||||
$start->x += $v27 * $v25;
|
||||
$start->y += $v29 * $v25;
|
||||
$start->z = $v19;
|
||||
}
|
||||
|
||||
|
|
@ -167,18 +167,20 @@ class Level{
|
|||
|
||||
[$blockID, $blockMeta] = $this->level->getBlock($xStart, $yStart, $zStart);
|
||||
$block = StaticBlock::getBlock($blockID);
|
||||
|
||||
console("$i($xStart, $yStart, $zStart): $blockID");
|
||||
console("start end: $start $end BEFORE");
|
||||
|
||||
$aabb = $block::getAABB($this, $xStart, $yStart, $zStart);
|
||||
if($startID > 0 && $aabb != null){ //TODO also block::canColideCheck
|
||||
$v38 = $block::clip($this, $xStart, $yStart, $zStart, $start, $end);
|
||||
if($v38 != null) return $v38;
|
||||
}
|
||||
console("start end: $start $end AFTER");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
*/
|
||||
//TODO mayPlace
|
||||
|
||||
public function isLavaInBB($aabb){
|
||||
$minX = floor($aabb->minX);
|
||||
$maxX = floor($aabb->maxX + 1);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue