Code style fix, interface rename, custom item getter

This commit is contained in:
paulevsGitch 2021-07-20 00:10:00 +03:00
parent 179ada3296
commit c6afa74529
134 changed files with 3404 additions and 1244 deletions

View file

@ -2256,21 +2256,48 @@ public class OpenSimplexNoise {
double attn_ext0 = 2 - dx_ext0 * dx_ext0 - dy_ext0 * dy_ext0 - dz_ext0 * dz_ext0 - dw_ext0 * dw_ext0;
if (attn_ext0 > 0) {
attn_ext0 *= attn_ext0;
value += attn_ext0 * attn_ext0 * extrapolate(xsv_ext0, ysv_ext0, zsv_ext0, wsv_ext0, dx_ext0, dy_ext0, dz_ext0, dw_ext0);
value += attn_ext0 * attn_ext0 * extrapolate(
xsv_ext0,
ysv_ext0,
zsv_ext0,
wsv_ext0,
dx_ext0,
dy_ext0,
dz_ext0,
dw_ext0
);
}
// Second extra vertex
double attn_ext1 = 2 - dx_ext1 * dx_ext1 - dy_ext1 * dy_ext1 - dz_ext1 * dz_ext1 - dw_ext1 * dw_ext1;
if (attn_ext1 > 0) {
attn_ext1 *= attn_ext1;
value += attn_ext1 * attn_ext1 * extrapolate(xsv_ext1, ysv_ext1, zsv_ext1, wsv_ext1, dx_ext1, dy_ext1, dz_ext1, dw_ext1);
value += attn_ext1 * attn_ext1 * extrapolate(
xsv_ext1,
ysv_ext1,
zsv_ext1,
wsv_ext1,
dx_ext1,
dy_ext1,
dz_ext1,
dw_ext1
);
}
// Third extra vertex
double attn_ext2 = 2 - dx_ext2 * dx_ext2 - dy_ext2 * dy_ext2 - dz_ext2 * dz_ext2 - dw_ext2 * dw_ext2;
if (attn_ext2 > 0) {
attn_ext2 *= attn_ext2;
value += attn_ext2 * attn_ext2 * extrapolate(xsv_ext2, ysv_ext2, zsv_ext2, wsv_ext2, dx_ext2, dy_ext2, dz_ext2, dw_ext2);
value += attn_ext2 * attn_ext2 * extrapolate(
xsv_ext2,
ysv_ext2,
zsv_ext2,
wsv_ext2,
dx_ext2,
dy_ext2,
dz_ext2,
dw_ext2
);
}
return value / NORM_CONSTANT_4D;
@ -2304,11 +2331,341 @@ public class OpenSimplexNoise {
// vertices of a rhombicuboctahedron from the center, skewed so
// that the triangular and square facets can be inscribed inside
// circles of the same radius.
private static byte[] gradients3D = new byte[] {-11, 4, 4, -4, 11, 4, -4, 4, 11, 11, 4, 4, 4, 11, 4, 4, 4, 11, -11, -4, 4, -4, -11, 4, -4, -4, 11, 11, -4, 4, 4, -11, 4, 4, -4, 11, -11, 4, -4, -4, 11, -4, -4, 4, -11, 11, 4, -4, 4, 11, -4, 4, 4, -11, -11, -4, -4, -4, -11, -4, -4, -4, -11, 11, -4, -4, 4, -11, -4, 4, -4, -11,};
private static byte[] gradients3D = new byte[] {
-11,
4,
4,
-4,
11,
4,
-4,
4,
11,
11,
4,
4,
4,
11,
4,
4,
4,
11,
-11,
-4,
4,
-4,
-11,
4,
-4,
-4,
11,
11,
-4,
4,
4,
-11,
4,
4,
-4,
11,
-11,
4,
-4,
-4,
11,
-4,
-4,
4,
-11,
11,
4,
-4,
4,
11,
-4,
4,
4,
-11,
-11,
-4,
-4,
-4,
-11,
-4,
-4,
-4,
-11,
11,
-4,
-4,
4,
-11,
-4,
4,
-4,
-11,
};
// Gradients for 4D. They approximate the directions to the
// vertices of a disprismatotesseractihexadecachoron from the center,
// skewed so that the tetrahedral and cubic facets can be inscribed inside
// spheres of the same radius.
private static byte[] gradients4D = new byte[] {3, 1, 1, 1, 1, 3, 1, 1, 1, 1, 3, 1, 1, 1, 1, 3, -3, 1, 1, 1, -1, 3, 1, 1, -1, 1, 3, 1, -1, 1, 1, 3, 3, -1, 1, 1, 1, -3, 1, 1, 1, -1, 3, 1, 1, -1, 1, 3, -3, -1, 1, 1, -1, -3, 1, 1, -1, -1, 3, 1, -1, -1, 1, 3, 3, 1, -1, 1, 1, 3, -1, 1, 1, 1, -3, 1, 1, 1, -1, 3, -3, 1, -1, 1, -1, 3, -1, 1, -1, 1, -3, 1, -1, 1, -1, 3, 3, -1, -1, 1, 1, -3, -1, 1, 1, -1, -3, 1, 1, -1, -1, 3, -3, -1, -1, 1, -1, -3, -1, 1, -1, -1, -3, 1, -1, -1, -1, 3, 3, 1, 1, -1, 1, 3, 1, -1, 1, 1, 3, -1, 1, 1, 1, -3, -3, 1, 1, -1, -1, 3, 1, -1, -1, 1, 3, -1, -1, 1, 1, -3, 3, -1, 1, -1, 1, -3, 1, -1, 1, -1, 3, -1, 1, -1, 1, -3, -3, -1, 1, -1, -1, -3, 1, -1, -1, -1, 3, -1, -1, -1, 1, -3, 3, 1, -1, -1, 1, 3, -1, -1, 1, 1, -3, -1, 1, 1, -1, -3, -3, 1, -1, -1, -1, 3, -1, -1, -1, 1, -3, -1, -1, 1, -1, -3, 3, -1, -1, -1, 1, -3, -1, -1, 1, -1, -3, -1, 1, -1, -1, -3, -3, -1, -1, -1, -1, -3, -1, -1, -1, -1, -3, -1, -1, -1, -1, -3,};
private static byte[] gradients4D = new byte[] {
3,
1,
1,
1,
1,
3,
1,
1,
1,
1,
3,
1,
1,
1,
1,
3,
-3,
1,
1,
1,
-1,
3,
1,
1,
-1,
1,
3,
1,
-1,
1,
1,
3,
3,
-1,
1,
1,
1,
-3,
1,
1,
1,
-1,
3,
1,
1,
-1,
1,
3,
-3,
-1,
1,
1,
-1,
-3,
1,
1,
-1,
-1,
3,
1,
-1,
-1,
1,
3,
3,
1,
-1,
1,
1,
3,
-1,
1,
1,
1,
-3,
1,
1,
1,
-1,
3,
-3,
1,
-1,
1,
-1,
3,
-1,
1,
-1,
1,
-3,
1,
-1,
1,
-1,
3,
3,
-1,
-1,
1,
1,
-3,
-1,
1,
1,
-1,
-3,
1,
1,
-1,
-1,
3,
-3,
-1,
-1,
1,
-1,
-3,
-1,
1,
-1,
-1,
-3,
1,
-1,
-1,
-1,
3,
3,
1,
1,
-1,
1,
3,
1,
-1,
1,
1,
3,
-1,
1,
1,
1,
-3,
-3,
1,
1,
-1,
-1,
3,
1,
-1,
-1,
1,
3,
-1,
-1,
1,
1,
-3,
3,
-1,
1,
-1,
1,
-3,
1,
-1,
1,
-1,
3,
-1,
1,
-1,
1,
-3,
-3,
-1,
1,
-1,
-1,
-3,
1,
-1,
-1,
-1,
3,
-1,
-1,
-1,
1,
-3,
3,
1,
-1,
-1,
1,
3,
-1,
-1,
1,
1,
-3,
-1,
1,
1,
-1,
-3,
-3,
1,
-1,
-1,
-1,
3,
-1,
-1,
-1,
1,
-3,
-1,
-1,
1,
-1,
-3,
3,
-1,
-1,
-1,
1,
-3,
-1,
-1,
1,
-1,
-3,
-1,
1,
-1,
-1,
-3,
-3,
-1,
-1,
-1,
-1,
-3,
-1,
-1,
-1,
-1,
-3,
-1,
-1,
-1,
-1,
-3,
};
}

View file

@ -133,8 +133,16 @@ public class VoronoiNoise {
}
}
BlockPos p1 = new BlockPos((ix + (double) selX) * scale, (iy + (double) selY) * scale, (iz + (double) selZ) * scale);
BlockPos p2 = new BlockPos((ix + (double) selXPre) * scale, (iy + (double) selYPre) * scale, (iz + (double) selZPre) * scale);
BlockPos p1 = new BlockPos(
(ix + (double) selX) * scale,
(iy + (double) selY) * scale,
(iz + (double) selZ) * scale
);
BlockPos p2 = new BlockPos(
(ix + (double) selXPre) * scale,
(iy + (double) selYPre) * scale,
(iz + (double) selZPre) * scale
);
return new BlockPos[] {p1, p2};
}
}