mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-10-26 05:50:08 +00:00
Fix IntermediateBuffer
This commit is contained in:
1 parent
a18d459343
commit
9685dbbb9d
3 files changed
+6
-5
No files matched your search
+4
-3
@@ -1,5 +1,6 @@
|
|||||||
package com.dfsek.terra.api.structures.script.functions;
|
package com.dfsek.terra.api.structures.script.functions;
|
||||||
|
|
||||||
|
import com.dfsek.terra.api.math.vector.Location;
|
||||||
import com.dfsek.terra.api.math.vector.Vector2;
|
import com.dfsek.terra.api.math.vector.Vector2;
|
||||||
import com.dfsek.terra.api.math.vector.Vector3;
|
import com.dfsek.terra.api.math.vector.Vector3;
|
||||||
import com.dfsek.terra.api.platform.TerraPlugin;
|
import com.dfsek.terra.api.platform.TerraPlugin;
|
||||||
@@ -32,12 +33,12 @@ public class CheckFunction implements Function<String> {
|
|||||||
return "check";
|
return "check";
|
||||||
}
|
}
|
||||||
|
|
||||||
private Vector3 getVector(Buffer buffer, Rotation rotation, int recursions) {
|
private Location getVector(Buffer buffer, Rotation rotation, int recursions) {
|
||||||
Vector2 xz = new Vector2(x.apply(buffer, rotation, recursions).doubleValue(), z.apply(buffer, rotation, recursions).doubleValue());
|
Vector2 xz = new Vector2(x.apply(buffer, rotation, recursions).doubleValue(), z.apply(buffer, rotation, recursions).doubleValue());
|
||||||
|
|
||||||
RotationUtil.rotateVector(xz, rotation);
|
RotationUtil.rotateVector(xz, rotation);
|
||||||
|
|
||||||
return new Vector3(FastMath.roundToInt(xz.getX()), y.apply(buffer, rotation, recursions).intValue(), FastMath.roundToInt(xz.getZ())).add(buffer.getOrigin().toVector());
|
return buffer.getOrigin().clone().add(new Vector3(FastMath.roundToInt(xz.getX()), y.apply(buffer, rotation, recursions).intValue(), FastMath.roundToInt(xz.getZ())));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -45,7 +46,7 @@ public class CheckFunction implements Function<String> {
|
|||||||
return apply(getVector(buffer, rotation, recursions), buffer.getOrigin().getWorld());
|
return apply(getVector(buffer, rotation, recursions), buffer.getOrigin().getWorld());
|
||||||
}
|
}
|
||||||
|
|
||||||
private String apply(Vector3 vector, World world) {
|
private String apply(Location vector, World world) {
|
||||||
if(new LandCheck(world, main).check(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ()))
|
if(new LandCheck(world, main).check(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ()))
|
||||||
return "LAND";
|
return "LAND";
|
||||||
if(new OceanCheck(world, main).check(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ()))
|
if(new OceanCheck(world, main).check(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ()))
|
||||||
|
|||||||
+1
-1
@@ -21,7 +21,7 @@ public class IntermediateBuffer implements Buffer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Location getOrigin() {
|
public Location getOrigin() {
|
||||||
return original.getOrigin().add(offset);
|
return original.getOrigin().clone().add(offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+1
-1
@@ -48,6 +48,6 @@ public class StructureBuffer implements Buffer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Location getOrigin() {
|
public Location getOrigin() {
|
||||||
return origin;
|
return origin.clone();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user