make raytracer collide with unknown chunks

This commit is contained in:
Babbaj 2023-08-15 01:14:53 -04:00
parent 535eccfc24
commit b1be4f29ad
No known key found for this signature in database
GPG Key ID: F044309848A07CAC
2 changed files with 8 additions and 8 deletions

View File

@ -175,8 +175,8 @@ dependencies {
transitive = false transitive = false
} }
launchAnnotationProcessor 'org.spongepowered:mixin:0.8.4-SNAPSHOT:processor' launchAnnotationProcessor 'org.spongepowered:mixin:0.8.4-SNAPSHOT:processor'
launchImplementation('dev.babbaj:nether-pathfinder:1.2') launchImplementation('dev.babbaj:nether-pathfinder:1.3.0')
implementation 'dev.babbaj:nether-pathfinder:1.2' implementation 'dev.babbaj:nether-pathfinder:1.3.0'
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.12'
} }

View File

@ -129,7 +129,7 @@ public final class NetherPathfinderContext {
*/ */
public boolean raytrace(final double startX, final double startY, final double startZ, public boolean raytrace(final double startX, final double startY, final double startZ,
final double endX, final double endY, final double endZ) { final double endX, final double endY, final double endZ) {
return NetherPathfinder.isVisible(this.context, true, startX, startY, startZ, endX, endY, endZ); return NetherPathfinder.isVisible(this.context, NetherPathfinder.CACHE_MISS_SOLID, startX, startY, startZ, endX, endY, endZ);
} }
/** /**
@ -141,24 +141,24 @@ public final class NetherPathfinderContext {
* @return {@code true} if there is visibility between the points * @return {@code true} if there is visibility between the points
*/ */
public boolean raytrace(final Vec3d start, final Vec3d end) { public boolean raytrace(final Vec3d start, final Vec3d end) {
return NetherPathfinder.isVisible(this.context, true, start.x, start.y, start.z, end.x, end.y, end.z); return NetherPathfinder.isVisible(this.context, NetherPathfinder.CACHE_MISS_SOLID, start.x, start.y, start.z, end.x, end.y, end.z);
} }
public boolean raytrace(final int count, final double[] src, final double[] dst, final int visibility) { public boolean raytrace(final int count, final double[] src, final double[] dst, final int visibility) {
switch (visibility) { switch (visibility) {
case Visibility.ALL: case Visibility.ALL:
return NetherPathfinder.isVisibleMulti(this.context, true, count, src, dst, false) == -1; return NetherPathfinder.isVisibleMulti(this.context, NetherPathfinder.CACHE_MISS_SOLID, count, src, dst, false) == -1;
case Visibility.NONE: case Visibility.NONE:
return NetherPathfinder.isVisibleMulti(this.context, true, count, src, dst, true) == -1; return NetherPathfinder.isVisibleMulti(this.context, NetherPathfinder.CACHE_MISS_SOLID, count, src, dst, true) == -1;
case Visibility.ANY: case Visibility.ANY:
return NetherPathfinder.isVisibleMulti(this.context, true, count, src, dst, true) != -1; return NetherPathfinder.isVisibleMulti(this.context, NetherPathfinder.CACHE_MISS_SOLID, count, src, dst, true) != -1;
default: default:
throw new IllegalArgumentException("lol"); throw new IllegalArgumentException("lol");
} }
} }
public void raytrace(final int count, final double[] src, final double[] dst, final boolean[] hitsOut, final double[] hitPosOut) { public void raytrace(final int count, final double[] src, final double[] dst, final boolean[] hitsOut, final double[] hitPosOut) {
NetherPathfinder.raytrace(this.context, true, count, src, dst, hitsOut, hitPosOut); NetherPathfinder.raytrace(this.context, NetherPathfinder.CACHE_MISS_SOLID, count, src, dst, hitsOut, hitPosOut);
} }
public void cancel() { public void cancel() {