Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b6220bf829 | |||
| c4a3ae2146 | |||
| 377512f8fc | |||
| c086762065 | |||
| f12d32dd27 | |||
| 10ce8a6da6 | |||
| cbf367538e | |||
| 0e39e01c8b | |||
| 719aa85317 | |||
| a649463bd0 |
@@ -1,13 +1,13 @@
|
|||||||
# Biosphere2
|
# Biosphere2
|
||||||
Biosphere2 is a [Skript](https://github.com/bensku/Skript) addon that adds concise syntax to the [Skript](https://github.com/bensku/Skript) language for all kind of location and vector manipulations.
|
Biosphere2 is a [Skript](https://github.com/bensku/Skript) addon that adds concise syntax to the [Skript](https://github.com/bensku/Skript) language for all kind of location and vector manipulations.
|
||||||
|
|
||||||
#### Current Version: 1.0.1 (2017-11-25)
|
#### Current Version: [1.0.1](https://github.com/bi0qaw/biosphere2/releases) (2017-11-26)
|
||||||
|
|
||||||
Head over to the [wiki](https://github.com/bi0qaw/biosphere2/wiki) for an extensive documentation of Biosphere2's features.
|
Head over to the [wiki](https://github.com/bi0qaw/biosphere2/wiki) for an extensive documentation of Biosphere2's features.
|
||||||
Syntax documentation can also be found on:
|
Syntax documentation can also be found on:
|
||||||
* [skUnity](https://docs.skunity.com/syntax/search/addon:Biosphere2)
|
|
||||||
* [Skript Hub](http://skripthub.net/docs/?addon=Biosphere2)
|
* [Skript Hub](http://skripthub.net/docs/?addon=Biosphere2)
|
||||||
|
* [skUnity](https://docs.skunity.com/syntax/search/addon:Biosphere2)
|
||||||
|
|
||||||
Examples are not up yet, but will be added to the [wiki](https://github.com/bi0qaw/biosphere2/wiki) later.
|
Examples are up and can be found in the [Gallery](https://github.com/bi0qaw/biosphere2/wiki/Gallery)
|
||||||
|
|
||||||
Use the [issue tracker](https://github.com/bi0qaw/biosphere2/issues) to report any bugs or for other discussion. You can alternatively also create a post on the [skUnity forums](https://forums.skunity.com/forums/#skript). Feel also free to join the [Discord](https://discord.gg/4zesrPH) chat.
|
Use the [issue tracker](https://github.com/bi0qaw/biosphere2/issues) to report any bugs or for other discussion. You can alternatively also create a post on the [skUnity forums](https://forums.skunity.com/forums/#skript). Feel also free to join the [Discord](https://discord.gg/4zesrPH) chat.
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>io.github.bi0qaw</groupId>
|
<groupId>io.github.bi0qaw</groupId>
|
||||||
<artifactId>biosphere2</artifactId>
|
<artifactId>biosphere2</artifactId>
|
||||||
<version>1.0.1</version>
|
<version>1.0.2</version>
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
|
|||||||
@@ -0,0 +1,256 @@
|
|||||||
|
command /biosphere-test:
|
||||||
|
trigger:
|
||||||
|
set {_num} to 180 in radian
|
||||||
|
send "---------------------------"
|
||||||
|
send "in radian"
|
||||||
|
send "%{_num}% == 3.14"
|
||||||
|
set {_num} to 3.14 in degree
|
||||||
|
send "---------------------------"
|
||||||
|
send "in degree"
|
||||||
|
send "%{_num}% == 179.91"
|
||||||
|
set {_frame} to frame of player
|
||||||
|
send "---------------------------"
|
||||||
|
send "frame of player"
|
||||||
|
send "%{_frame}% == frame:yaw: %yaw of player%, pitch: %pitch of player%"
|
||||||
|
set {_yaw} to frame yaw of {_frame}
|
||||||
|
set {_pitch} to frame pitch of {_frame}
|
||||||
|
send "---------------------------"
|
||||||
|
send "yaw/pitch of frame"
|
||||||
|
send "yaw: %{_yaw}%, pitch: %{_pitch}% == yaw: %yaw of player%, pitch: %pitch of player%"
|
||||||
|
set frame yaw of {_frame} to 50
|
||||||
|
set frame pitch of {_frame} to -80
|
||||||
|
set {_yaw} to frame yaw of {_frame}
|
||||||
|
set {_pitch} to frame pitch of {_frame}
|
||||||
|
send "---------------------------"
|
||||||
|
send "set yaw/pitch of frame"
|
||||||
|
send "yaw: %{_yaw}%, pitch: %{_pitch}% == yaw: 50, pitch: -80"
|
||||||
|
add 10 to frame yaw of {_frame}
|
||||||
|
remove 10 from frame pitch of {_frame}
|
||||||
|
set {_yaw} to frame yaw of {_frame}
|
||||||
|
set {_pitch} to frame pitch of {_frame}
|
||||||
|
send "---------------------------"
|
||||||
|
send "add/remove yaw/pitch of frame"
|
||||||
|
send "yaw: %{_yaw}%, pitch: %{_pitch}% == yaw: 60, pitch: -90"
|
||||||
|
set {_frame} to frame with yaw 40 and pitch 10
|
||||||
|
set {_yaw} to frame yaw of {_frame}
|
||||||
|
set {_pitch} to frame pitch of {_frame}
|
||||||
|
send "---------------------------"
|
||||||
|
send "frame from yaw and pitch"
|
||||||
|
send "yaw: %{_yaw}%, pitch: %{_pitch}% == yaw: 40, pitch: 10"
|
||||||
|
set {_world} to world of player
|
||||||
|
set {_l::1} to location(1, 2, 3, {_world})
|
||||||
|
set {_l::2} to location(3, 2, 1, {_world})
|
||||||
|
set {_l::3} to location(2, 2, 2, {_world})
|
||||||
|
set {_midpoint} to midpoint of {_l::*}
|
||||||
|
send "---------------------------"
|
||||||
|
send "midpoint of locations"
|
||||||
|
send "%{_midpoint}% == %{_l::3}%"
|
||||||
|
set {_l1} to location(0, 10, 20, {_world})
|
||||||
|
set {_l2} to location(10, 20, 30, {_world})
|
||||||
|
set {_l::*} to linear coordinate 0.1 from {_l1} to {_l2}
|
||||||
|
set {_coord} to location(1, 11, 21, {_world})
|
||||||
|
send "---------------------------"
|
||||||
|
send "location linear coordinate"
|
||||||
|
send "%{_l::1}% == %{_coord}%"
|
||||||
|
set {_l::*} to cylinder coordinate at {_l1} with radius 2, yaw 90, height 3
|
||||||
|
set {_loc2} to location(-2, 13, 20, {_world})
|
||||||
|
send "---------------------------"
|
||||||
|
send "location cylindrical coordinate"
|
||||||
|
send "%{_l::1}% == %{_loc2}%"
|
||||||
|
set {_l::*} to spherical coordinate at {_l1} with radius 3*sqrt(2), yaw 90 and pitch 45
|
||||||
|
set {_loc2} to location(-3, 7, 20, {_world})
|
||||||
|
send "---------------------------"
|
||||||
|
send "location spherical coordinate"
|
||||||
|
send "%{_l::1}% == %{_loc2}%"
|
||||||
|
set {_origin} to location(0, 0, 0, {_world})
|
||||||
|
send "---------------------------"
|
||||||
|
send "location rotate around x/y/z axis"
|
||||||
|
set {_l::*} to {_l1} rotated around x-axis at {_origin} with angle 90
|
||||||
|
set {_loc2} to location(0, 20, -10, {_world})
|
||||||
|
send "%{_l::1}% == %{_loc2}%"
|
||||||
|
set {_l::*} to {_l1} rotated around y-axis at {_origin} with angle 90
|
||||||
|
set {_loc2} to location(-20, 10, 0, {_world})
|
||||||
|
send "%{_l::1}% == %{_loc2}%"
|
||||||
|
set {_l::*} to {_l1} rotated around z-axis at {_origin} with angle 90
|
||||||
|
set {_loc2} to location(10, 0, 20, {_world})
|
||||||
|
send "%{_l::1}% == %{_loc2}%"
|
||||||
|
set {_l::*} to {_l1} reflected at {_origin}
|
||||||
|
set {_loc2} to location(0, -10, -20, {_world})
|
||||||
|
set {_l2::*} to {_l1} reflected at {_origin} in direction vector 0, -1, 1
|
||||||
|
set {_loc3} to location(0, 10, -20, {_world})
|
||||||
|
send "---------------------------"
|
||||||
|
send "location reflection"
|
||||||
|
send "%{_l::1}% == %{_loc2}%"
|
||||||
|
send "%{_l2::1}% == %{_loc3}%"
|
||||||
|
set {_l::*} to {_l2} scaled at {_origin} by -1
|
||||||
|
set {_loc2} to location(-10, -20, -30, {_world})
|
||||||
|
set {_l2::*} to {_l2} scaled at {_origin} by -1 and direction vector 1, 2, 3
|
||||||
|
set {_loc3} to location(-10, -40, -90, {_world})
|
||||||
|
send "---------------------------"
|
||||||
|
send "location scaling"
|
||||||
|
send "%{_l::1}% == %{_loc2}%"
|
||||||
|
send "%{_l2::1}% == %{_loc3}%"
|
||||||
|
set {_l::*} to {_l1} with center {_origin} moved to {_l2}
|
||||||
|
set {_loc2} to location(10, 30, 50, {_world})
|
||||||
|
send "---------------------------"
|
||||||
|
send "location shift/move"
|
||||||
|
send "%{_l::1}% == %{_loc2}%"
|
||||||
|
set {_l} to {_l1} offset by vector 1, 2, 3
|
||||||
|
set {_loc} to location(1, 12, 23, {_world})
|
||||||
|
send "---------------------------"
|
||||||
|
send "location offset"
|
||||||
|
send "%{_l}% == %{_loc}%"
|
||||||
|
set {_v1} to vector 1, 0, 0 in frame of player
|
||||||
|
set {_v2} to vector from player to location 1 in front of player
|
||||||
|
send "---------------------------"
|
||||||
|
send "vector in frame"
|
||||||
|
send "%{_v1}% == %{_v2}%"
|
||||||
|
set {_v::1} to vector 1, 2, 3
|
||||||
|
set {_v::2} to vector 3, 2, 1
|
||||||
|
set {_v::3} to vector 2, 2, 2
|
||||||
|
set {_midpoint} to vector midpoint of {_v::*}
|
||||||
|
set {_vec} to vector 2, 2, 2
|
||||||
|
send "---------------------------"
|
||||||
|
send "vector midpoint"
|
||||||
|
send "%{_midpoint}% == %{_vec}%"
|
||||||
|
set {_v::*} to vector 1, 2, 3 moved by vector 1, 2, 3
|
||||||
|
set {_vec} to vector 2, 4, 6
|
||||||
|
send "---------------------------"
|
||||||
|
send "vector moved"
|
||||||
|
send "%{_v::1}% == %{_vec}%"
|
||||||
|
set {_v::*} to vector vector 2, 4, 6 reflected at vector 1, 2, 3
|
||||||
|
set {_v2} to vector 0, 0, 0
|
||||||
|
set {_v1::*} to vector vector 2, 4, 6 reflected at vector 1, 2, 3 in direction vector 1, 2, 3
|
||||||
|
set {_v3} to vector 0, -2, -6
|
||||||
|
send "---------------------------"
|
||||||
|
send "vector reflection"
|
||||||
|
send "%{_v::1}% == %{_v2}%"
|
||||||
|
send "%{_v1::1}% == %{_v3}%"
|
||||||
|
set {_v1} to vector 1, 2, 3 rotated around vector 1, 0, 0 with angle 90
|
||||||
|
set {_v2} to vector 1, 2, 3 rotated around vector 0, 1, 0 with angle 90
|
||||||
|
set {_v3} to vector 1, 2, 3 rotated around vector 0, 0, 1 with angle 90
|
||||||
|
send "---------------------------"
|
||||||
|
send "vector rotate axis"
|
||||||
|
send "%{_v1}% == %vector 1, 3, -2%"
|
||||||
|
send "%{_v2}% == %vector -3, 2, 1%"
|
||||||
|
send "%{_v3}% == %vector 2, -1, 3%"
|
||||||
|
set {_v1} to vector 1, 2, 3 rotated around x-axis with angle 90
|
||||||
|
set {_v2} to vector 1, 2, 3 rotated around y-axis with angle 90
|
||||||
|
set {_v3} to vector 1, 2, 3 rotated around z-axis with angle 90
|
||||||
|
send "---------------------------"
|
||||||
|
send "vector rotate x/y/z-axis"
|
||||||
|
send "%{_v1}% == %vector 1, 3, -2%"
|
||||||
|
send "%{_v2}% == %vector -3, 2, 1%"
|
||||||
|
send "%{_v3}% == %vector 2, -1, 3%"
|
||||||
|
set {_v1} to vector 1, 2, 3 scaled by 2
|
||||||
|
set {_v2} to vector 1, 2, 3 scaled by 2 with direction vector 1, 2, 3
|
||||||
|
send "---------------------------"
|
||||||
|
send "vector scale"
|
||||||
|
send "%{_v1}% == %vector 2, 4, 6%"
|
||||||
|
send "%{_v2}% == %vector 2, 8, 18%"
|
||||||
|
|
||||||
|
command /bs-test <text> <text>:
|
||||||
|
trigger:
|
||||||
|
if arg-1 is "l", "loc" or "location":
|
||||||
|
set {_l} to location 5 in front of player
|
||||||
|
set {_l1} to location 5 in front and 5 left of player
|
||||||
|
set {_l2} to location 5 in front and 5 right of player
|
||||||
|
if arg-2 is "box":
|
||||||
|
set {_box::*} to box between location 2.5 left and 2.5 in front of player and location 2.5 right, 7.5 in front and 5 above player
|
||||||
|
send "%{_box::*}%/"
|
||||||
|
show happy villager at {_box::*}
|
||||||
|
else if arg-2 is "box-outline":
|
||||||
|
set {_box::*} to box outline between location 2.5 left and 2.5 in front of player and location 2.5 right, 7.5 in front and 5 above player with density 5
|
||||||
|
show happy villager at {_box::*}
|
||||||
|
else if arg-2 is "circle":
|
||||||
|
set {_circle::*} to circle at {_l} with radius 3 and density 5
|
||||||
|
show happy villager at {_circle::*}
|
||||||
|
else if arg-2 is "cube":
|
||||||
|
set {_cube::*} to cube at {_l} with radius 3
|
||||||
|
show happy villager at {_cube::*}
|
||||||
|
else if arg-2 is "cube-outline":
|
||||||
|
set {_cubeoutline::*} to cube outline at {_l} with radius 3 and density 5
|
||||||
|
show happy villager at {_cubeoutline::*}
|
||||||
|
else if arg-2 is "helix":
|
||||||
|
set {_helix::*} to helix at {_l} with radius 2, height 5, step 1 and density 5
|
||||||
|
show happy villager at {_helix::*}
|
||||||
|
else if arg-2 is "line":
|
||||||
|
set {_line::*} to line from {_l1} to {_l2} with density 5
|
||||||
|
show happy villager at {_line::*}
|
||||||
|
else if arg-2 is "linked":
|
||||||
|
set {_l::1} to {_l1}
|
||||||
|
set {_l::2} to {_l2}
|
||||||
|
set {_linked::*} to {_l::*} linked with density 5
|
||||||
|
show happy villager at {_linked::*}
|
||||||
|
else if arg-2 is "path":
|
||||||
|
set {_poly::*} to polygon at {_l} with 7 points and radius 3
|
||||||
|
set {_path::*} to path between {_poly::*} with density 5
|
||||||
|
show happy villager at {_path::*}
|
||||||
|
else if arg-2 is "poly" or "polygon":
|
||||||
|
set {_poly::*} to polygon at {_l} with 10 points and radius 3
|
||||||
|
show happy villager at {_poly::*}
|
||||||
|
else if arg-2 is "poly-outline" or "polygon-outline":
|
||||||
|
set {_polyoutline::*} to polygon outline at {_l} with 10 vertices, radius 3 and density 5
|
||||||
|
show happy villager at {_polyoutline::*}
|
||||||
|
else if arg-2 is "sphere":
|
||||||
|
set {_sphere::*} to sphere at {_l} with radius 3 and density 5
|
||||||
|
show happy villager at {_sphere::*}
|
||||||
|
else if arg-2 is "random-sphere":
|
||||||
|
set {_randomsphere::*} to random sphere at {_l} with radius 3 and density 5
|
||||||
|
show happy villager at {_randomsphere::*}
|
||||||
|
else:
|
||||||
|
send "circle, cube, cube-outline, helix, line, linked, path, polygon, polygon-outline, sphere and random-sphere"
|
||||||
|
else if arg-1 is "v", "vec" or "vector":
|
||||||
|
set {_l} to location 5 in front of player
|
||||||
|
set {_l1} to location 5 in front and 5 left of player
|
||||||
|
set {_l2} to location 5 in front and 5 right of player
|
||||||
|
if arg-2 is "box":
|
||||||
|
set {_box::*} to vector box between vector -2.5, -2.5, -2.5 and vector 2.5, 2.5, 2.5
|
||||||
|
show happy villager at {_l} offset by {_box::*}
|
||||||
|
else if arg-2 is "box-outline":
|
||||||
|
set {_box::*} to vector box outline between vector -2.5, -2.5, -2.5 and vector 2.5, 2.5, 2.5 with density 5
|
||||||
|
show happy villager at {_l} offset by {_box::*}
|
||||||
|
else if arg-2 is "circle":
|
||||||
|
set {_circle::*} to circle with radius 3 and density 5
|
||||||
|
show happy villager at {_l} offset by {_circle::*}
|
||||||
|
else if arg-2 is "cube":
|
||||||
|
set {_cube::*} to cube with radius 3
|
||||||
|
show happy villager at {_l} offset by {_cube::*}
|
||||||
|
else if arg-2 is "cube-outline":
|
||||||
|
set {_cubeoutline::*} to cube outline with radius 3 and density 5
|
||||||
|
show happy villager at {_l} offset by {_cubeoutline::*}
|
||||||
|
else if arg-2 is "helix":
|
||||||
|
set {_helix::*} to helix with radius 2, height 5, step 1 and density 5
|
||||||
|
show happy villager at {_l} offset by {_helix::*}
|
||||||
|
else if arg-2 is "line":
|
||||||
|
set {_v} to vector from {_l1} to {_l2}
|
||||||
|
set {_line::*} to line with length vector length of {_v} and density 5
|
||||||
|
set {_yaw} to vector yaw of {_v}
|
||||||
|
set {_frame} to frame with yaw {_yaw} and pitch 0
|
||||||
|
show happy villager at {_l1} offset by {_line::*} in {_frame}
|
||||||
|
else if arg-2 is "linked":
|
||||||
|
set {_v::1} to vector from player to {_l1}
|
||||||
|
set {_v::2} to vector from player to {_l2}
|
||||||
|
set {_linked::*} to vectors {_v::*} linked with density 5
|
||||||
|
show happy villager at player offset by {_linked::*}
|
||||||
|
else if arg-2 is "path":
|
||||||
|
set {_poly::*} to polygon with 7 points and radius 3
|
||||||
|
set {_path::*} to vector path between {_poly::*} with density 5
|
||||||
|
show happy villager at {_l} offset by {_path::*}
|
||||||
|
else if arg-2 is "polygon":
|
||||||
|
set {_polygon::*} to polygon with 10 points and radius 3
|
||||||
|
show happy villager at {_l} offset by {_polygon::*}
|
||||||
|
else if arg-2 is "polygon-outline":
|
||||||
|
set {_polygonoutline::*} to vector polygon outline with 10 points, radius 3 and density 5
|
||||||
|
show happy villager at {_l} offset by {_polygonoutline::*}
|
||||||
|
else if arg-2 is "sphere":
|
||||||
|
set {_sphere::*} to sphere with radius 3 and density 5
|
||||||
|
show happy villager at {_l} offset by {_sphere::*}
|
||||||
|
else if arg-2 is "random-sphere":
|
||||||
|
set {_randomsphere::*} to random sphere with radius 3 and density 5
|
||||||
|
show happy villager at {_l} offset by {_randomsphere::*}
|
||||||
|
else:
|
||||||
|
send "circle, cube, cube-outline, helix, line, linked, path, polygon, polygon-outline, sphere and random-sphere"
|
||||||
|
else:
|
||||||
|
send "/bs-test location <shape>"
|
||||||
|
send "/bs-test vector <shape>"
|
||||||
@@ -0,0 +1,241 @@
|
|||||||
|
function hsvtorgb(col: text, h: number, sat: number, val: number) :: number:
|
||||||
|
set {_h} to mod({_h}, 360)
|
||||||
|
if {_sat} > 1:
|
||||||
|
set {_sat} to 1
|
||||||
|
else if {_sat} < 0:
|
||||||
|
set {_sat} to 0
|
||||||
|
if {_val} > 1:
|
||||||
|
set {_val} to 1
|
||||||
|
else if {_val} < 0:
|
||||||
|
set {_val} to 0
|
||||||
|
set {_c} to {_val} * {_sat}
|
||||||
|
set {_hh} to {_h}/60
|
||||||
|
set {_t} to mod({_hh}, 2) - 1
|
||||||
|
set {_x} to {_c} * (1 - abs({_t}))
|
||||||
|
set {_m} to {_v} - {_c}
|
||||||
|
set {_ret} to {_m}
|
||||||
|
if {_col} is "red" or "r":
|
||||||
|
if {_hh} < 1:
|
||||||
|
add {_c} to {_ret}
|
||||||
|
else if {_hh} < 2:
|
||||||
|
add {_x} to {_ret}
|
||||||
|
else if {_hh} < 4:
|
||||||
|
set {_ret} to {_ret}
|
||||||
|
else if {_hh} < 5:
|
||||||
|
add {_x} to {_ret}
|
||||||
|
else if {_hh} < 6:
|
||||||
|
add {_c} to {_ret}
|
||||||
|
else if {_col} is "green" or "g":
|
||||||
|
if {_hh} < 1:
|
||||||
|
add {_x} to {_ret}
|
||||||
|
else if {_hh} < 2:
|
||||||
|
add {_c} to {_ret}
|
||||||
|
else if {_hh} < 3:
|
||||||
|
add {_c} to {_ret}
|
||||||
|
else if {_hh} < 4:
|
||||||
|
add {_x} to {_ret}
|
||||||
|
else if {_col} is "blue" or "b":
|
||||||
|
if {_hh} < 2:
|
||||||
|
set {_ret} to {_ret}
|
||||||
|
else if {_hh} < 3:
|
||||||
|
add {_x} to {_ret}
|
||||||
|
else if {_hh} < 5:
|
||||||
|
add {_c} to {_ret}
|
||||||
|
else if {_hh} < 6:
|
||||||
|
add {_x} to {_ret}
|
||||||
|
return 0-{_ret}
|
||||||
|
|
||||||
|
function rgb(r: number, g: number, b: number, locs: locations):
|
||||||
|
loop {_locs::*}:
|
||||||
|
set {_x} to x-coordinate of loop-value
|
||||||
|
set {_y} to y-coordinate of loop-value
|
||||||
|
set {_z} to z-coordinate of loop-value
|
||||||
|
execute command "/particle reddust %{_x}% %{_y}% %{_z}% %{_r}% %{_g}% %{_b}% 1"
|
||||||
|
|
||||||
|
function rainbow(h: number, locs: locations):
|
||||||
|
set {_r} to hsvtorgb("r", {_h}, 1, 1)
|
||||||
|
set {_g} to hsvtorgb("g", {_h}, 1, 1)
|
||||||
|
set {_b} to hsvtorgb("b", {_h}, 1, 1)
|
||||||
|
rgb({_r}, {_g}, {_b}, {_locs::*})
|
||||||
|
|
||||||
|
command /color-circles:
|
||||||
|
trigger:
|
||||||
|
set {_circle::*} to circle with radius 1 and density 5
|
||||||
|
set {_line::*} to vector line from vector 0, 2, 0 to vector 0, 0, 0 with density 4
|
||||||
|
loop {_line::*}:
|
||||||
|
set {_hue} to random number between 0 and 360
|
||||||
|
set {_locs::*} to player offset by loop-value offset by {_circle::*}
|
||||||
|
rainbow({_hue}, {_locs::*})
|
||||||
|
wait 1 tick
|
||||||
|
set gamemode of player to spectator
|
||||||
|
wait 2 seconds
|
||||||
|
set gamemode of player to creative
|
||||||
|
|
||||||
|
command /line-circle:
|
||||||
|
trigger:
|
||||||
|
set {_circle::*} to circle with radius 5 and density 1
|
||||||
|
set {_bigcircle::*} to {_circle::*} scaled by 1.5
|
||||||
|
loop size of {_circle::*} times:
|
||||||
|
add vector line from {_circle::%loop-number%} to {_bigcircle::%loop-number%} with density 5 to {_lines::*}
|
||||||
|
show happy villager at location 8 in front of player offset by {_lines::*}
|
||||||
|
|
||||||
|
command /line-circle-2:
|
||||||
|
trigger:
|
||||||
|
set {_circle::*} to circle with radius 2.5 and density 2
|
||||||
|
set {_bigcircle::*} to {_circle::*} scaled by 3
|
||||||
|
set {_size} to size of {_circle::*}
|
||||||
|
loop {_size} times:
|
||||||
|
add vector line from {_circle::%loop-number%} to {_bigcircle::%loop-number%} with density 5 to {_lines::%loop-number%::*}
|
||||||
|
set {run} to true
|
||||||
|
while {run} is true:
|
||||||
|
set {_hue} to 50
|
||||||
|
loop {_size} times:
|
||||||
|
set {_locs::*} to location 8 in front of player offset by {_lines::%loop-number%::*}
|
||||||
|
add 10 to {_hue}
|
||||||
|
rainbow({_hue}, {_locs::*})
|
||||||
|
if {run} is true:
|
||||||
|
wait 1 tick
|
||||||
|
else:
|
||||||
|
stop trigger
|
||||||
|
|
||||||
|
command /line-vortex:
|
||||||
|
trigger:
|
||||||
|
set {_circle::*} to circle with radius 3 and density 2
|
||||||
|
add {_circle::*} to {_circle::*}
|
||||||
|
set {_bigcircle::*} to {_circle::*} scaled by 2
|
||||||
|
loop size of {_circle::*} / 2 times:
|
||||||
|
add vector line from {_circle::%loop-number%} to {_bigcircle::%loop-number + 7%} with density 5 to {_lines::*}
|
||||||
|
show happy villager at location 8 in front of player offset by {_lines::*}
|
||||||
|
|
||||||
|
command /line-vortex-2:
|
||||||
|
trigger:
|
||||||
|
set {_circle::*} to circle with radius 3 and density 2
|
||||||
|
add {_circle::*} to {_circle::*}
|
||||||
|
set {_bigcircle::*} to {_circle::*} scaled by 2
|
||||||
|
set {_smallcircle::*} to {_circle::*} scaled by 0.5
|
||||||
|
loop size of {_circle::*} / 2 times:
|
||||||
|
add vector line from {_circle::%loop-number%} to {_bigcircle::%loop-number + 7%} with density 5 to {_lines::*}
|
||||||
|
add vector line from {_circle::%loop-number%} to {_smallcircle::%loop-number + 7%} with density 5 to {_lines::*}
|
||||||
|
show happy villager at location 8 in front of player offset by {_lines::*}
|
||||||
|
|
||||||
|
command /miniblock-halo <integer>:
|
||||||
|
trigger:
|
||||||
|
set {_size} to ceil(100/arg 1) * arg 1
|
||||||
|
set {_circle::*} to polygon with {_size} points and radius 0.6
|
||||||
|
add {_circle::*} to {_circle::*}
|
||||||
|
set {_armorstandoffset} to vector 0.3, 1.5, -0.2
|
||||||
|
set {_loc} to player offset by {_circle::1}
|
||||||
|
set {_x} to x-coordinate of {_loc}
|
||||||
|
set {_y} to y-coordinate of {_loc}
|
||||||
|
set {_z} to z-coordinate of {_loc}
|
||||||
|
loop arg-1 times:
|
||||||
|
execute command "/summon armor_stand %{_x}% %{_y}% %{_z}% {Invisible:1b,Small:1b,Invulnerable:1b,NoBasePlate:1b,NoGravity:1b,Marker:1b,ArmorItems:[{},{},{},{}],HandItems:[{id:red_glazed_terracotta,Count:1b},{}],CustomName:biosphere2-%loop-number%}"
|
||||||
|
set {_numadd} to {_size} / arg 1
|
||||||
|
set {run} to true
|
||||||
|
while {run} is true:
|
||||||
|
loop arg-1 times:
|
||||||
|
set {_num::%loop-number-1%} to (loop-number-1 - 1) * {_numadd}
|
||||||
|
loop {_size} times:
|
||||||
|
loop arg-1 times:
|
||||||
|
add 1 to {_num::%loop-number-2%}
|
||||||
|
set {_loc} to player offset by {_armorstandoffset} offset by {_circle::%{_num::%loop-number-2%}%}
|
||||||
|
set {_x} to x-coordinate of {_loc}
|
||||||
|
set {_y} to y-coordinate of {_loc}
|
||||||
|
set {_z} to z-coordinate of {_loc}
|
||||||
|
execute command "/tp @e[name=biosphere2-%loop-number-2%] %{_x}% %{_y}% %{_z}%"
|
||||||
|
if {run} is true:
|
||||||
|
wait 1 tick
|
||||||
|
else:
|
||||||
|
stop trigger
|
||||||
|
|
||||||
|
command /rainbow-halo:
|
||||||
|
trigger:
|
||||||
|
set {_circle::*} to circle with radius 0.75 and density 5
|
||||||
|
set {_hue} to 0
|
||||||
|
set {run} to true
|
||||||
|
while {run} is true:
|
||||||
|
loop {_circle::*}:
|
||||||
|
set {_loc} to location 2 above player offset by loop-value in frame of player
|
||||||
|
rainbow({_hue}, {_loc})
|
||||||
|
add 5 to {_hue}
|
||||||
|
if {_hue} > 360:
|
||||||
|
set {_hue} to {_hue} - 360
|
||||||
|
if {run} is true:
|
||||||
|
wait 2 ticks
|
||||||
|
else:
|
||||||
|
stop trigger
|
||||||
|
|
||||||
|
command /rainbow-yaw-helix:
|
||||||
|
trigger:
|
||||||
|
set {_helix::*} to helix with radius 1, height 2, step 0.25 and density 10
|
||||||
|
set {_hue} to 0
|
||||||
|
set {run} to true
|
||||||
|
while {run} is true:
|
||||||
|
loop {_helix::*}:
|
||||||
|
set {_loc} to player offset by loop-value
|
||||||
|
set {_yaw} to yaw of player
|
||||||
|
rainbow({_yaw}, {_loc}) # Shows a colored particle at {_loc}
|
||||||
|
if {run} is true:
|
||||||
|
wait 1 tick
|
||||||
|
else:
|
||||||
|
stop trigger
|
||||||
|
|
||||||
|
function rainbow_lines(p: player):
|
||||||
|
set {_yaw} to random number from 0 to 360
|
||||||
|
set {_startheight} to random number from -0.5 to 1.5
|
||||||
|
set {_endheight} to {_startheight} + random number from 1 to 2
|
||||||
|
set {_hue} to random number from 0 to 360
|
||||||
|
set {_start} to cylindrical vector with radius 0.75, yaw {_yaw} and height {_startheight}
|
||||||
|
set {_end} to cylindrical vector with radius 0.75, yaw {_yaw} and height {_endheight}
|
||||||
|
set {_line::*} to vector line from {_start} to {_end} with density 5
|
||||||
|
loop {_line::*}:
|
||||||
|
set {_loc} to {_p} offset by loop-value
|
||||||
|
rainbow({_hue}, {_loc}) # Shows a colored particle at {_loc}
|
||||||
|
if {run} is true:
|
||||||
|
wait 1 tick
|
||||||
|
else:
|
||||||
|
stop loop
|
||||||
|
|
||||||
|
command /rainbow-lines:
|
||||||
|
trigger:
|
||||||
|
set {_line::*} to vector line from vector 0, 0, 0 to vector 0, 1, 0 with density 5
|
||||||
|
set {_size} to size of {_line::*}
|
||||||
|
set {run} to true
|
||||||
|
while {run} is true:
|
||||||
|
chance of 50%:
|
||||||
|
rainbow_lines(player) # Shows a colored particle line at {_loc}
|
||||||
|
wait 5 ticks
|
||||||
|
|
||||||
|
command /star <integer=5>:
|
||||||
|
trigger:
|
||||||
|
set {_poly::*} to polygon with arg-1 points and radius 5
|
||||||
|
add {_poly::*} to {_poly::*} # This allows me to use loop-number + 2 without exceeding the list size in the loop
|
||||||
|
loop arg-1 times:
|
||||||
|
add vector line from {_poly::%loop-number%} to {_poly::%loop-number + 2%} with density 5 to {_star::*}
|
||||||
|
show happy villager at location 5 in front of player offset by {_star::*}
|
||||||
|
|
||||||
|
command /star-2 <integer=5>:
|
||||||
|
trigger:
|
||||||
|
set {_poly::*} to polygon with arg-1 points and radius 5
|
||||||
|
add {_poly::*} to {_poly::*} # This allows me to use loop-number + 2 without exceeding the list size in the loop
|
||||||
|
loop arg-1 times:
|
||||||
|
add vector line from {_poly::%loop-number%} to {_poly::%loop-number + 2%} with density 5 to {_star::*}
|
||||||
|
add vector line from {_poly::%loop-number%} to {_poly::%loop-number + 4%} with density 5 to {_star::*}
|
||||||
|
show happy villager at location 5 in front of player offset by {_star::*}
|
||||||
|
|
||||||
|
command /star-player <integer=7>:
|
||||||
|
trigger:
|
||||||
|
set {_poly::*} to polygon with arg-1 points and radius 5
|
||||||
|
add {_poly::*} to {_poly::*} # This allows me to use loop-number + 2 without exceeding the list size in the loop
|
||||||
|
loop arg-1 times:
|
||||||
|
add vector line from {_poly::%loop-number%} to {_poly::%loop-number + 2%} with density 5 to {_star::*}
|
||||||
|
set {_star::*} to {_star::*} rotated around z-axis by -90
|
||||||
|
show happy villager at location 7 in front of player's head offset by {_star::*} in frame of player
|
||||||
|
|
||||||
|
|
||||||
|
command /stopeffect:
|
||||||
|
trigger:
|
||||||
|
clear {run}
|
||||||
|
execute command "/kill @e[name=biosphere2]"
|
||||||
|
loop 30 times:
|
||||||
|
execute command "/kill @e[name=biosphere2-%loop-number%]"
|
||||||
@@ -27,6 +27,8 @@ public class Biosphere extends JavaPlugin {
|
|||||||
Skript.registerExpression(ExprFrameFromYawPitch.class, Frame.class, ExpressionType.SIMPLE, "frame with yaw %number% and pitch %number%");
|
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%");
|
Skript.registerExpression(ExprFrameYawPitch.class, Number.class, ExpressionType.PROPERTY, "frame (0¦yaw|1¦pitch) of %frame%");
|
||||||
|
|
||||||
|
Skript.registerExpression(ExprLocationBox.class, Location.class, ExpressionType.SIMPLE, "box between %location% and %location%");
|
||||||
|
Skript.registerExpression(ExprLocationBoxOutline.class, Location.class, ExpressionType.SIMPLE, "box outline between %location% and %location% with density %number%");
|
||||||
Skript.registerExpression(ExprLocationCircle.class, Location.class, ExpressionType.SIMPLE, "circle[s] at %locations%[ with] radius %number%(,| and) density %number%");
|
Skript.registerExpression(ExprLocationCircle.class, Location.class, ExpressionType.SIMPLE, "circle[s] at %locations%[ with] radius %number%(,| and) density %number%");
|
||||||
Skript.registerExpression(ExprLocationCube.class, Location.class, ExpressionType.SIMPLE, "cube[s] at %locations% with radius %number%");
|
Skript.registerExpression(ExprLocationCube.class, Location.class, ExpressionType.SIMPLE, "cube[s] at %locations% with radius %number%");
|
||||||
Skript.registerExpression(ExprLocationCubeOutline.class, Location.class, ExpressionType.SIMPLE, "cube[s] outline[s] at %locations% with radius %number%(,| and) density %number%");
|
Skript.registerExpression(ExprLocationCubeOutline.class, Location.class, ExpressionType.SIMPLE, "cube[s] outline[s] at %locations% with radius %number%(,| and) density %number%");
|
||||||
@@ -39,8 +41,8 @@ public class Biosphere extends JavaPlugin {
|
|||||||
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(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(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(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(ExprLocationPolygon.class, Location.class, ExpressionType.SIMPLE, "polygon[s] at %locations% with %number% (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(ExprLocationPolygonOutline.class, Location.class, ExpressionType.SIMPLE, "polygon[s] outline[s] at %locations% with %number% (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(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(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(ExprLocationRotXYZ.class, Location.class, ExpressionType.SIMPLE, "%locations% rotated around (1¦x|2¦y|3¦z)(-| )axis at %location% (with angle|by) %number%[ degree[s]]");
|
||||||
@@ -49,6 +51,8 @@ public class Biosphere extends JavaPlugin {
|
|||||||
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(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%");
|
Skript.registerExpression(ExprLocationSphereRand.class, Location.class, ExpressionType.SIMPLE, "random sphere[s] at %locations% with radius %number%(,| and) density %number%");
|
||||||
|
|
||||||
|
Skript.registerExpression(ExprVectorBox.class, Vector.class, ExpressionType.SIMPLE, "vector box between %vector% and %vector%");
|
||||||
|
Skript.registerExpression(ExprVectorBoxOutline.class, Vector.class, ExpressionType.SIMPLE, "vector box outline between %vector% and %vector% with density %number%");
|
||||||
Skript.registerExpression(ExprVectorCircle.class, Vector.class, ExpressionType.SIMPLE, "[vector ]circle with radius %number%(,| and) density %number%");
|
Skript.registerExpression(ExprVectorCircle.class, Vector.class, ExpressionType.SIMPLE, "[vector ]circle with radius %number%(,| and) density %number%");
|
||||||
Skript.registerExpression(ExprVectorCube.class, Vector.class, ExpressionType.SIMPLE, "[vector ]cube with radius %number%");
|
Skript.registerExpression(ExprVectorCube.class, Vector.class, ExpressionType.SIMPLE, "[vector ]cube with radius %number%");
|
||||||
Skript.registerExpression(ExprVectorCubeOutline.class, Vector.class, ExpressionType.SIMPLE, "[vector ]cube outline with radius %number%(,| and) density %number%");
|
Skript.registerExpression(ExprVectorCubeOutline.class, Vector.class, ExpressionType.SIMPLE, "[vector ]cube outline with radius %number%(,| and) density %number%");
|
||||||
@@ -61,8 +65,8 @@ public class Biosphere extends JavaPlugin {
|
|||||||
Skript.registerExpression(ExprVectorMove.class, Vector.class, ExpressionType.SIMPLE, "[vector[s] ]%vectors% moved by %vectors%");
|
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(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(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(ExprVectorPolygon.class, Vector.class, ExpressionType.SIMPLE, "[vector ]polygon with %number% (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(ExprVectorPolygonOutline.class, Vector.class, ExpressionType.SIMPLE, "[vector ]polygon outline with %number% (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(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(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(ExprVectorRotateXYZ.class, Vector.class, ExpressionType.SIMPLE, "[vector[s] ]%vectors% rotated around (1¦x|2¦y|3¦z)(-| )axis (with angle|by) %number%[ degree[s]]");
|
||||||
|
|||||||
@@ -0,0 +1,50 @@
|
|||||||
|
package io.github.bi0qaw.biosphere.expression;
|
||||||
|
|
||||||
|
import ch.njol.skript.doc.Description;
|
||||||
|
import ch.njol.skript.doc.Examples;
|
||||||
|
import ch.njol.skript.doc.Name;
|
||||||
|
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;
|
||||||
|
|
||||||
|
|
||||||
|
@Name("Location Box")
|
||||||
|
@Description("Creates a list of locations in the shape of a box (only the corners!).")
|
||||||
|
@Examples({"set {_box::*} to box between player and location 5 right, 5 in front and 5 above player",
|
||||||
|
"show happy villager at {_box::*}"})
|
||||||
|
public class ExprLocationBox extends SimpleExpression<Location> {
|
||||||
|
|
||||||
|
private Expression<Location> location1;
|
||||||
|
private Expression<Location> location2;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Location[] get(Event event) {
|
||||||
|
return LocationLib.getBox(location1.getSingle(event), location2.getSingle(event));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSingle() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<? extends Location> getReturnType() {
|
||||||
|
return Location.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString(Event event, boolean b) {
|
||||||
|
return "box between " + location1.toString(event, b) + " and " + location2.toString(event, b);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean init(Expression<?>[] expressions, int i, Kleenean kleenean, SkriptParser.ParseResult parseResult) {
|
||||||
|
location1 = (Expression<Location>) expressions[0];
|
||||||
|
location2 = (Expression<Location>) expressions[1];
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
package io.github.bi0qaw.biosphere.expression;
|
||||||
|
|
||||||
|
import ch.njol.skript.doc.Description;
|
||||||
|
import ch.njol.skript.doc.Examples;
|
||||||
|
import ch.njol.skript.doc.Name;
|
||||||
|
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;
|
||||||
|
|
||||||
|
|
||||||
|
@Name("Location Box Outline")
|
||||||
|
@Description("Creates a list of vectors in the shape of a box including corners and edges. The density value controls the amount of points. A higher number increases the amount of points. A density of 1 corresponds to 1 point per block.")
|
||||||
|
@Examples({"set {_boxoutline::*} to box outline between player and location 5 right, 5 in front and 5 above player with density 5",
|
||||||
|
"show happy villager at {_boxoutline::*}"})
|
||||||
|
public class ExprLocationBoxOutline extends SimpleExpression<Location> {
|
||||||
|
|
||||||
|
private Expression<Location> location1;
|
||||||
|
private Expression<Location> location2;
|
||||||
|
private Expression<Number> density;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Location[] get(Event event) {
|
||||||
|
return LocationLib.getBoxOutline(location1.getSingle(event), location2.getSingle(event), density.getSingle(event).doubleValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSingle() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<? extends Location> getReturnType() {
|
||||||
|
return Location.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString(Event event, boolean b) {
|
||||||
|
return "box outline between " + location1.toString(event, b) + " and " + location2.toString(event, b) + " with denstiy " + density.toString(event, b);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean init(Expression<?>[] expressions, int i, Kleenean kleenean, SkriptParser.ParseResult parseResult) {
|
||||||
|
location1 = (Expression<Location>) expressions[0];
|
||||||
|
location2 = (Expression<Location>) expressions[1];
|
||||||
|
density = (Expression<Number>) expressions[2];
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
package io.github.bi0qaw.biosphere.expression;
|
package io.github.bi0qaw.biosphere.expression;
|
||||||
|
|
||||||
|
import ch.njol.skript.doc.Description;
|
||||||
|
import ch.njol.skript.doc.Examples;
|
||||||
|
import ch.njol.skript.doc.Name;
|
||||||
import ch.njol.skript.lang.Expression;
|
import ch.njol.skript.lang.Expression;
|
||||||
import ch.njol.skript.lang.SkriptParser;
|
import ch.njol.skript.lang.SkriptParser;
|
||||||
import ch.njol.skript.lang.util.SimpleExpression;
|
import ch.njol.skript.lang.util.SimpleExpression;
|
||||||
@@ -8,6 +11,12 @@ import io.github.bi0qaw.biosphere.util.LocationLib;
|
|||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
|
|
||||||
|
|
||||||
|
@Name("Location Path")
|
||||||
|
@Description("Creates a path between the locations. The density value controls the amount of points. A higher number increases the amount of points. A density of 1 corresponds to 1 point per block.")
|
||||||
|
@Examples({"set {_polygon::*} to polygon at player with 7 points and radius 3",
|
||||||
|
"set {_path::*} to path between {_polygon::*} with density 5",
|
||||||
|
"show happy villager at {_path::*}"})
|
||||||
public class ExprLocationPath extends SimpleExpression<Location> {
|
public class ExprLocationPath extends SimpleExpression<Location> {
|
||||||
|
|
||||||
private Expression<Location> locations;
|
private Expression<Location> locations;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import ch.njol.util.Kleenean;
|
|||||||
public class ExprLocationPolygon extends SimpleExpression<Location>{
|
public class ExprLocationPolygon extends SimpleExpression<Location>{
|
||||||
|
|
||||||
private Expression<Location> locations;
|
private Expression<Location> locations;
|
||||||
private Expression<Integer> points;
|
private Expression<Number> points;
|
||||||
private Expression<Number> radius;
|
private Expression<Number> radius;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -40,7 +40,7 @@ public class ExprLocationPolygon extends SimpleExpression<Location>{
|
|||||||
@Override
|
@Override
|
||||||
public boolean init(Expression<?>[] expr, int arg1, Kleenean arg2, ParseResult arg3) {
|
public boolean init(Expression<?>[] expr, int arg1, Kleenean arg2, ParseResult arg3) {
|
||||||
locations = (Expression<Location>) expr[0];
|
locations = (Expression<Location>) expr[0];
|
||||||
points = (Expression<Integer>) expr[1];
|
points = (Expression<Number>) expr[1];
|
||||||
radius = (Expression<Number>) expr[2];
|
radius = (Expression<Number>) expr[2];
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import ch.njol.util.Kleenean;
|
|||||||
public class ExprLocationPolygonOutline extends SimpleExpression<Location>{
|
public class ExprLocationPolygonOutline extends SimpleExpression<Location>{
|
||||||
|
|
||||||
private Expression<Location> locations;
|
private Expression<Location> locations;
|
||||||
private Expression<Integer> points;
|
private Expression<Number> points;
|
||||||
private Expression<Number> radius;
|
private Expression<Number> radius;
|
||||||
private Expression<Number> density;
|
private Expression<Number> density;
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ public class ExprLocationPolygonOutline extends SimpleExpression<Location>{
|
|||||||
@Override
|
@Override
|
||||||
public boolean init(Expression<?>[] expr, int arg1, Kleenean arg2, ParseResult arg3) {
|
public boolean init(Expression<?>[] expr, int arg1, Kleenean arg2, ParseResult arg3) {
|
||||||
locations = (Expression<Location>) expr[0];
|
locations = (Expression<Location>) expr[0];
|
||||||
points = (Expression<Integer>) expr[1];
|
points = (Expression<Number>) expr[1];
|
||||||
radius = (Expression<Number>) expr[2];
|
radius = (Expression<Number>) expr[2];
|
||||||
density = (Expression<Number>) expr[3];
|
density = (Expression<Number>) expr[3];
|
||||||
return true;
|
return true;
|
||||||
@@ -53,7 +53,7 @@ public class ExprLocationPolygonOutline extends SimpleExpression<Location>{
|
|||||||
@Override
|
@Override
|
||||||
@Nullable
|
@Nullable
|
||||||
protected Location[] get(Event e) {
|
protected Location[] get(Event e) {
|
||||||
int p = points.getSingle(e).intValue();
|
int p = points.getSingle(e).intValue();
|
||||||
double r = radius.getSingle(e).doubleValue();
|
double r = radius.getSingle(e).doubleValue();
|
||||||
double d = density.getSingle(e).doubleValue();
|
double d = density.getSingle(e).doubleValue();
|
||||||
return LocationLib.getPolygonOutline(locations.getArray(e), p, r, d);
|
return LocationLib.getPolygonOutline(locations.getArray(e), p, r, d);
|
||||||
|
|||||||
@@ -0,0 +1,50 @@
|
|||||||
|
package io.github.bi0qaw.biosphere.expression;
|
||||||
|
|
||||||
|
import ch.njol.skript.doc.Description;
|
||||||
|
import ch.njol.skript.doc.Examples;
|
||||||
|
import ch.njol.skript.doc.Name;
|
||||||
|
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;
|
||||||
|
|
||||||
|
|
||||||
|
@Name("Vector Box")
|
||||||
|
@Description("Creates a list of vectors in the shape of a box (only the corners!).")
|
||||||
|
@Examples({"set {_box::*} to vector box between vector -2.5, -2.5, -2.5 and vector 2.5, 2.5, 2.5",
|
||||||
|
"show happy villager at player's head offset by {_box::*}"})
|
||||||
|
public class ExprVectorBox extends SimpleExpression<Vector>{
|
||||||
|
|
||||||
|
private Expression<Vector> vector1;
|
||||||
|
private Expression<Vector> vector2;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Vector[] get(Event event) {
|
||||||
|
return VectorLib.getBox(vector1.getSingle(event), vector2.getSingle(event));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSingle() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<? extends Vector> getReturnType() {
|
||||||
|
return Vector.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString(Event event, boolean b) {
|
||||||
|
return "vector box between " + vector1.toString(event, b) + " and " + vector2.toString(event, b);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean init(Expression<?>[] expressions, int i, Kleenean kleenean, SkriptParser.ParseResult parseResult) {
|
||||||
|
vector1 = (Expression<Vector>) expressions[0];
|
||||||
|
vector2 = (Expression<Vector>) expressions[1];
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
package io.github.bi0qaw.biosphere.expression;
|
||||||
|
|
||||||
|
import ch.njol.skript.doc.Description;
|
||||||
|
import ch.njol.skript.doc.Examples;
|
||||||
|
import ch.njol.skript.doc.Name;
|
||||||
|
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;
|
||||||
|
|
||||||
|
|
||||||
|
@Name("Vector Box Outline")
|
||||||
|
@Description("Creates a list of vectors in the shape of a box including corners and edges. The density value controls the amount of points. A higher number increases the amount of points. A density of 1 corresponds to 1 point per block.")
|
||||||
|
@Examples({"set {_boxoutline::*} to vector box outline between vector -2.5, -2.5, -2.5 and vector 2.5, 2.5, 2.5 with density 5",
|
||||||
|
"show happy villager at player's head offset by {_boxoutline::*}"})
|
||||||
|
public class ExprVectorBoxOutline extends SimpleExpression<Vector>{
|
||||||
|
|
||||||
|
private Expression<Vector> vector1;
|
||||||
|
private Expression<Vector> vector2;
|
||||||
|
private Expression<Number> density;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Vector[] get(Event event) {
|
||||||
|
return VectorLib.getBoxOutline(vector1.getSingle(event), vector2.getSingle(event), density.getSingle(event).doubleValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSingle() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<? extends Vector> getReturnType() {
|
||||||
|
return Vector.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString(Event event, boolean b) {
|
||||||
|
return "vector box outline between " + vector1.toString(event, b) + " and " + vector2.toString(event, b) + " with density " + density.toString(event, b);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean init(Expression<?>[] expressions, int i, Kleenean kleenean, SkriptParser.ParseResult parseResult) {
|
||||||
|
vector1 = (Expression<Vector>) expressions[0];
|
||||||
|
vector2 = (Expression<Vector>) expressions[1];
|
||||||
|
density = (Expression<Number>) expressions[2];
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
package io.github.bi0qaw.biosphere.expression;
|
package io.github.bi0qaw.biosphere.expression;
|
||||||
|
|
||||||
|
import ch.njol.skript.doc.Description;
|
||||||
|
import ch.njol.skript.doc.Examples;
|
||||||
|
import ch.njol.skript.doc.Name;
|
||||||
import ch.njol.skript.lang.Expression;
|
import ch.njol.skript.lang.Expression;
|
||||||
import ch.njol.skript.lang.SkriptParser;
|
import ch.njol.skript.lang.SkriptParser;
|
||||||
import ch.njol.skript.lang.util.SimpleExpression;
|
import ch.njol.skript.lang.util.SimpleExpression;
|
||||||
@@ -8,6 +11,14 @@ import io.github.bi0qaw.biosphere.util.VectorLib;
|
|||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
|
||||||
|
@Name("Vector Offset")
|
||||||
|
@Description("Adds each offset to all vectors")
|
||||||
|
@Examples({"#creates a 8 circles on the vertices of a cube and displays them with particles around the player",
|
||||||
|
"set {_cube::*} to cube with radius 3",
|
||||||
|
"set {_circle::*} to circle with radius 2 and density 5",
|
||||||
|
"set {_cube-circles::*} to vectors {_cube::*} offset by {_circle::*}",
|
||||||
|
"show happy villager at player offset by {_cube-circles::*}"})
|
||||||
public class ExprVectorOffset extends SimpleExpression<Vector> {
|
public class ExprVectorOffset extends SimpleExpression<Vector> {
|
||||||
|
|
||||||
private Expression<Vector> vectors;
|
private Expression<Vector> vectors;
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
package io.github.bi0qaw.biosphere.expression;
|
package io.github.bi0qaw.biosphere.expression;
|
||||||
|
|
||||||
|
import ch.njol.skript.doc.Description;
|
||||||
|
import ch.njol.skript.doc.Examples;
|
||||||
|
import ch.njol.skript.doc.Name;
|
||||||
import ch.njol.skript.lang.Expression;
|
import ch.njol.skript.lang.Expression;
|
||||||
import ch.njol.skript.lang.SkriptParser;
|
import ch.njol.skript.lang.SkriptParser;
|
||||||
import ch.njol.skript.lang.util.SimpleExpression;
|
import ch.njol.skript.lang.util.SimpleExpression;
|
||||||
@@ -8,6 +11,11 @@ import io.github.bi0qaw.biosphere.util.VectorLib;
|
|||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
@Name("Vector Path")
|
||||||
|
@Description("Creates a path between vectors. The density value controls the amount of points. A higher number increases the amount of points. A density of 1 corresponds to 1 point per block.")
|
||||||
|
@Examples({"set {_polygon::*} to polygon with 7 points and radius 3",
|
||||||
|
"set {_path::*} to vector path between {_polygon::*} with density 5",
|
||||||
|
"show happy villager at player offset by {_path::*}"})
|
||||||
public class ExprVectorPath extends SimpleExpression<Vector>{
|
public class ExprVectorPath extends SimpleExpression<Vector>{
|
||||||
|
|
||||||
private Expression<Vector> vectors;
|
private Expression<Vector> vectors;
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import javax.annotation.Nullable;
|
|||||||
"#shows particles in the shape of a triangle at the player"})
|
"#shows particles in the shape of a triangle at the player"})
|
||||||
public class ExprVectorPolygon extends SimpleExpression<Vector>{
|
public class ExprVectorPolygon extends SimpleExpression<Vector>{
|
||||||
|
|
||||||
private Expression<Integer> vertices;
|
private Expression<Number> vertices;
|
||||||
private Expression<Number> radius;
|
private Expression<Number> radius;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -36,7 +36,7 @@ public class ExprVectorPolygon extends SimpleExpression<Vector>{
|
|||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public boolean init(Expression<?>[] expr, int arg1, Kleenean arg2, SkriptParser.ParseResult arg3) {
|
public boolean init(Expression<?>[] expr, int arg1, Kleenean arg2, SkriptParser.ParseResult arg3) {
|
||||||
vertices = (Expression<Integer>) expr[0];
|
vertices = (Expression<Number>) expr[0];
|
||||||
radius = (Expression<Number>) expr[1];
|
radius = (Expression<Number>) expr[1];
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import javax.annotation.Nullable;
|
|||||||
"#shows particles in the shape of a hexagon (6 points) at the player"})
|
"#shows particles in the shape of a hexagon (6 points) at the player"})
|
||||||
public class ExprVectorPolygonOutline extends SimpleExpression<Vector> {
|
public class ExprVectorPolygonOutline extends SimpleExpression<Vector> {
|
||||||
|
|
||||||
private Expression<Integer> vertices;
|
private Expression<Number> vertices;
|
||||||
private Expression<Number> radius;
|
private Expression<Number> radius;
|
||||||
private Expression<Number> density;
|
private Expression<Number> density;
|
||||||
|
|
||||||
@@ -37,7 +37,7 @@ public class ExprVectorPolygonOutline extends SimpleExpression<Vector> {
|
|||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public boolean init(Expression<?>[] expr, int arg1, Kleenean arg2, SkriptParser.ParseResult arg3) {
|
public boolean init(Expression<?>[] expr, int arg1, Kleenean arg2, SkriptParser.ParseResult arg3) {
|
||||||
vertices = (Expression<Integer>) expr[0];
|
vertices = (Expression<Number>) expr[0];
|
||||||
radius = (Expression<Number>) expr[1];
|
radius = (Expression<Number>) expr[1];
|
||||||
density = (Expression<Number>) expr[2];
|
density = (Expression<Number>) expr[2];
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -14,6 +14,16 @@ public class LocationLib {
|
|||||||
return offset(locations, circle);
|
return offset(locations, circle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Location[] getBox(Location location1, Location location2) {
|
||||||
|
Vector[] box = VectorLib.getBox(location1.toVector(), location2.toVector());
|
||||||
|
return toLocation(box, location1.getWorld());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Location[] getBoxOutline(Location location1, Location location2, double density) {
|
||||||
|
Vector[] boxoutline = VectorLib.getBoxOutline(location1.toVector(), location2.toVector(), density);
|
||||||
|
return toLocation(boxoutline, location1.getWorld());
|
||||||
|
}
|
||||||
|
|
||||||
public static Location[] getCube(Location[] locations, double radius) {
|
public static Location[] getCube(Location[] locations, double radius) {
|
||||||
Vector[] cube = VectorLib.getCube(radius);
|
Vector[] cube = VectorLib.getCube(radius);
|
||||||
return offset(locations, cube);
|
return offset(locations, cube);
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package io.github.bi0qaw.biosphere.util;
|
|||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
import java.lang.reflect.Array;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -81,6 +82,39 @@ public class VectorLib {
|
|||||||
return vectors.toArray(new Vector[vectors.size()]);
|
return vectors.toArray(new Vector[vectors.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Vector[] getBox(Vector vector1, Vector vector2) {
|
||||||
|
Vector[] vectors = new Vector[8];
|
||||||
|
Vector lower = VectorMath.getLower(vector1, vector2);
|
||||||
|
Vector upper = VectorMath.getUpper(vector1, vector2);
|
||||||
|
vectors[0] = lower.clone();
|
||||||
|
vectors[1] = new Vector(upper.getX(), lower.getY(), lower.getZ());
|
||||||
|
vectors[2] = new Vector(lower.getX(), upper.getY(), lower.getZ());
|
||||||
|
vectors[3] = new Vector(lower.getX(), lower.getY(), upper.getZ());
|
||||||
|
vectors[4] = new Vector(upper.getX(), upper.getY(), lower.getZ());
|
||||||
|
vectors[5] = new Vector(upper.getX(), lower.getY(), upper.getZ());
|
||||||
|
vectors[6] = new Vector(lower.getX(), upper.getY(), upper.getZ());
|
||||||
|
vectors[7] = upper.clone();
|
||||||
|
return vectors;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Vector[] getBoxOutline(Vector vector1, Vector vector2, double density) {
|
||||||
|
Vector[] box = getBox(vector1, vector2);
|
||||||
|
List<Vector> vecs = new ArrayList<Vector>();
|
||||||
|
vecs.addAll(Arrays.asList(linkLine(box[0], box[1], density)));
|
||||||
|
vecs.addAll(Arrays.asList(linkLine(box[0], box[2], density)));
|
||||||
|
vecs.addAll(Arrays.asList(linkLine(box[0], box[3], density)));
|
||||||
|
vecs.addAll(Arrays.asList(linkLine(box[1], box[4], density)));
|
||||||
|
vecs.addAll(Arrays.asList(linkLine(box[1], box[5], density)));
|
||||||
|
vecs.addAll(Arrays.asList(linkLine(box[2], box[4], density)));
|
||||||
|
vecs.addAll(Arrays.asList(linkLine(box[2], box[6], density)));
|
||||||
|
vecs.addAll(Arrays.asList(linkLine(box[3], box[5], density)));
|
||||||
|
vecs.addAll(Arrays.asList(linkLine(box[3], box[6], density)));
|
||||||
|
vecs.addAll(Arrays.asList(linkLine(box[4], box[7], density)));
|
||||||
|
vecs.addAll(Arrays.asList(linkLine(box[5], box[7], density)));
|
||||||
|
vecs.addAll(Arrays.asList(linkLine(box[6], box[7], density)));
|
||||||
|
return vecs.toArray(new Vector[vecs.size()]);
|
||||||
|
}
|
||||||
|
|
||||||
public static Vector[] getCube(double radius) {
|
public static Vector[] getCube(double radius) {
|
||||||
Vector[] vectors = new Vector[8];
|
Vector[] vectors = new Vector[8];
|
||||||
double d = radius / SQRT2;
|
double d = radius / SQRT2;
|
||||||
|
|||||||
@@ -33,6 +33,20 @@ public class VectorMath {
|
|||||||
return new Vector(x,0, z).multiply(div).setY(y);
|
return new Vector(x,0, z).multiply(div).setY(y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Vector getLower(Vector vector1, Vector vector2) {
|
||||||
|
double x = Math.min(vector1.getX(), vector2.getX());
|
||||||
|
double y = Math.min(vector1.getY(), vector2.getY());
|
||||||
|
double z = Math.min(vector1.getZ(), vector2.getZ());
|
||||||
|
return new Vector(x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Vector getUpper(Vector vector1, Vector vector2) {
|
||||||
|
double x = Math.max(vector1.getX(), vector2.getX());
|
||||||
|
double y = Math.max(vector1.getY(), vector2.getY());
|
||||||
|
double z = Math.max(vector1.getZ(), vector2.getZ());
|
||||||
|
return new Vector(x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
public static float getYaw(Vector vector) {
|
public static float getYaw(Vector vector) {
|
||||||
if (((Double) vector.getX()).equals((double) 0) && ((Double) vector.getZ()).equals((double) 0)){
|
if (((Double) vector.getX()).equals((double) 0) && ((Double) vector.getZ()).equals((double) 0)){
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
name: Biosphere2
|
name: Biosphere2
|
||||||
main: io.github.bi0qaw.biosphere.Biosphere
|
main: io.github.bi0qaw.biosphere.Biosphere
|
||||||
author: bi0qaw
|
author: bi0qaw
|
||||||
version: 1.0.1
|
version: 1.0.2
|
||||||
Reference in New Issue
Block a user