mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 01:37:37 +00:00
Correctly use getNearestSurfaceTerrainBlock in SurfaceSpline and SchemGen (#1616)
Fixes #1609
This commit is contained in:
parent
3f28a5759d
commit
f7a0c14a1b
@ -72,8 +72,8 @@ public class SurfaceSpline implements Brush {
|
|||||||
final int tipx = MathMan.roundInt(tipv.getX());
|
final int tipx = MathMan.roundInt(tipv.getX());
|
||||||
final int tipz = (int) tipv.getZ();
|
final int tipz = (int) tipv.getZ();
|
||||||
int tipy = MathMan.roundInt(tipv.getY());
|
int tipy = MathMan.roundInt(tipv.getY());
|
||||||
tipy = editSession.getNearestSurfaceTerrainBlock(tipx, tipz, tipy, minY, maxY);
|
tipy = editSession.getNearestSurfaceTerrainBlock(tipx, tipz, tipy, minY, maxY, Integer.MIN_VALUE, Integer.MAX_VALUE);
|
||||||
if (tipy == -1) {
|
if (tipy == Integer.MIN_VALUE || tipy == Integer.MAX_VALUE) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (radius == 0) {
|
if (radius == 0) {
|
||||||
@ -93,8 +93,16 @@ public class SurfaceSpline implements Brush {
|
|||||||
for (int loopx = tipx - ceilrad; loopx <= tipx + ceilrad; loopx++) {
|
for (int loopx = tipx - ceilrad; loopx <= tipx + ceilrad; loopx++) {
|
||||||
for (int loopz = tipz - ceilrad; loopz <= tipz + ceilrad; loopz++) {
|
for (int loopz = tipz - ceilrad; loopz <= tipz + ceilrad; loopz++) {
|
||||||
if (MathMan.hypot2(loopx - tipx, 0, loopz - tipz) <= radius2) {
|
if (MathMan.hypot2(loopx - tipx, 0, loopz - tipz) <= radius2) {
|
||||||
int y = editSession.getNearestSurfaceTerrainBlock(loopx, loopz, v.getBlockY(), 0, maxY);
|
int y = editSession.getNearestSurfaceTerrainBlock(
|
||||||
if (y == -1) {
|
loopx,
|
||||||
|
loopz,
|
||||||
|
v.getBlockY(),
|
||||||
|
minY,
|
||||||
|
maxY,
|
||||||
|
Integer.MIN_VALUE,
|
||||||
|
Integer.MAX_VALUE
|
||||||
|
);
|
||||||
|
if (y == Integer.MIN_VALUE || y == Integer.MAX_VALUE) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
newSet.add(loopx, y, loopz);
|
newSet.add(loopx, y, loopz);
|
||||||
|
@ -33,8 +33,16 @@ public class SchemGen implements Resource {
|
|||||||
public boolean spawn(Random random, int x, int z) throws WorldEditException {
|
public boolean spawn(Random random, int x, int z) throws WorldEditException {
|
||||||
mutable.mutX(x);
|
mutable.mutX(x);
|
||||||
mutable.mutZ(z);
|
mutable.mutZ(z);
|
||||||
int y = extent.getNearestSurfaceTerrainBlock(x, z, mutable.getBlockY(), this.extent.getMinY(), this.extent.getMaxY());
|
int y = extent.getNearestSurfaceTerrainBlock(
|
||||||
if (y == -1) {
|
x,
|
||||||
|
z,
|
||||||
|
mutable.getBlockY(),
|
||||||
|
this.extent.getMinY(),
|
||||||
|
this.extent.getMaxY(),
|
||||||
|
Integer.MIN_VALUE,
|
||||||
|
Integer.MAX_VALUE
|
||||||
|
);
|
||||||
|
if (y == Integer.MIN_VALUE || y == Integer.MAX_VALUE) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
mutable.mutY(y);
|
mutable.mutY(y);
|
||||||
|
Loading…
Reference in New Issue
Block a user