mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-06-17 14:21:08 +00:00
make Vector2 constructor private
This commit is contained in:
+1
-1
@@ -39,7 +39,7 @@ public class BiomePipeline {
|
|||||||
* @return BiomeHolder containing biomes.
|
* @return BiomeHolder containing biomes.
|
||||||
*/
|
*/
|
||||||
public BiomeHolder getBiomes(int x, int z, long seed) {
|
public BiomeHolder getBiomes(int x, int z, long seed) {
|
||||||
BiomeHolder holder = new BiomeHolderImpl(init, new Vector2(x * (init - 1), z * (init - 1)));
|
BiomeHolder holder = new BiomeHolderImpl(init, Vector2.of(x * (init - 1), z * (init - 1)));
|
||||||
holder.fill(source, seed);
|
holder.fill(source, seed);
|
||||||
for(Stage stage : stages) holder = stage.apply(holder, seed);
|
for(Stage stage : stages) holder = stage.apply(holder, seed);
|
||||||
return holder;
|
return holder;
|
||||||
|
|||||||
+1
-1
@@ -26,7 +26,7 @@ public class BiomeFunctionBuilder implements FunctionBuilder<BiomeFunction> {
|
|||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public BiomeFunction build(List<Returnable<?>> argumentList, Position position) {
|
public BiomeFunction build(List<Returnable<?>> argumentList, Position position) {
|
||||||
return new BiomeFunction(platform, (Returnable<Number>) argumentList.get(0), (Returnable<Number>) argumentList.get(1),
|
return new BiomeFunction((Returnable<Number>) argumentList.get(0), (Returnable<Number>) argumentList.get(1),
|
||||||
(Returnable<Number>) argumentList.get(2), position);
|
(Returnable<Number>) argumentList.get(2), position);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-4
@@ -25,13 +25,11 @@ import com.dfsek.terra.api.world.biome.generation.BiomeProvider;
|
|||||||
|
|
||||||
|
|
||||||
public class BiomeFunction implements Function<String> {
|
public class BiomeFunction implements Function<String> {
|
||||||
private final Platform platform;
|
|
||||||
private final Returnable<Number> x, y, z;
|
private final Returnable<Number> x, y, z;
|
||||||
private final Position position;
|
private final Position position;
|
||||||
|
|
||||||
|
|
||||||
public BiomeFunction(Platform platform, Returnable<Number> x, Returnable<Number> y, Returnable<Number> z, Position position) {
|
public BiomeFunction(Returnable<Number> x, Returnable<Number> y, Returnable<Number> z, Position position) {
|
||||||
this.platform = platform;
|
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.y = y;
|
this.y = y;
|
||||||
this.z = z;
|
this.z = z;
|
||||||
@@ -43,7 +41,7 @@ public class BiomeFunction implements Function<String> {
|
|||||||
public String apply(ImplementationArguments implementationArguments, Map<String, Variable<?>> variableMap) {
|
public String apply(ImplementationArguments implementationArguments, Map<String, Variable<?>> variableMap) {
|
||||||
TerraImplementationArguments arguments = (TerraImplementationArguments) implementationArguments;
|
TerraImplementationArguments arguments = (TerraImplementationArguments) implementationArguments;
|
||||||
|
|
||||||
Vector2 xz = new Vector2(x.apply(implementationArguments, variableMap).doubleValue(),
|
Vector2 xz = Vector2.of(x.apply(implementationArguments, variableMap).doubleValue(),
|
||||||
z.apply(implementationArguments, variableMap).doubleValue());
|
z.apply(implementationArguments, variableMap).doubleValue());
|
||||||
|
|
||||||
RotationUtil.rotateVector(xz, arguments.getRotation());
|
RotationUtil.rotateVector(xz, arguments.getRotation());
|
||||||
|
|||||||
+1
-1
@@ -71,7 +71,7 @@ public class BlockFunction implements Function<Void> {
|
|||||||
|
|
||||||
void setBlock(ImplementationArguments implementationArguments, Map<String, Variable<?>> variableMap,
|
void setBlock(ImplementationArguments implementationArguments, Map<String, Variable<?>> variableMap,
|
||||||
TerraImplementationArguments arguments, BlockState rot) {
|
TerraImplementationArguments arguments, BlockState rot) {
|
||||||
Vector2 xz = new Vector2(x.apply(implementationArguments, variableMap).doubleValue(),
|
Vector2 xz = Vector2.of(x.apply(implementationArguments, variableMap).doubleValue(),
|
||||||
z.apply(implementationArguments, variableMap).doubleValue());
|
z.apply(implementationArguments, variableMap).doubleValue());
|
||||||
|
|
||||||
RotationUtil.rotateVector(xz, arguments.getRotation());
|
RotationUtil.rotateVector(xz, arguments.getRotation());
|
||||||
|
|||||||
+1
-1
@@ -38,7 +38,7 @@ public class CheckBlockFunction implements Function<String> {
|
|||||||
public String apply(ImplementationArguments implementationArguments, Map<String, Variable<?>> variableMap) {
|
public String apply(ImplementationArguments implementationArguments, Map<String, Variable<?>> variableMap) {
|
||||||
TerraImplementationArguments arguments = (TerraImplementationArguments) implementationArguments;
|
TerraImplementationArguments arguments = (TerraImplementationArguments) implementationArguments;
|
||||||
|
|
||||||
Vector2 xz = new Vector2(x.apply(implementationArguments, variableMap).doubleValue(),
|
Vector2 xz = Vector2.of(x.apply(implementationArguments, variableMap).doubleValue(),
|
||||||
z.apply(implementationArguments, variableMap).doubleValue());
|
z.apply(implementationArguments, variableMap).doubleValue());
|
||||||
|
|
||||||
RotationUtil.rotateVector(xz, arguments.getRotation());
|
RotationUtil.rotateVector(xz, arguments.getRotation());
|
||||||
|
|||||||
+1
-1
@@ -47,7 +47,7 @@ public class EntityFunction implements Function<Void> {
|
|||||||
@Override
|
@Override
|
||||||
public Void apply(ImplementationArguments implementationArguments, Map<String, Variable<?>> variableMap) {
|
public Void apply(ImplementationArguments implementationArguments, Map<String, Variable<?>> variableMap) {
|
||||||
TerraImplementationArguments arguments = (TerraImplementationArguments) implementationArguments;
|
TerraImplementationArguments arguments = (TerraImplementationArguments) implementationArguments;
|
||||||
Vector2 xz = new Vector2(x.apply(implementationArguments, variableMap).doubleValue(),
|
Vector2 xz = Vector2.of(x.apply(implementationArguments, variableMap).doubleValue(),
|
||||||
z.apply(implementationArguments, variableMap).doubleValue());
|
z.apply(implementationArguments, variableMap).doubleValue());
|
||||||
|
|
||||||
RotationUtil.rotateVector(xz, arguments.getRotation());
|
RotationUtil.rotateVector(xz, arguments.getRotation());
|
||||||
|
|||||||
+1
-1
@@ -36,7 +36,7 @@ public class GetMarkFunction implements Function<String> {
|
|||||||
@Override
|
@Override
|
||||||
public String apply(ImplementationArguments implementationArguments, Map<String, Variable<?>> variableMap) {
|
public String apply(ImplementationArguments implementationArguments, Map<String, Variable<?>> variableMap) {
|
||||||
TerraImplementationArguments arguments = (TerraImplementationArguments) implementationArguments;
|
TerraImplementationArguments arguments = (TerraImplementationArguments) implementationArguments;
|
||||||
Vector2 xz = new Vector2(x.apply(implementationArguments, variableMap).doubleValue(),
|
Vector2 xz = Vector2.of(x.apply(implementationArguments, variableMap).doubleValue(),
|
||||||
z.apply(implementationArguments, variableMap).doubleValue());
|
z.apply(implementationArguments, variableMap).doubleValue());
|
||||||
|
|
||||||
RotationUtil.rotateVector(xz, arguments.getRotation());
|
RotationUtil.rotateVector(xz, arguments.getRotation());
|
||||||
|
|||||||
+1
-1
@@ -58,7 +58,7 @@ public class LootFunction implements Function<Void> {
|
|||||||
@Override
|
@Override
|
||||||
public Void apply(ImplementationArguments implementationArguments, Map<String, Variable<?>> variableMap) {
|
public Void apply(ImplementationArguments implementationArguments, Map<String, Variable<?>> variableMap) {
|
||||||
TerraImplementationArguments arguments = (TerraImplementationArguments) implementationArguments;
|
TerraImplementationArguments arguments = (TerraImplementationArguments) implementationArguments;
|
||||||
Vector2 xz = new Vector2(x.apply(implementationArguments, variableMap).doubleValue(),
|
Vector2 xz = Vector2.of(x.apply(implementationArguments, variableMap).doubleValue(),
|
||||||
z.apply(implementationArguments, variableMap).doubleValue());
|
z.apply(implementationArguments, variableMap).doubleValue());
|
||||||
|
|
||||||
RotationUtil.rotateVector(xz, arguments.getRotation());
|
RotationUtil.rotateVector(xz, arguments.getRotation());
|
||||||
|
|||||||
+1
-1
@@ -45,7 +45,7 @@ public class PullFunction implements Function<Void> {
|
|||||||
@Override
|
@Override
|
||||||
public Void apply(ImplementationArguments implementationArguments, Map<String, Variable<?>> variableMap) {
|
public Void apply(ImplementationArguments implementationArguments, Map<String, Variable<?>> variableMap) {
|
||||||
TerraImplementationArguments arguments = (TerraImplementationArguments) implementationArguments;
|
TerraImplementationArguments arguments = (TerraImplementationArguments) implementationArguments;
|
||||||
Vector2 xz = new Vector2(x.apply(implementationArguments, variableMap).doubleValue(),
|
Vector2 xz = Vector2.of(x.apply(implementationArguments, variableMap).doubleValue(),
|
||||||
z.apply(implementationArguments, variableMap).doubleValue());
|
z.apply(implementationArguments, variableMap).doubleValue());
|
||||||
|
|
||||||
RotationUtil.rotateVector(xz, arguments.getRotation());
|
RotationUtil.rotateVector(xz, arguments.getRotation());
|
||||||
|
|||||||
+1
-1
@@ -38,7 +38,7 @@ public class SetMarkFunction implements Function<Void> {
|
|||||||
@Override
|
@Override
|
||||||
public Void apply(ImplementationArguments implementationArguments, Map<String, Variable<?>> variableMap) {
|
public Void apply(ImplementationArguments implementationArguments, Map<String, Variable<?>> variableMap) {
|
||||||
TerraImplementationArguments arguments = (TerraImplementationArguments) implementationArguments;
|
TerraImplementationArguments arguments = (TerraImplementationArguments) implementationArguments;
|
||||||
Vector2 xz = new Vector2(x.apply(implementationArguments, variableMap).doubleValue(),
|
Vector2 xz = Vector2.of(x.apply(implementationArguments, variableMap).doubleValue(),
|
||||||
z.apply(implementationArguments, variableMap).doubleValue());
|
z.apply(implementationArguments, variableMap).doubleValue());
|
||||||
|
|
||||||
RotationUtil.rotateVector(xz, arguments.getRotation());
|
RotationUtil.rotateVector(xz, arguments.getRotation());
|
||||||
|
|||||||
+1
-1
@@ -45,7 +45,7 @@ public class StateFunction implements Function<Void> {
|
|||||||
@Override
|
@Override
|
||||||
public Void apply(ImplementationArguments implementationArguments, Map<String, Variable<?>> variableMap) {
|
public Void apply(ImplementationArguments implementationArguments, Map<String, Variable<?>> variableMap) {
|
||||||
TerraImplementationArguments arguments = (TerraImplementationArguments) implementationArguments;
|
TerraImplementationArguments arguments = (TerraImplementationArguments) implementationArguments;
|
||||||
Vector2 xz = new Vector2(x.apply(implementationArguments, variableMap).doubleValue(),
|
Vector2 xz = Vector2.of(x.apply(implementationArguments, variableMap).doubleValue(),
|
||||||
z.apply(implementationArguments, variableMap).doubleValue());
|
z.apply(implementationArguments, variableMap).doubleValue());
|
||||||
RotationUtil.rotateVector(xz, arguments.getRotation());
|
RotationUtil.rotateVector(xz, arguments.getRotation());
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -63,7 +63,7 @@ public class StructureFunction implements Function<Boolean> {
|
|||||||
if(arguments.getRecursions() > platform.getTerraConfig().getMaxRecursion())
|
if(arguments.getRecursions() > platform.getTerraConfig().getMaxRecursion())
|
||||||
throw new RuntimeException("Structure recursion too deep: " + arguments.getRecursions());
|
throw new RuntimeException("Structure recursion too deep: " + arguments.getRecursions());
|
||||||
|
|
||||||
Vector2 xz = new Vector2(x.apply(implementationArguments, variableMap).doubleValue(),
|
Vector2 xz = Vector2.of(x.apply(implementationArguments, variableMap).doubleValue(),
|
||||||
z.apply(implementationArguments, variableMap).doubleValue());
|
z.apply(implementationArguments, variableMap).doubleValue());
|
||||||
|
|
||||||
RotationUtil.rotateVector(xz, arguments.getRotation());
|
RotationUtil.rotateVector(xz, arguments.getRotation());
|
||||||
|
|||||||
+1
-1
@@ -45,7 +45,7 @@ public class CheckFunction implements Function<String> {
|
|||||||
TerraImplementationArguments arguments = (TerraImplementationArguments) implementationArguments;
|
TerraImplementationArguments arguments = (TerraImplementationArguments) implementationArguments;
|
||||||
|
|
||||||
|
|
||||||
Vector2 xz = new Vector2(x.apply(implementationArguments, variableMap).doubleValue(),
|
Vector2 xz = Vector2.of(x.apply(implementationArguments, variableMap).doubleValue(),
|
||||||
z.apply(implementationArguments, variableMap).doubleValue());
|
z.apply(implementationArguments, variableMap).doubleValue());
|
||||||
|
|
||||||
RotationUtil.rotateVector(xz, arguments.getRotation());
|
RotationUtil.rotateVector(xz, arguments.getRotation());
|
||||||
|
|||||||
@@ -25,11 +25,15 @@ public class Vector2 implements Cloneable {
|
|||||||
* @param x X component
|
* @param x X component
|
||||||
* @param z Z component
|
* @param z Z component
|
||||||
*/
|
*/
|
||||||
public Vector2(double x, double z) {
|
private Vector2(double x, double z) {
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.z = z;
|
this.z = z;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Vector2 of(double x, double z) {
|
||||||
|
return new Vector2(x, z);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Multiply X and Z components by a value.
|
* Multiply X and Z components by a value.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user