123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319 |
- 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";
- rankingtable = "sfsingle";
- game_short = "sfsingle";
- sign.started(gamesignloc);
- event.load("bucket_use");
- event.load("player_pickup");
- event.load("craft");
- min = 16;
- sec = 0;
- timer_string = concat("§bTimer: §r", text.number(min), " min 0", text.number(sec), " s");
- 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(2, "tick");
- minigame.speakAll(gamename, "Collect as many shown items as you can.");
- minigame.speakAll(gamename, "Drop and collect not counted items again.");
- @wait
- wait();
- if(event == "living_pre_hurt") {
- if(!isPlayer(living_entity)) {
- goto("wait");
- }
- player = living_entity;
- }
- if(player.hasMinigameId(player, script_id)) {
- ignoreGoto(event);
- }
- goto("wait");
- @player_join
- 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();
- }
- }
- }
- player_list = minigame.getPlayers(script_id);
- minigame.speakAll(gamename, "The game has started.");
- 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", 19200, 1);
- }
- for(h = 0; h < 3; h++) {
- gosub("newitem");
- }
- 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(2, "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(2, "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
- if(min < 12) {
- if(step == 1) {
- for(i = 0; i < list.getSize(items2); i++) {
- list.add(items1, list.getIndex(items2, i));
- }
- step = 2;
- }
- if(min < 8) {
- if(step == 2) {
- for(i = 0; i < list.getSize(items3); i++) {
- list.add(items1, list.getIndex(items3, i));
- }
- step = 3;
- }
- if(min < 4) {
- 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;
- @endgame
- yetfound = list.getSize(founditems);
- iter = list.iterator(player_list);
- while(hasNext(iter)) {
- player = player.get(next(iter));
- player_id = player.getId(player);
- playedgames = minigame.getPlayed(player_id, game_short) + 1;
- minigame.setPlayed(player_id, game_short, playedgames);
- last_record = ranking.getPoints(rankingtable, player_id);
- if(last_record < yetfound) {
- diff = yetfound - last_record;
- last_record = yetfound;
- }
- ranking.setPoints(rankingtable, player_id, last_record);
-
- minigame.statsHeader(player, $gamename, "§e");
- minigame.statsLine(player, "§e", "Found Items", text.number(yetfound));
- if(diff != null) {
- msg(player, " §e- §rBeat own record by §e", text.number(diff));
- }
- minigame.statsLine(player, "§e", "Played games", text.number(playedgames));
- money.addBoost(player, yetfound / 2);
- }
- @player_logout
- @player_giveup
- script = script.getFromId(script_id);
- 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.kickplayer(script, player);
- minigame.term(script, gamesignloc);
- term();
|