mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-08-29 13:20:32 +00:00
StructureFunction returns boolean based on pass/fail
This commit is contained in:
@@ -92,8 +92,8 @@ public class StructureScript {
|
|||||||
return !block.apply(buffer, rotation, random, 0).equals(Block.ReturnLevel.FAIL);
|
return !block.apply(buffer, rotation, random, 0).equals(Block.ReturnLevel.FAIL);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void executeInBuffer(Buffer buffer, Random random, Rotation rotation, int recursions) {
|
public boolean executeInBuffer(Buffer buffer, Random random, Rotation rotation, int recursions) {
|
||||||
block.apply(buffer, rotation, random, recursions);
|
return !block.apply(buffer, rotation, random, recursions).equals(Block.ReturnLevel.FAIL);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
|
|||||||
+4
-6
@@ -17,7 +17,7 @@ import net.jafama.FastMath;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
public class StructureFunction implements Function<Void> {
|
public class StructureFunction implements Function<Boolean> {
|
||||||
private final ScriptRegistry registry;
|
private final ScriptRegistry registry;
|
||||||
private final Returnable<String> id;
|
private final Returnable<String> id;
|
||||||
private final Returnable<Number> x, y, z;
|
private final Returnable<Number> x, y, z;
|
||||||
@@ -43,11 +43,11 @@ public class StructureFunction implements Function<Void> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ReturnType returnType() {
|
public ReturnType returnType() {
|
||||||
return ReturnType.VOID;
|
return ReturnType.BOOLEAN;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Void apply(Buffer buffer, Rotation rotation, Random random, int recursions) {
|
public Boolean apply(Buffer buffer, Rotation rotation, Random random, int recursions) {
|
||||||
|
|
||||||
Vector2 xz = new Vector2(x.apply(buffer, rotation, random, recursions).doubleValue(), z.apply(buffer, rotation, random, recursions).doubleValue());
|
Vector2 xz = new Vector2(x.apply(buffer, rotation, random, recursions).doubleValue(), z.apply(buffer, rotation, random, recursions).doubleValue());
|
||||||
|
|
||||||
@@ -70,9 +70,7 @@ public class StructureFunction implements Function<Void> {
|
|||||||
|
|
||||||
Vector3 offset = new Vector3(FastMath.roundToInt(xz.getX()), y.apply(buffer, rotation, random, recursions).intValue(), FastMath.roundToInt(xz.getZ()));
|
Vector3 offset = new Vector3(FastMath.roundToInt(xz.getX()), y.apply(buffer, rotation, random, recursions).intValue(), FastMath.roundToInt(xz.getZ()));
|
||||||
|
|
||||||
script.executeInBuffer(new IntermediateBuffer(buffer, offset), random, rotation.rotate(rotation1), recursions + 1);
|
return script.executeInBuffer(new IntermediateBuffer(buffer, offset), random, rotation.rotate(rotation1), recursions + 1);
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user