private double calcCameraDistance(double startingDistance) {
final SelfDestruct selfDestruct = Expensive.getInstance().getFunctionRegistry().getSelfDestruct();
if (selfDestruct.unhooked) {
for (int i = 0; i < 8; ++i) {
float f = (float) ((i & 1) * 2 - 1);
float f1 = (float) ((i >> 1 & 1) * 2 - 1);
float f2 = (float) ((i >> 2 & 1) * 2 - 1);
f = f * 0.1F;
f1 = f1 * 0.1F;
f2 = f2 * 0.1F;
Vector3d vector3d = this.pos.add((double) f, (double) f1, (double) f2);
Vector3d vector3d1 = new Vector3d(
this.pos.x - (double) this.look.getX() * startingDistance + (double) f + (double) f2,
this.pos.y - (double) this.look.getY() * startingDistance + (double) f1,
this.pos.z - (double) this.look.getZ() * startingDistance + (double) f2);
RayTraceResult raytraceresult = this.world.rayTraceBlocks(new RayTraceContext(vector3d, vector3d1,
RayTraceContext.BlockMode.VISUAL, RayTraceContext.FluidMode.NONE, this.renderViewEntity));
if (raytraceresult.getType() != RayTraceResult.Type.MISS) {
double d0 = raytraceresult.getHitVec().distanceTo(this.pos);
if (d0 < startingDistance) {
startingDistance = d0;
}
}
}
}
return startingDistance;
}