mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-04-24 00:56:38 +00:00
Reformat
This commit is contained in:
@@ -10,6 +10,7 @@ package com.dfsek.terra.addons.terrascript.script;
|
||||
import com.dfsek.seismic.math.algebra.AlgebraFunctions;
|
||||
import com.dfsek.seismic.math.trigonometry.TrigonometryFunctions;
|
||||
import com.dfsek.seismic.type.Rotation;
|
||||
import com.dfsek.seismic.type.vector.Vector3Int;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -46,7 +47,6 @@ import com.dfsek.terra.api.registry.key.Keyed;
|
||||
import com.dfsek.terra.api.registry.key.RegistryKey;
|
||||
import com.dfsek.terra.api.structure.LootTable;
|
||||
import com.dfsek.terra.api.structure.Structure;
|
||||
import com.dfsek.seismic.type.vector.Vector3Int;
|
||||
import com.dfsek.terra.api.world.WritableWorld;
|
||||
|
||||
|
||||
|
||||
@@ -7,15 +7,15 @@
|
||||
|
||||
package com.dfsek.terra.addons.terrascript.script;
|
||||
|
||||
import com.dfsek.seismic.type.Rotation;
|
||||
import com.dfsek.seismic.type.vector.Vector3;
|
||||
import com.dfsek.seismic.type.vector.Vector3Int;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.random.RandomGenerator;
|
||||
|
||||
import com.dfsek.seismic.type.Rotation;
|
||||
|
||||
import com.dfsek.terra.addons.terrascript.parser.lang.ImplementationArguments;
|
||||
import com.dfsek.seismic.type.vector.Vector3;
|
||||
import com.dfsek.seismic.type.vector.Vector3Int;
|
||||
import com.dfsek.terra.api.world.WritableWorld;
|
||||
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
package com.dfsek.terra.addons.terrascript.script.functions;
|
||||
|
||||
import com.dfsek.seismic.type.vector.Vector2;
|
||||
import com.dfsek.seismic.type.vector.Vector3;
|
||||
|
||||
import com.dfsek.terra.addons.terrascript.parser.lang.ImplementationArguments;
|
||||
import com.dfsek.terra.addons.terrascript.parser.lang.Returnable;
|
||||
@@ -15,7 +16,6 @@ import com.dfsek.terra.addons.terrascript.parser.lang.Scope;
|
||||
import com.dfsek.terra.addons.terrascript.parser.lang.functions.Function;
|
||||
import com.dfsek.terra.addons.terrascript.script.TerraImplementationArguments;
|
||||
import com.dfsek.terra.addons.terrascript.tokenizer.Position;
|
||||
import com.dfsek.seismic.type.vector.Vector3;
|
||||
import com.dfsek.terra.api.world.biome.generation.BiomeProvider;
|
||||
|
||||
|
||||
@@ -37,8 +37,7 @@ public class BiomeFunction implements Function<String> {
|
||||
TerraImplementationArguments arguments = (TerraImplementationArguments) implementationArguments;
|
||||
|
||||
Vector2 xz = Vector2.Mutable.of(x.apply(implementationArguments, scope).doubleValue(),
|
||||
z.apply(implementationArguments, scope).doubleValue()).rotate(arguments.getRotation());
|
||||
|
||||
z.apply(implementationArguments, scope).doubleValue()).rotate(arguments.getRotation());
|
||||
|
||||
|
||||
BiomeProvider grid = arguments.getWorld().getBiomeProvider();
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
package com.dfsek.terra.addons.terrascript.script.functions;
|
||||
|
||||
import com.dfsek.seismic.type.vector.Vector2;
|
||||
import com.dfsek.seismic.type.vector.Vector3;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -22,8 +24,6 @@ import com.dfsek.terra.addons.terrascript.script.TerraImplementationArguments;
|
||||
import com.dfsek.terra.addons.terrascript.tokenizer.Position;
|
||||
import com.dfsek.terra.api.Platform;
|
||||
import com.dfsek.terra.api.block.state.BlockState;
|
||||
import com.dfsek.seismic.type.vector.Vector2;
|
||||
import com.dfsek.seismic.type.vector.Vector3;
|
||||
|
||||
|
||||
public class BlockFunction implements Function<Void> {
|
||||
|
||||
@@ -7,14 +7,15 @@
|
||||
|
||||
package com.dfsek.terra.addons.terrascript.script.functions;
|
||||
|
||||
import com.dfsek.seismic.type.vector.Vector2;
|
||||
import com.dfsek.seismic.type.vector.Vector3;
|
||||
|
||||
import com.dfsek.terra.addons.terrascript.parser.lang.ImplementationArguments;
|
||||
import com.dfsek.terra.addons.terrascript.parser.lang.Returnable;
|
||||
import com.dfsek.terra.addons.terrascript.parser.lang.Scope;
|
||||
import com.dfsek.terra.addons.terrascript.parser.lang.functions.Function;
|
||||
import com.dfsek.terra.addons.terrascript.script.TerraImplementationArguments;
|
||||
import com.dfsek.terra.addons.terrascript.tokenizer.Position;
|
||||
import com.dfsek.seismic.type.vector.Vector2;
|
||||
import com.dfsek.seismic.type.vector.Vector3;
|
||||
|
||||
|
||||
public class CheckBlockFunction implements Function<String> {
|
||||
@@ -34,7 +35,7 @@ public class CheckBlockFunction implements Function<String> {
|
||||
TerraImplementationArguments arguments = (TerraImplementationArguments) implementationArguments;
|
||||
|
||||
Vector2 xz = Vector2.Mutable.of(x.apply(implementationArguments, scope).doubleValue(),
|
||||
z.apply(implementationArguments, scope).doubleValue()).rotate(arguments.getRotation());
|
||||
z.apply(implementationArguments, scope).doubleValue()).rotate(arguments.getRotation());
|
||||
|
||||
|
||||
String data = arguments.getWorld()
|
||||
|
||||
@@ -7,6 +7,9 @@
|
||||
|
||||
package com.dfsek.terra.addons.terrascript.script.functions;
|
||||
|
||||
import com.dfsek.seismic.type.vector.Vector2;
|
||||
import com.dfsek.seismic.type.vector.Vector3;
|
||||
|
||||
import com.dfsek.terra.addons.terrascript.parser.exceptions.ParseException;
|
||||
import com.dfsek.terra.addons.terrascript.parser.lang.ImplementationArguments;
|
||||
import com.dfsek.terra.addons.terrascript.parser.lang.Returnable;
|
||||
@@ -19,8 +22,6 @@ import com.dfsek.terra.api.Platform;
|
||||
import com.dfsek.terra.api.entity.Entity;
|
||||
import com.dfsek.terra.api.entity.EntityType;
|
||||
import com.dfsek.terra.api.event.events.world.generation.EntitySpawnEvent;
|
||||
import com.dfsek.seismic.type.vector.Vector2;
|
||||
import com.dfsek.seismic.type.vector.Vector3;
|
||||
|
||||
|
||||
public class EntityFunction implements Function<Void> {
|
||||
|
||||
@@ -7,14 +7,15 @@
|
||||
|
||||
package com.dfsek.terra.addons.terrascript.script.functions;
|
||||
|
||||
import com.dfsek.seismic.type.vector.Vector2;
|
||||
import com.dfsek.seismic.type.vector.Vector3;
|
||||
|
||||
import com.dfsek.terra.addons.terrascript.parser.lang.ImplementationArguments;
|
||||
import com.dfsek.terra.addons.terrascript.parser.lang.Returnable;
|
||||
import com.dfsek.terra.addons.terrascript.parser.lang.Scope;
|
||||
import com.dfsek.terra.addons.terrascript.parser.lang.functions.Function;
|
||||
import com.dfsek.terra.addons.terrascript.script.TerraImplementationArguments;
|
||||
import com.dfsek.terra.addons.terrascript.tokenizer.Position;
|
||||
import com.dfsek.seismic.type.vector.Vector2;
|
||||
import com.dfsek.seismic.type.vector.Vector3;
|
||||
|
||||
|
||||
public class GetMarkFunction implements Function<String> {
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
package com.dfsek.terra.addons.terrascript.script.functions;
|
||||
|
||||
import com.dfsek.seismic.type.vector.Vector2;
|
||||
import com.dfsek.seismic.type.vector.Vector3;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -27,8 +29,6 @@ import com.dfsek.terra.api.event.events.world.generation.LootPopulateEvent;
|
||||
import com.dfsek.terra.api.registry.Registry;
|
||||
import com.dfsek.terra.api.registry.key.RegistryKey;
|
||||
import com.dfsek.terra.api.structure.LootTable;
|
||||
import com.dfsek.seismic.type.vector.Vector2;
|
||||
import com.dfsek.seismic.type.vector.Vector3;
|
||||
|
||||
|
||||
public class LootFunction implements Function<Void> {
|
||||
@@ -56,7 +56,7 @@ public class LootFunction implements Function<Void> {
|
||||
public Void apply(ImplementationArguments implementationArguments, Scope scope) {
|
||||
TerraImplementationArguments arguments = (TerraImplementationArguments) implementationArguments;
|
||||
Vector2 xz = Vector2.Mutable.of(x.apply(implementationArguments, scope).doubleValue(),
|
||||
z.apply(implementationArguments, scope).doubleValue()).rotate(arguments.getRotation());
|
||||
z.apply(implementationArguments, scope).doubleValue()).rotate(arguments.getRotation());
|
||||
|
||||
|
||||
String id = data.apply(implementationArguments, scope);
|
||||
|
||||
@@ -7,6 +7,9 @@
|
||||
|
||||
package com.dfsek.terra.addons.terrascript.script.functions;
|
||||
|
||||
import com.dfsek.seismic.type.vector.Vector2;
|
||||
import com.dfsek.seismic.type.vector.Vector3;
|
||||
|
||||
import com.dfsek.terra.addons.terrascript.parser.exceptions.ParseException;
|
||||
import com.dfsek.terra.addons.terrascript.parser.lang.ImplementationArguments;
|
||||
import com.dfsek.terra.addons.terrascript.parser.lang.Returnable;
|
||||
@@ -17,8 +20,6 @@ import com.dfsek.terra.addons.terrascript.script.TerraImplementationArguments;
|
||||
import com.dfsek.terra.addons.terrascript.tokenizer.Position;
|
||||
import com.dfsek.terra.api.Platform;
|
||||
import com.dfsek.terra.api.block.state.BlockState;
|
||||
import com.dfsek.seismic.type.vector.Vector2;
|
||||
import com.dfsek.seismic.type.vector.Vector3;
|
||||
|
||||
|
||||
public class PullFunction implements Function<Void> {
|
||||
|
||||
@@ -7,14 +7,15 @@
|
||||
|
||||
package com.dfsek.terra.addons.terrascript.script.functions;
|
||||
|
||||
import com.dfsek.seismic.type.vector.Vector2;
|
||||
import com.dfsek.seismic.type.vector.Vector3;
|
||||
|
||||
import com.dfsek.terra.addons.terrascript.parser.lang.ImplementationArguments;
|
||||
import com.dfsek.terra.addons.terrascript.parser.lang.Returnable;
|
||||
import com.dfsek.terra.addons.terrascript.parser.lang.Scope;
|
||||
import com.dfsek.terra.addons.terrascript.parser.lang.functions.Function;
|
||||
import com.dfsek.terra.addons.terrascript.script.TerraImplementationArguments;
|
||||
import com.dfsek.terra.addons.terrascript.tokenizer.Position;
|
||||
import com.dfsek.seismic.type.vector.Vector2;
|
||||
import com.dfsek.seismic.type.vector.Vector3;
|
||||
|
||||
|
||||
public class SetMarkFunction implements Function<Void> {
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
package com.dfsek.terra.addons.terrascript.script.functions;
|
||||
|
||||
import com.dfsek.seismic.type.vector.Vector2;
|
||||
import com.dfsek.seismic.type.vector.Vector3;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -17,8 +19,6 @@ import com.dfsek.terra.addons.terrascript.parser.lang.functions.Function;
|
||||
import com.dfsek.terra.addons.terrascript.script.TerraImplementationArguments;
|
||||
import com.dfsek.terra.addons.terrascript.tokenizer.Position;
|
||||
import com.dfsek.terra.api.block.entity.BlockEntity;
|
||||
import com.dfsek.seismic.type.vector.Vector2;
|
||||
import com.dfsek.seismic.type.vector.Vector3;
|
||||
|
||||
|
||||
public class StateFunction implements Function<Void> {
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
package com.dfsek.terra.addons.terrascript.script.functions;
|
||||
|
||||
import com.dfsek.seismic.type.Rotation;
|
||||
import com.dfsek.seismic.type.vector.Vector2;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -23,7 +24,6 @@ import com.dfsek.terra.addons.terrascript.tokenizer.Position;
|
||||
import com.dfsek.terra.api.Platform;
|
||||
import com.dfsek.terra.api.registry.Registry;
|
||||
import com.dfsek.terra.api.structure.Structure;
|
||||
import com.dfsek.seismic.type.vector.Vector2;
|
||||
|
||||
|
||||
public class StructureFunction implements Function<Boolean> {
|
||||
|
||||
@@ -1,84 +1,84 @@
|
||||
bool thing1 = 2 > (2+2) || false;
|
||||
bool thing1 = 2 > (2 +2) || false;
|
||||
|
||||
if(2 > 2 || 3 + 4 <= 2 && 4 + 5 > 2 / 3) {
|
||||
if (2 > 2 || 3 +4 <= 2 && 4 +5 > 2 / 3) {
|
||||
test("ok", 2);
|
||||
}
|
||||
|
||||
test("minecraft:green_w" + "ool", (2 * (3+1) * (2 * (1+1))));
|
||||
test("minecraft:green_w" +"ool", (2 * (3 +1) * (2 * (1 +1))));
|
||||
//
|
||||
|
||||
num testVar = 3.4;
|
||||
bool boolean = true;
|
||||
str stringVar = "hello!";
|
||||
|
||||
num precedence = 3 + 2 * 2 + 3;
|
||||
test("precedence: " + precedence, 2);
|
||||
num precedence2 = 3 * 2 + 2 * 3;
|
||||
test("precedence 2: " + precedence2, 2);
|
||||
num precedence = 3 +2 * 2 +3;
|
||||
test("precedence: " +precedence, 2);
|
||||
num precedence2 = 3 * 2 +2 * 3;
|
||||
test("precedence 2: " +precedence2, 2);
|
||||
|
||||
bool iftest = false;
|
||||
|
||||
bool truetest = false;
|
||||
|
||||
num iterator = 0;
|
||||
num thing = 4 - 2-2+2-2+2;
|
||||
test("4 - 2 = " + thing, 2);
|
||||
num thing = 4 -2 -2 +2 -2 +2;
|
||||
test("4 - 2 = " +thing, 2);
|
||||
|
||||
thing = -2;
|
||||
test("-2 = " + thing, 2);
|
||||
test("-2 = " +thing, 2);
|
||||
thing = -thing;
|
||||
test("--2 = " + thing, 2);
|
||||
test("--2 = " +thing, 2);
|
||||
|
||||
|
||||
|
||||
for(num i = 0; i < 5; i = i + 1) {
|
||||
test("i = " + i, iterator);
|
||||
if(i > 1 + 1) {
|
||||
for (num i = 0; i < 5; i = i +1) {
|
||||
test("i = " +i, iterator);
|
||||
if (i > 1 +1) {
|
||||
test("more than 2", iterator);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
for(num i = 0; i < 5; i = i + 1) {
|
||||
test("i = " + i, iterator);
|
||||
for (num i = 0; i < 5; i = i +1) {
|
||||
test("i = " +i, iterator);
|
||||
}
|
||||
|
||||
for(num j = 0; j < 5; j = j + 1) test("single statement j = " + j, iterator);
|
||||
for (num j = 0; j < 5; j = j +1) test("single statement j = " +j, iterator);
|
||||
|
||||
if(4 + 2 == 2 + 4) {
|
||||
test("new thing " + 2, iterator);
|
||||
if (4 +2 == 2 +4) {
|
||||
test("new thing " +2, iterator);
|
||||
}
|
||||
|
||||
while(iterator < 5) {
|
||||
test("always, even after " + 2, iterator);
|
||||
iterator = iterator + 1;
|
||||
if(iterator > 2) {
|
||||
while (iterator < 5) {
|
||||
test("always, even after " +2, iterator);
|
||||
iterator = iterator +1;
|
||||
if (iterator > 2) {
|
||||
continue;
|
||||
}
|
||||
test("not after " + 2, iterator);
|
||||
test("not after " +2, iterator);
|
||||
}
|
||||
|
||||
if(true) test("single statement" + 2, iterator);
|
||||
else if(true) test("another single statement" + 2, iterator);
|
||||
if (true) test("single statement" +2, iterator);
|
||||
else if (true) test("another single statement" +2, iterator);
|
||||
|
||||
if(true) {
|
||||
test("true!" + 2, iterator);
|
||||
if (true) {
|
||||
test("true!" +2, iterator);
|
||||
} else {
|
||||
test("false!" + 2, iterator);
|
||||
}
|
||||
|
||||
if(false) {
|
||||
test("true!" + 2, iterator);
|
||||
} else {
|
||||
test("false!" + 2, iterator);
|
||||
test("false!" +2, iterator);
|
||||
}
|
||||
|
||||
if(false) {
|
||||
test("true again!" + 2, iterator);
|
||||
} else if(true == true) {
|
||||
test("false again!" + 2, iterator);
|
||||
if (false) {
|
||||
test("true!" +2, iterator);
|
||||
} else {
|
||||
test("not logged!" + 2, iterator);
|
||||
test("false!" +2, iterator);
|
||||
}
|
||||
|
||||
if (false) {
|
||||
test("true again!" +2, iterator);
|
||||
} else if (true == true) {
|
||||
test("false again!" +2, iterator);
|
||||
} else {
|
||||
test("not logged!" +2, iterator);
|
||||
}
|
||||
|
||||
|
||||
@@ -87,11 +87,11 @@ if(false) {
|
||||
|
||||
/*
|
||||
fsdfsd
|
||||
*/
|
||||
* /
|
||||
|
||||
test("fdsgdf" + 2, 1 + testVar);
|
||||
|
||||
if(true && !(boolean && false) && true) {
|
||||
num scopedVar = 2;
|
||||
test("if statement" + 2 + stringVar, 1 + testVar + scopedVar);
|
||||
if (true && !(boolean && false) && true) {
|
||||
num scopedVar = 2;
|
||||
test("if statement" + 2 +stringVar, 1 + testVar + scopedVar);
|
||||
}
|
||||
Reference in New Issue
Block a user