mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-04-14 19:56:19 +00:00
make vector2 immutable by default
This commit is contained in:
@@ -41,10 +41,9 @@ public class BiomeFunction implements Function<String> {
|
||||
public String apply(ImplementationArguments implementationArguments, Map<String, Variable<?>> variableMap) {
|
||||
TerraImplementationArguments arguments = (TerraImplementationArguments) implementationArguments;
|
||||
|
||||
Vector2 xz = Vector2.of(x.apply(implementationArguments, variableMap).doubleValue(),
|
||||
z.apply(implementationArguments, variableMap).doubleValue());
|
||||
Vector2 xz = RotationUtil.rotateVector(Vector2.of(x.apply(implementationArguments, variableMap).doubleValue(),
|
||||
z.apply(implementationArguments, variableMap).doubleValue()), arguments.getRotation());
|
||||
|
||||
RotationUtil.rotateVector(xz, arguments.getRotation());
|
||||
|
||||
BiomeProvider grid = arguments.getWorld().getBiomeProvider();
|
||||
|
||||
|
||||
@@ -71,11 +71,10 @@ public class BlockFunction implements Function<Void> {
|
||||
|
||||
void setBlock(ImplementationArguments implementationArguments, Map<String, Variable<?>> variableMap,
|
||||
TerraImplementationArguments arguments, BlockState rot) {
|
||||
Vector2 xz = Vector2.of(x.apply(implementationArguments, variableMap).doubleValue(),
|
||||
z.apply(implementationArguments, variableMap).doubleValue());
|
||||
|
||||
RotationUtil.rotateVector(xz, arguments.getRotation());
|
||||
|
||||
Vector2 xz = RotationUtil.rotateVector(Vector2.of(x.apply(implementationArguments, variableMap).doubleValue(),
|
||||
z.apply(implementationArguments, variableMap).doubleValue()), arguments.getRotation());
|
||||
|
||||
|
||||
RotationUtil.rotateBlockData(rot, arguments.getRotation().inverse());
|
||||
try {
|
||||
Vector3 set = Vector3.of(FastMath.roundToInt(xz.getX()),
|
||||
|
||||
@@ -37,12 +37,11 @@ public class CheckBlockFunction implements Function<String> {
|
||||
@Override
|
||||
public String apply(ImplementationArguments implementationArguments, Map<String, Variable<?>> variableMap) {
|
||||
TerraImplementationArguments arguments = (TerraImplementationArguments) implementationArguments;
|
||||
|
||||
Vector2 xz = Vector2.of(x.apply(implementationArguments, variableMap).doubleValue(),
|
||||
z.apply(implementationArguments, variableMap).doubleValue());
|
||||
|
||||
RotationUtil.rotateVector(xz, arguments.getRotation());
|
||||
|
||||
|
||||
Vector2 xz = RotationUtil.rotateVector(Vector2.of(x.apply(implementationArguments, variableMap).doubleValue(),
|
||||
z.apply(implementationArguments, variableMap).doubleValue()), arguments.getRotation());
|
||||
|
||||
|
||||
String data = arguments.getWorld()
|
||||
.getBlockState(arguments.getOrigin()
|
||||
.toVector3()
|
||||
|
||||
@@ -47,10 +47,9 @@ public class EntityFunction implements Function<Void> {
|
||||
@Override
|
||||
public Void apply(ImplementationArguments implementationArguments, Map<String, Variable<?>> variableMap) {
|
||||
TerraImplementationArguments arguments = (TerraImplementationArguments) implementationArguments;
|
||||
Vector2 xz = Vector2.of(x.apply(implementationArguments, variableMap).doubleValue(),
|
||||
z.apply(implementationArguments, variableMap).doubleValue());
|
||||
|
||||
RotationUtil.rotateVector(xz, arguments.getRotation());
|
||||
Vector2 xz = RotationUtil.rotateVector(Vector2.of(x.apply(implementationArguments, variableMap).doubleValue(),
|
||||
z.apply(implementationArguments, variableMap).doubleValue()), arguments.getRotation());
|
||||
|
||||
Entity entity = arguments.getWorld().spawnEntity(Vector3.of(xz.getX(), y.apply(implementationArguments, variableMap).doubleValue(), xz.getZ()).add(arguments.getOrigin()).add(0.5, 0, 0.5), data);
|
||||
platform.getEventManager().callEvent(new EntitySpawnEvent(entity.world().getPack(), entity));
|
||||
return null;
|
||||
|
||||
@@ -36,10 +36,9 @@ public class GetMarkFunction implements Function<String> {
|
||||
@Override
|
||||
public String apply(ImplementationArguments implementationArguments, Map<String, Variable<?>> variableMap) {
|
||||
TerraImplementationArguments arguments = (TerraImplementationArguments) implementationArguments;
|
||||
Vector2 xz = Vector2.of(x.apply(implementationArguments, variableMap).doubleValue(),
|
||||
z.apply(implementationArguments, variableMap).doubleValue());
|
||||
|
||||
RotationUtil.rotateVector(xz, arguments.getRotation());
|
||||
Vector2 xz = RotationUtil.rotateVector(Vector2.of(x.apply(implementationArguments, variableMap).doubleValue(),
|
||||
z.apply(implementationArguments, variableMap).doubleValue()), arguments.getRotation());
|
||||
|
||||
String mark = arguments.getMark(Vector3.of(FastMath.floorToInt(xz.getX()), FastMath.floorToInt(
|
||||
y.apply(implementationArguments, variableMap).doubleValue()), FastMath.floorToInt(xz.getZ())).add(arguments.getOrigin()));
|
||||
return mark == null ? "" : mark;
|
||||
|
||||
@@ -58,11 +58,10 @@ public class LootFunction implements Function<Void> {
|
||||
@Override
|
||||
public Void apply(ImplementationArguments implementationArguments, Map<String, Variable<?>> variableMap) {
|
||||
TerraImplementationArguments arguments = (TerraImplementationArguments) implementationArguments;
|
||||
Vector2 xz = Vector2.of(x.apply(implementationArguments, variableMap).doubleValue(),
|
||||
z.apply(implementationArguments, variableMap).doubleValue());
|
||||
|
||||
RotationUtil.rotateVector(xz, arguments.getRotation());
|
||||
|
||||
Vector2 xz = RotationUtil.rotateVector(Vector2.of(x.apply(implementationArguments, variableMap).doubleValue(),
|
||||
z.apply(implementationArguments, variableMap).doubleValue()), arguments.getRotation());
|
||||
|
||||
|
||||
String id = data.apply(implementationArguments, variableMap);
|
||||
|
||||
|
||||
|
||||
@@ -45,10 +45,9 @@ public class PullFunction implements Function<Void> {
|
||||
@Override
|
||||
public Void apply(ImplementationArguments implementationArguments, Map<String, Variable<?>> variableMap) {
|
||||
TerraImplementationArguments arguments = (TerraImplementationArguments) implementationArguments;
|
||||
Vector2 xz = Vector2.of(x.apply(implementationArguments, variableMap).doubleValue(),
|
||||
z.apply(implementationArguments, variableMap).doubleValue());
|
||||
|
||||
RotationUtil.rotateVector(xz, arguments.getRotation());
|
||||
Vector2 xz = RotationUtil.rotateVector(Vector2.of(x.apply(implementationArguments, variableMap).doubleValue(),
|
||||
z.apply(implementationArguments, variableMap).doubleValue()), arguments.getRotation());
|
||||
|
||||
BlockState rot = data.clone();
|
||||
RotationUtil.rotateBlockData(rot, arguments.getRotation().inverse());
|
||||
|
||||
|
||||
@@ -38,11 +38,10 @@ public class SetMarkFunction implements Function<Void> {
|
||||
@Override
|
||||
public Void apply(ImplementationArguments implementationArguments, Map<String, Variable<?>> variableMap) {
|
||||
TerraImplementationArguments arguments = (TerraImplementationArguments) implementationArguments;
|
||||
Vector2 xz = Vector2.of(x.apply(implementationArguments, variableMap).doubleValue(),
|
||||
z.apply(implementationArguments, variableMap).doubleValue());
|
||||
|
||||
RotationUtil.rotateVector(xz, arguments.getRotation());
|
||||
|
||||
Vector2 xz = RotationUtil.rotateVector(Vector2.of(x.apply(implementationArguments, variableMap).doubleValue(),
|
||||
z.apply(implementationArguments, variableMap).doubleValue()), arguments.getRotation());
|
||||
|
||||
|
||||
arguments.setMark(Vector3.of(FastMath.floorToInt(xz.getX()),
|
||||
FastMath.floorToInt(
|
||||
y.apply(implementationArguments, variableMap).doubleValue()),
|
||||
|
||||
@@ -45,10 +45,10 @@ public class StateFunction implements Function<Void> {
|
||||
@Override
|
||||
public Void apply(ImplementationArguments implementationArguments, Map<String, Variable<?>> variableMap) {
|
||||
TerraImplementationArguments arguments = (TerraImplementationArguments) implementationArguments;
|
||||
Vector2 xz = Vector2.of(x.apply(implementationArguments, variableMap).doubleValue(),
|
||||
z.apply(implementationArguments, variableMap).doubleValue());
|
||||
RotationUtil.rotateVector(xz, arguments.getRotation());
|
||||
|
||||
Vector2 xz = RotationUtil.rotateVector(Vector2.of(x.apply(implementationArguments, variableMap).doubleValue(),
|
||||
z.apply(implementationArguments, variableMap).doubleValue()), arguments.getRotation());
|
||||
|
||||
|
||||
Vector3 origin = Vector3.of(FastMath.roundToInt(xz.getX()), y.apply(implementationArguments, variableMap).intValue(),
|
||||
FastMath.roundToInt(xz.getZ())).add(arguments.getOrigin());
|
||||
try {
|
||||
|
||||
@@ -62,12 +62,11 @@ public class StructureFunction implements Function<Boolean> {
|
||||
|
||||
if(arguments.getRecursions() > platform.getTerraConfig().getMaxRecursion())
|
||||
throw new RuntimeException("Structure recursion too deep: " + arguments.getRecursions());
|
||||
|
||||
Vector2 xz = Vector2.of(x.apply(implementationArguments, variableMap).doubleValue(),
|
||||
z.apply(implementationArguments, variableMap).doubleValue());
|
||||
|
||||
RotationUtil.rotateVector(xz, arguments.getRotation());
|
||||
|
||||
|
||||
Vector2 xz = RotationUtil.rotateVector(Vector2.of(x.apply(implementationArguments, variableMap).doubleValue(),
|
||||
z.apply(implementationArguments, variableMap).doubleValue()), arguments.getRotation());
|
||||
|
||||
|
||||
String app = id.apply(implementationArguments, variableMap);
|
||||
return registry.get(app).map(script -> {
|
||||
Rotation rotation1;
|
||||
|
||||
Reference in New Issue
Block a user