Skip to content

Commit

Permalink
what the fuck have you done to my code
Browse files Browse the repository at this point in the history
  • Loading branch information
Spigey committed May 3, 2024
1 parent 965722a commit 25feeb9
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/main/java/spigey/asteroide/util.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.StringNbtReader;
import net.minecraft.network.packet.c2s.play.CreativeInventoryActionC2SPacket;
import org.jetbrains.annotations.NotNull;
import spigey.asteroide.modules.BanStuffs;

import java.lang.reflect.Array;
Expand Down Expand Up @@ -204,15 +205,23 @@ public static void MultiCommandBlock(List<String> commands){
commands.add("setblock ~ ~1 ~ barrier");
commands.add("summon minecraft:falling_block ~ ~2 ~ {BlockState:{Name:command_block},TileEntityData:{Command:'fill ~ ~ ~ ~ ~-4 ~ air',auto:1b}}");
commands.add("kill @e[type=command_block_minecart,tag=oawiudoawiudoawidu]");
StringBuilder out = new StringBuilder("/summon falling_block ~ ~2 ~ {Time:1,BlockState:{Name:redstone_block}, Passengers:[{id:falling_block, Time:0, BlockState:{Name:activator_rail}");
for (int i = 0; i < commands.size(); i++) {
out.append(",Passengers:[{id:command_block_minecart, Tags:[\"oawiudoawiudoawidu\"], Command:\"").append(commands.get(i)).append("\"}]");
}
out.append("}]}");
StringBuilder out = getStringBuilder(commands);
try {
CommandBlock(Items.COMMAND_BLOCK, String.valueOf(out), 1, "Multi-Command Command Block", true);
} catch (CommandSyntaxException e) {
error(String.valueOf(e));
}
}

private static @NotNull StringBuilder getStringBuilder(List<String> commands) {
StringBuilder out = new StringBuilder("/summon falling_block ~ ~2 ~ {Time:1,BlockState:{Name:redstone_block}, Passengers:[{id:falling_block, Time:0, BlockState:{Name:activator_rail}");
for (int i = 0; i < commands.size(); i++) {
out.append(",Passengers:[{id:command_block_minecart, Tags:[\"oawiudoawiudoawidu\"], Command:\"").append(commands.get(i)).append('"');
}
for (int i = 0; i < commands.size(); i++){
out.append("\"}]");
}
out.append("}]}");
return out;
}
}

0 comments on commit 25feeb9

Please sign in to comment.