Skip to content

Commit dd8d85e

Browse files
committed
Improve data pack visualizer type detection
The visualizer options are mutually exclusive, so there's no need to have an `if` in every single one of them.
1 parent bfa9ec6 commit dd8d85e

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

scripts/dat_generate/dat_generate.gml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ function dat_generate(argument0, argument1, argument2) {
5151
}
5252
}
5353

54-
if o.dat_vis_type = "Fall" { // Fall
54+
else if o.dat_vis_type = "Fall" { // Fall
5555
str += "summon minecraft:falling_block " + string(key - 45 + real(o.dat_xval)) + " " + string(o.dat_yval) + " " + string((ins_index * 2) + real(o.dat_zval)) + " " + "{BlockState:{Name:\"minecraft:"+ block_id + "\"},"
5656
if o.dat_glow = 1 {
5757
str += "Tags:[\"nbs\",\"nbs_" + team_number + "\"],Glowing:1,"
@@ -62,7 +62,7 @@ function dat_generate(argument0, argument1, argument2) {
6262
}
6363
}
6464

65-
if o.dat_vis_type = "Piano Roll" { // Piano Roll
65+
else if o.dat_vis_type = "Piano Roll" { // Piano Roll
6666
str += "summon minecraft:falling_block " + string(real((key - 45) * -1) + real(o.dat_xval)) + " " + string(o.dat_yval) + " " + string(real(o.dat_zval)) + " " + "{BlockState:{Name:\"minecraft:"+ block_id + "\"},"
6767
if o.dat_glow = 1 {
6868
str += "Tags:[\"nbs\",\"nbs_" + team_number + "\"],Glowing:1,"
@@ -73,7 +73,7 @@ function dat_generate(argument0, argument1, argument2) {
7373
}
7474
}
7575

76-
if o.dat_vis_type = "Rise" { // Rise
76+
else if o.dat_vis_type = "Rise" { // Rise
7777
str += "summon minecraft:falling_block " + string(key - 45 + real(o.dat_xval)) + " " + string(o.dat_yval) + " " + string((ins_index * 2) + real(o.dat_zval)) + " " + "{BlockState:{Name:\"minecraft:"+ block_id + "\"},"
7878
if o.dat_glow = 1 {
7979
str += "Tags:[\"nbs\",\"nbs_" + team_number + "\"],Glowing:1,"
@@ -84,7 +84,7 @@ function dat_generate(argument0, argument1, argument2) {
8484
}
8585
}
8686

87-
if o.dat_vis_type = "Bounce" { // Bounce
87+
else if o.dat_vis_type = "Bounce" { // Bounce
8888
str += "summon minecraft:falling_block " + team_number + " " + string(o.dat_yval) + " " + string((ins_index * 2) + real(o.dat_zval)) + " " + "{BlockState:{Name:\"minecraft:"+ block_id + "\"},"
8989
if o.dat_glow = 1 {
9090
str += "Tags:[\"nbs\",\"nbs_" + team_number + "\"],Glowing:1,"
@@ -94,7 +94,8 @@ function dat_generate(argument0, argument1, argument2) {
9494
str += "team join nbs_" + team_number + " @e[tag=nbs_" + string(ins_index + 1) + "]" + br
9595
}
9696
}
97-
if o.dat_vis_type = "Fountain" { // Fountain
97+
98+
else if o.dat_vis_type = "Fountain" { // Fountain
9899
str += "summon minecraft:falling_block " + team_number + " " + string(o.dat_yval) + " " + string((ins_index * 2) + real(o.dat_zval)) + " " + "{BlockState:{Name:\"minecraft:"+ block_id + "\"},"
99100
if o.dat_glow = 1 {
100101
str += "Tags:[\"nbs\",\"nbs_" + team_number + "\"],Glowing:1,"
@@ -106,7 +107,8 @@ function dat_generate(argument0, argument1, argument2) {
106107
str += "team join nbs_" + team_number + " @e[tag=nbs_" + string(ins_index) + "]" + br
107108
}
108109
}
109-
if o.dat_vis_type = "Rittai Onkyou" { // Rittai Onkyou
110+
111+
else if o.dat_vis_type = "Rittai Onkyou" { // Rittai Onkyou
110112
str += "summon minecraft:falling_block " + string(blockposition * 48) + " " + string(90) + " " + string(blockvolume * 48) + " " +"{\"Tags\":[\"nbs\"],BlockState:{Name:\"minecraft:"+ block_id + "\"},Time:-80,DropItem:0,Motion:[0.0d,-1.3d,0.0d]}" + br
111113
+ "summon minecraft:falling_block " + string(blockposition * 48) + " " + string(90) + " " + string((blockvolume * 48) - 1) + " " +"{\"Tags\":[\"nbs\"],BlockState:{Name:\"minecraft:note_block\"},Time:-80,DropItem:0,Motion:[0.0d,-1.3d,0.0d]}" + br
112114
+ "particle minecraft:note " + string(blockposition * 48) + " " + string(90) + " " + string((blockvolume * 48) - 2) + " 0 0 0 1 1 force @p" + br

0 commit comments

Comments
 (0)