diff --git a/pom.xml b/pom.xml
index 7b6157e..44b73b2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
io.github.bi0qaw
biosphere2
- 1.0-SNAPSHOT
+ 1.0.1
diff --git a/src/main/java/io/github/bi0qaw/biosphere/Biosphere.java b/src/main/java/io/github/bi0qaw/biosphere/Biosphere.java
index 4d8ef4a..e13c43c 100644
--- a/src/main/java/io/github/bi0qaw/biosphere/Biosphere.java
+++ b/src/main/java/io/github/bi0qaw/biosphere/Biosphere.java
@@ -23,7 +23,7 @@ public class Biosphere extends JavaPlugin {
Skript.registerExpression(ExprDegToRad.class, Number.class, ExpressionType.PROPERTY, "%number% [in] rad[ian]");
Skript.registerExpression(ExprRadToDeg.class, Number.class, ExpressionType.PROPERTY, "%number% [in] deg[ree]");
- Skript.registerExpression(ExprFrameFromEntity.class, Frame.class, ExpressionType.SIMPLE, new String[]{"frame of %entity%", "%entity%['s] frame"});
+ Skript.registerExpression(ExprFrameFromEntity.class, Frame.class, ExpressionType.SIMPLE, "frame of %entity%", "%entity%['s] frame");
Skript.registerExpression(ExprFrameFromYawPitch.class, Frame.class, ExpressionType.SIMPLE, "frame with yaw %number% and pitch %number%");
Skript.registerExpression(ExprFrameYawPitch.class, Number.class, ExpressionType.PROPERTY, "frame (0¦yaw|1¦pitch) of %frame%");
@@ -32,18 +32,19 @@ public class Biosphere extends JavaPlugin {
Skript.registerExpression(ExprLocationCubeOutline.class, Location.class, ExpressionType.SIMPLE, "cube[s] outline[s] at %locations% with radius %number%(,| and) density %number%");
Skript.registerExpression(ExprLocationCylinderLoc.class, Location.class, ExpressionType.SIMPLE, "cylinder coordinate[s] at %locations% with radius %number%(,| and) yaw %number%(,| and) height %number%");
Skript.registerExpression(ExprLocationHelix.class, Location.class, ExpressionType.SIMPLE, "heli(x|xes|ces) at %locations% with radius %number%(,| and) height %number%(,| and) step[(height|size)] %number%(,| and) density %number%");
- Skript.registerExpression(ExprLocationLine.class, Location.class, ExpressionType.SIMPLE, "line[s] from %locations% to %location% with density %number%");
+ Skript.registerExpression(ExprLocationLine.class, Location.class, ExpressionType.SIMPLE, "line[s] (between|from) %locations% (and|to) %location% with density %number%");
Skript.registerExpression(ExprLocationLineLoc.class, Location.class, ExpressionType.SIMPLE, "line[ar] (coordinate[s]|position[s]|location[s]) %number% from %locations% to %location%");
Skript.registerExpression(ExprLocationLinkAll.class, Location.class, ExpressionType.SIMPLE, "%locations% (linked|connected) with density %number%");
Skript.registerExpression(ExprLocationMidpoint.class, Location.class, ExpressionType.SIMPLE, "[location ]midpoint of %locations%");
- Skript.registerExpression(ExprLocationMove.class, Location.class, ExpressionType.SIMPLE, new String[]{"%locations% with center %location% (moved|shifted) to %location%", "%locations% with center %location% (moved|shifted) to %location%"});
- Skript.registerExpression(ExprLocationOffset.class, Location.class, ExpressionType.SIMPLE, "%locations% offset by %vectors%");
+ Skript.registerExpression(ExprLocationMove.class, Location.class, ExpressionType.SIMPLE, "%locations% with center %location% (moved|shifted) to %location%", "%locations% with center %location% (moved|shifted) to %location%");
+ Skript.registerExpression(ExprLocationOffset.class, Location.class, ExpressionType.SIMPLE, "[location[s]] %locations% offset by %vectors%");
+ Skript.registerExpression(ExprLocationPath.class, Location.class, ExpressionType.SIMPLE, "[location ]path between %locations% with density %number%");
Skript.registerExpression(ExprLocationPolygon.class, Location.class, ExpressionType.SIMPLE, "polygon[s] at %locations% with %integer% (vertex|vertices|vertexes|points)(,| and) radius %number%");
Skript.registerExpression(ExprLocationPolygonOutline.class, Location.class, ExpressionType.SIMPLE, "polygon[s] outline[s] at %locations% with %integer% (vertex|vertices|vertexes|points)(,| and) radius %number%(,| and) density %number%");
Skript.registerExpression(ExprLocationReflection.class, Location.class, ExpressionType.SIMPLE, "%locations% (mirrored|reflected) at %location%[ (in|with) direction [of ]%-vector%]");
Skript.registerExpression(ExprLocationRotate.class, Location.class, ExpressionType.SIMPLE, "%locations% rotated around %vector% at %location% (with angle|by) %number%[ degree[s]]");
Skript.registerExpression(ExprLocationRotXYZ.class, Location.class, ExpressionType.SIMPLE, "%locations% rotated around (1¦x|2¦y|3¦z)(-| )axis at %location% (with angle|by) %number%[ degree[s]]");
- Skript.registerExpression(ExprLocationScale.class, Location.class, ExpressionType.SIMPLE, "%locations% scaled at %location% by %number%[ (in|with|and) direction %-vector%]");
+ Skript.registerExpression(ExprLocationScale.class, Location.class, ExpressionType.SIMPLE, "%locations% scaled at %location% by %number%[ (in|with|and) direction [of ]%-vector%]");
Skript.registerExpression(ExprLocationSphere.class, Location.class, ExpressionType.SIMPLE, "sphere[s] at %locations% with radius %number%(,| and) density %number%");
Skript.registerExpression(ExprLocationSphereLoc.class, Location.class, ExpressionType.SIMPLE, "spher(e|ic[al]) (coordinate[s]|position[s]|location[s]) at %locations% with radius %number%(,| and) yaw %number%(,| and) pitch %number%");
Skript.registerExpression(ExprLocationSphereRand.class, Location.class, ExpressionType.SIMPLE, "random sphere[s] at %locations% with radius %number%(,| and) density %number%");
@@ -54,16 +55,18 @@ public class Biosphere extends JavaPlugin {
Skript.registerExpression(ExprVectorHelix.class, Vector.class, ExpressionType.SIMPLE, "[vector ]helix with radius %number%(,| and) height %number%(,| and) step[(height|size)] %number%(,| and) density %number%");
Skript.registerExpression(ExprVectorInFrame.class, Vector.class, ExpressionType.SIMPLE, "[vector ]%vectors% in %frame%");
Skript.registerExpression(ExprVectorLine.class, Vector.class, ExpressionType.SIMPLE, "[vector ]line with length %number%(,| and) density %number%");
- Skript.registerExpression(ExprVectorLineBetweenVectors.class, Vector.class, ExpressionType.SIMPLE, "vector line between %vector% and %vector% with density %number%");
+ Skript.registerExpression(ExprVectorLineBetweenVectors.class, Vector.class, ExpressionType.SIMPLE, "vector line (between|from) %vector% (and|to) %vector% with density %number%");
Skript.registerExpression(ExprVectorLinkAll.class, Vector.class, ExpressionType.SIMPLE, "vector[s] %vectors% (linked|connected) with density %number%");
Skript.registerExpression(ExprVectorMidpoint.class, Vector.class, ExpressionType.SIMPLE, "vector midpoint of %vectors%");
- Skript.registerExpression(ExprVectorMove.class, Vector.class, ExpressionType.SIMPLE, "[vector[s] ]%vectors% moved by %vector%");
+ Skript.registerExpression(ExprVectorMove.class, Vector.class, ExpressionType.SIMPLE, "[vector[s] ]%vectors% moved by %vectors%");
+ Skript.registerExpression(ExprVectorOffset.class, Vector.class, ExpressionType.SIMPLE, "vector[s] %vectors% offset by %vectors%");
+ Skript.registerExpression(ExprVectorPath.class, Vector.class, ExpressionType.SIMPLE, "vector[s] path between %vectors% with density %number%");
Skript.registerExpression(ExprVectorPolygon.class, Vector.class, ExpressionType.SIMPLE, "[vector ]polygon with %integer% (vertex|vertices|vertexes|points)(,| and) radius %number%");
Skript.registerExpression(ExprVectorPolygonOutline.class, Vector.class, ExpressionType.SIMPLE, "[vector ]polygon outline with %integer% (vertex|vertices|vertexes|points)(,| and) radius %number%(,|and) density %number%");
Skript.registerExpression(ExprVectorReflection.class, Vector.class, ExpressionType.SIMPLE, "vector[s] %vectors% (mirrored|reflected) at %vector%[ (in|with) direction [of ]%-vector%]");
Skript.registerExpression(ExprVectorRotate.class, Vector.class, ExpressionType.SIMPLE, "[vector[s] ]%vectors% rotated around %vector% (with angle|by) %number%[ degree[s]]");
Skript.registerExpression(ExprVectorRotateXYZ.class, Vector.class, ExpressionType.SIMPLE, "[vector[s] ]%vectors% rotated around (1¦x|2¦y|3¦z)(-| )axis (with angle|by) %number%[ degree[s]]");
- Skript.registerExpression(ExprVectorScale.class, Vector.class, ExpressionType.SIMPLE, "[vector[s] ]%vectors% scaled by %number%[ (in|with|and) direction %-vector%]");
+ Skript.registerExpression(ExprVectorScale.class, Vector.class, ExpressionType.SIMPLE, "[vector[s] ]%vectors% scaled by %number%[ (in|with|and) direction [of ]%-vector%]");
Skript.registerExpression(ExprVectorSphere.class, Vector.class, ExpressionType.SIMPLE, "[vector ]sphere with radius %number%(,| and) density %number%");
Skript.registerExpression(ExprVectorSphereRand.class, Vector.class, ExpressionType.SIMPLE, "[vector ]random sphere with radius %number%(,| and) density %number%");
}
diff --git a/src/main/java/io/github/bi0qaw/biosphere/expression/ExprLocationPath.java b/src/main/java/io/github/bi0qaw/biosphere/expression/ExprLocationPath.java
new file mode 100644
index 0000000..360f9de
--- /dev/null
+++ b/src/main/java/io/github/bi0qaw/biosphere/expression/ExprLocationPath.java
@@ -0,0 +1,42 @@
+package io.github.bi0qaw.biosphere.expression;
+
+import ch.njol.skript.lang.Expression;
+import ch.njol.skript.lang.SkriptParser;
+import ch.njol.skript.lang.util.SimpleExpression;
+import ch.njol.util.Kleenean;
+import io.github.bi0qaw.biosphere.util.LocationLib;
+import org.bukkit.Location;
+import org.bukkit.event.Event;
+
+public class ExprLocationPath extends SimpleExpression {
+
+ private Expression locations;
+ private Expression density;
+
+ @Override
+ protected Location[] get(Event event) {
+ return LocationLib.getPath(locations.getArray(event), density.getSingle(event).doubleValue());
+ }
+
+ @Override
+ public boolean isSingle() {
+ return locations.isSingle();
+ }
+
+ @Override
+ public Class extends Location> getReturnType() {
+ return Location.class;
+ }
+
+ @Override
+ public String toString(Event event, boolean b) {
+ return "path between" + locations.toString(event, b) + "with density " + density.toString(event, b);
+ }
+
+ @Override
+ public boolean init(Expression>[] expressions, int i, Kleenean kleenean, SkriptParser.ParseResult parseResult) {
+ locations = (Expression) expressions[0];
+ density = (Expression) expressions[1];
+ return true;
+ }
+}
diff --git a/src/main/java/io/github/bi0qaw/biosphere/expression/ExprVectorMove.java b/src/main/java/io/github/bi0qaw/biosphere/expression/ExprVectorMove.java
index ea73afe..aa054b3 100644
--- a/src/main/java/io/github/bi0qaw/biosphere/expression/ExprVectorMove.java
+++ b/src/main/java/io/github/bi0qaw/biosphere/expression/ExprVectorMove.java
@@ -16,7 +16,7 @@ import javax.annotation.Nullable;
@Name("Vector Offset")
@Description("Offset vectors by other vectors.")
@Examples({"set {_circle::*} to circle with radius 1 and density 5",
- "set {_offset::*} to {_circle::*} offset by vector 1, 2, 3",
+ "set {_offset::*} to {_circle::*} moved by vector 1, 2, 3",
"#Moves the circle from the origin (vector 0, 0, 0) to the position at 1, 2, 3"})
public class ExprVectorMove extends SimpleExpression {
@@ -54,6 +54,6 @@ public class ExprVectorMove extends SimpleExpression {
for (Vector v: o) {
totalOffset.add(v);
}
- return VectorLib.offset(vectors.getArray(e).clone(), totalOffset);
+ return VectorLib.move(VectorLib.clone(vectors.getArray(e)), totalOffset);
}
}
diff --git a/src/main/java/io/github/bi0qaw/biosphere/expression/ExprVectorOffset.java b/src/main/java/io/github/bi0qaw/biosphere/expression/ExprVectorOffset.java
new file mode 100644
index 0000000..5557448
--- /dev/null
+++ b/src/main/java/io/github/bi0qaw/biosphere/expression/ExprVectorOffset.java
@@ -0,0 +1,42 @@
+package io.github.bi0qaw.biosphere.expression;
+
+import ch.njol.skript.lang.Expression;
+import ch.njol.skript.lang.SkriptParser;
+import ch.njol.skript.lang.util.SimpleExpression;
+import ch.njol.util.Kleenean;
+import io.github.bi0qaw.biosphere.util.VectorLib;
+import org.bukkit.event.Event;
+import org.bukkit.util.Vector;
+
+public class ExprVectorOffset extends SimpleExpression {
+
+ private Expression vectors;
+ private Expression offsets;
+
+ @Override
+ protected Vector[] get(Event event) {
+ return VectorLib.offset(vectors.getArray(event), offsets.getArray(event));
+ }
+
+ @Override
+ public boolean isSingle() {
+ return vectors.isSingle() && offsets.isSingle();
+ }
+
+ @Override
+ public Class extends Vector> getReturnType() {
+ return Vector.class;
+ }
+
+ @Override
+ public String toString(Event event, boolean b) {
+ return "vector " + vectors.toString(event, b) + " offset by " + offsets.toString(event, b);
+ }
+
+ @Override
+ public boolean init(Expression>[] expressions, int i, Kleenean kleenean, SkriptParser.ParseResult parseResult) {
+ vectors = (Expression) expressions[0];
+ offsets = (Expression) expressions[1];
+ return true;
+ }
+}
diff --git a/src/main/java/io/github/bi0qaw/biosphere/expression/ExprVectorPath.java b/src/main/java/io/github/bi0qaw/biosphere/expression/ExprVectorPath.java
new file mode 100644
index 0000000..bcd23ed
--- /dev/null
+++ b/src/main/java/io/github/bi0qaw/biosphere/expression/ExprVectorPath.java
@@ -0,0 +1,42 @@
+package io.github.bi0qaw.biosphere.expression;
+
+import ch.njol.skript.lang.Expression;
+import ch.njol.skript.lang.SkriptParser;
+import ch.njol.skript.lang.util.SimpleExpression;
+import ch.njol.util.Kleenean;
+import io.github.bi0qaw.biosphere.util.VectorLib;
+import org.bukkit.event.Event;
+import org.bukkit.util.Vector;
+
+public class ExprVectorPath extends SimpleExpression{
+
+ private Expression vectors;
+ private Expression density;
+
+ @Override
+ protected Vector[] get(Event event) {
+ return VectorLib.getPath(vectors.getArray(event), density.getSingle(event).doubleValue());
+ }
+
+ @Override
+ public boolean isSingle() {
+ return vectors.isSingle();
+ }
+
+ @Override
+ public Class extends Vector> getReturnType() {
+ return Vector.class;
+ }
+
+ @Override
+ public String toString(Event event, boolean b) {
+ return "vector path between " + vectors.toString(event, b) + " with density " + density.toString(event, b);
+ }
+
+ @Override
+ public boolean init(Expression>[] expressions, int i, Kleenean kleenean, SkriptParser.ParseResult parseResult) {
+ vectors = (Expression) expressions[0];
+ density = (Expression) expressions[1];
+ return true;
+ }
+}
diff --git a/src/main/java/io/github/bi0qaw/biosphere/expression/ExprVectorReflection.java b/src/main/java/io/github/bi0qaw/biosphere/expression/ExprVectorReflection.java
index b2c960c..186c3a7 100644
--- a/src/main/java/io/github/bi0qaw/biosphere/expression/ExprVectorReflection.java
+++ b/src/main/java/io/github/bi0qaw/biosphere/expression/ExprVectorReflection.java
@@ -50,11 +50,12 @@ public class ExprVectorReflection extends SimpleExpression {
@Override
@Nullable
protected Vector[] get(Event e) {
+ Vector[] clones = VectorLib.clone(vectors.getArray(e));
if (direction == null) {
- return VectorLib.pointReflection(vectors.getArray(e).clone(), center.getSingle(e));
+ return VectorLib.pointReflection(clones, center.getSingle(e));
}
else {
- return VectorLib.reflection(vectors.getArray(e).clone(), center.getSingle(e), direction.getSingle(e));
+ return VectorLib.reflection(clones, center.getSingle(e), direction.getSingle(e));
}
}
}
diff --git a/src/main/java/io/github/bi0qaw/biosphere/expression/ExprVectorRotate.java b/src/main/java/io/github/bi0qaw/biosphere/expression/ExprVectorRotate.java
index c0f4775..2599799 100644
--- a/src/main/java/io/github/bi0qaw/biosphere/expression/ExprVectorRotate.java
+++ b/src/main/java/io/github/bi0qaw/biosphere/expression/ExprVectorRotate.java
@@ -56,7 +56,7 @@ public class ExprVectorRotate extends SimpleExpression {
float a = angle.getSingle(e).floatValue();
a = -a; //Skript uses clockwise and VectorMath anti-clockwise rotation
Vector ax = axis.getSingle(e).clone().normalize();
- return VectorLib.rotate(vectors.getArray(e).clone(), ax, a);
+ return VectorLib.rotate(VectorLib.clone(vectors.getArray(e)), ax, a);
}
}
diff --git a/src/main/java/io/github/bi0qaw/biosphere/expression/ExprVectorRotateXYZ.java b/src/main/java/io/github/bi0qaw/biosphere/expression/ExprVectorRotateXYZ.java
index 3d750cf..eb7f33e 100644
--- a/src/main/java/io/github/bi0qaw/biosphere/expression/ExprVectorRotateXYZ.java
+++ b/src/main/java/io/github/bi0qaw/biosphere/expression/ExprVectorRotateXYZ.java
@@ -54,14 +54,15 @@ public class ExprVectorRotateXYZ extends SimpleExpression {
protected Vector[] get(Event e) {
float a = angle.getSingle(e).floatValue();
a = -a; //Skript uses clockwise and VectorMath anti-clockwise rotation
+ Vector[] clones = VectorLib.clone(vectors.getArray(e));
if (axis == 1) {
- return VectorLib.rotateX(vectors.getArray(e).clone(), a);
+ return VectorLib.rotateX(clones, a);
}
else if (axis == 2) {
- return VectorLib.rotateY(vectors.getArray(e).clone(), a);
+ return VectorLib.rotateY(clones, a);
}
else {
- return VectorLib.rotateZ(vectors.getArray(e).clone(), a);
+ return VectorLib.rotateZ(clones, a);
}
}
diff --git a/src/main/java/io/github/bi0qaw/biosphere/expression/ExprVectorScale.java b/src/main/java/io/github/bi0qaw/biosphere/expression/ExprVectorScale.java
index 61b4baa..908eeae 100644
--- a/src/main/java/io/github/bi0qaw/biosphere/expression/ExprVectorScale.java
+++ b/src/main/java/io/github/bi0qaw/biosphere/expression/ExprVectorScale.java
@@ -59,10 +59,10 @@ public class ExprVectorScale extends SimpleExpression {
protected Vector[] get(Event e) {
double f = factor.getSingle(e).doubleValue();
if (direction == null) {
- return VectorLib.scale(vectors.getArray(e).clone(), f);
+ return VectorLib.scale(VectorLib.clone(vectors.getArray(e).clone()), f);
}
else {
- return VectorLib.scaleDirectional(vectors.getArray(e).clone(), direction.getSingle(e), f);
+ return VectorLib.scaleDirectional(VectorLib.clone(vectors.getArray(e)), direction.getSingle(e), f);
}
}
}
diff --git a/src/main/java/io/github/bi0qaw/biosphere/util/LocationLib.java b/src/main/java/io/github/bi0qaw/biosphere/util/LocationLib.java
index 8626a70..61b0d06 100644
--- a/src/main/java/io/github/bi0qaw/biosphere/util/LocationLib.java
+++ b/src/main/java/io/github/bi0qaw/biosphere/util/LocationLib.java
@@ -56,6 +56,17 @@ public class LocationLib {
return locations;
}
+ public static Location[] getPath(Location[] locations, double density) {
+ if (locations.length > 0) {
+ Vector[] path = VectorLib.getPath(VectorLib.toVector(locations), density);
+ World world = locations[0].getWorld();
+ return toLocation(path, world);
+ }
+ else {
+ return new Location[]{};
+ }
+ }
+
public static Location[] getPolygon(Location[] locations, int points, double radius) {
Vector[] polygon = VectorLib.getPolygon(points, radius);
return offset(locations, polygon);
@@ -85,14 +96,8 @@ public class LocationLib {
if (locations.length > 0) {
Vector[] vectors = VectorLib.toVector(locations);
Vector[] linked = VectorLib.linkAll(vectors, density);
- Location[] linkedLocations = new Location[linked.length];
World world = locations[0].getWorld();
- int i = 0;
- for (Vector v: linked) {
- linkedLocations[i] = v.toLocation(world);
- i++;
- }
- return linkedLocations;
+ return toLocation(linked, world);
}
else {
return new Location[] {};
diff --git a/src/main/java/io/github/bi0qaw/biosphere/util/VectorLib.java b/src/main/java/io/github/bi0qaw/biosphere/util/VectorLib.java
index c4b8320..5504687 100644
--- a/src/main/java/io/github/bi0qaw/biosphere/util/VectorLib.java
+++ b/src/main/java/io/github/bi0qaw/biosphere/util/VectorLib.java
@@ -50,6 +50,18 @@ public class VectorLib {
return getPolygon(n, radius);
}
+ public static Vector[] getPath(Vector[] vectors, double density) {
+ List path = new ArrayList();
+ int length = vectors.length;
+ if (length < 2) {
+ return vectors;
+ }
+ for (int i = 0; i < length - 1; i++) {
+ path.addAll(Arrays.asList(linkLine(vectors[i], vectors[i+1], density)));
+ }
+ return path.toArray(new Vector[path.size()]);
+ }
+
public static Vector[] getPolygon(int points, double radius) {
float deltaAngle = 360 / (float) points;
Vector[] vectors = new Vector[points];
@@ -106,7 +118,7 @@ public class VectorLib {
}
public static Vector[] getHelix(double radius, double height, double step, double density) {
- int points = (int) ( height * 2 * Math.PI * radius * density);
+ int points = (int) ( Math.abs(height) * 2 * Math.PI * Math.abs(radius) * density);
double deltaAngle = 360 * height / (step * points);
double deltaHeight = height / points;
Vector[] vectors = new Vector[points];
@@ -118,11 +130,10 @@ public class VectorLib {
public static Vector[] linkAll(Vector[] vectors, double density) {
List vecs = new ArrayList();
- for (Vector v1 : vectors) {
- for (Vector v2 : vectors) {
- if (!v1.equals(v2)) {
- vecs.addAll(Arrays.asList(linkLine(v1, v2, density)));
- }
+ int length = vectors.length;
+ for (int i = 0; i < length - 1; i++) {
+ for (int j = i + 1; j < length ; j++) {
+ vecs.addAll(Arrays.asList(linkLine(vectors[i], vectors[j], density)));
}
}
return vecs.toArray(new Vector[vecs.size()]);
@@ -137,13 +148,25 @@ public class VectorLib {
return midpoint;
}
- public static Vector[] offset(Vector[] vectors, Vector offset) {
+ public static Vector[] move(Vector[] vectors, Vector offset) {
for (Vector v: vectors) {
v.add(offset);
}
return vectors;
}
+ public static Vector[] offset(Vector[] vectors, Vector[] offsets) {
+ Vector[] offset = new Vector[vectors.length * offsets.length];
+ int i = 0;
+ for (Vector v: vectors) {
+ for (Vector o: offsets) {
+ offset[i] = v.clone().add(o);
+ i++;
+ }
+ }
+ return offset;
+ }
+
public static Vector[] pointReflection(Vector[] vectors, Vector center) {
for (Vector v: vectors) {
v.subtract(center).multiply(-1).add(center);
@@ -160,28 +183,28 @@ public class VectorLib {
public static Vector[] rotate(Vector[] vectors, Vector axis, double angle) {
for (Vector v: vectors) {
- v = VectorMath.rot(v, axis, angle);
+ VectorMath.rot(v, axis, angle);
}
return vectors;
}
public static Vector[] rotateX(Vector[] vectors, double angle) {
for (Vector v: vectors) {
- v = VectorMath.rotX(v, angle);
+ VectorMath.rotX(v, angle);
}
return vectors;
}
public static Vector[] rotateY(Vector[] vectors, double angle) {
for (Vector v: vectors) {
- v = VectorMath.rotY(v, angle);
+ VectorMath.rotY(v, angle);
}
return vectors;
}
public static Vector[] rotateZ(Vector[] vectors, double angle) {
for (Vector v: vectors) {
- v = VectorMath.rotZ(v, angle);
+ VectorMath.rotZ(v, angle);
}
return vectors;
}
@@ -241,4 +264,14 @@ public class VectorLib {
}
return vectors;
}
+
+ public static Vector[] clone(Vector[] vectors) {
+ Vector[] clones = new Vector[vectors.length];
+ int i = 0;
+ for (Vector v: vectors) {
+ clones[i] = v.clone();
+ i++;
+ }
+ return clones;
+ }
}
diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml
index 98b2f73..cbd4d4e 100644
--- a/src/main/resources/plugin.yml
+++ b/src/main/resources/plugin.yml
@@ -1,4 +1,4 @@
name: Biosphere2
main: io.github.bi0qaw.biosphere.Biosphere
author: bi0qaw
-version: 1.0.0
\ No newline at end of file
+version: 1.0.1
\ No newline at end of file