use of fr.neatmonster.nocheatplus.utilities.map.FakeBlockCache in project NoCheatPlus by NoCheatPlus.
the class InteractRayTracing method getTestCase.
/**
* Get a directly usable test case (in a closure), for copy and paste to TestInteractRayTracing.
* @param captureMargin
* @param expectCollide
* @return
*/
public String getTestCase(double captureMargin, boolean expectCollide) {
FakeBlockCache recorder = new FakeBlockCache();
recorder.set(this.blockCache, x0, y0, z0, x0 + dX, y0 + dY, z0 + dZ, captureMargin);
StringBuilder builder = new StringBuilder(10000);
// Add everything inside a closure for direct copy and paste.
builder.append('{');
// Set up the block cache.
recorder.toJava(builder, "fbc", "");
// Add the test case code.
builder.append("InteractRayTracing rt = new CenteredInteractRayTracing(false, " + targetX + ", " + targetY + ", " + targetZ + "); rt.setBlockCache(fbc);");
builder.append("TestRayTracing.runCoordinates(rt, new double[]{" + x0 + ", " + y0 + ", " + z0 + ", " + (x0 + dX) + ", " + (y0 + dY) + ", " + (z0 + dZ) + "}, " + expectCollide + ", " + !expectCollide + ", 0.0, false, \"ingame\");");
builder.append("rt.cleanup(); fbc.cleanup();");
builder.append('}');
recorder.cleanup();
return builder.toString();
}
Aggregations