From 8354ed6c09e960d2f48d7bc40b7c7978947524eb Mon Sep 17 00:00:00 2001 From: ketsuban_152 Date: Sat, 4 Jul 2026 21:59:07 +0900 Subject: Initial commit --- .../java/luckyblock/action/LuckyActionHolder.java | 62 ++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 src/main/java/luckyblock/action/LuckyActionHolder.java (limited to 'src/main/java/luckyblock/action/LuckyActionHolder.java') diff --git a/src/main/java/luckyblock/action/LuckyActionHolder.java b/src/main/java/luckyblock/action/LuckyActionHolder.java new file mode 100644 index 0000000..b18ad67 --- /dev/null +++ b/src/main/java/luckyblock/action/LuckyActionHolder.java @@ -0,0 +1,62 @@ +package luckyblock.action; + +import com.google.gson.JsonElement; +import com.google.gson.annotations.SerializedName; +import luckyblock.action.triggers.*; +import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.level.Level; + +import java.util.ArrayList; +import java.util.List; + +public class LuckyActionHolder { + private static final List cmdList = new ArrayList<>(); + + static { + cmdList.add(new BroadcastTrigger()); + cmdList.add(new SummonItemTrigger()); + cmdList.add(new SummonTrigger()); + cmdList.add(new TrappedRoomTrigger()); + } + + public String type = ""; + public int weight = -1; + public List queue; + + @SerializedName("delay-queue") + public List delay_queue; + public JsonElement json; + public List items; + public List mobs; + public int count = 1; + public int height = 0; + @SerializedName("is-powered") + public boolean is_powered = false; + @SerializedName("wall-block") + public String wall_block = "minecraft:stone_bricks"; + public int radius = 3; + + public void execute(Level level, BlockPos pos) { + if (!(level instanceof ServerLevel serverLevel)) { return; } + + for (ILuckyTrigger c : cmdList) { + if (this.type != null && this.type.equals(c.getName())) { + c.execute(serverLevel, pos, this, level.getRandom()); + break; + } + } + + if (this.queue != null && !this.queue.isEmpty()) { + for (int i=0;i