carved_pumpkin = read.item("carved_pumpkin"); leaves_tag = block.getTag("minecraft:leaves"); double_block_half_property = block.getProperty("double_block_half"); gosub("setstart"); step = 1; gamename = "§aSammelfieber"; no_core_reset = true; templist = list.new(); list.add(templist, items1); list.add(templist, items2); list.add(templist, items3); list.add(templist, items4); for(h = 0; h < list.getSize(templist); h++) { list = list.getIndex(templist, h); for(i = 0; i < list.getSize(list); i++) { item_type = list.getIndex(list, i); item = read.item(item_type); if(item == null) { minigame.speakAll(item_type); minigame.speakAll("False Item found. Game termed. Inform marvinius."); term(); } } } goto("simplelobby"); @specificLobbyHandling if(event == "player_join") { if(init_signs == null) { block.setSign(sign_min_loc, 2, text.number(min)); block.setSign(sign_amount_loc, 2, text.number(amount_nextitems)); init_signs = true; } return; } if(event == "block_click") { if(hand == "offhand") { return; } if(block_loc == plus_min_loc) { if(min < max_mins) { min++; } block.setSign(sign_min_loc, 2, text.number(min)); return; } if(block_loc == minus_min_loc) { if(min > 1) { min--; } block.setSign(sign_min_loc, 2, text.number(min)); return; } if(block_loc == plus_amount_loc) { if(amount_nextitems < max_nextitems) { amount_nextitems++; } block.setSign(sign_amount_loc, 2, text.number(amount_nextitems)); return; } if(block_loc == minus_amount_loc) { if(amount_nextitems > 1) { amount_nextitems--; } block.setSign(sign_amount_loc, 2, text.number(amount_nextitems)); return; } } return; @finalstart player_list = minigame.getPlayers(script_id); minigame.speakAll(gamename, "The game has started."); whole_secs = min * 60 + sec; time_phase_1 = whole_secs / 4 * 3; time_phase_2 = whole_secs / 4 * 2; time_phase_3 = whole_secs / 4; timer_string = concat("§bTimer: §r", text.number(min), " min 0", text.number(sec), " s"); iter = list.iterator(player_list); while(hasNext(iter)) { player = player.get(next(iter)); entity.teleport(player, spawn_loc); player.setGamemode(player, "survival"); player.setFly(player, false); entity.cleareffects(player); living.setHealth(player, 20); player.setHunger(player, 20); player.setSaturation(player, 5); player.clearInventory(player); display.reset(player); display.add(player, 1, gamename); display.add(player, 2, timer_string); display.add(player, 3, "§bFound Items: §r0"); display.add(player, 4, "§bNext Items:"); entity.addEffect(player, "speed", min * 60 * 20, 1); } event.load("bucket_use"); event.load("player_pickup"); event.load("craft"); farmtypes = list.new(); list.add(farmtypes, "minecraft:carrots"); list.add(farmtypes, "minecraft:melon_stem"); list.add(farmtypes, "minecraft:potatoes"); list.add(farmtypes, "minecraft:wheat"); player_blocks = set.new(); set.add(player_blocks, "minecraft:crafting_table"); set.add(player_blocks, "minecraft:furnace"); set.add(player_blocks, "minecraft:chest"); nextitems = list.new(); founditems = list.new(); player_blocks_placed = set.new(); resetlist_type = list.new(); resetlist_loc = list.new(); resetlistdouble_type = list.new(); resetlistdouble_loc = list.new(); resetlistdouble_loc2 = list.new(); sgoto(1, "tick"); for(h = 0; h < amount_nextitems; h++) { gosub("newitem"); } minigame.speakAll(gamename, "Collect as many shown items as you can."); minigame.speakAll(gamename, "Drop and collect not counted items again."); @wait wait(); if(player.hasMinigameId(player, script_id)) { ignoreGoto(event); } goto("wait"); @block_click if(action == "right") { if(set.contains(player_blocks, block_type)) { goto("wait"); } if(hand == "MAIN_HAND") { hand = "hand"; } else { hand = "offhand"; } item_type = item.getType(living.getEquip(player, hand)); if(set.contains(player_blocks, item_type)) { goto("wait"); } cancel = true; if(block_type == "minecraft:pumpkin" && item_type == "minecraft:shears") { item.drop(block_loc, carved_pumpkin); } } goto("wait"); @living_pre_hurt if(isPlayer(living_entity)) { cancel = true; } goto("wait"); @block_break cancel = false; if(set.contains(player_blocks, block_type)) { goto("wait"); } if(block.hasTag(leaves_tag, block.get(block_loc))) { split_list = text.split("_", block_type); drop_type = concat(text.concatList(split_list, "_", 0, list.getSize(split_list) - 2), "_sapling"); item.drop(block_loc, read.item(drop_type)); } state = block.property.getValue(block_loc, double_block_half_property); if(state != null) { if(state == "lower") { loc = block_loc; loc2 = loc.mod(block_loc, 0, 1, 0); } else { loc = loc.mod(block_loc, 0, -1, 0); loc2 = block_loc; } list.add(resetlistdouble_type, block_type); list.add(resetlistdouble_loc, loc); list.add(resetlistdouble_loc2, loc2); sgoto(1, "doubleresetblock"); goto("wait"); } if(block_type == "minecraft:vine") { cancel = true; goto("wait"); } if(block_type == "minecraft:sugar_cane") { cancel = true; item.drop(block_loc, read.item("sugar_cane")); goto("wait"); } if(block_type == "minecraft:farmland") { cancel = true; goto("wait"); } list.add(resetlist_type, block_type); list.add(resetlist_loc, block_loc); sgoto(1, "resetblock"); goto("wait"); @bucket_use cancel = true; goto("wait"); @block_place cancel = true; if(set.contains(player_blocks, block_type)) { cancel = false; set.add(player_blocks_placed, block_loc); } goto("wait"); @doubleresetblock btype = list.getIndex(resetlistdouble_type, 0); loc = list.getIndex(resetlistdouble_loc, 0); loc2 = list.getIndex(resetlistdouble_loc2, 0); list.removeIndex(resetlistdouble_type, 0); list.removeIndex(resetlistdouble_loc, 0); list.removeIndex(resetlistdouble_loc2, 0); block.set(loc, concat(btype, "[half=lower]")); block.set(loc2, concat(btype, "[half=upper]")); goto("wait"); @resetblock btype = list.getIndex(resetlist_type, 0); bloc = list.getIndex(resetlist_loc, 0); list.removeIndex(resetlist_type, 0); list.removeIndex(resetlist_loc, 0); if(list.contains(farmtypes, btype)) { block.set(bloc, concat(btype, "[age=7]")); } else { block.set(bloc, btype); } goto("wait"); @tick if(sec == 0) { sec = 59; min--; if(min == -1) { goto("endgame"); } } else { sec--; if(sec < 10) { minigame.displayAll(2, concat("§bTimer: §r", text.number(min), " min 0", text.number(sec), " s")); } else { minigame.displayAll(2, concat("§bTimer: §r", text.number(min), " min ", text.number(sec), " s")); } if(min == 0) { if(sec == 30) { minigame.speakAll(gamename, "30 seconds left!"); } elseif(sec == 10) { minigame.speakAll(gamename, "10 seconds left!"); } elseif(sec == 5) { minigame.speakAll(gamename, "5 seconds left!"); } } } sgoto(20, "tick"); goto("wait"); @player_pickup @craft itype = item.getType(item); if(list.contains(nextitems, itype)) { list.add(founditems, itype); list.remove(nextitems, itype); minigame.displayAll(3, concat("§bFound Items: §r", text.number(list.getSize(founditems)))); gosub("newitem"); } goto("wait"); @newitem atm_time = min * 60 + sec; if(atm_time < time_phase_1) { if(step == 1) { for(i = 0; i < list.getSize(items2); i++) { list.add(items1, list.getIndex(items2, i)); } step = 2; } if(atm_time < time_phase_2) { if(step == 2) { for(i = 0; i < list.getSize(items3); i++) { list.add(items1, list.getIndex(items3, i)); } step = 3; } if(atm_time < time_phase_3) { if(step == 3) { for(i = 0; i < list.getSize(items4); i++) { list.add(items1, list.getIndex(items4, i)); } step = 4; } } } } items1_size = list.getSize(items1); if(items1_size == 0) { return; } randomitemstring = list.getIndex(items1, math.random(0, items1_size - 1)); list.remove(items1, randomitemstring); list.add(nextitems, randomitemstring); for(i = 0; i < list.getSize(nextitems); i++) { type = list.getIndex(nextitems, i); minigame.displayAll(5 + i, text.replace(type, "minecraft:", "")); } return; @player_logout @player_giveup script = script.getFromId(script_id); minigame.kickplayer(script, player); if(list.getSize(player_list) == 0) { goto("endcore"); } goto("wait"); @endgame yetfound = list.getSize(founditems); script = script.getFromId(script_id); iter = list.iterator(player_list); while(hasNext(iter)) { player = player.get(next(iter)); minigame.statsHeader(player, $gamename, "§e"); minigame.statsLine(player, "§e", "Found Items", text.number(yetfound)); } @endcore iter = set.iterator(player_blocks_placed); while(hasNext(iter)) { block.set(next(iter), "minecraft:air"); } entity.removeAll("net.minecraft.entity.item.ItemEntity", middleloc, radius); minigame.kickAllPlayers(script); minigame.term(script, gamesignloc); term();