mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-04-23 16:49:10 +00:00
sub structures use pos as origin
This commit is contained in:
@@ -7,6 +7,8 @@
|
|||||||
|
|
||||||
package com.dfsek.terra.addons.terrascript.script.functions;
|
package com.dfsek.terra.addons.terrascript.script.functions;
|
||||||
|
|
||||||
|
import com.dfsek.terra.api.util.vector.Vector3Int;
|
||||||
|
|
||||||
import net.jafama.FastMath;
|
import net.jafama.FastMath;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -66,20 +68,24 @@ public class StructureFunction implements Function<Boolean> {
|
|||||||
|
|
||||||
|
|
||||||
String app = id.apply(implementationArguments, scope);
|
String app = id.apply(implementationArguments, scope);
|
||||||
|
int xValue = FastMath.roundToInt(xz.getX());
|
||||||
|
int yValue = y.apply(implementationArguments, scope).intValue();
|
||||||
|
int zValue = FastMath.roundToInt(xz.getZ());
|
||||||
|
Vector3Int origin = Vector3Int.of(xValue, yValue, zValue);
|
||||||
return registry.getByID(app).map(script -> {
|
return registry.getByID(app).map(script -> {
|
||||||
if(script instanceof StructureScript structureScript) {
|
if(script instanceof StructureScript structureScript) {
|
||||||
return structureScript.generate(arguments.getOrigin(),
|
return structureScript.generate(origin,
|
||||||
arguments.getWorld()
|
arguments.getWorld()
|
||||||
.buffer(FastMath.roundToInt(xz.getX()),
|
.buffer(xValue,
|
||||||
y.apply(implementationArguments, scope).intValue(),
|
yValue,
|
||||||
FastMath.roundToInt(xz.getZ())),
|
zValue),
|
||||||
arguments.getRotation(), arguments.getRecursions() + 1);
|
arguments.getRotation(), arguments.getRecursions() + 1);
|
||||||
}
|
}
|
||||||
return script.generate(arguments.getOrigin(),
|
return script.generate(arguments.getOrigin(),
|
||||||
arguments.getWorld()
|
arguments.getWorld()
|
||||||
.buffer(FastMath.roundToInt(xz.getX()),
|
.buffer(xValue,
|
||||||
y.apply(implementationArguments, scope).intValue(),
|
yValue,
|
||||||
FastMath.roundToInt(xz.getZ())),
|
zValue),
|
||||||
arguments.getRotation());
|
arguments.getRotation());
|
||||||
}).orElseGet(() -> {
|
}).orElseGet(() -> {
|
||||||
LOGGER.error("No such structure {}", app);
|
LOGGER.error("No such structure {}", app);
|
||||||
|
|||||||
Reference in New Issue
Block a user