123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- event.load("block_click");
- event.load("inv_click");
- event.load("player_move");
- event.load("player_pre_respawn");
- event.load("player_post_respawn");
- quest.setBlockList(list.new());
- story_world = world.getStory();
- move_id_to_spawn = event.addMoveData(loc.new(story_world, -1501.5, 59, -35.5), loc.new(story_world, -1499, 62.5, -33), 5, -1);
- story_respawn = set.new();
- age_prop_3 = block.getProperty("age_0_3");
- bread_loc = loc.new(story_world, -1568, 67, -66);
- transit_loc = loc.new(story_world, -1522, 64, -18);
- schiff_spawn = loc.new(story_world, -1636, 63, -999, 50, 0.0001);
- bread = read.item("minecraft:bread", 3);
- times = map.new();
- bread_wait_time = 3; //seconds
- transit_inv = inv.new("333333333");
- inv.setItem(transit_inv, 0, read.item("minecraft:cake", 1, "§fAdmont"));
- inv.setItem(transit_inv, 1, read.item("minecraft:sand", 1, "§fSchiffbruch"));
- msg("dev", "§bStory §rloaded.");
- @wait
- wait();
- ignoreGoto(event);
- goto("wait");
- @block_click
- world = loc.getWorld(block_loc);
- if(world.getName(world) != "story") {
- goto("wait");
- }
- if(block_type == "minecraft:sweet_berry_bush") {
- scheduler.setBlock(5, block_loc, concat("minecraft:sweet_berry_bush[age=3]"), false);
- goto("wait");
- }
- if(hand == "OFF_HAND") {
- goto("wait");
- }
- if(action == "left") {
- goto("wait");
- }
- if(block_type == "minecraft:oak_leaves") {
- r = math.random(1, 20);
- if(r == 1) {
- item.drop(block_loc, read.item("minecraft:apple"));
- }
- r = math.random(1, 1000);
- if(r == 1) {
- item.drop(block_loc, read.item("minecraft:golden_apple"));
- }
- goto("wait");
- }
- if(block_type == "km:plum_leaves") {
- r = math.random(1, 20);
- if(r == 1) {
- item.drop(block_loc, read.item("km:plum"));
- }
- goto("wait");
- }
- if(block_type == "km:apricot_leaves") {
- r = math.random(1, 20);
- if(r == 1) {
- item.drop(block_loc, read.item("km:apricot"));
- }
- goto("wait");
- }
- if(block_type == "km:pear_leaves") {
- r = math.random(1, 20);
- if(r == 1) {
- item.drop(block_loc, read.item("km:pear"));
- }
- goto("wait");
- }
- if(block_loc == transit_loc) {
- inv.open(transit_inv, player, "Überfahrt");
- goto("wait");
- }
- if(block_loc == bread_loc) {
- player_uuid = player.getUuid(player);
- now_time = time.getMillis();
- time = map.getOrDefault(times, player_uuid, 0);
- diff_time = (now_time - time) / 1000;
- if(diff_time > bread_wait_time) {
- map.add(times, player_uuid, now_time);
- player.giveItem(player, bread);
- } else {
- msg.prefix(player, "§6FoodGiver", concat("Please wait for ", text.number(math.round(bread_wait_time - diff_time)), " seconds."));
- }
- }
- goto("wait");
- @inv_click
- if(inv_name == "Überfahrt") {
- if(item.getType(item) == "minecraft:air") {
- goto("wait");
- }
- if(inv_slot == 0) {
- entity.teleport(player, world.getStorySpawn());
- } elseif(inv_slot == 1) {
- entity.teleport(player, schiff_spawn);
- }
- inv.close(player);
- }
- goto("wait");
- @player_move
- if(id == move_id_to_spawn) {
- player.setBackPosLoc(player, world.getStorySpawn());
- player.teleport(player, world.getServerSpawn(), false);
- }
- goto("wait");
- @player_pre_respawn
- if(loc.isInStoryWorld(entity.getLocation(player))) {
- set.add(story_respawn, player.getUuid(player));
- }
- goto("wait");
- @player_post_respawn
- player_uuid = player.getUuid(player);
- if(set.contains(story_respawn, player_uuid)) {
- set.remove(story_respawn, player_uuid);
- entity.teleport(player, world.getStorySpawn());
- }
- goto("wait");
|