public Location check( final Player player, Location loc, final PlayerLocation from, final PlayerLocation to, final MovingData data, final MovingConfig cc) { // TODO: if (!from.isSameCoords(loc)) {...check passable for loc -> from !?... + sf etc too?} // TODO: Future: Account for the players bounding box? [test very-strict setting for at least // the end points...] String tags = ""; // Block distances (sum, max) for from-to (not for loc!). final int manhattan = from.manhattan(to); // Skip moves inside of ignored blocks right away [works as long as we only check between // foot-locations]. if (manhattan <= 1 && BlockProperties.isPassable(from.getTypeId())) { // TODO: Monitor: BlockProperties.isPassable checks slightly different than before. if (manhattan == 0) { return null; } else { // manhattan == 1 if (BlockProperties.isPassable(to.getTypeId())) { return null; } } } boolean toPassable = to.isPassable(); // General condition check for using ray-tracing. if (toPassable && cc.passableRayTracingCheck && (!cc.passableRayTracingBlockChangeOnly || manhattan > 0)) { rayTracing.set(from, to); rayTracing.loop(); if (rayTracing.collides() || rayTracing.getStepsDone() >= rayTracing.getMaxSteps()) { final int maxBlockDist = manhattan <= 1 ? manhattan : from.maxBlockDist(to); if (maxBlockDist <= 1 && rayTracing.getStepsDone() == 1 && !from.isPassable()) { // Redo ray-tracing for moving out of blocks. if (collidesIgnoreFirst(from, to)) { toPassable = false; tags = "raytracing_2x_"; } else if (data.debug) { NCPAPIProvider.getNoCheatPlusAPI() .getLogManager() .debug( Streams.TRACE_FILE, player.getName() + " passable: allow moving out of a block."); } } else { if (!allowsSplitMove(from, to, manhattan)) { toPassable = false; tags = "raytracing_"; } } } // TODO: Future: If accuracy is demanded, also check the head position (or bounding box right // away). rayTracing.cleanup(); } // TODO: Checking order: If loc is not the same as from, a quick return here might not be // wanted. if (toPassable) { // Quick return. // (Might consider if vl>=1: only decrease if from and loc are passable too, though micro...) data.passableVL *= 0.99; return null; } else { return potentialViolation(player, loc, from, to, manhattan, tags, data, cc); } }