// data/scripts/season/main.ts
import { system as system5, TicksPerSecond as TicksPerSecond2, WeatherType as WeatherType3, world as world3 } from "@minecraft/server";

// data/scripts/season/season-cycle.ts
import { system } from "@minecraft/server";

// data/scripts/season/season-id.ts
var SEASON_IDS = {
  Spring: 0,
  Summer: 1,
  Autumn: 2,
  Winter: 3
};
var SEASON_NAMES_BY_ID = {
  [SEASON_IDS.Spring]: "Spring",
  [SEASON_IDS.Summer]: "Summer",
  [SEASON_IDS.Autumn]: "Autumn",
  [SEASON_IDS.Winter]: "Winter"
};

// data/scripts/season/season-cycle.ts
var LAST_UPDATE = 0;
var CURRENT_SEASON_ID = SEASON_IDS.Spring;
var SEASON_CHANGE_INTERVAL = 300;
var SEASON_CHANGE_CLOCK;
var SUBSCRIBERS = /* @__PURE__ */ new Set();
var SeasonCycle = class _SeasonCycle {
  /**
   * Register the season cycle
   */
  static register(config) {
    const { interval = 24e3 } = config;
    SEASON_CHANGE_INTERVAL = interval;
    LAST_UPDATE = Date.now();
    SEASON_CHANGE_CLOCK = system.runInterval(() => {
      const currentId = CURRENT_SEASON_ID;
      const seasons = Object.values(SEASON_IDS);
      const nextId = seasons[(seasons.indexOf(currentId) + 1) % seasons.length];
      _SeasonCycle.setCurrentSeason(nextId);
    }, interval);
  }
  /**
   * Get the current season
   * @returns The current season id
   */
  static getCurrentSeason() {
    return CURRENT_SEASON_ID;
  }
  /**
   * Set the current season
   * @param season - The season id to set
   */
  static setCurrentSeason(season) {
    CURRENT_SEASON_ID = season;
    LAST_UPDATE = Date.now();
    for (const callback of SUBSCRIBERS.values()) {
      callback(season);
    }
  }
  /**
   * Check if the current season matches the given season
   * @param season - The season id to check
   * @returns True if the current season matches the given season, false otherwise
   */
  static matches(season) {
    return CURRENT_SEASON_ID === season;
  }
  /**
   * Get the current season duration from the last season change.
   * @returns Duration in ticks
   */
  static getCurrentSeasonDuration() {
    return Math.floor((Date.now() - LAST_UPDATE) / 50);
  }
  /**
   * Get the season duration
   * @returns Duration in ticks
   */
  static getSeasonDuration() {
    return SEASON_CHANGE_INTERVAL;
  }
  /**
   * Subscribe to the season change event
   * @param callback - The callback to call when the season changes
   *
   * @returns A function to unsubscribe from the season change event
   */
  static subscribe(callback) {
    SUBSCRIBERS.add(callback);
    return () => {
      SUBSCRIBERS.delete(callback);
    };
  }
};

// data/scripts/season/weather-cycle.ts
import {
  system as system3,
  WeatherType as WeatherType2,
  world as world2
} from "@minecraft/server";

// data/scripts/world/world-load.ts
import { system as system2, TicksPerSecond, world } from "@minecraft/server";
var IS_LOADED = false;
var SUBSCRIBERS2 = /* @__PURE__ */ new Set();
async function checkIfLoaded() {
  if (IS_LOADED) {
    return;
  }
  const CHECK_INTERVAL = 5;
  const SECONDS_TO_CHECK = 15;
  const tries = SECONDS_TO_CHECK * TicksPerSecond / CHECK_INTERVAL;
  for (let i = 0; i < tries; i++) {
    try {
      const firstPlayer = world.getAllPlayers()[0];
      if (firstPlayer) {
        const block = firstPlayer.dimension.getBlock(firstPlayer.location);
        if (block && block.isValid()) {
          IS_LOADED = true;
          for (const callback of SUBSCRIBERS2) {
            callback();
          }
          return;
        }
      }
    } catch {
    }
    await system2.waitTicks(CHECK_INTERVAL);
  }
}
checkIfLoaded();
var WorldLoad = class {
  static isLoaded() {
    return IS_LOADED;
  }
  static subscribe(callback) {
    if (IS_LOADED) {
      callback();
      return;
    }
    SUBSCRIBERS2.add(callback);
  }
};

// data/scripts/season/weather-cycle.ts
var CURRENT_WEATHER = WeatherType2.Clear;
var LAST_RAIN_TIME;
var SUBSCRIBERS3 = /* @__PURE__ */ new Set();
var WeatherCycle = class {
  static setCurrentWeather(weather) {
    CURRENT_WEATHER = weather;
    world2.setDynamicProperty("gs_season:weather", weather);
    world2.getDimension("overworld").setWeather(weather);
  }
  static register() {
    const saved = world2.getDynamicProperty("gs_season:weather");
    WorldLoad.subscribe(() => {
      this.setCurrentWeather(saved ?? WeatherType2.Clear);
    });
    world2.beforeEvents.weatherChange.subscribe((e) => {
      for (const callback of SUBSCRIBERS3) {
        try {
          callback(e);
        } catch {
        }
      }
      if (!e.cancel) {
        system3.run(() => {
          this.setCurrentWeather(e.newWeather);
        });
      }
      if (e.newWeather === WeatherType2.Clear && e.previousWeather !== WeatherType2.Clear) {
        LAST_RAIN_TIME = system3.currentTick;
      }
    });
  }
  static getCurrentWeather() {
    return CURRENT_WEATHER;
  }
  static subscribe(callback) {
    SUBSCRIBERS3.add(callback);
  }
  static timeSinceRain() {
    const { currentTick } = system3;
    return currentTick - (LAST_RAIN_TIME ?? currentTick);
  }
};

// data/scripts/season/wind-intensity.ts
import { system as system4 } from "@minecraft/server";

// data/scripts/math/utils/random.ts
function randomIntInRange(min, max) {
  return Math.floor(Math.random() * (max - min + 1)) + min;
}
function randomInRange(min, max) {
  return Math.random() * (max - min) + min;
}
function randomSign() {
  return Math.random() < 0.5 ? -1 : 1;
}

// data/scripts/season/wind-intensity.ts
var IS_INTENSE = false;
var INTERVAL_REF;
var IS_INTENSE_TIMEOUT_REF;
var WindIntensity = class _WindIntensity {
  static config;
  static register(config) {
    if (INTERVAL_REF) {
      system4.clearRun(INTERVAL_REF);
    }
    this.config = config;
    const { chance, interval, period } = config;
    INTERVAL_REF = system4.runInterval(() => {
      if (IS_INTENSE) return;
      if (Math.random() < chance) {
        _WindIntensity.isIntense = true;
      }
    }, interval);
  }
  static get isIntense() {
    return IS_INTENSE;
  }
  static set isIntense(value) {
    IS_INTENSE = value;
    if (value) {
      const { period } = this.config;
      if (IS_INTENSE_TIMEOUT_REF) {
        system4.clearRun(IS_INTENSE_TIMEOUT_REF);
      }
      IS_INTENSE_TIMEOUT_REF = system4.runTimeout(() => {
        IS_INTENSE = false;
        IS_INTENSE_TIMEOUT_REF = void 0;
      }, randomIntInRange(period[0], period[1]));
    } else {
      if (IS_INTENSE_TIMEOUT_REF) {
        system4.clearRun(IS_INTENSE_TIMEOUT_REF);
      }
      IS_INTENSE_TIMEOUT_REF = void 0;
    }
  }
};

// data/scripts/season/main.ts
WeatherCycle.register();
SeasonCycle.register({
  interval: 24e3
});
WindIntensity.register({
  chance: 0.4,
  interval: TicksPerSecond2 * 10,
  period: [TicksPerSecond2 * 30, TicksPerSecond2 * 60]
});
WeatherCycle.subscribe((e) => {
  if (SeasonCycle.matches(SEASON_IDS.Winter) && e.newWeather !== WeatherType3.Clear) {
    e.cancel = true;
  }
});
SeasonCycle.subscribe((season) => {
  world3.sendMessage(
    `\xA7aThe season has changed to \xA76${SEASON_NAMES_BY_ID[season]}`
  );
});
system5.afterEvents.scriptEventReceive.subscribe(
  ({ id, message }) => {
    switch (id) {
      case "gs_season:set_season":
        message = message.toLocaleLowerCase();
        message = `${message.charAt(0).toUpperCase()}${message.slice(1)}`;
        if (SEASON_IDS[message] !== void 0) {
          SeasonCycle.setCurrentSeason(SEASON_IDS[message]);
        }
        break;
      case "gs_season:set_wind_int":
        WindIntensity.isIntense = Boolean(message);
        break;
    }
  },
  {
    namespaces: ["gs_season"]
  }
);

// data/scripts/blocks/main.ts
import { world as world10, system as system12, ItemEnchantableComponent as ItemEnchantableComponent2 } from "@minecraft/server";

// data/scripts/blocks/managers/BlockManager.ts
var BlockManager = class {
  static get(dim, loc) {
    try {
      return dim.getBlock(loc);
    } catch {
      return void 0;
    }
  }
  static destroy(dim, loc) {
    dim.runCommand(`setblock ${loc.x} ${loc.y} ${loc.z} air destroy`);
  }
};

// data/scripts/blocks/constants/bannedBlocks.ts
var bannedBlocks = [
  "gs_season:dandy_lion",
  "gs_season:devils_grass",
  "gs_season:lanceolata",
  "gs_season:clover",
  "gs_season:persian_speedwell",
  "gs_season:acacia_leaves",
  "gs_season:baobab_leaves",
  "gs_season:bushwillow_leaves",
  "gs_season:beech_leaves",
  "gs_season:red_oak_leaves",
  "gs_season:sugar_maple_leaves",
  "gs_season:aspen_grass_1",
  "gs_season:aspen_grass_2",
  "gs_season:aspen_grass_3",
  "gs_season:aspen_grass_4",
  "gs_season:aspen_flower",
  "gs_season:aspen_fern",
  "gs_season:aspen_leaves",
  "gs_season:jacaranda_leaves_1",
  "gs_season:jacaranda_leaves_2",
  "gs_season:jacaranda_grass_1",
  "gs_season:jacaranda_grass_2",
  "gs_season:jacaranda_grass_3",
  "gs_season:jacaranda_grass_4",
  "gs_season:jacaranda_grass_5",
  "gs_season:jacaranda_grass_1_tall",
  "gs_season:jacaranda_grass_2_tall",
  "gs_season:jacaranda_grass_3_tall",
  "gs_season:jacaranda_vines",
  "gs_season:palm_leaves",
  "gs_season:savannah_grass_long",
  "gs_season:savannah_grass_tall",
  "gs_season:savannah_vines",
  "gs_season:baobab_vines",
  "gs_season:savannah_fern",
  "gs_season:savannah_grass_1",
  "gs_season:savannah_grass_2",
  "gs_season:savannah_grass_3",
  "gs_season:african_potato",
  "gs_season:heliotrope",
  "gs_season:ratgrass",
  "gs_season:wildindigo",
  "gs_season:christmas_fern",
  "gs_season:partridge_berry",
  "gs_season:sarsaparilla",
  "gs_season:trillium",
  "gs_season:wintergreen",
  "gs_season:aloe",
  "gs_season:alpine_bearberry",
  "gs_season:arctic_willow",
  "gs_season:bog_blueberry",
  "gs_season:crowberry",
  "gs_season:dwarf_birch",
  "gs_season:mountain_avens",
  "gs_season:purple_saxifrage",
  "gs_season:tundra_fern_tall",
  "gs_season:tundra_fern",
  "gs_season:tundra_grass_1",
  "gs_season:tundra_grass_2",
  "gs_season:tundra_grass_3",
  "gs_season:reindeer_lichen",
  "gs_season:forest_mushroom_1",
  "gs_season:forest_mushroom_2",
  "gs_season:forest_mushroom_3",
  "gs_season:forest_mushroom_4",
  "gs_season:forest_grass_tall",
  "gs_season:forest_grass_1",
  "gs_season:forest_grass_2",
  "gs_season:forest_grass_3",
  "gs_season:forest_grass_4",
  "gs_season:wall_mushroom",
  "gs_season:oasis_cactus_1",
  "gs_season:oasis_cactus",
  "gs_season:oasis_deadbush",
  "gs_season:oasis_fern",
  "gs_season:oasis_grass",
  "gs_season:acacia_door",
  "gs_season:acacia_trapdoor",
  "gs_season:acacia_slab",
  "gs_season:acacia_stairs",
  "gs_season:baobab_door",
  "gs_season:baobab_trapdoor",
  "gs_season:baobab_slab",
  "gs_season:baobab_stairs",
  "gs_season:bushwillow_door",
  "gs_season:bushwillow_trapdoor",
  "gs_season:bushwillow_slab",
  "gs_season:bushwillow_stairs",
  "gs_season:beech_door",
  "gs_season:beech_trapdoor",
  "gs_season:beech_slab",
  "gs_season:beech_stairs",
  "gs_season:red_oak_door",
  "gs_season:red_oak_trapdoor",
  "gs_season:red_oak_slab",
  "gs_season:red_oak_stairs",
  "gs_season:sugar_maple_door",
  "gs_season:sugar_maple_trapdoor",
  "gs_season:sugar_maple_slab",
  "gs_season:sugar_maple_stairs",
  "gs_season:aspen_door",
  "gs_season:aspen_trapdoor",
  "gs_season:aspen_slab",
  "gs_season:aspen_stairs",
  "gs_season:jacaranda_door_1",
  "gs_season:jacaranda_door_2",
  "gs_season:jacaranda_trapdoor_1",
  "gs_season:jacaranda_trapdoor_2",
  "gs_season:jacaranda_1_stairs",
  "gs_season:jacaranda_2_stairs",
  "gs_season:jacaranda_1_slab",
  "gs_season:jacaranda_2_slab",
  "gs_season:palm_door",
  "gs_season:palm_trapdoor",
  "gs_season:palm_slab",
  "gs_season:palm_stairs",
  "gs_season:acacia_log",
  "gs_season:acacia_stripped_log",
  "gs_season:acacia_wood",
  "gs_season:acacia_wood_stripped",
  "gs_season:acacia_planks",
  "gs_season:baobab_log",
  "gs_season:baobab_stripped_log",
  "gs_season:baobab_wood",
  "gs_season:baobab_wood_stripped",
  "gs_season:baobab_planks",
  "gs_season:bushwillow_log",
  "gs_season:bushwillow_stripped_log",
  "gs_season:bushwillow_wood",
  "gs_season:bushwillow_wood_stripped",
  "gs_season:bushwillow_planks",
  "gs_season:beech_log",
  "gs_season:beech_stripped_log",
  "gs_season:beech_wood",
  "gs_season:beech_wood_stripped",
  "gs_season:beech_planks",
  "gs_season:red_oak_log",
  "gs_season:red_oak_stripped_log",
  "gs_season:red_oak_wood",
  "gs_season:red_oak_wood_stripped",
  "gs_season:red_oak_planks",
  "gs_season:sugar_maple_log",
  "gs_season:sugar_maple_stripped_log",
  "gs_season:sugar_maple_wood",
  "gs_season:sugar_maple_wood_stripped",
  "gs_season:sugar_maple_planks",
  "gs_season:aspen_log",
  "gs_season:aspen_stripped_log",
  "gs_season:aspen_wood",
  "gs_season:aspen_wood_stripped",
  "gs_season:aspen_planks",
  "gs_season:jacaranda_planks_1",
  "gs_season:jacaranda_planks_2",
  "gs_season:jacaranda_stripped_log_1",
  "gs_season:jacaranda_stripped_log_2",
  "gs_season:jacaranda_wood_1",
  "gs_season:jacaranda_wood_2",
  "gs_season:jacaranda_wood_stripped_1",
  "gs_season:jacaranda_wood_stripped_2",
  "gs_season:palm_log",
  "gs_season:palm_stripped_log",
  "gs_season:palm_wood",
  "gs_season:palm_wood_stripped",
  "gs_season:palm_planks",
  "gs_season:forest_grass",
  "gs_season:savannah_grass",
  "gs_season:tundra_grass",
  "gs_season:tundra_podzol",
  "gs_season:aspen_grass",
  "gs_season:jacaranda_grass",
  "gs_season:oasis_sand",
  "gs_season:dirt",
  "gs_season:mossy_stone",
  "gs_season:mossy_stone_wall",
  "gs_season:mossy_stone_slab",
  "gs_season:mossy_stone_stairs",
  "gs_season:overworld_grass_1",
  "gs_season:overworld_grass_2",
  "gs_season:overworld_grass_3",
  "gs_season:overworld_leaf_litter",
  "gs_season:overworld_grass",
  "gs_season:wild_farmland_wet",
  "gs_season:pebbles_1",
  "gs_season:pebbles_2",
  "gs_season:pebbles_3",
  "gs_season:pebbles_4",
  "gs_season:seashells",
  "gs_season:rice",
  "gs_season:rhubarb",
  "gs_season:corn",
  "gs_season:scarlet_azalea",
  "gs_season:scarlet_cave_vines_bottom",
  "gs_season:scarlet_cave_vines_top",
  "gs_season:scarlet_clay",
  "gs_season:scarlet_grass",
  "gs_season:scarlet_lichen",
  "gs_season:scarlet_moss",
  "gs_season:scarlet_reeds",
  "gs_season:scarlet_spore_blossom",
  "gs_season:scarlet_tallgrass",
  "gs_season:reeds",
  "gs_season:overworld_azalea",
  "gs_season:jacaranda_plant",
  "gs_season:cotton",
  "gs_season:scarlet_dripstone",
  "gs_season:scarlet_dripstone_block",
  "gs_season:aspen_sapling",
  "minecraft:leaf_litter",
  "minecraft:acacia_button",
  "minecraft:acacia_door",
  "minecraft:acacia_hanging_sign",
  "minecraft:acacia_leaves",
  "minecraft:acacia_pressure_plate",
  "minecraft:acacia_sapling",
  "minecraft:acacia_slab",
  "minecraft:acacia_standing_sign",
  "minecraft:acacia_trapdoor",
  "minecraft:acacia_wall_sign",
  "minecraft:activator_rail",
  "minecraft:allium",
  "minecraft:amethyst_cluster",
  "minecraft:andesite_slab",
  "minecraft:anvil",
  "minecraft:azalea",
  "minecraft:azalea_leaves",
  "minecraft:azalea_leaves_flowered",
  "minecraft:azure_bluet",
  "minecraft:bamboo",
  "minecraft:bamboo_button",
  "minecraft:bamboo_door",
  "minecraft:bamboo_hanging_sign",
  "minecraft:bamboo_mosaic_slab",
  "minecraft:bamboo_pressure_plate",
  "minecraft:bamboo_sapling",
  "minecraft:bamboo_slab",
  "minecraft:bamboo_standing_sign",
  "minecraft:bamboo_trapdoor",
  "minecraft:bamboo_wall_sign",
  "minecraft:barrier",
  "minecraft:beetroot",
  "minecraft:bell",
  "minecraft:big_dripleaf",
  "minecraft:birch_button",
  "minecraft:birch_door",
  "minecraft:birch_hanging_sign",
  "minecraft:birch_leaves",
  "minecraft:birch_pressure_plate",
  "minecraft:birch_sapling",
  "minecraft:birch_slab",
  "minecraft:birch_standing_sign",
  "minecraft:birch_trapdoor",
  "minecraft:birch_wall_sign",
  "minecraft:black_candle",
  "minecraft:black_candle_cake",
  "minecraft:black_carpet",
  "minecraft:black_shulker_box",
  "minecraft:black_stained_glass_pane",
  "minecraft:blackstone_slab",
  "minecraft:blackstone_wall",
  "minecraft:blue_candle",
  "minecraft:blue_candle_cake",
  "minecraft:blue_carpet",
  "minecraft:blue_orchid",
  "minecraft:blue_shulker_box",
  "minecraft:blue_stained_glass_pane",
  "minecraft:border_block",
  "minecraft:brain_coral",
  "minecraft:brain_coral_fan",
  "minecraft:brain_coral_wall_fan",
  "minecraft:brewing_stand",
  "minecraft:brick_slab",
  "minecraft:brown_candle",
  "minecraft:brown_candle_cake",
  "minecraft:brown_carpet",
  "minecraft:brown_carpet",
  "minecraft:brown_mushroom",
  "minecraft:brown_shulker_box",
  "minecraft:brown_stained_glass_pane",
  "minecraft:bubble_column",
  "minecraft:bubble_coral",
  "minecraft:bubble_coral_fan",
  "minecraft:bubble_coral_wall_fan",
  "minecraft:cactus",
  "minecraft:cake",
  "minecraft:calibrated_sculk_sensor",
  "minecraft:camera",
  "minecraft:campfire",
  "minecraft:candle",
  "minecraft:candle_cake",
  "minecraft:carpet",
  "minecraft:carrots",
  "minecraft:carved_pumpkin",
  "minecraft:cauldron",
  "minecraft:cave_vines",
  "minecraft:cave_vines_body_with_berries",
  "minecraft:cave_vines_head_with_berries",
  "minecraft:chain",
  "minecraft:cherry_button",
  "minecraft:cherry_door",
  "minecraft:cherry_hanging_sign",
  "minecraft:cherry_leaves",
  "minecraft:cherry_pressure_plate",
  "minecraft:cherry_sapling",
  "minecraft:cherry_slab",
  "minecraft:cherry_standing_sign",
  "minecraft:cherry_trapdoor",
  "minecraft:cherry_wall_sign",
  "minecraft:chest",
  "minecraft:chipped_anvil",
  "minecraft:chorus_flower",
  "minecraft:chorus_plant",
  "minecraft:cobbled_deepslate_slab",
  "minecraft:cobbled_deepslate_wall",
  "minecraft:cobblestone_slab",
  "minecraft:cobblestone_wall",
  "minecraft:cocoa",
  "minecraft:conduit",
  "minecraft:copper_bulb",
  "minecraft:copper_door",
  "minecraft:copper_grate",
  "minecraft:copper_trapdoor",
  "minecraft:coral",
  "minecraft:coral_fan",
  "minecraft:coral_fan_dead",
  "minecraft:coral_fan_hang",
  "minecraft:coral_fan_hang2",
  "minecraft:coral_fan_hang3",
  "minecraft:cornflower",
  "minecraft:crimson_button",
  "minecraft:crimson_door",
  "minecraft:crimson_fungus",
  "minecraft:crimson_hanging_sign",
  "minecraft:crimson_leaves",
  "minecraft:crimson_pressure_plate",
  "minecraft:crimson_sapling",
  "minecraft:crimson_roots",
  "minecraft:crimson_slab",
  "minecraft:crimson_standing_sign",
  "minecraft:crimson_trapdoor",
  "minecraft:crimson_wall_sign",
  "minecraft:cut_copper_slab",
  "minecraft:cut_red_sandstone_slab",
  "minecraft:cut_sandstone_slab",
  "minecraft:cyan_candle",
  "minecraft:cyan_candle_cake",
  "minecraft:cyan_carpet",
  "minecraft:cyan_shulker_box",
  "minecraft:cyan_stained_glass_pane",
  "minecraft:damaged_anvil",
  "minecraft:dandelion",
  "minecraft:dark_oak_button",
  "minecraft:dark_oak_door",
  "minecraft:dark_oak_hanging_sign",
  "minecraft:dark_oak_leaves",
  "minecraft:dark_oak_pressure_plate",
  "minecraft:dark_oak_sapling",
  "minecraft:dark_oak_slab",
  "minecraft:dark_oak_trapdoor",
  "minecraft:dark_prismarine_slab",
  "minecraft:darkoak_standing_sign",
  "minecraft:darkoak_wall_sign",
  "minecraft:daylight_detector",
  "minecraft:daylight_detector_inverted",
  "minecraft:dead_brain_coral",
  "minecraft:dead_brain_coral_fan",
  "minecraft:dead_brain_coral_wall_fan",
  "minecraft:dead_bubble_coral",
  "minecraft:dead_bubble_coral_fan",
  "minecraft:dead_bubble_coral_wall_fan",
  "minecraft:dead_fire_coral",
  "minecraft:dead_fire_coral_fan",
  "minecraft:dead_fire_coral_wall_fan",
  "minecraft:dead_horn_coral",
  "minecraft:dead_horn_coral_fan",
  "minecraft:dead_horn_coral_wall_fan",
  "minecraft:dead_tube_coral",
  "minecraft:dead_tube_coral_fan",
  "minecraft:dead_tube_coral_wall_fan",
  "minecraft:deadbush",
  "minecraft:decorated_pot",
  "minecraft:deepslate_brick_slab",
  "minecraft:deepslate_brick_wall",
  "minecraft:deepslate_tile_slab",
  "minecraft:deepslate_tile_wall",
  "minecraft:deprecated_anvil",
  "minecraft:detector_rail",
  "minecraft:diorite_slab",
  "minecraft:double_cut_copper_slab",
  "minecraft:double_plant",
  "minecraft:dragon_egg",
  "minecraft:enchanting_table",
  "minecraft:end_gateway",
  "minecraft:end_portal",
  "minecraft:end_portal_frame",
  "minecraft:end_rod",
  "minecraft:end_stone_brick_slab",
  "minecraft:ender_chest",
  "minecraft:exposed_copper_door",
  "minecraft:exposed_copper_trapdoor",
  "minecraft:exposed_cut_copper_slab",
  "minecraft:fern",
  "minecraft:fire",
  "minecraft:fire_coral",
  "minecraft:fire_coral_fan",
  "minecraft:fire_coral_wall_fan",
  "minecraft:flower_pot",
  "minecraft:flowering_azalea",
  "minecraft:flowing_lava",
  "minecraft:flowing_water",
  "minecraft:frame",
  "minecraft:frog_spawn",
  "minecraft:glass_pane",
  "minecraft:glow_frame",
  "minecraft:glow_lichen",
  "minecraft:golden_rail",
  "minecraft:granite_slab",
  "minecraft:gray_candle",
  "minecraft:gray_candle_cake",
  "minecraft:gray_carpet",
  "minecraft:gray_shulker_box",
  "minecraft:gray_stained_glass_pane",
  "minecraft:green_candle",
  "minecraft:green_candle_cake",
  "minecraft:green_carpet",
  "minecraft:green_shulker_box",
  "minecraft:green_stained_glass_pane",
  "minecraft:grindstone",
  "minecraft:hanging_roots",
  "minecraft:heavy_core",
  "minecraft:heavy_weighted_pressure_plate",
  "minecraft:hopper",
  "minecraft:horn_coral",
  "minecraft:horn_coral_fan",
  "minecraft:horn_coral_wall_fan",
  "minecraft:info_update",
  "minecraft:info_update2",
  "minecraft:invisibleBedrock",
  "minecraft:iron_bars",
  "minecraft:iron_door",
  "minecraft:iron_trapdoor",
  "minecraft:jungle_button",
  "minecraft:jungle_door",
  "minecraft:jungle_hanging_sign",
  "minecraft:jungle_leaves",
  "minecraft:jungle_pressure_plate",
  "minecraft:jungle_sapling",
  "minecraft:jungle_slab",
  "minecraft:jungle_standing_sign",
  "minecraft:jungle_trapdoor",
  "minecraft:jungle_wall_sign",
  "minecraft:kelp",
  "minecraft:ladder",
  "minecraft:lantern",
  "minecraft:large_amethyst_bud",
  "minecraft:large_fern",
  "minecraft:lava",
  "minecraft:lava_cauldron",
  "minecraft:leaves",
  "minecraft:leaves2",
  "minecraft:lectern",
  "minecraft:lever",
  "minecraft:light_block",
  "minecraft:light_block_0",
  "minecraft:light_block_1",
  "minecraft:light_block_10",
  "minecraft:light_block_11",
  "minecraft:light_block_12",
  "minecraft:light_block_13",
  "minecraft:light_block_14",
  "minecraft:light_block_15",
  "minecraft:light_block_2",
  "minecraft:light_block_3",
  "minecraft:light_block_4",
  "minecraft:light_block_5",
  "minecraft:light_block_6",
  "minecraft:light_block_7",
  "minecraft:light_block_8",
  "minecraft:light_block_9",
  "minecraft:light_blue_candle",
  "minecraft:light_blue_candle_cake",
  "minecraft:light_blue_carpet",
  "minecraft:light_blue_shulker_box",
  "minecraft:light_blue_stained_glass_pane",
  "minecraft:light_gray_candle",
  "minecraft:light_gray_candle_cake",
  "minecraft:light_gray_carpet",
  "minecraft:light_gray_shulker_box",
  "minecraft:light_gray_stained_glass_pane",
  "minecraft:light_weighted_pressure_plate",
  "minecraft:lightning_rod",
  "minecraft:lilac",
  "minecraft:lily_of_the_valley",
  "minecraft:lime_candle",
  "minecraft:lime_candle_cake",
  "minecraft:lime_carpet",
  "minecraft:lime_shulker_box",
  "minecraft:lime_stained_glass_pane",
  "minecraft:lit_pumpkin",
  "minecraft:magenta_candle",
  "minecraft:magenta_candle_cake",
  "minecraft:magenta_carpet",
  "minecraft:magenta_shulker_box",
  "minecraft:magenta_stained_glass_pane",
  "minecraft:mangrove_button",
  "minecraft:mangrove_door",
  "minecraft:mangrove_hanging_sign",
  "minecraft:mangrove_leaves",
  "minecraft:mangrove_pressure_plate",
  "minecraft:mangrove_propagule",
  "minecraft:mangrove_sapling",
  "minecraft:mangrove_slab",
  "minecraft:mangrove_standing_sign",
  "minecraft:mangrove_trapdoor",
  "minecraft:mangrove_wall_sign",
  "minecraft:medium_amethyst_bud",
  "minecraft:melon_block",
  "minecraft:melon_stem",
  "minecraft:moss_carpet",
  "minecraft:mossy_cobblestone_slab",
  "minecraft:mossy_stone_brick_slab",
  "minecraft:movingBlock",
  "minecraft:mud_brick_slab",
  "minecraft:mud_brick_wall",
  "minecraft:nether_brick_slab",
  "minecraft:nether_sprouts",
  "minecraft:nether_wart",
  "minecraft:normal_stone_slab",
  "minecraft:oak_button",
  "minecraft:oak_door",
  "minecraft:oak_hanging_sign",
  "minecraft:oak_leaves",
  "minecraft:oak_pressure_plate",
  "minecraft:oak_sapling",
  "minecraft:oak_slab",
  "minecraft:oak_standing_sign",
  "minecraft:oak_trapdoor",
  "minecraft:oak_wall_sign",
  "minecraft:orange_candle",
  "minecraft:orange_candle_cake",
  "minecraft:orange_carpet",
  "minecraft:orange_shulker_box",
  "minecraft:orange_stained_glass_pane",
  "minecraft:orange_tulip",
  "minecraft:oxeye_daisy",
  "minecraft:oxidized_copper_door",
  "minecraft:oxidized_copper_trapdoor",
  "minecraft:oxidized_cut_copper_slab",
  "minecraft:peony",
  "minecraft:petrified_oak_slab",
  "minecraft:pink_candle",
  "minecraft:pink_candle_cake",
  "minecraft:pink_carpet",
  "minecraft:pink_petals",
  "minecraft:pink_shulker_box",
  "minecraft:pink_stained_glass_pane",
  "minecraft:pink_tulip",
  "minecraft:pistonArmCollision",
  "minecraft:pitcher_crop",
  "minecraft:pitcher_plant",
  "minecraft:pointed_dripstone",
  "minecraft:polished_andesite_slab",
  "minecraft:polished_blackstone_brick_slab",
  "minecraft:polished_blackstone_brick_wall",
  "minecraft:polished_blackstone_button",
  "minecraft:polished_blackstone_pressure_plate",
  "minecraft:polished_blackstone_slab",
  "minecraft:polished_blackstone_wall",
  "minecraft:polished_deepslate_slab",
  "minecraft:polished_deepslate_wall",
  "minecraft:polished_diorite_slab",
  "minecraft:polished_granite_slab",
  "minecraft:polished_tuff_slab",
  "minecraft:poppy",
  "minecraft:portal",
  "minecraft:potatoes",
  "minecraft:powder_snow",
  "minecraft:powered_comparator",
  "minecraft:powered_repeater",
  "minecraft:prismarine_brick_slab",
  "minecraft:prismarine_slab",
  "minecraft:pumpkin",
  "minecraft:pumpkin_stem",
  "minecraft:purple_candle",
  "minecraft:purple_candle_cake",
  "minecraft:purple_carpet",
  "minecraft:purple_shulker_box",
  "minecraft:purple_stained_glass_pane",
  "minecraft:purpur_slab",
  "minecraft:quartz_slab",
  "minecraft:rail",
  "minecraft:red_candle",
  "minecraft:red_candle_cake",
  "minecraft:red_carpet",
  "minecraft:red_flower",
  "minecraft:red_mushroom",
  "minecraft:red_nether_brick_slab",
  "minecraft:red_sandstone_slab",
  "minecraft:red_shulker_box",
  "minecraft:red_stained_glass_pane",
  "minecraft:red_tulip",
  "minecraft:redstone_torch",
  "minecraft:redstone_wire",
  "minecraft:reeds",
  "minecraft:reserved6",
  "minecraft:rose_bush",
  "minecraft:sandstone_slab",
  "minecraft:sapling",
  "minecraft:scaffolding",
  "minecraft:sculk",
  "minecraft:sculk_sensor",
  "minecraft:sculk_shrieker",
  "minecraft:sculk_vein",
  "minecraft:sea_pickle",
  "minecraft:seagrass",
  "minecraft:short_grass",
  "minecraft:shulker_box",
  "minecraft:skull",
  "minecraft:small_amethyst_bud",
  "minecraft:small_dripleaf_block",
  "minecraft:smooth_quartz_slab",
  "minecraft:smooth_red_sandstone_slab",
  "minecraft:smooth_sandstone_slab",
  "minecraft:smooth_stone_slab",
  "minecraft:sniffer_egg",
  "minecraft:snow_layer",
  "minecraft:soul_campfire",
  "minecraft:soul_fire",
  "minecraft:soul_lantern",
  "minecraft:soul_torch",
  "minecraft:spore_blossom",
  "minecraft:spruce_button",
  "minecraft:spruce_door",
  "minecraft:spruce_hanging_sign",
  "minecraft:spruce_leaves",
  "minecraft:spruce_pressure_plate",
  "minecraft:spruce_sapling",
  "minecraft:spruce_slab",
  "minecraft:spruce_standing_sign",
  "minecraft:spruce_trapdoor",
  "minecraft:spruce_wall_sign",
  "minecraft:stained_glass_pane",
  "minecraft:standing_banner",
  "minecraft:standing_sign",
  "minecraft:stickyPistonArmCollision",
  "minecraft:stone_brick_slab",
  "minecraft:stone_button",
  "minecraft:stone_pressure_plate",
  "minecraft:stone_slab",
  "minecraft:stone_slab2",
  "minecraft:stone_slab3",
  "minecraft:stone_slab4",
  "minecraft:stonecutter",
  "minecraft:stonecutter_block",
  "minecraft:structure_void",
  "minecraft:sunflower",
  "minecraft:sweet_berry_bush",
  "minecraft:tall_grass",
  "minecraft:tallgrass",
  "minecraft:torch",
  "minecraft:torchflower",
  "minecraft:torchflower_crop",
  "minecraft:trapdoor",
  "minecraft:trapped_chest",
  "minecraft:tripWire",
  "minecraft:tripwire_hook",
  "minecraft:tube_coral",
  "minecraft:tube_coral_fan",
  "minecraft:tube_coral_wall_fan",
  "minecraft:tuff_brick_slab",
  "minecraft:tuff_brick_wall",
  "minecraft:tuff_slab",
  "minecraft:tuff_wall",
  "minecraft:turtle_egg",
  "minecraft:twisting_vines",
  "minecraft:undyed_shulker_box",
  "minecraft:unlit_redstone_torch",
  "minecraft:unpowered_comparator",
  "minecraft:unpowered_repeater",
  "minecraft:vault",
  "minecraft:vine",
  "minecraft:wall_banner",
  "minecraft:wall_sign",
  "minecraft:warped_button",
  "minecraft:warped_door",
  "minecraft:warped_fungus",
  "minecraft:warped_hanging_sign",
  "minecraft:warped_leaves",
  "minecraft:warped_pressure_plate",
  "minecraft:warped_sapling",
  "minecraft:warped_roots",
  "minecraft:warped_slab",
  "minecraft:warped_standing_sign",
  "minecraft:warped_trapdoor",
  "minecraft:warped_wall_sign",
  "minecraft:water",
  "minecraft:waterlily",
  "minecraft:waxed_copper_door",
  "minecraft:waxed_copper_trapdoor",
  "minecraft:waxed_cut_copper_slab",
  "minecraft:waxed_exposed_copper_door",
  "minecraft:waxed_exposed_copper_trapdoor",
  "minecraft:waxed_exposed_cut_copper_slab",
  "minecraft:waxed_oxidizedcopper_door",
  "minecraft:waxed_oxidizedcopper_trapdoor",
  "minecraft:waxed_oxidizedcut_copper_slab",
  "minecraft:waxed_weathered_copper_door",
  "minecraft:waxed_weathered_copper_trapdoor",
  "minecraft:waxed_weathered_cut_copper_slab",
  "minecraft:web",
  "minecraft:weeping_vines",
  "minecraft:wheat",
  "minecraft:white_candle",
  "minecraft:white_candle_cake",
  "minecraft:white_carpet",
  "minecraft:white_shulker_box",
  "minecraft:white_stained_glass_pane",
  "minecraft:white_tulip",
  "minecraft:wither_rose",
  "minecraft:wooden_button",
  "minecraft:wooden_door",
  "minecraft:wooden_pressure_plate",
  "minecraft:wooden_slab",
  "minecraft:yellow_candle",
  "minecraft:yellow_candle_cake",
  "minecraft:yellow_carpet",
  "minecraft:yellow_flower",
  "minecraft:yellow_shulker_box",
  "minecraft:yellow_stained_glass_pane"
];

// data/scripts/blocks/managers/FenceManager.ts
var TAG = "gs_season:is_fence";
var PREFIX = "gs_season";
var FenceManager = class {
  static beforePlace(data) {
    data.permutationToPlace = data.permutationToPlace.withState(`${PREFIX}:display`, false);
  }
  static updateAround(center) {
    const dirs = ["north", "south", "east", "west"];
    const blocks = [center, ...dirs.map((d) => tryDir(center, d))].filter(Boolean);
    for (const b of blocks) if (b.hasTag(TAG)) this.updateSingle(b);
  }
  static updateSingle(fence) {
    const dirs = ["north", "south", "east", "west"];
    for (const dir of dirs) {
      const neighbour = tryDir(fence, dir);
      const should = neighbour && !(neighbour.isAir || neighbour.isLiquid) && !bannedBlocks.includes(neighbour.typeId);
      fence.setPermutation(fence.permutation.withState(`${PREFIX}:connect_${dir}`, should));
    }
  }
};
function tryDir(b, dir) {
  try {
    return b[dir](1);
  } catch {
    return void 0;
  }
}

// data/scripts/blocks/managers/WallManager.js
var wallTag = "wall:is_wall";
var bannedBlocks2 = [
  "gs_season:dandy_lion",
  "gs_season:devils_grass",
  "gs_season:lanceolata",
  "gs_season:clover",
  "gs_season:persian_speedwell",
  "gs_season:acacia_leaves",
  "gs_season:baobab_leaves",
  "gs_season:bushwillow_leaves",
  "gs_season:beech_leaves",
  "gs_season:red_oak_leaves",
  "gs_season:sugar_maple_leaves",
  "gs_season:aspen_grass_1",
  "gs_season:aspen_grass_2",
  "gs_season:aspen_grass_3",
  "gs_season:aspen_grass_4",
  "gs_season:aspen_flower",
  "gs_season:aspen_fern",
  "gs_season:aspen_leaves",
  "gs_season:jacaranda_leaves_1",
  "gs_season:jacaranda_leaves_2",
  "gs_season:jacaranda_grass_1",
  "gs_season:jacaranda_grass_2",
  "gs_season:jacaranda_grass_3",
  "gs_season:jacaranda_grass_4",
  "gs_season:jacaranda_grass_5",
  "gs_season:jacaranda_grass_1_tall",
  "gs_season:jacaranda_grass_2_tall",
  "gs_season:jacaranda_grass_3_tall",
  "gs_season:jacaranda_vines",
  "gs_season:palm_leaves",
  "gs_season:savannah_grass_long",
  "gs_season:savannah_grass_tall",
  "gs_season:savannah_vines",
  "gs_season:savannah_fern",
  "gs_season:savannah_grass_1",
  "gs_season:savannah_grass_2",
  "gs_season:savannah_grass_3",
  "gs_season:african_potato",
  "gs_season:heliotrope",
  "gs_season:ratgrass",
  "gs_season:wildindigo",
  "gs_season:christmas_fern",
  "gs_season:partridge_berry",
  "gs_season:sarsaparilla",
  "gs_season:trillium",
  "gs_season:wintergreen",
  "gs_season:aloe",
  "gs_season:alpine_bearberry",
  "gs_season:arctic_willow",
  "gs_season:bog_blueberry",
  "gs_season:crowberry",
  "gs_season:dwarf_birch",
  "gs_season:mountain_avens",
  "gs_season:purple_saxifrage",
  "gs_season:tundra_fern_tall",
  "gs_season:tundra_fern",
  "gs_season:tundra_grass_1",
  "gs_season:tundra_grass_2",
  "gs_season:tundra_grass_3",
  "gs_season:reindeer_lichen",
  "gs_season:forest_mushroom_1",
  "gs_season:forest_mushroom_2",
  "gs_season:forest_mushroom_3",
  "gs_season:forest_mushroom_4",
  "gs_season:forest_grass_tall",
  "gs_season:forest_grass_1",
  "gs_season:forest_grass_2",
  "gs_season:forest_grass_3",
  "gs_season:forest_grass_4",
  "gs_season:wall_mushroom",
  "gs_season:oasis_cactus_1",
  "gs_season:oasis_cactus",
  "gs_season:oasis_deadbush",
  "gs_season:oasis_fern",
  "gs_season:oasis_grass",
  "gs_season:acacia_door",
  "gs_season:acacia_trapdoor",
  "gs_season:acacia_slab",
  "gs_season:acacia_stairs",
  "gs_season:baobab_door",
  "gs_season:baobab_trapdoor",
  "gs_season:baobab_slab",
  "gs_season:baobab_stairs",
  "gs_season:bushwillow_door",
  "gs_season:bushwillow_trapdoor",
  "gs_season:bushwillow_slab",
  "gs_season:bushwillow_stairs",
  "gs_season:beech_door",
  "gs_season:beech_trapdoor",
  "gs_season:beech_slab",
  "gs_season:beech_stairs",
  "gs_season:red_oak_door",
  "gs_season:red_oak_trapdoor",
  "gs_season:red_oak_slab",
  "gs_season:red_oak_stairs",
  "gs_season:sugar_maple_door",
  "gs_season:sugar_maple_trapdoor",
  "gs_season:sugar_maple_slab",
  "gs_season:sugar_maple_stairs",
  "gs_season:aspen_door",
  "gs_season:aspen_trapdoor",
  "gs_season:aspen_slab",
  "gs_season:aspen_stairs",
  "gs_season:jacaranda_door_1",
  "gs_season:jacaranda_door_2",
  "gs_season:jacaranda_trapdoor_1",
  "gs_season:jacaranda_trapdoor_2",
  "gs_season:jacaranda_1_stairs",
  "gs_season:jacaranda_2_stairs",
  "gs_season:jacaranda_1_slab",
  "gs_season:jacaranda_2_slab",
  "gs_season:palm_door",
  "gs_season:palm_trapdoor",
  "gs_season:palm_slab",
  "gs_season:palm_stairs",
  "gs_season:acacia_log",
  "gs_season:acacia_stripped_log",
  "gs_season:acacia_wood",
  "gs_season:acacia_wood_stripped",
  "gs_season:acacia_planks",
  "gs_season:baobab_log",
  "gs_season:baobab_stripped_log",
  "gs_season:baobab_wood",
  "gs_season:baobab_wood_stripped",
  "gs_season:baobab_planks",
  "gs_season:bushwillow_log",
  "gs_season:bushwillow_stripped_log",
  "gs_season:bushwillow_wood",
  "gs_season:bushwillow_wood_stripped",
  "gs_season:bushwillow_planks",
  "gs_season:beech_log",
  "gs_season:beech_stripped_log",
  "gs_season:beech_wood",
  "gs_season:beech_wood_stripped",
  "gs_season:beech_planks",
  "gs_season:red_oak_log",
  "gs_season:red_oak_stripped_log",
  "gs_season:red_oak_wood",
  "gs_season:red_oak_wood_stripped",
  "gs_season:red_oak_planks",
  "gs_season:sugar_maple_log",
  "gs_season:sugar_maple_stripped_log",
  "gs_season:sugar_maple_wood",
  "gs_season:sugar_maple_wood_stripped",
  "gs_season:sugar_maple_planks",
  "gs_season:aspen_log",
  "gs_season:aspen_stripped_log",
  "gs_season:aspen_wood",
  "gs_season:aspen_wood_stripped",
  "gs_season:aspen_planks",
  "gs_season:jacaranda_planks_1",
  "gs_season:jacaranda_planks_2",
  "gs_season:jacaranda_stripped_log_1",
  "gs_season:jacaranda_stripped_log_2",
  "gs_season:jacaranda_wood_1",
  "gs_season:jacaranda_wood_2",
  "gs_season:jacaranda_wood_stripped_1",
  "gs_season:jacaranda_wood_stripped_2",
  "gs_season:palm_log",
  "gs_season:palm_stripped_log",
  "gs_season:palm_wood",
  "gs_season:palm_wood_stripped",
  "gs_season:palm_planks",
  "gs_season:forest_grass",
  "gs_season:savannah_grass",
  "gs_season:tundra_grass",
  "gs_season:tundra_podzol",
  "gs_season:aspen_grass",
  "gs_season:jacaranda_grass",
  "gs_season:oasis_sand",
  "gs_season:dirt",
  "gs_season:mossy_stone",
  "gs_season:mossy_stone_wall",
  "gs_season:mossy_stone_slab",
  "gs_season:mossy_stone_stairs",
  "gs_season:overworld_grass_1",
  "gs_season:overworld_grass_2",
  "gs_season:overworld_grass_3",
  "gs_season:overworld_leaf_litter",
  "gs_season:overworld_grass",
  "gs_season:wild_farmland_wet",
  "gs_season:pebbles_1",
  "gs_season:pebbles_2",
  "gs_season:pebbles_3",
  "gs_season:pebbles_4",
  "gs_season:seashells",
  "gs_season:rice",
  "gs_season:rhubarb",
  "gs_season:corn",
  "gs_season:scarlet_azalea",
  "gs_season:scarlet_cave_vines_bottom",
  "gs_season:scarlet_cave_vines_top",
  "gs_season:scarlet_clay",
  "gs_season:scarlet_grass",
  "gs_season:scarlet_lichen",
  "gs_season:scarlet_moss",
  "gs_season:scarlet_reeds",
  "gs_season:scarlet_spore_blossom",
  "gs_season:scarlet_tallgrass",
  "gs_season:reeds",
  "gs_season:overworld_azalea",
  "gs_season:jacaranda_plant",
  "gs_season:cotton",
  "gs_season:scarlet_dripstone",
  "gs_season:scarlet_dripstone_block",
  "gs_season:acacia_fence",
  "gs_season:acacia_fence_gate",
  "gs_season:baobab_fence",
  "gs_season:baobab_fence_gate",
  "gs_season:bushwillow_fence",
  "gs_season:bushwillow_fence_gate",
  "gs_season:beech_fence",
  "gs_season:beech_fence_gate",
  "gs_season:red_oak_fence",
  "gs_season:red_oak_fence_gate",
  "gs_season:sugar_maple_fence",
  "gs_season:sugar_maple_fence_gate",
  "gs_season:aspen_fence",
  "gs_season:aspen_fence_gate",
  "gs_season:palm_fence",
  "gs_season:palm_fence_gate",
  "gs_season:aspen_sapling",
  "minecraft:acacia_button",
  "minecraft:acacia_door",
  "minecraft:acacia_hanging_sign",
  "minecraft:acacia_leaves",
  "minecraft:acacia_pressure_plate",
  "minecraft:acacia_sapling",
  "minecraft:acacia_slab",
  "minecraft:acacia_standing_sign",
  "minecraft:acacia_trapdoor",
  "minecraft:acacia_wall_sign",
  "minecraft:activator_rail",
  "minecraft:allium",
  "minecraft:amethyst_cluster",
  "minecraft:andesite_slab",
  "minecraft:anvil",
  "minecraft:azalea",
  "minecraft:azalea_leaves",
  "minecraft:azalea_leaves_flowered",
  "minecraft:azure_bluet",
  "minecraft:bamboo",
  "minecraft:bamboo_button",
  "minecraft:bamboo_door",
  "minecraft:bamboo_hanging_sign",
  "minecraft:bamboo_mosaic_slab",
  "minecraft:bamboo_pressure_plate",
  "minecraft:bamboo_sapling",
  "minecraft:bamboo_slab",
  "minecraft:bamboo_standing_sign",
  "minecraft:bamboo_trapdoor",
  "minecraft:bamboo_wall_sign",
  "minecraft:barrier",
  "minecraft:beetroot",
  "minecraft:bell",
  "minecraft:bush",
  "minecraft:big_dripleaf",
  "minecraft:birch_button",
  "minecraft:birch_door",
  "minecraft:birch_hanging_sign",
  "minecraft:birch_leaves",
  "minecraft:birch_pressure_plate",
  "minecraft:birch_sapling",
  "minecraft:birch_slab",
  "minecraft:birch_standing_sign",
  "minecraft:birch_trapdoor",
  "minecraft:birch_wall_sign",
  "minecraft:black_candle",
  "minecraft:black_candle_cake",
  "minecraft:black_carpet",
  "minecraft:black_shulker_box",
  "minecraft:black_stained_glass_pane",
  "minecraft:blackstone_slab",
  "minecraft:blue_candle",
  "minecraft:blue_candle_cake",
  "minecraft:blue_carpet",
  "minecraft:blue_orchid",
  "minecraft:blue_shulker_box",
  "minecraft:blue_stained_glass_pane",
  "minecraft:border_block",
  "minecraft:brain_coral",
  "minecraft:brain_coral_fan",
  "minecraft:brain_coral_wall_fan",
  "minecraft:brewing_stand",
  "minecraft:brick_slab",
  "minecraft:brown_candle",
  "minecraft:brown_candle_cake",
  "minecraft:brown_carpet",
  "minecraft:brown_carpet",
  "minecraft:brown_mushroom",
  "minecraft:brown_shulker_box",
  "minecraft:brown_stained_glass_pane",
  "minecraft:bubble_column",
  "minecraft:bubble_coral",
  "minecraft:bubble_coral_fan",
  "minecraft:bubble_coral_wall_fan",
  "minecraft:cactus",
  "minecraft:cake",
  "minecraft:calibrated_sculk_sensor",
  "minecraft:camera",
  "minecraft:campfire",
  "minecraft:candle",
  "minecraft:candle_cake",
  "minecraft:carpet",
  "minecraft:carrots",
  "minecraft:carved_pumpkin",
  "minecraft:cauldron",
  "minecraft:cave_vines",
  "minecraft:cave_vines_body_with_berries",
  "minecraft:cave_vines_head_with_berries",
  "minecraft:chain",
  "minecraft:cherry_button",
  "minecraft:cherry_door",
  "minecraft:cherry_hanging_sign",
  "minecraft:cherry_leaves",
  "minecraft:cherry_pressure_plate",
  "minecraft:cherry_sapling",
  "minecraft:cherry_slab",
  "minecraft:cherry_standing_sign",
  "minecraft:cherry_trapdoor",
  "minecraft:cherry_wall_sign",
  "minecraft:chest",
  "minecraft:chipped_anvil",
  "minecraft:chorus_flower",
  "minecraft:chorus_plant",
  "minecraft:cobbled_deepslate_slab",
  "minecraft:cobblestone_slab",
  "minecraft:cocoa",
  "minecraft:conduit",
  "minecraft:copper_bulb",
  "minecraft:copper_door",
  "minecraft:copper_grate",
  "minecraft:copper_trapdoor",
  "minecraft:coral",
  "minecraft:coral_fan",
  "minecraft:coral_fan_dead",
  "minecraft:coral_fan_hang",
  "minecraft:coral_fan_hang2",
  "minecraft:coral_fan_hang3",
  "minecraft:cornflower",
  "minecraft:crimson_button",
  "minecraft:crimson_door",
  "minecraft:crimson_fungus",
  "minecraft:crimson_hanging_sign",
  "minecraft:crimson_leaves",
  "minecraft:crimson_pressure_plate",
  "minecraft:crimson_sapling",
  "minecraft:crimson_roots",
  "minecraft:crimson_slab",
  "minecraft:crimson_standing_sign",
  "minecraft:crimson_trapdoor",
  "minecraft:crimson_wall_sign",
  "minecraft:cut_copper_slab",
  "minecraft:cut_red_sandstone_slab",
  "minecraft:cut_sandstone_slab",
  "minecraft:cyan_candle",
  "minecraft:cyan_candle_cake",
  "minecraft:cyan_carpet",
  "minecraft:cyan_shulker_box",
  "minecraft:cyan_stained_glass_pane",
  "minecraft:damaged_anvil",
  "minecraft:dandelion",
  "minecraft:dark_oak_button",
  "minecraft:dark_oak_door",
  "minecraft:dark_oak_hanging_sign",
  "minecraft:dark_oak_leaves",
  "minecraft:dark_oak_pressure_plate",
  "minecraft:dark_oak_sapling",
  "minecraft:dark_oak_slab",
  "minecraft:dark_oak_trapdoor",
  "minecraft:dark_prismarine_slab",
  "minecraft:darkoak_standing_sign",
  "minecraft:darkoak_wall_sign",
  "minecraft:daylight_detector",
  "minecraft:daylight_detector_inverted",
  "minecraft:dead_brain_coral",
  "minecraft:dead_brain_coral_fan",
  "minecraft:dead_brain_coral_wall_fan",
  "minecraft:dead_bubble_coral",
  "minecraft:dead_bubble_coral_fan",
  "minecraft:dead_bubble_coral_wall_fan",
  "minecraft:dead_fire_coral",
  "minecraft:dead_fire_coral_fan",
  "minecraft:dead_fire_coral_wall_fan",
  "minecraft:dead_horn_coral",
  "minecraft:dead_horn_coral_fan",
  "minecraft:dead_horn_coral_wall_fan",
  "minecraft:dead_tube_coral",
  "minecraft:dead_tube_coral_fan",
  "minecraft:dead_tube_coral_wall_fan",
  "minecraft:deadbush",
  "minecraft:decorated_pot",
  "minecraft:deepslate_brick_slab",
  "minecraft:deepslate_tile_slab",
  "minecraft:deprecated_anvil",
  "minecraft:detector_rail",
  "minecraft:diorite_slab",
  "minecraft:double_cut_copper_slab",
  "minecraft:double_plant",
  "minecraft:dragon_egg",
  "minecraft:enchanting_table",
  "minecraft:end_gateway",
  "minecraft:end_portal",
  "minecraft:end_portal_frame",
  "minecraft:end_rod",
  "minecraft:end_stone_brick_slab",
  "minecraft:ender_chest",
  "minecraft:exposed_copper_door",
  "minecraft:exposed_copper_trapdoor",
  "minecraft:exposed_cut_copper_slab",
  "minecraft:fern",
  "minecraft:fire",
  "minecraft:fire_coral",
  "minecraft:fire_coral_fan",
  "minecraft:fire_coral_wall_fan",
  "minecraft:flower_pot",
  "minecraft:flowering_azalea",
  "minecraft:flowing_lava",
  "minecraft:flowing_water",
  "minecraft:frame",
  "minecraft:frog_spawn",
  "minecraft:glass_pane",
  "minecraft:glow_frame",
  "minecraft:glow_lichen",
  "minecraft:golden_rail",
  "minecraft:granite_slab",
  "minecraft:gray_candle",
  "minecraft:gray_candle_cake",
  "minecraft:gray_carpet",
  "minecraft:gray_shulker_box",
  "minecraft:gray_stained_glass_pane",
  "minecraft:green_candle",
  "minecraft:green_candle_cake",
  "minecraft:green_carpet",
  "minecraft:green_shulker_box",
  "minecraft:green_stained_glass_pane",
  "minecraft:grindstone",
  "minecraft:hanging_roots",
  "minecraft:heavy_core",
  "minecraft:heavy_weighted_pressure_plate",
  "minecraft:hopper",
  "minecraft:horn_coral",
  "minecraft:horn_coral_fan",
  "minecraft:horn_coral_wall_fan",
  "minecraft:info_update",
  "minecraft:info_update2",
  "minecraft:invisibleBedrock",
  "minecraft:iron_bars",
  "minecraft:iron_door",
  "minecraft:iron_trapdoor",
  "minecraft:jungle_button",
  "minecraft:jungle_door",
  "minecraft:jungle_hanging_sign",
  "minecraft:jungle_leaves",
  "minecraft:jungle_pressure_plate",
  "minecraft:jungle_sapling",
  "minecraft:jungle_slab",
  "minecraft:jungle_standing_sign",
  "minecraft:jungle_trapdoor",
  "minecraft:jungle_wall_sign",
  "minecraft:kelp",
  "minecraft:ladder",
  "minecraft:lantern",
  "minecraft:large_amethyst_bud",
  "minecraft:large_fern",
  "minecraft:lava",
  "minecraft:lava_cauldron",
  "minecraft:leaves",
  "minecraft:leaves2",
  "minecraft:lectern",
  "minecraft:lever",
  "minecraft:light_block",
  "minecraft:light_block_0",
  "minecraft:light_block_1",
  "minecraft:light_block_10",
  "minecraft:light_block_11",
  "minecraft:light_block_12",
  "minecraft:light_block_13",
  "minecraft:light_block_14",
  "minecraft:light_block_15",
  "minecraft:light_block_2",
  "minecraft:light_block_3",
  "minecraft:light_block_4",
  "minecraft:light_block_5",
  "minecraft:light_block_6",
  "minecraft:light_block_7",
  "minecraft:light_block_8",
  "minecraft:light_block_9",
  "minecraft:light_blue_candle",
  "minecraft:light_blue_candle_cake",
  "minecraft:light_blue_carpet",
  "minecraft:light_blue_shulker_box",
  "minecraft:light_blue_stained_glass_pane",
  "minecraft:light_gray_candle",
  "minecraft:light_gray_candle_cake",
  "minecraft:light_gray_carpet",
  "minecraft:light_gray_shulker_box",
  "minecraft:light_gray_stained_glass_pane",
  "minecraft:light_weighted_pressure_plate",
  "minecraft:lightning_rod",
  "minecraft:lilac",
  "minecraft:lily_of_the_valley",
  "minecraft:lime_candle",
  "minecraft:lime_candle_cake",
  "minecraft:lime_carpet",
  "minecraft:lime_shulker_box",
  "minecraft:lime_stained_glass_pane",
  "minecraft:lit_pumpkin",
  "minecraft:magenta_candle",
  "minecraft:magenta_candle_cake",
  "minecraft:magenta_carpet",
  "minecraft:magenta_shulker_box",
  "minecraft:magenta_stained_glass_pane",
  "minecraft:mangrove_button",
  "minecraft:mangrove_door",
  "minecraft:mangrove_hanging_sign",
  "minecraft:mangrove_leaves",
  "minecraft:mangrove_pressure_plate",
  "minecraft:mangrove_propagule",
  "minecraft:mangrove_sapling",
  "minecraft:mangrove_slab",
  "minecraft:mangrove_standing_sign",
  "minecraft:mangrove_trapdoor",
  "minecraft:mangrove_wall_sign",
  "minecraft:medium_amethyst_bud",
  "minecraft:melon_block",
  "minecraft:melon_stem",
  "minecraft:moss_carpet",
  "minecraft:mossy_cobblestone_slab",
  "minecraft:mossy_stone_brick_slab",
  "minecraft:movingBlock",
  "minecraft:mud_brick_slab",
  "minecraft:nether_brick_slab",
  "minecraft:nether_sprouts",
  "minecraft:nether_wart",
  "minecraft:normal_stone_slab",
  "minecraft:oak_button",
  "minecraft:oak_door",
  "minecraft:oak_hanging_sign",
  "minecraft:oak_leaves",
  "minecraft:oak_pressure_plate",
  "minecraft:oak_sapling",
  "minecraft:oak_slab",
  "minecraft:oak_standing_sign",
  "minecraft:oak_trapdoor",
  "minecraft:oak_wall_sign",
  "minecraft:orange_candle",
  "minecraft:orange_candle_cake",
  "minecraft:orange_carpet",
  "minecraft:orange_shulker_box",
  "minecraft:orange_stained_glass_pane",
  "minecraft:orange_tulip",
  "minecraft:oxeye_daisy",
  "minecraft:oxidized_copper_door",
  "minecraft:oxidized_copper_trapdoor",
  "minecraft:oxidized_cut_copper_slab",
  "minecraft:peony",
  "minecraft:petrified_oak_slab",
  "minecraft:pink_candle",
  "minecraft:pink_candle_cake",
  "minecraft:pink_carpet",
  "minecraft:pink_petals",
  "minecraft:pink_shulker_box",
  "minecraft:pink_stained_glass_pane",
  "minecraft:pink_tulip",
  "minecraft:pistonArmCollision",
  "minecraft:pitcher_crop",
  "minecraft:pitcher_plant",
  "minecraft:pointed_dripstone",
  "minecraft:polished_andesite_slab",
  "minecraft:polished_blackstone_brick_slab",
  "minecraft:polished_blackstone_button",
  "minecraft:polished_blackstone_pressure_plate",
  "minecraft:polished_blackstone_slab",
  "minecraft:polished_deepslate_slab",
  "minecraft:polished_diorite_slab",
  "minecraft:polished_granite_slab",
  "minecraft:polished_tuff_slab",
  "minecraft:poppy",
  "minecraft:portal",
  "minecraft:potatoes",
  "minecraft:powder_snow",
  "minecraft:powered_comparator",
  "minecraft:powered_repeater",
  "minecraft:prismarine_brick_slab",
  "minecraft:prismarine_slab",
  "minecraft:pumpkin",
  "minecraft:pumpkin_stem",
  "minecraft:purple_candle",
  "minecraft:purple_candle_cake",
  "minecraft:purple_carpet",
  "minecraft:purple_shulker_box",
  "minecraft:purple_stained_glass_pane",
  "minecraft:purpur_slab",
  "minecraft:quartz_slab",
  "minecraft:rail",
  "minecraft:red_candle",
  "minecraft:red_candle_cake",
  "minecraft:red_carpet",
  "minecraft:red_flower",
  "minecraft:red_mushroom",
  "minecraft:red_nether_brick_slab",
  "minecraft:red_sandstone_slab",
  "minecraft:red_shulker_box",
  "minecraft:red_stained_glass_pane",
  "minecraft:red_tulip",
  "minecraft:redstone_torch",
  "minecraft:redstone_wire",
  "minecraft:reeds",
  "minecraft:reserved6",
  "minecraft:rose_bush",
  "minecraft:sandstone_slab",
  "minecraft:sapling",
  "minecraft:scaffolding",
  "minecraft:sculk",
  "minecraft:sculk_sensor",
  "minecraft:sculk_shrieker",
  "minecraft:sculk_vein",
  "minecraft:sea_pickle",
  "minecraft:seagrass",
  "minecraft:short_grass",
  "minecraft:shulker_box",
  "minecraft:skull",
  "minecraft:small_amethyst_bud",
  "minecraft:small_dripleaf_block",
  "minecraft:smooth_quartz_slab",
  "minecraft:smooth_red_sandstone_slab",
  "minecraft:smooth_sandstone_slab",
  "minecraft:smooth_stone_slab",
  "minecraft:sniffer_egg",
  "minecraft:snow_layer",
  "minecraft:soul_campfire",
  "minecraft:soul_fire",
  "minecraft:soul_lantern",
  "minecraft:soul_torch",
  "minecraft:spore_blossom",
  "minecraft:spruce_button",
  "minecraft:spruce_door",
  "minecraft:spruce_hanging_sign",
  "minecraft:spruce_leaves",
  "minecraft:spruce_pressure_plate",
  "minecraft:spruce_sapling",
  "minecraft:spruce_slab",
  "minecraft:spruce_standing_sign",
  "minecraft:spruce_trapdoor",
  "minecraft:spruce_wall_sign",
  "minecraft:stained_glass_pane",
  "minecraft:standing_banner",
  "minecraft:standing_sign",
  "minecraft:stickyPistonArmCollision",
  "minecraft:stone_brick_slab",
  "minecraft:stone_button",
  "minecraft:stone_pressure_plate",
  "minecraft:stone_slab",
  "minecraft:stone_slab2",
  "minecraft:stone_slab3",
  "minecraft:stone_slab4",
  "minecraft:stonecutter",
  "minecraft:stonecutter_block",
  "minecraft:structure_void",
  "minecraft:sunflower",
  "minecraft:sweet_berry_bush",
  "minecraft:tall_grass",
  "minecraft:tallgrass",
  "minecraft:torch",
  "minecraft:torchflower",
  "minecraft:torchflower_crop",
  "minecraft:trapdoor",
  "minecraft:trapped_chest",
  "minecraft:tripWire",
  "minecraft:tripwire_hook",
  "minecraft:tube_coral",
  "minecraft:tube_coral_fan",
  "minecraft:tube_coral_wall_fan",
  "minecraft:tuff_brick_slab",
  "minecraft:tuff_slab",
  "minecraft:turtle_egg",
  "minecraft:twisting_vines",
  "minecraft:undyed_shulker_box",
  "minecraft:unlit_redstone_torch",
  "minecraft:unpowered_comparator",
  "minecraft:unpowered_repeater",
  "minecraft:vault",
  "minecraft:vine",
  "minecraft:wall_banner",
  "minecraft:wall_sign",
  "minecraft:warped_button",
  "minecraft:warped_door",
  "minecraft:warped_fungus",
  "minecraft:warped_hanging_sign",
  "minecraft:warped_leaves",
  "minecraft:warped_pressure_plate",
  "minecraft:warped_sapling",
  "minecraft:warped_roots",
  "minecraft:warped_slab",
  "minecraft:warped_standing_sign",
  "minecraft:warped_trapdoor",
  "minecraft:warped_wall_sign",
  "minecraft:water",
  "minecraft:waterlily",
  "minecraft:waxed_copper_door",
  "minecraft:waxed_copper_trapdoor",
  "minecraft:waxed_cut_copper_slab",
  "minecraft:waxed_exposed_copper_door",
  "minecraft:waxed_exposed_copper_trapdoor",
  "minecraft:waxed_exposed_cut_copper_slab",
  "minecraft:waxed_oxidizedcopper_door",
  "minecraft:waxed_oxidizedcopper_trapdoor",
  "minecraft:waxed_oxidizedcut_copper_slab",
  "minecraft:waxed_weathered_copper_door",
  "minecraft:waxed_weathered_copper_trapdoor",
  "minecraft:waxed_weathered_cut_copper_slab",
  "minecraft:web",
  "minecraft:weeping_vines",
  "minecraft:wheat",
  "minecraft:white_candle",
  "minecraft:white_candle_cake",
  "minecraft:white_carpet",
  "minecraft:white_shulker_box",
  "minecraft:white_stained_glass_pane",
  "minecraft:white_tulip",
  "minecraft:wither_rose",
  "minecraft:wooden_button",
  "minecraft:wooden_door",
  "minecraft:wooden_pressure_plate",
  "minecraft:wooden_slab",
  "minecraft:yellow_candle",
  "minecraft:yellow_candle_cake",
  "minecraft:yellow_carpet",
  "minecraft:yellow_flower",
  "minecraft:yellow_shulker_box",
  "minecraft:yellow_stained_glass_pane"
];
var WallManager = class {
  static update_Wall_States(Wall) {
    let above = void 0;
    try {
      above = Wall.above(1);
    } catch {
    }
    let north = void 0;
    try {
      north = Wall.north(1);
    } catch {
    }
    let south = void 0;
    try {
      south = Wall.south(1);
    } catch {
    }
    let east = void 0;
    try {
      east = Wall.east(1);
    } catch {
    }
    let west = void 0;
    try {
      west = Wall.west(1);
    } catch {
    }
    const blocks = [
      { block: above, side: "up" },
      { block: north, side: "north" },
      { block: south, side: "south" },
      { block: east, side: "east" },
      { block: west, side: "west" }
    ];
    for (const blockData of blocks) {
      if (blockData.block != void 0) {
        if (!(blockData.block.isLiquid || blockData.block.isAir || bannedBlocks2.includes(blockData.block.typeId))) {
          if (blockData.side != "up") {
            Wall.setPermutation(Wall.permutation.withState("wall:connect_" + blockData.side, true));
          } else {
            Wall.setPermutation(Wall.permutation.withState("wall:top_bit", true));
          }
        } else {
          if (blockData.side != "up") {
            Wall.setPermutation(Wall.permutation.withState("wall:connect_" + blockData.side, false));
          } else {
            Wall.setPermutation(Wall.permutation.withState("wall:top_bit", false));
          }
        }
      } else {
        if (blockData.side != "up") {
          Wall.setPermutation(Wall.permutation.withState("wall:connect_" + blockData.side, false));
        } else {
          Wall.setPermutation(Wall.permutation.withState("wall:top_bit", false));
        }
      }
    }
    const north_state = Wall.permutation.getState("wall:connect_north");
    const south_state = Wall.permutation.getState("wall:connect_south");
    const east_state = Wall.permutation.getState("wall:connect_east");
    const west_state = Wall.permutation.getState("wall:connect_west");
    if (north_state && south_state && !east_state && !west_state || !north_state && !south_state && east_state && west_state) {
      Wall.setPermutation(Wall.permutation.withState("wall:slim", true));
      if (north_state && south_state) {
        Wall.setPermutation(Wall.permutation.withState("wall:slim_bit", "north_south"));
      } else {
        Wall.setPermutation(Wall.permutation.withState("wall:slim_bit", "east_west"));
      }
    } else Wall.setPermutation(Wall.permutation.withState("wall:slim", false));
  }
  static updateWallsAround(Block11) {
    let above = void 0;
    try {
      above = Block11.above(1);
    } catch {
    }
    let below = void 0;
    try {
      below = Block11.below(1);
    } catch {
    }
    let north = void 0;
    try {
      north = Block11.north(1);
    } catch {
    }
    let south = void 0;
    try {
      south = Block11.south(1);
    } catch {
    }
    let east = void 0;
    try {
      east = Block11.east(1);
    } catch {
    }
    let west = void 0;
    try {
      west = Block11.west(1);
    } catch {
    }
    const blocks = [Block11, above, below, north, south, east, west];
    for (const block of blocks) {
      if (block != void 0) {
        if (block.hasTag(wallTag)) this.update_Wall_States(block);
      }
    }
  }
};

// data/scripts/blocks/managers/trees.js
import { world as world4 } from "@minecraft/server";

// data/scripts/blocks/utils/decrementstack.js
function decrementstack(item, user) {
  if (!(item?.typeId == void 0)) {
    if (item.amount > 1) {
      item.amount--;
      user.getComponent("equippable").setEquipment("Mainhand", item);
    } else if (item.amount === 1) {
      user.getComponent("equippable").setEquipment("Mainhand", void 0);
    }
  }
}

// data/scripts/blocks/managers/trees.js
var treeOptions = {
  "gs_season:aspen_sapling": {
    structures: ["aspen_tree_1"],
    offsetX: 5,
    offsetZ: 5
  },
  "gs_season:acacia_sapling": {
    structures: ["acacia_tree_1"],
    offsetX: 11,
    offsetZ: 12
  },
  "gs_season:baobab_sapling": {
    structures: ["baobab_tree_1"],
    offsetX: 12,
    offsetZ: 12
  },
  "gs_season:beech_sapling": {
    structures: ["beech_tree_1"],
    offsetX: 8,
    offsetZ: 8
  },
  "gs_season:bushwillow_sapling": {
    structures: ["bushwillow_tree_1"],
    offsetX: 6,
    offsetZ: 7
  },
  "gs_season:jacaranda_purple_sapling": {
    structures: [
      "jacaranda_p_tree_1"
    ],
    offsetX: 8,
    offsetZ: 9
  },
  "gs_season:jacaranda_blue_sapling": {
    structures: [
      "jacaranda_w_tree_1"
    ],
    offsetX: 8,
    offsetZ: 9
  },
  "gs_season:red_oak_sapling": {
    structures: [
      "redwood_pine_tree_1"
    ],
    offsetX: 8,
    offsetZ: 8
  },
  "gs_season:sugar_maple_sapling": {
    structures: ["maple_tree_1"],
    offsetX: 10,
    offsetZ: 11
  },
  "gs_season:palm_sapling": {
    structures: ["palm_tree_1"],
    offsetX: 3,
    offsetZ: 5
  }
};
world4.beforeEvents.worldInitialize.subscribe((initEvent) => {
  initEvent.blockComponentRegistry.registerCustomComponent(
    "gs_season:bonemealable_sapling",
    {
      onPlayerInteract: (e) => {
        const block = e.block;
        const player = e.player;
        const item = e.player.getComponent("equippable").getEquipment("Mainhand");
        bonemeal(player, block, item);
      }
    }
  );
  initEvent.blockComponentRegistry.registerCustomComponent(
    "gs_season:aspen_leaves_drops",
    {
      onPlayerDestroy: (e) => {
        const block = e.block;
        const item = e.player.getComponent("equippable").getEquipment("Mainhand");
        const player = e.player;
        if (item?.typeId == "minecraft:shears") {
          player.runCommandAsync(
            "loot spawn " + JSON.stringify(block.location.x) + " " + JSON.stringify(block.location.y + 1) + " " + JSON.stringify(block.location.z) + ' loot "aspen_leaves_sheared"'
          );
        }
        if (!(item?.typeId == "minecraft:shears")) {
          player.runCommandAsync(
            "loot spawn " + JSON.stringify(block.location.x) + " " + JSON.stringify(block.location.y + 1) + " " + JSON.stringify(block.location.z) + ' loot "aspen_leaves"'
          );
        }
      }
    }
  );
  initEvent.blockComponentRegistry.registerCustomComponent(
    "gs_season:acacia_leaves_drops",
    {
      onPlayerDestroy: (e) => {
        const block = e.block;
        const item = e.player.getComponent("equippable").getEquipment("Mainhand");
        const player = e.player;
        if (item?.typeId == "minecraft:shears") {
          player.runCommandAsync(
            "loot spawn " + JSON.stringify(block.location.x) + " " + JSON.stringify(block.location.y + 1) + " " + JSON.stringify(block.location.z) + ' loot "acacia_leaves_sheared"'
          );
        }
        if (!(item?.typeId == "minecraft:shears")) {
          player.runCommandAsync(
            "loot spawn " + JSON.stringify(block.location.x) + " " + JSON.stringify(block.location.y + 1) + " " + JSON.stringify(block.location.z) + ' loot "acacia_leaves"'
          );
        }
      }
    }
  );
  initEvent.blockComponentRegistry.registerCustomComponent(
    "gs_season:baobab_leaves_drops",
    {
      onPlayerDestroy: (e) => {
        const block = e.block;
        const item = e.player.getComponent("equippable").getEquipment("Mainhand");
        const player = e.player;
        if (item?.typeId == "minecraft:shears") {
          player.runCommandAsync(
            "loot spawn " + JSON.stringify(block.location.x) + " " + JSON.stringify(block.location.y + 1) + " " + JSON.stringify(block.location.z) + ' loot "baobab_leaves_sheared"'
          );
        }
        if (!(item?.typeId == "minecraft:shears")) {
          player.runCommandAsync(
            "loot spawn " + JSON.stringify(block.location.x) + " " + JSON.stringify(block.location.y + 1) + " " + JSON.stringify(block.location.z) + ' loot "baobab_leaves"'
          );
        }
      }
    }
  );
  initEvent.blockComponentRegistry.registerCustomComponent(
    "gs_season:beech_leaves_drops",
    {
      onPlayerDestroy: (e) => {
        const block = e.block;
        const item = e.player.getComponent("equippable").getEquipment("Mainhand");
        const player = e.player;
        if (item?.typeId == "minecraft:shears") {
          player.runCommandAsync(
            "loot spawn " + JSON.stringify(block.location.x) + " " + JSON.stringify(block.location.y + 1) + " " + JSON.stringify(block.location.z) + ' loot "beech_leaves_sheared"'
          );
        }
        if (!(item?.typeId == "minecraft:shears")) {
          player.runCommandAsync(
            "loot spawn " + JSON.stringify(block.location.x) + " " + JSON.stringify(block.location.y + 1) + " " + JSON.stringify(block.location.z) + ' loot "beech_leaves"'
          );
        }
      }
    }
  );
  initEvent.blockComponentRegistry.registerCustomComponent(
    "gs_season:bushwillow_leaves_drops",
    {
      onPlayerDestroy: (e) => {
        const block = e.block;
        const item = e.player.getComponent("equippable").getEquipment("Mainhand");
        const player = e.player;
        if (item?.typeId == "minecraft:shears") {
          player.runCommandAsync(
            "loot spawn " + JSON.stringify(block.location.x) + " " + JSON.stringify(block.location.y + 1) + " " + JSON.stringify(block.location.z) + ' loot "bushwillow_leaves_sheared"'
          );
        }
        if (!(item?.typeId == "minecraft:shears")) {
          player.runCommandAsync(
            "loot spawn " + JSON.stringify(block.location.x) + " " + JSON.stringify(block.location.y + 1) + " " + JSON.stringify(block.location.z) + ' loot "bushwillow_leaves"'
          );
        }
      }
    }
  );
  initEvent.blockComponentRegistry.registerCustomComponent(
    "gs_season:jacaranda_leaves_drops",
    {
      onPlayerDestroy: (e) => {
        const block = e.block;
        const item = e.player.getComponent("equippable").getEquipment("Mainhand");
        const player = e.player;
        if (item?.typeId == "minecraft:shears") {
          player.runCommandAsync(
            "loot spawn " + JSON.stringify(block.location.x) + " " + JSON.stringify(block.location.y + 1) + " " + JSON.stringify(block.location.z) + ' loot "jacaranda_leaves_sheared"'
          );
        }
        if (!(item?.typeId == "minecraft:shears")) {
          player.runCommandAsync(
            "loot spawn " + JSON.stringify(block.location.x) + " " + JSON.stringify(block.location.y + 1) + " " + JSON.stringify(block.location.z) + ' loot "jacaranda_leaves"'
          );
        }
      }
    }
  );
  initEvent.blockComponentRegistry.registerCustomComponent(
    "gs_season:jacaranda_blue_leaves_drops",
    {
      onPlayerDestroy: (e) => {
        const block = e.block;
        const item = e.player.getComponent("equippable").getEquipment("Mainhand");
        const player = e.player;
        if (item?.typeId == "minecraft:shears") {
          player.runCommandAsync(
            "loot spawn " + JSON.stringify(block.location.x) + " " + JSON.stringify(block.location.y + 1) + " " + JSON.stringify(block.location.z) + ' loot "jacaranda_blue_leaves_sheared"'
          );
        }
        if (!(item?.typeId == "minecraft:shears")) {
          player.runCommandAsync(
            "loot spawn " + JSON.stringify(block.location.x) + " " + JSON.stringify(block.location.y + 1) + " " + JSON.stringify(block.location.z) + ' loot "jacaranda_blue_leaves"'
          );
        }
      }
    }
  );
  initEvent.blockComponentRegistry.registerCustomComponent(
    "gs_season:red_oak_leaves_drops",
    {
      onPlayerDestroy: (e) => {
        const block = e.block;
        const item = e.player.getComponent("equippable").getEquipment("Mainhand");
        const player = e.player;
        if (item?.typeId == "minecraft:shears") {
          player.runCommandAsync(
            "loot spawn " + JSON.stringify(block.location.x) + " " + JSON.stringify(block.location.y + 1) + " " + JSON.stringify(block.location.z) + ' loot "red_oak_leaves_sheared"'
          );
        }
        if (!(item?.typeId == "minecraft:shears")) {
          player.runCommandAsync(
            "loot spawn " + JSON.stringify(block.location.x) + " " + JSON.stringify(block.location.y + 1) + " " + JSON.stringify(block.location.z) + ' loot "red_oak_leaves"'
          );
        }
      }
    }
  );
  initEvent.blockComponentRegistry.registerCustomComponent(
    "gs_season:sugar_maple_leaves_drops",
    {
      onPlayerDestroy: (e) => {
        const block = e.block;
        const item = e.player.getComponent("equippable").getEquipment("Mainhand");
        const player = e.player;
        if (item?.typeId == "minecraft:shears") {
          player.runCommandAsync(
            "loot spawn " + JSON.stringify(block.location.x) + " " + JSON.stringify(block.location.y + 1) + " " + JSON.stringify(block.location.z) + ' loot "sugar_maple_leaves_sheared"'
          );
        }
        if (!(item?.typeId == "minecraft:shears")) {
          player.runCommandAsync(
            "loot spawn " + JSON.stringify(block.location.x) + " " + JSON.stringify(block.location.y + 1) + " " + JSON.stringify(block.location.z) + ' loot "sugar_maple_leaves"'
          );
        }
      }
    }
  );
  initEvent.blockComponentRegistry.registerCustomComponent(
    "gs_season:palm_leaves_drops",
    {
      onPlayerDestroy: (e) => {
        const block = e.block;
        const item = e.player.getComponent("equippable").getEquipment("Mainhand");
        const player = e.player;
        if (item?.typeId == "minecraft:shears") {
          player.runCommandAsync(
            "loot spawn " + JSON.stringify(block.location.x) + " " + JSON.stringify(block.location.y + 1) + " " + JSON.stringify(block.location.z) + ' loot "palm_leaves_sheared"'
          );
        }
        if (!(item?.typeId == "minecraft:shears")) {
          player.runCommandAsync(
            "loot spawn " + JSON.stringify(block.location.x) + " " + JSON.stringify(block.location.y + 1) + " " + JSON.stringify(block.location.z) + ' loot "palm_leaves"'
          );
        }
      }
    }
  );
  initEvent.blockComponentRegistry.registerCustomComponent(
    "gs_season:grow_sapling",
    {
      onRandomTick: (e) => {
        const block = e.block;
        grow_sapling(block);
      }
    }
  );
});
function bonemeal(player, block, item) {
  if (item?.typeId === "minecraft:bone_meal" && block.hasTag("gs_season:sapling")) {
    if (Math.random() < 0.09) {
      grow_sapling(block);
    }
    block.dimension.spawnParticle(
      "minecraft:crop_growth_emitter",
      block.center()
    );
    block.dimension.playSound("item.bone_meal.use", block.center());
    decrementstack(item, player);
  }
}
function grow_sapling(block) {
  const saplingType = block.typeId;
  const options = treeOptions[saplingType];
  if (options && options.structures.length > 0) {
    const chosenStructure = options.structures[Math.floor(Math.random() * options.structures.length)];
    tree_grow(block, chosenStructure, options.offsetX, options.offsetZ);
  } else {
    console.warn(`Sapling type "${saplingType}" has no structures defined.`);
  }
}
function tree_grow(block, structureName, offsetX, offsetZ) {
  const x = block.location.x - offsetX;
  const y = block.location.y;
  const z = block.location.z - offsetZ;
  block.setType("minecraft:air");
  block.dimension.runCommandAsync(
    `structure load "gs_season:${structureName}" ${x} ${y} ${z} 0_degrees`
  );
}

// data/scripts/blocks/managers/decay.js
import { system as system7, world as world5, ItemStack } from "@minecraft/server";

// data/scripts/blocks/utils/search.js
import {
  system as system6
} from "@minecraft/server";
async function find(ITERATIONS_LIMIT, dimension, baseLocation, inSearchBlockConsumer, condition, successBlockConsumer, failureFunction) {
  const blockQueue = new Array();
  blockQueue.push({
    x: baseLocation.x + 1,
    y: baseLocation.y,
    z: baseLocation.z,
    direction: 0
  }, {
    x: baseLocation.x,
    y: baseLocation.y,
    z: baseLocation.z + 1,
    direction: 1
  }, {
    x: baseLocation.x - 1,
    y: baseLocation.y,
    z: baseLocation.z,
    direction: 2
  }, {
    x: baseLocation.x,
    y: baseLocation.y,
    z: baseLocation.z - 1,
    direction: 3
  }, {
    x: baseLocation.x,
    y: baseLocation.y + 1,
    z: baseLocation.z,
    direction: 4
  }, {
    x: baseLocation.x,
    y: baseLocation.y + 1,
    z: baseLocation.z,
    direction: 5
  });
  let blockResult;
  for (let i = 0; !blockResult && i < ITERATIONS_LIMIT; ++i) {
    const loc = blockQueue.shift();
    switch (loc.direction) {
      case 0:
        blockResult = searchEst(
          blockQueue,
          dimension,
          loc,
          inSearchBlockConsumer,
          condition
        );
        break;
      case 1:
        blockResult = searchNord(
          blockQueue,
          dimension,
          loc,
          inSearchBlockConsumer,
          condition
        );
        break;
      case 2:
        blockResult = searchOvest(
          blockQueue,
          dimension,
          loc,
          inSearchBlockConsumer,
          condition
        );
        break;
      case 3:
        blockResult = searchSud(
          blockQueue,
          dimension,
          loc,
          inSearchBlockConsumer,
          condition
        );
        break;
      case 4:
        blockResult = searchUp(
          blockQueue,
          dimension,
          loc,
          inSearchBlockConsumer,
          condition
        );
        break;
      case 5:
        blockResult = searchDown(
          blockQueue,
          dimension,
          loc,
          inSearchBlockConsumer,
          condition
        );
        break;
    }
  }
  if (blockResult)
    system6.run(() => {
      successBlockConsumer(blockResult);
    });
  else system6.run(() => {
    failureFunction();
  });
}
function searchUp(blockQueue, dimension, newLocation, inSearchBlockConsumer, condition) {
  const currentBlock = dimension.getBlock(newLocation);
  inSearchBlockConsumer(currentBlock);
  if (currentBlock && condition(currentBlock))
    return currentBlock;
  blockQueue.push({
    x: newLocation.x,
    y: newLocation.y + 1,
    z: newLocation.z,
    direction: 4
  });
  return null;
}
function searchDown(blockQueue, dimension, newLocation, inSearchBlockConsumer, condition) {
  const currentBlock = dimension.getBlock(newLocation);
  inSearchBlockConsumer(currentBlock);
  if (currentBlock && condition(currentBlock))
    return currentBlock;
  blockQueue.push({
    x: newLocation.x,
    y: newLocation.y - 1,
    z: newLocation.z,
    direction: 5
  });
  return null;
}
function searchEst(blockQueue, dimension, newLocation, inSearchBlockConsumer, condition) {
  const currentBlock = dimension.getBlock(newLocation);
  inSearchBlockConsumer(currentBlock);
  if (currentBlock && condition(currentBlock))
    return currentBlock;
  blockQueue.push({
    x: newLocation.x + 1,
    y: newLocation.y,
    z: newLocation.z,
    direction: 0
  }, {
    x: newLocation.x,
    y: newLocation.y,
    z: newLocation.z + 1,
    direction: 1
  }, {
    x: newLocation.x,
    y: newLocation.y,
    z: newLocation.z - 1,
    direction: 3
  }, {
    x: newLocation.x,
    y: newLocation.y + 1,
    z: newLocation.z,
    direction: 4
  }, {
    x: newLocation.x,
    y: newLocation.y - 1,
    z: newLocation.z,
    direction: 5
  });
  return null;
}
function searchNord(blockQueue, dimension, newLocation, inSearchBlockConsumer, condition) {
  const currentBlock = dimension.getBlock(newLocation);
  inSearchBlockConsumer(currentBlock);
  if (currentBlock && condition(currentBlock))
    return currentBlock;
  blockQueue.push({
    x: newLocation.x,
    y: newLocation.y,
    z: newLocation.z + 1,
    direction: 1
  }, {
    x: newLocation.x,
    y: newLocation.y + 1,
    z: newLocation.z,
    direction: 4
  }, {
    x: newLocation.x,
    y: newLocation.y - 1,
    z: newLocation.z,
    direction: 5
  });
  return null;
}
function searchOvest(blockQueue, dimension, newLocation, inSearchBlockConsumer, condition) {
  const currentBlock = dimension.getBlock(newLocation);
  inSearchBlockConsumer(currentBlock);
  if (currentBlock && condition(currentBlock))
    return currentBlock;
  blockQueue.push({
    x: newLocation.x,
    y: newLocation.y,
    z: newLocation.z + 1,
    direction: 1
  }, {
    x: newLocation.x - 1,
    y: newLocation.y,
    z: newLocation.z,
    direction: 2
  }, {
    x: newLocation.x,
    y: newLocation.y,
    z: newLocation.z - 1,
    direction: 3
  }, {
    x: newLocation.x,
    y: newLocation.y + 1,
    z: newLocation.z,
    direction: 4
  }, {
    x: newLocation.x,
    y: newLocation.y - 1,
    z: newLocation.z,
    direction: 5
  });
  return null;
}
function searchSud(blockQueue, dimension, newLocation, inSearchBlockConsumer, condition) {
  const currentBlock = dimension.getBlock(newLocation);
  inSearchBlockConsumer(currentBlock);
  if (currentBlock && condition(currentBlock))
    return currentBlock;
  blockQueue.push({
    x: newLocation.x,
    y: newLocation.y,
    z: newLocation.z - 1,
    direction: 3
  }, {
    x: newLocation.x,
    y: newLocation.y + 1,
    z: newLocation.z,
    direction: 4
  }, {
    x: newLocation.x,
    y: newLocation.y - 1,
    z: newLocation.z,
    direction: 5
  });
  return null;
}

// data/scripts/blocks/managers/decay.js
var MAX_SURROUNDING_BLOCK_CHECKS = 144;
var LOG_TYPES = /* @__PURE__ */ new Set([
  "gs_season:aspen_log",
  "gs_season:aspen_wood",
  "gs_season:bushwillow_log",
  "gs_season:bushwillow_wood",
  "gs_season:acacia_log",
  "gs_season:acacia_wood",
  "gs_season: baobab_log",
  "gs_season:baobab_wood",
  "gs_season:jacaranda_log_1",
  "gs_season:jacaranda_wood_1",
  "gs_season:jacaranda_log_2",
  "gs_season:jacaranda_wood_2",
  "gs_season:beech_log",
  "gs_season:beech_wood",
  "gs_season:red_oak_log",
  "gs_season:red_oak_wood",
  "gs_season:sugar_maple_log",
  "gs_season:sugar_maple_wood",
  "gs_season:palm_log",
  "gs_season:palm_wood"
]);
var LEAF_TYPES = /* @__PURE__ */ new Set([
  "gs_season:aspen_leaves",
  "gs_season:palm_leaves",
  "gs_season:baobab_leaves",
  "gs_season:jacaranda_leaves_1",
  "gs_season:jacaranda_leaves_2",
  "gs_season:beech_leaves",
  "gs_season:red_oak_leaves",
  "gs_season:sugar_maple_leaves",
  "gs_season:bushwillow_leaves",
  "gs_season:acacia_leaves"
]);
var SAPLING_MAP = {
  "gs_season:aspen_leaves": "gs_season:aspen_sapling",
  "gs_season:palm_leaves": "gs_season:palm_sapling",
  "gs_season:baobab_leaves": "gs_season:baobab_sapling",
  "gs_season:jacaranda_leaves_1": "gs_season:jacaranda_purple_sapling",
  "gs_season:jacaranda_leaves_2": "gs_season:jacaranda_blue_sapling",
  "gs_season:beech_leaves": "gs_season:beech_sapling",
  "gs_season:red_oak_leaves": "gs_season:red_oak_sapling",
  "gs_season:sugar_maple_leaves": "gs_season:sugar_maple_sapling",
  "gs_season:acacia_leaves": "gs_season:acacia_sapling",
  "gs_season:bushwillow_leaves": "gs_season:bushwillow_sapling"
};
function locToString(loc) {
  return loc.x + "|" + loc.y + "|" + loc.z;
}
var decayingLeaves = /* @__PURE__ */ new Set();
world5.afterEvents.playerJoin.subscribe((_) => {
  const dl = world5.getDynamicProperty("gs_season:decaying_leaves");
  if (!dl) return;
  const dimension = world5.getDimension("overworld");
  const locs = dl.split("_");
  for (const loc of locs) {
    const coords = loc.split("|");
    const location = {
      x: parseInt(coords[0]),
      y: parseInt(coords[1]),
      z: parseInt(coords[2])
    };
    decayingLeaves.add(loc);
    const leaf = dimension.getBlock(location);
    scheduleLeaf(dimension, location, loc, leaf);
  }
});
world5.beforeEvents.playerLeave.subscribe((_) => {
  const iter = decayingLeaves.keys();
  let loc;
  let result;
  if (loc = iter.next().value) {
    result = loc;
    while (loc = iter.next().value) result += "_" + loc;
    world5.setDynamicProperty("gs_season:decaying_leaves", result);
  }
});
world5.afterEvents.playerBreakBlock.subscribe((event2) => {
  triggerBreakBlock(event2.brokenBlockPermutation.type.id, event2.block);
});
function scheduleLeaf(dimension, location, loc, leaf) {
  let scheduleID;
  scheduleID = system7.runInterval(() => {
    if (!leaf) {
      leaf = dimension.getBlock(location);
      return;
    }
    if (decayingLeaves.has(loc)) {
      if (LEAF_TYPES.has(leaf.typeId)) {
        const r = Math.random();
        if (r < 0.2) {
          try {
            if (r < 0.01) {
              const sapling = SAPLING_MAP[leaf.typeId];
              if (sapling)
                dimension.spawnItem(new ItemStack(sapling, 1), location);
            }
            if (r < 0.02)
              dimension.spawnItem(
                new ItemStack("minecraft:stick", 1),
                location
              );
          } catch {
          }
          try {
            leaf.setType("minecraft:air");
            decayingLeaves.delete(loc);
          } catch {
          }
        }
        return;
      }
      decayingLeaves.delete(loc);
    }
    system7.clearRun(scheduleID);
  }, 20);
}
function triggerBreakBlock(brokenBlockID, block) {
  if (LOG_TYPES.has(brokenBlockID)) {
    let failureFunction = function() {
      for (const leaf of affectedLeaves)
        scheduleLeaf(
          leaf.dimension,
          leaf.location,
          locToString(leaf.location),
          leaf
        );
    };
    const affectedLeaves = new Array();
    find(
      MAX_SURROUNDING_BLOCK_CHECKS,
      block.dimension,
      block.location,
      function inSearchBlockConsumer(b) {
        const loc = locToString(b.location);
        if (LEAF_TYPES.has(b.typeId) && !decayingLeaves.has(loc)) {
          decayingLeaves.add(loc);
          affectedLeaves.push(b);
        }
      },
      function condition(b) {
        return LOG_TYPES.has(b.typeId);
      },
      function successBlockConsumer(b) {
        if (!LEAF_TYPES.has(b.above().typeId) && !LEAF_TYPES.has(b.below().typeId) && !LEAF_TYPES.has(b.north().typeId) && !LEAF_TYPES.has(b.east().typeId) && !LEAF_TYPES.has(b.south().typeId) && !LEAF_TYPES.has(b.west().typeId))
          failureFunction();
        else
          for (const leaf of affectedLeaves)
            decayingLeaves.delete(locToString(leaf.location));
      },
      failureFunction
    );
  }
}

// data/scripts/blocks/managers/StairsManager.ts
var STAIRS_TAG = "gs_season:is_stairs";
var entries = [];
function uc(s) {
  return s[0].toUpperCase() + s.slice(1);
}
function registerStairs(blockId, frontState, backState, displayState) {
  entries.push({ blockId, connectedFront: frontState, connectedBack: backState, display: displayState });
}
function neighbours(block) {
  return {
    north: tryDir2(block, "north"),
    south: tryDir2(block, "south"),
    east: tryDir2(block, "east"),
    west: tryDir2(block, "west")
  };
}
function tryDir2(b, dir) {
  try {
    return b[dir](1);
  } catch {
    return void 0;
  }
}
var StairsManager = class {
  static onPlace(block) {
    const ent = entries.find((e) => e.blockId === block.typeId);
    if (ent) block.setPermutation(block.permutation.withState(ent.display, false));
  }
  static beforePlace(data) {
    const ent = entries.find((e) => e.blockId === data.permutationToPlace.type.id);
    if (ent) data.permutationToPlace = data.permutationToPlace.withState(ent.display, false);
  }
  static updateAround(center) {
    const dirs = ["north", "south", "east", "west"];
    const blocks = [center, ...dirs.map((d) => tryDir2(center, d))].filter(Boolean);
    for (const b of blocks) if (b.hasTag(STAIRS_TAG)) this.update(b);
  }
  static update(block) {
    const ent = entries.find((e) => e.blockId === block.typeId);
    if (!ent) return;
    let facing = uc(block.permutation.getState("minecraft:cardinal_direction"));
    const half = block.permutation.getState("minecraft:vertical_half");
    const { north, south, east, west } = neighbours(block);
    const lookup = { north, south, east, west };
    function isCompat(b) {
      return b && b.hasTag(STAIRS_TAG) && b.permutation.getState("minecraft:vertical_half") === half;
    }
    const frontBlock = { North: north, South: south, East: east, West: west }[facing];
    const backBlock = { North: south, South: north, East: west, West: east }[facing];
    const connectedFront = isCompat(frontBlock) ? sideConnection(facing, uc(frontBlock.permutation.getState("minecraft:cardinal_direction"))) : "none";
    const connectedBack = !isCompat(frontBlock) && isCompat(backBlock) ? sideConnection(facing, uc(backBlock.permutation.getState("minecraft:cardinal_direction"))) : "none";
    block.setPermutation(block.permutation.withState(ent.connectedFront, connectedFront));
    block.setPermutation(block.permutation.withState(ent.connectedBack, connectedBack));
  }
};
function sideConnection(facing, other) {
  const map = {
    North: { West: "left", East: "right" },
    South: { West: "right", East: "left" },
    East: { North: "left", South: "right" },
    West: { South: "left", North: "right" }
  };
  return map[facing]?.[other] ?? "none";
}

// data/scripts/blocks/components/StairsComponent.ts
var StairsComponent = class {
  constructor(blockId, connectedFrontId, connectedBackId, displayId) {
    registerStairs(blockId, connectedFrontId, connectedBackId, displayId);
  }
  onPlace({ block }) {
    StairsManager.onPlace(block);
    StairsManager.updateAround(block);
  }
  //   beforeOnPlayerPlace = (data:any)=>{
  //     StairsManager.beforePlace(data);
  //     system.runTimeout(()=> StairsManager.updateAround(data.block));
  //   };
  onPlayerDestroy = (data) => StairsManager.updateAround(data.block);
};

// data/scripts/blocks/components/SlabInteraction.ts
import { Direction, EntityEquippableComponent, EquipmentSlot } from "@minecraft/server";

// data/scripts/blocks/managers/ItemManager.ts
import { ItemDurabilityComponent } from "@minecraft/server";
var ItemManager = class {
  static canDamage(_) {
    return true;
  }
  static damage(item, player) {
    const comp = item.getComponent(ItemDurabilityComponent.componentId);
    if (!comp || !this.canDamage(item)) return item;
    if (comp.damage + 1 > comp.maxDurability) {
      player?.dimension.playSound("random.break", player.location);
      return void 0;
    }
    comp.damage += 1;
    return item;
  }
  static consume(item) {
    if (item.amount <= 1) return void 0;
    item.amount -= 1;
    return item;
  }
};

// data/scripts/common/sound.utils.ts
function playSound(dim, loc, { id, volume = 1, pitch = 1 }) {
  dim.playSound(id, loc, { volume, pitch });
}
function stopSound(player, id) {
  try {
    player.runCommand(`stopsound @s ${id}`);
  } catch {
  }
}

// data/scripts/blocks/components/SlabInteraction.ts
var VerticalHalf = { Top: "top", Bottom: "bottom" };
var SlabInteraction = class {
  constructor(stateId, itemId, sound) {
    this.stateId = stateId;
    this.itemId = itemId;
    this.sound = sound;
  }
  onPlayerInteract = (ev) => {
    const { block, face, player } = ev;
    const mainhand = player?.getComponent(EntityEquippableComponent.componentId)?.getEquipmentSlot(EquipmentSlot.Mainhand);
    const item = mainhand?.getItem();
    if (!item || item.typeId !== this.itemId) return;
    let requiredFace = Direction.Down;
    const half = block.permutation.getState("minecraft:vertical_half");
    if (half === VerticalHalf.Bottom) requiredFace = Direction.Up;
    if (face !== requiredFace) return;
    mainhand.setItem(ItemManager.consume(item));
    block.setPermutation(block.permutation.withState(this.stateId, true));
    if (this.sound) playSound(block.dimension, block.center(), this.sound);
  };
};

// data/scripts/blocks/components/RedstonePowered.ts
var RedstonePowered = class {
  constructor(stateId, events) {
    this.stateId = stateId;
    this.events = events;
  }
  tick(block, dim) {
    const getPower = (b) => b?.getRedstonePower() ?? 0;
    const p = getPower(block);
    const offsets = [{ x: 0, y: 1, z: 0 }, { x: 0, y: -1, z: 0 }, { x: 1, y: 0, z: 0 }, { x: -1, y: 0, z: 0 }, { x: 0, y: 0, z: 1 }, { x: 0, y: 0, z: -1 }];
    const adj = offsets.some((o) => getPower(BlockManager.get(dim, { x: block.location.x + o.x, y: block.location.y + o.y, z: block.location.z + o.z })));
    const powered = p !== 0 || adj;
    const prev = block.permutation.getState(this.stateId);
    if (powered) {
      if (!prev) {
        block.setPermutation(block.permutation.withState(this.stateId, true));
        this.events.onPower?.({ block, dimension: dim });
      }
      this.events.whilePowered?.({ block, dimension: dim });
    } else if (prev) {
      block.setPermutation(block.permutation.withState(this.stateId, false));
      this.events.onUnpower?.({ block, dimension: dim });
    }
  }
};

// data/scripts/blocks/components/Trapdoor.ts
var TrapdoorComponent = class {
  constructor(openId, poweredId, sounds) {
    this.openId = openId;
    this.sounds = sounds;
    this.power = new RedstonePowered(poweredId, {
      onPower: ({ block, dimension }) => this.toggle(block, dimension),
      onUnpower: ({ block, dimension }) => this.toggle(block, dimension)
    });
  }
  power;
  toggle(block, dimension) {
    const isOpen = block.permutation.getState(this.openId);
    block.setPermutation(block.permutation.withState(this.openId, !isOpen));
    playSound(dimension, block.center(), { id: isOpen ? this.sounds.close : this.sounds.open });
  }
  onTick = (data) => this.power.tick(data.block, data.dimension);
  onPlayerInteract = (data) => this.toggle(data.block, data.dimension);
};

// data/scripts/blocks/components/LogStrip.ts
import { BlockPermutation, EntityEquippableComponent as EntityEquippableComponent2, EquipmentSlot as EquipmentSlot2, GameMode } from "@minecraft/server";
var LogStrip = class {
  constructor(rules) {
    this.rules = rules;
  }
  subscribe(world42, system40) {
    world42.beforeEvents.playerInteractWithBlock.subscribe((ev) => {
      system40.runTimeout(() => {
        if (!ev.isFirstEvent) return;
        const { player, block } = ev;
        const item = player?.getComponent(EntityEquippableComponent2.componentId)?.getEquipmentSlot(EquipmentSlot2.Mainhand)?.getItem();
        if (!item?.hasTag("minecraft:is_axe")) return;
        const rule = this.rules.find((r) => r.fromId === block.typeId);
        if (!rule) return;
        const states = block.permutation.getAllStates();
        block.setPermutation(BlockPermutation.resolve(rule.toId));
        if (rule.keepStates) {
          for (const k in states) block.setPermutation(block.permutation.withState(k, states[k]));
        }
        if (rule.sound) player.dimension.playSound(rule.sound.id, block.location, rule.sound);
        if (player.getGameMode() !== GameMode.creative) {
          const mainhand = player.getComponent(EntityEquippableComponent2.componentId)?.getEquipmentSlot(EquipmentSlot2.Mainhand);
          mainhand?.setItem(ItemManager.damage(item, player));
        }
      });
    });
  }
};

// data/scripts/blocks/components/FenceGateComponent.ts
import {
  Direction as Direction2
} from "@minecraft/server";
var FenceGateComponent = class {
  constructor(openState, displayState, poweredState, openSound, closeSound) {
    this.openState = openState;
    this.displayState = displayState;
    this.openSound = openSound;
    this.closeSound = closeSound;
    this.power = new RedstonePowered(poweredState, {
      onPower: ({ block, dimension }) => this.toggle(block, dimension, "forward"),
      onUnpower: ({ block, dimension }) => this.toggle(block, dimension, "none")
    });
  }
  power;
  toggle(block, dimension, to) {
    let state = block.permutation.getState(this.openState);
    if (to === void 0) {
      state = state === "none" ? "forward" : "none";
    } else state = to;
    block.setPermutation(
      block.permutation.withState(this.openState, state)
    );
    const snd = state === "none" ? this.closeSound : this.openSound;
    if (snd) playSound(dimension, block.center(), snd);
  }
  onPlayerInteract = (data) => {
    const face = data.face;
    const current = data.block.permutation.getState(this.openState);
    if (current !== "none") {
      this.toggle(data.block, data.dimension, "none");
      return;
    }
    let openTo = "forward";
    if (face === Direction2.South || face === Direction2.East)
      openTo = "backward";
    this.toggle(data.block, data.dimension, openTo);
  };
  onPlace = ({ block }) => {
    block.setPermutation(
      block.permutation.withState(this.displayState, false)
    );
  };
  beforeOnPlayerPlace = (data) => {
    data.permutationToPlace = data.permutationToPlace.withState(
      this.displayState,
      false
    );
  };
  onTick = (data) => this.power.tick(data.block, data.dimension);
};

// data/scripts/blocks/managers/door/constructor.js
import { BlockPermutation as BlockPermutation3, ItemStack as ItemStack4 } from "@minecraft/server";

// data/scripts/blocks/managers/door/manager.js
import { system as system8, MinecraftDimensionTypes, ItemStack as ItemStack3, BlockPermutation as BlockPermutation2 } from "@minecraft/server";
function dimensionToHeight(dimension) {
  const heights = [
    {
      id: MinecraftDimensionTypes.overworld,
      maxHeight: 320
    },
    {
      id: MinecraftDimensionTypes.nether,
      maxHeight: 128
    },
    {
      id: MinecraftDimensionTypes.theEnd,
      maxHeight: 256
    }
  ];
  const data = heights.find((f) => f.id == dimension);
  if (data != void 0) {
    return data.maxHeight;
  } else
    return 0;
}
function spawnItemAnywhere(item, location, dimension) {
  const itemEntity = dimension.spawnItem(item, { x: location.x, y: 100, z: location.z });
  itemEntity.teleport(location);
  return itemEntity;
}
var doorManager = class {
  //set the door tag
  static doorTag = "gs_season:is_door";
  //interact with a door block
  static interactWithDoor(block) {
    const dim = block.dimension;
    const loc = block.location;
    const topHalf = block.permutation.getState("gs_season:upper_block_bit");
    const open = block.permutation.getState("gs_season:open_bit");
    let doorPart = void 0;
    if (topHalf == false) {
      try {
        doorPart = block.above(1);
      } catch {
      }
    } else
      try {
        doorPart = block.below(1);
      } catch {
      }
    if (doorPart != void 0) {
      const data = this.doors.find((f) => f.id === block.typeId);
      let bool = false;
      if (open == true) {
        if (data != void 0 && data.closeSound != void 0) {
          dim.playSound(data.closeSound.id, loc, { pitch: data.closeSound.pitch, volume: data.closeSound.volume });
        }
        bool = false;
      } else {
        if (data != void 0 && data.openSound != void 0)
          dim.playSound(data.openSound.id, loc, { pitch: data.openSound.pitch, volume: data.openSound.volume });
        bool = true;
      }
      const blocks = [block, doorPart];
      for (const door of blocks) {
        try {
          door.setPermutation(door.permutation.withState("gs_season:open_bit", bool));
        } catch {
        }
      }
    }
  }
  static breakDoor(blockID, block, topHalf) {
    system8.runTimeout(() => {
      let doorPart = void 0;
      if (topHalf == false) {
        try {
          doorPart = block.above(1);
        } catch {
        }
      } else
        try {
          doorPart = block.below(1);
        } catch {
        }
      if (doorPart != void 0 && doorPart.hasTag(this.doorTag))
        doorPart.setPermutation(BlockPermutation2.resolve("minecraft:air"));
      const data = this.doors.find((f) => f.id == blockID);
      if (data == void 0)
        return;
      const item = new ItemStack3(data.itemID, 1);
      const loc = block.location;
      spawnItemAnywhere(item, { x: loc.x + 0.5, y: loc.y + 0.5, z: loc.z + 0.5 }, block.dimension);
      block.setPermutation(BlockPermutation2.resolve("minecraft:air"));
    });
  }
  static placeDoor(block, aboveBlock, permutationToPlace) {
    let reversed = false;
    const facing = permutationToPlace.getState("minecraft:cardinal_direction");
    switch (facing) {
      case "north":
        try {
          const otherblock = block.west(1);
          if (otherblock?.typeId.includes("door")) {
            const otherfacing = otherblock.permutation.getState("minecraft:cardinal_direction");
            if (otherfacing == facing) {
              reversed = true;
            }
          }
        } catch {
        }
        break;
      case "south":
        try {
          const otherblock = block.east(1);
          if (otherblock?.typeId.includes("door")) {
            const otherfacing = otherblock.permutation.getState("minecraft:cardinal_direction");
            if (otherfacing == facing) {
              reversed = true;
            }
          }
        } catch {
        }
        break;
      case "east":
        try {
          const otherblock = block.north(1);
          if (otherblock?.typeId.includes("door")) {
            const otherfacing = otherblock.permutation.getState("minecraft:cardinal_direction");
            if (otherfacing == facing) {
              reversed = true;
            }
          }
        } catch {
        }
        break;
      case "west":
        try {
          const otherblock = block.south(1);
          if (otherblock?.typeId.includes("door")) {
            const otherfacing = otherblock.permutation.getState("minecraft:cardinal_direction");
            if (otherfacing == facing) {
              reversed = true;
            }
          }
        } catch {
        }
        break;
    }
    system8.runTimeout(() => {
      block.setPermutation(permutationToPlace.withState("gs_season:reversed", reversed));
    });
    aboveBlock.setPermutation(BlockPermutation2.resolve(permutationToPlace.type.id));
    aboveBlock.setPermutation(aboveBlock.permutation.withState("gs_season:upper_block_bit", true));
    aboveBlock.setPermutation(aboveBlock.permutation.withState("minecraft:cardinal_direction", facing).withState("gs_season:reversed", reversed));
  }
  static doors = [];
};

// data/scripts/blocks/redstone.js
var BlockPoweredEvent = class {
  tick = (block, dimension) => {
    const loc = block.location;
    let poweredState = block.permutation.getState(this.stateId);
    const offsets = [
      { x: 0, y: 1, z: 0 },
      { x: 0, y: -1, z: 0 },
      { x: 1, y: 0, z: 0 },
      { x: -1, y: 0, z: 0 },
      { x: 0, y: 0, z: 1 },
      { x: 0, y: 0, z: -1 }
    ];
    let powered = false;
    const redstonePower = block.getRedstonePower();
    if (redstonePower != 0 && redstonePower != void 0)
      powered = true;
    for (const offset of offsets) {
      if (powered)
        continue;
      const nearbyBlock = dimension.getBlock({ x: loc.x + offset.x, y: loc.y + offset.y, z: loc.z + offset.z });
      const redstonePower2 = nearbyBlock?.getRedstonePower();
      if (redstonePower2 != 0 && redstonePower2 != void 0)
        powered = true;
    }
    if (powered) {
      if (this.events.whilePowered)
        this.events.whilePowered({ block, dimension });
      if (!poweredState) {
        block.setPermutation(block.permutation.withState(this.stateId, true));
        if (this.events.onPower)
          this.events.onPower({ block, dimension });
      }
    } else if (poweredState) {
      block.setPermutation(block.permutation.withState(this.stateId, false));
      if (this.events.onUnpowered)
        this.events.onUnpowered({ block, dimension });
    }
  };
  events;
  stateId;
  constructor(stateId, events) {
    this.events = events;
    this.stateId = stateId;
  }
};

// data/scripts/blocks/managers/door/constructor.js
var redstoneDoorEvent = new BlockPoweredEvent("gs_season:powered", {
  onPower({ block }) {
    if (block.permutation.getState("gs_season:open_bit") == true)
      return;
    doorManager.interactWithDoor(block);
  },
  onUnpowered({ block }) {
    const topHalf = block.permutation.getState("gs_season:upper_block_bit");
    let doorPart = void 0;
    if (topHalf == false) {
      try {
        doorPart = block.above(1);
      } catch {
      }
    } else
      try {
        doorPart = block.below(1);
      } catch {
      }
    if (block.permutation.getState("gs_season:open_bit") == false)
      return;
    if (doorPart && doorPart.hasTag(doorManager.doorTag) && doorPart.permutation.getState("gs_season:powered") == true)
      return;
    doorManager.interactWithDoor(block);
  }
});
var BlockComponentDoor = class {
  onTick = (data) => {
    redstoneDoorEvent.tick(data.block, data.dimension);
    const block = data.block;
    const doordata = doorManager.doors.find((f) => f.id == block.typeId);
    const topHalf = block.permutation.getState("gs_season:upper_block_bit");
    let doorPart = void 0;
    if (topHalf == false) {
      try {
        doorPart = block.above(1);
      } catch {
      }
    } else
      try {
        doorPart = block.below(1);
      } catch {
      }
    if (doorPart == void 0) {
      if (topHalf == true) {
        block.setPermutation(BlockPermutation3.resolve("minecraft:air"));
      } else {
        if (doordata) {
          const item = new ItemStack4(doordata.itemID, 1);
          spawnItemAnywhere(item, block.location, block.dimension);
        }
        block.setPermutation(BlockPermutation3.resolve("minecraft:air"));
      }
    } else if (!doorPart.hasTag(doorManager.doorTag)) {
      if (topHalf == true) {
        block.setPermutation(BlockPermutation3.resolve("minecraft:air"));
      } else {
        if (doordata) {
          const item = new ItemStack4(doordata.itemID, 1);
          spawnItemAnywhere(item, block.location, block.dimension);
        }
        block.setPermutation(BlockPermutation3.resolve("minecraft:air"));
      }
    } else
      try {
        if (topHalf == true)
          return;
        let below = void 0;
        below = block.below(1);
        if (below?.isAir || below?.isLiquid)
          doorManager.breakDoor(block.typeId, block, false);
      } catch {
      }
  };
  //on interact with door
  onPlayerInteract = (data) => {
    const isMetalDoor = data.block.getTags().includes("gs_season:metal_door");
    if (isMetalDoor) {
      return;
    }
    doorManager.interactWithDoor(data.block);
  };
  //on place door
  beforeOnPlayerPlace = (data) => {
    const { block, player, dimension, permutationToPlace } = data;
    const loc = block.location;
    if (loc.y + 1 >= dimensionToHeight(dimension.id)) {
      data.cancel = true;
      return;
    }
    let blockAbove = void 0;
    let blockBelow = void 0;
    try {
      blockBelow = dimension.getBlock({ x: loc.x, y: loc.y - 1, z: loc.z });
    } catch {
    }
    if (blockBelow == void 0) {
      data.cancel = true;
      return;
    }
    if (blockBelow.isAir || blockBelow.isLiquid) {
      data.cancel = true;
      return;
    }
    try {
      blockAbove = dimension.getBlock({ x: loc.x, y: loc.y + 1, z: loc.z });
    } catch {
    }
    if (blockAbove == void 0) {
      data.cancel = true;
      return;
    }
    if (blockAbove.isAir || blockAbove.isLiquid) {
      doorManager.placeDoor(block, blockAbove, data.permutationToPlace);
    } else {
      data.cancel = true;
      return;
    }
  };
  constructor(doors) {
    for (const door of doors) {
      doorManager.doors.push(door);
    }
  }
};

// data/scripts/blocks/components/OpaqueLeaves.js
import { BlockPermutation as BlockPermutation4, Direction as Direction4, system as system9, world as world7 } from "@minecraft/server";

// data/scripts/blocks/utils/Vector3.js
import { Direction as Direction3 } from "@minecraft/server";
var Vector32 = class _Vector3 {
  /**
   * Creates a Vector3 instance from a direction
   * 
   * @param dir - The direction to convert to a Vector3
   * @returns Vector3 corresponding to the direction
   */
  static fromDirection(dir) {
    const dirMap = {
      [Direction3.Down]: [0, -1, 0],
      [Direction3.Up]: [0, 1, 0],
      [Direction3.North]: [0, 0, -1],
      [Direction3.South]: [0, 0, 1],
      [Direction3.East]: [1, 0, 0],
      [Direction3.West]: [-1, 0, 0],
      "down": [0, -1, 0],
      "up": [0, 1, 0],
      "north": [0, 0, -1],
      "south": [0, 0, 1],
      "east": [1, 0, 0],
      "west": [-1, 0, 0]
    };
    const coords = dirMap[dir];
    if (!coords) {
      console.error(`Vector3/fromDirection: Unknown direction '${dir}'`);
      return new _Vector3();
    }
    return new _Vector3(coords[0], coords[1], coords[2]);
  }
  /**
   * Create a new Vector3 instance
   */
  constructor(x, y, z) {
    if (Array.isArray(x)) {
      [this.x, this.y, this.z] = x;
    } else if (x && typeof x === "object" && "x" in x && "y" in x && "z" in x) {
      this.x = x.x;
      this.y = x.y;
      this.z = x.z;
    } else {
      this.x = Number(x) || 0;
      this.y = Number(y) || 0;
      this.z = Number(z) || 0;
    }
  }
  /**
   * Add another vector to this one
   */
  plus(other) {
    return new _Vector3(
      this.x + other.x,
      this.y + other.y,
      this.z + other.z
    );
  }
  /**
   * Subtract another vector from this one
   */
  minus(other) {
    return new _Vector3(
      this.x - other.x,
      this.y - other.y,
      this.z - other.z
    );
  }
  /**
   * Multiply this vector by a scalar
   */
  multiply(factor) {
    return new _Vector3(
      this.x * factor,
      this.y * factor,
      this.z * factor
    );
  }
  /**
   * Calculate the dot product with another vector
   */
  dotProduct(other) {
    return this.x * other.x + this.y * other.y + this.z * other.z;
  }
  /**
   * Calculate the cross product with another vector
   */
  crossProduct(other) {
    return new _Vector3(
      this.y * other.z - this.z * other.y,
      this.z * other.x - this.x * other.z,
      this.x * other.y - this.y * other.x
    );
  }
  /**
   * Calculate the length of this vector
   */
  length() {
    return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z);
  }
  /**
   * Return a normalized (unit length) version of this vector
   */
  normalized() {
    const len = this.length();
    if (len === 0) return new _Vector3();
    return this.multiply(1 / len);
  }
  /**
   * Calculate the distance to another vector
   */
  distanceTo(other) {
    const dx = this.x - other.x;
    const dy = this.y - other.y;
    const dz = this.z - other.z;
    return Math.sqrt(dx * dx + dy * dy + dz * dz);
  }
  /**
   * Check if this vector equals another vector
   */
  isEqualTo(other) {
    return this.x === other.x && this.y === other.y && this.z === other.z;
  }
  /**
   * Convert to an array [x, y, z]
   */
  asArray() {
    return [this.x, this.y, this.z];
  }
  /**
   * Get string representation
   */
  toString() {
    return `Vector3(${this.x}, ${this.y}, ${this.z})`;
  }
};

// data/scripts/blocks/components/OpaqueLeaves.js
var UPDATE_COOLDOWN = /* @__PURE__ */ new Map();
var COOLDOWN_DURATION = 5;
function updateLeaves(block) {
  if (!block || !block.isValid || !block.isValid()) return;
  const { dimension } = block;
  const blockLocation = new Vector32(block.location);
  const locationKey = `${blockLocation.x},${blockLocation.y},${blockLocation.z}`;
  const now = system9.currentTick;
  const lastUpdate = UPDATE_COOLDOWN.get(locationKey);
  if (lastUpdate && now - lastUpdate < COOLDOWN_DURATION) {
    return;
  }
  UPDATE_COOLDOWN.set(locationKey, now);
  if (UPDATE_COOLDOWN.size > 1e3) {
    const entriesToDelete = [];
    for (const [key, tick] of UPDATE_COOLDOWN.entries()) {
      if (now - tick > 100) {
        entriesToDelete.push(key);
      }
    }
    entriesToDelete.forEach((key) => UPDATE_COOLDOWN.delete(key));
  }
  const getBlockSafe = (location) => {
    try {
      return dimension.getBlock(location);
    } catch (error) {
      return void 0;
    }
  };
  const adjacentBlocks = [
    getBlockSafe(blockLocation.plus(Vector32.fromDirection(Direction4.North))),
    getBlockSafe(blockLocation.plus(Vector32.fromDirection(Direction4.South))),
    getBlockSafe(blockLocation.plus(Vector32.fromDirection(Direction4.East))),
    getBlockSafe(blockLocation.plus(Vector32.fromDirection(Direction4.West))),
    getBlockSafe(blockLocation.plus(Vector32.fromDirection(Direction4.Up))),
    getBlockSafe(blockLocation.plus(Vector32.fromDirection(Direction4.Down)))
  ];
  let processedCount = 0;
  const MAX_BLOCKS_PER_UPDATE = 6;
  for (const adjacentBlock of adjacentBlocks) {
    if (processedCount >= MAX_BLOCKS_PER_UPDATE) break;
    if (!adjacentBlock || !adjacentBlock.isValid || !adjacentBlock.isValid() || !adjacentBlock.hasTag("gs_season:leaves")) continue;
    processedCount++;
    const leafLocation = new Vector32(adjacentBlock.location);
    const surroundingBlocks = [
      adjacentBlock,
      getBlockSafe(leafLocation.plus(Vector32.fromDirection(Direction4.North))),
      getBlockSafe(leafLocation.plus(Vector32.fromDirection(Direction4.South))),
      getBlockSafe(leafLocation.plus(Vector32.fromDirection(Direction4.East))),
      getBlockSafe(leafLocation.plus(Vector32.fromDirection(Direction4.West))),
      getBlockSafe(leafLocation.plus(Vector32.fromDirection(Direction4.Up))),
      getBlockSafe(leafLocation.plus(Vector32.fromDirection(Direction4.Down)))
    ];
    let isFullySurrounded = true;
    for (const nearbyBlock of surroundingBlocks) {
      if (!nearbyBlock || !nearbyBlock.isValid || !nearbyBlock.isValid()) {
        isFullySurrounded = false;
        break;
      }
      if (nearbyBlock.isAir) {
        isFullySurrounded = false;
        break;
      }
    }
    try {
      const blockStates = adjacentBlock.permutation.getAllStates();
      if (!blockStates) continue;
      blockStates["gs_season:opaque"] = isFullySurrounded;
      adjacentBlock.setPermutation(BlockPermutation4.resolve(adjacentBlock.typeId, blockStates));
    } catch (error) {
      continue;
    }
  }
}
world7.afterEvents.playerBreakBlock.subscribe((event2) => {
  try {
    if (!event2.block || !event2.dimension) return;
    system9.run(() => {
      updateLeaves(event2.block);
    });
  } catch (error) {
  }
});
world7.afterEvents.playerPlaceBlock.subscribe((event2) => {
  try {
    if (!event2.block || !event2.dimension) return;
    system9.run(() => {
      updateLeaves(event2.block);
    });
  } catch (error) {
  }
});

// data/scripts/blocks/components/blocks.ts
import { BlockPermutation as BlockPermutation5, world as world8, system as system10, EquipmentSlot as EquipmentSlot3, GameMode as GameMode2, ItemComponentTypes, ItemStack as ItemStack5 } from "@minecraft/server";
var scoreboardName = "settings";
var settingPlayers = {
  blockParticles: "blockParticles"
};
world8.beforeEvents.worldInitialize.subscribe(({ blockComponentRegistry }) => {
  const variantMap = {
    "gs_season:savannah_grass_long": 1,
    "gs_season:savannah_tall_grass": 1,
    "gs_season:forest_grass_tall": 1,
    "gs_season:oasis_cactus": 2,
    "gs_season:wall_mushroom": 2
  };
  const getBlockState = (block, typeId) => !block ? 0 : block.matches(typeId) ? 2 : block.isAir || block.isLiquid ? 0 : 1;
  function collectDripstoneColumn(startBlock, direction, blockId) {
    const column = [startBlock];
    const dim = startBlock.dimension;
    const increment = direction === "up" ? 1 : -1;
    for (const offset of [-1, 1]) {
      let searchY = startBlock.location.y + offset * increment;
      while (true) {
        const block = dim.getBlock({ x: startBlock.location.x, y: searchY, z: startBlock.location.z });
        if (!block || block.typeId !== blockId || block.permutation.getState("gs_season:direction") !== direction) break;
        if (offset === -1) column.push(block);
        else column.unshift(block);
        searchY += offset * increment;
      }
    }
    return column;
  }
  function assignDripstoneThickness(column, direction) {
    const len = column.length;
    for (let i = 0; i < len; i++) {
      let thickness;
      if (len === 1) thickness = 0;
      else if (i === 0) thickness = 0;
      else if (i === 1) thickness = 1;
      else if (i === len - 1) thickness = 3;
      else thickness = 2;
      const perm = column[i].permutation.withState("gs_season:thickness", thickness).withState("gs_season:direction", direction);
      column[i].setPermutation(perm);
    }
  }
  function updateDripstone(block) {
    const blockId = block.typeId;
    const direction = block.permutation.getState("gs_season:direction");
    const column = collectDripstoneColumn(block, direction, blockId);
    assignDripstoneThickness(column, direction);
  }
  function breakDripstoneChain(block, direction) {
    const nextBlock = direction === "up" ? block.above() : block.below();
    block.dimension.runCommandAsync(`setblock ${block.location.x} ${block.location.y} ${block.location.z} air destroy`);
    if (nextBlock?.typeId === block.typeId) {
      system10.runTimeout(() => breakDripstoneChain(nextBlock, direction), 1);
    }
  }
  const safeGetBlock2 = (dim, { x, y, z }) => {
    try {
      return dim.getBlock({ x, y, z });
    } catch {
      return null;
    }
  };
  const destroyBlock = (block) => block.dimension.runCommandAsync(`setblock ${block.location.x} ${block.location.y} ${block.location.z} air destroy`);
  const getBasePrefix = (blockId) => {
    const match = blockId.match(/^(.*):(.+?)(_vines|_body)?$/);
    return match ? `${match[1]}:${match[2]}` : blockId;
  };
  const collectColumn = (block, typeId, upFirst = false) => {
    const column = [block];
    const { dimension: dim, location: { x, y, z } } = block;
    const collect = (dir) => {
      for (let offset = 1; ; offset++) {
        const b = safeGetBlock2(dim, { x, y: y + offset * dir, z });
        if (!b || b.typeId !== typeId) break;
        dir === 1 ? column.push(b) : column.unshift(b);
      }
    };
    upFirst ? (collect(1), collect(-1)) : (collect(-1), collect(1));
    return column;
  };
  const assignStates = {
    plant: (column) => {
      const len = column.length;
      if (len === 0) return;
      column.forEach((block, i) => {
        const state = len === 1 ? 0 : i === 0 ? 3 : i === len - 1 ? 0 : i === len - 2 ? 1 : 2;
        block.setPermutation(block.permutation.withState("gs_season:column", state));
      });
    },
    vine: (column) => column.forEach(
      (block, i) => block.setPermutation(block.permutation.withState("gs_season:column", i === 0 ? 0 : 1))
    )
  };
  const validateVineSupport = (column) => {
    if (column.length === 0) return false;
    const top = column[column.length - 1];
    const above = safeGetBlock2(top.dimension, {
      x: top.location.x,
      y: top.location.y + 1,
      z: top.location.z
    });
    return above && !above.isAir && !above.isLiquid;
  };
  const updaters = {
    plant: (block) => assignStates.plant(collectColumn(block, block.typeId)),
    vine: (block) => {
      const column = collectColumn(block, block.typeId, true);
      if (!validateVineSupport(column)) return column.forEach(destroyBlock);
      assignStates.vine(column);
    }
  };
  const chainBreakers = {
    plant: (block) => {
      const next = block.above();
      destroyBlock(block);
      if (next?.typeId === block.typeId)
        system10.runTimeout(() => chainBreakers.plant(next), 1);
    },
    vine: (startBlock) => {
      let current = startBlock;
      while (current && current.typeId === startBlock.typeId) {
        destroyBlock(current);
        current = current.below();
      }
    }
  };
  const createColumnComponent = (type) => ({
    onPlace({ block }) {
      try {
        block.setPermutation(block.permutation.withState("gs_season:column", 0));
        system10.runTimeout(() => {
          const updatedBlock = safeGetBlock2(block.dimension, block.location);
          if (updatedBlock) updaters[type](updatedBlock);
        }, 1);
      } catch (e) {
      }
    },
    onPlayerDestroy(event2) {
      const { block } = event2;
      const blockId = event2.destroyedBlockPermutation.type.id;
      const [above, below] = [block.above(), block.below()];
      const [aboveState, belowState] = [getBlockState(above, blockId), getBlockState(below, blockId)];
      const handlers = {
        plant: () => {
          if (belowState === 2) updaters.plant(below);
          if (aboveState === 2) chainBreakers.plant(above);
        },
        vine: () => {
          if (aboveState === 2) updaters.vine(above);
          if (belowState === 2) chainBreakers.vine(below);
        }
      };
      handlers[type]?.();
    }
  });
  const createTallStructure = (block, typeId, parts) => {
    const dim = block.dimension;
    const { x, y, z } = block.location;
    parts.forEach((partConfig, i) => {
      const targetBlock = safeGetBlock2(dim, { x, y: y + i, z });
      if (targetBlock) {
        const perm = BlockPermutation5.resolve(typeId, partConfig);
        targetBlock.setPermutation(perm);
      }
    });
  };
  const validateTallPlacement = (block, height) => {
    const { x, y, z } = block.location;
    const dim = block.dimension;
    for (let i = 1; i < height; i++) {
      const checkBlock = safeGetBlock2(dim, { x, y: y + i, z });
      if (!checkBlock?.isAir && !checkBlock?.isLiquid) return false;
    }
    return true;
  };
  const destroyTallStructure = (event2) => {
    const { dimension: dim, block, destroyedBlockPermutation } = event2;
    const { x, y, z } = block.location;
    const expectedId = destroyedBlockPermutation.type.id;
    for (let i = 1; i <= 2; i++) {
      const b = safeGetBlock2(dim, { x, y: y - i, z });
      if (b?.typeId === expectedId) {
        b.setType("minecraft:air");
      } else break;
    }
  };
  ["plant", "vine"].forEach((type) => {
    const componentName = type === "plant" ? "column_plant" : type === "vine" ? "vines" : type;
    blockComponentRegistry.registerCustomComponent(`gs_season:${componentName}`, createColumnComponent(type));
  });
  blockComponentRegistry.registerCustomComponent("gs_season:dripstone", {
    onPlace(event2) {
      const block = event2.block;
      const playersNearby = block.dimension.getEntities({
        location: block.location,
        maxDistance: 8,
        type: "minecraft:player"
      });
      if (playersNearby.length === 0) return;
      try {
        const above = block.above();
        const below = block.below();
        const blockId = block.typeId;
        const aboveState = getBlockState(above, blockId);
        const belowState = getBlockState(below, blockId);
        const direction = belowState === 0 || belowState === 2 && aboveState === 1 ? "down" : "up";
        block.setPermutation(block.permutation.withState("gs_season:direction", direction));
        system10.runTimeout(() => {
          const updatedBlock = block.dimension.getBlock(block.location);
          updateDripstone(updatedBlock);
        }, 1);
      } catch (ignored) {
      }
    },
    onPlayerDestroy(event2) {
      const block = event2.block;
      const blockId = event2.destroyedBlockPermutation.type.id;
      const direction = event2.destroyedBlockPermutation.getState("gs_season:direction");
      const above = block.above();
      const below = block.below();
      const aboveState = getBlockState(above, blockId);
      const belowState = getBlockState(below, blockId);
      if (belowState === 2) {
        direction === "up" ? updateDripstone(below) : breakDripstoneChain(below, "down");
      }
      if (aboveState === 2) {
        direction === "down" ? updateDripstone(above) : breakDripstoneChain(above, "up");
      }
    }
  });
  blockComponentRegistry.registerCustomComponent("gs_season:tall_foliage", {
    beforeOnPlayerPlace: (event2) => {
      if (!validateTallPlacement(event2.block, 3)) event2.cancel = true;
    },
    onPlace: ({ block }) => {
      try {
        const maxVariant = variantMap[block.typeId];
        const part = block.permutation.getState("gs_season:part");
        if (part !== 0) return;
        const getRandomVariant = () => Math.floor(Math.random() * maxVariant) + 1;
        const parts = [
          { "gs_season:part": 1, "gs_season:variant": getRandomVariant() },
          { "gs_season:part": 2, "gs_season:variant": getRandomVariant() },
          { "gs_season:part": 3, "gs_season:variant": getRandomVariant() }
        ];
        createTallStructure(block, block.typeId, parts);
      } catch (e) {
      }
    },
    onPlayerDestroy: destroyTallStructure
  });
  blockComponentRegistry.registerCustomComponent("gs_season:double_plant", {
    beforeOnPlayerPlace: (event2) => {
      if (!validateTallPlacement(event2.block, 2)) event2.cancel = true;
    },
    onPlace: ({ block }) => {
      try {
        const part = block.permutation.getState("gs_season:part");
        if (part !== 0) return;
        const parts = [
          { "gs_season:part": 1 },
          { "gs_season:part": 2 }
        ];
        createTallStructure(block, block.typeId, parts);
      } catch (e) {
      }
    },
    onPlayerDestroy: destroyTallStructure
  });
  blockComponentRegistry.registerCustomComponent("gs_season:variant", {
    onPlace: ({ block }) => {
      try {
        const maxVariant = variantMap[block.typeId];
        if (!maxVariant) return;
        const variant = Math.floor(Math.random() * maxVariant) + 1;
        const direction = block.permutation.getState("minecraft:cardinal_direction");
        const states = { "gs_season:variant": variant };
        if (direction !== void 0) states["minecraft:cardinal_direction"] = direction;
        block.setPermutation(BlockPermutation5.resolve(block.typeId, states));
      } catch (e) {
      }
    }
  });
  blockComponentRegistry.registerCustomComponent("gs_season:petals", {
    onPlayerInteract: ({ block, player, dimension }) => {
      const item = player.getComponent("minecraft:equippable")?.getEquipment("Mainhand");
      if (!item || item.typeId !== block.typeId) return;
      const perm = block.permutation;
      const stage = perm.getState("gs_season:petal_stage");
      if (stage >= 3) return;
      const dir = perm.getState("minecraft:cardinal_direction");
      const newStates = { "gs_season:petal_stage": stage + 1 };
      if (dir !== void 0) newStates["minecraft:cardinal_direction"] = dir;
      block.setPermutation(BlockPermutation5.resolve(block.typeId, newStates));
      dimension.playSound("place.moss", block.location);
      if (player.getGameMode() !== "creative") {
        item.amount > 1 ? item.amount-- : player.getComponent("minecraft:equippable")?.setEquipment("Mainhand", void 0);
      }
    }
  });
  const maxGrowthMap = {
    "gs_season:rhubarb": 5,
    "gs_season:rice": 5,
    "gs_season:corn": 5,
    "gs_season:cotton": 5
  };
  blockComponentRegistry.registerCustomComponent("gs_season:crop_growth", {
    onRandomTick: ({ block }) => {
      const growthChance = 1 / 3;
      if (Math.random() > growthChance) return;
      const growth = block.permutation.getState("gs_season:growth");
      const maxGrowth = maxGrowthMap[block.typeId];
      if (growth === void 0 || growth >= maxGrowth) return;
      const part = block.permutation.getState("gs_season:part");
      if (part === void 0) return;
      if (part === 2) {
        const below = block.below();
        if (!below) return;
        block = below;
      }
      ;
      const nextGrowth = growth + 1;
      if (nextGrowth >= 3) {
        const parts = [
          { "gs_season:part": 1, "gs_season:growth": nextGrowth },
          { "gs_season:part": 2, "gs_season:growth": nextGrowth }
        ];
        createTallStructure(block, block.typeId, parts);
      } else {
        block.setPermutation(BlockPermutation5.resolve(block.typeId, {
          "gs_season:growth": nextGrowth
        }));
      }
    },
    onPlayerInteract: ({ block, player, dimension }) => {
      const equippable = player.getComponent("minecraft:equippable");
      const item = equippable.getEquipment("Mainhand");
      if (!item || item.typeId !== "minecraft:bone_meal") return;
      const growth = block.permutation.getState("gs_season:growth");
      const maxGrowth = maxGrowthMap[block.typeId];
      if (growth === void 0 || growth >= maxGrowth) return;
      dimension.spawnParticle("minecraft:crop_growth_emitter", block.center());
      if (player.getGameMode() !== "creative") {
        if (item.amount > 1) {
          item.amount--;
          equippable.setEquipment("Mainhand", item);
        } else {
          equippable.setEquipment("Mainhand", void 0);
        }
      }
      const growthChance = 1 / 2;
      if (Math.random() > growthChance) return;
      const nextGrowth = growth + 1;
      const part = block.permutation.getState("gs_season:part");
      if (part !== void 0) {
        if (part === 2) {
          const below = block.below();
          if (!below) return;
          block = below;
        }
        ;
        if (nextGrowth >= 3) {
          const parts = [
            { "gs_season:part": 1, "gs_season:growth": nextGrowth },
            { "gs_season:part": 2, "gs_season:growth": nextGrowth }
          ];
          createTallStructure(block, block.typeId, parts);
        } else {
          block.setPermutation(BlockPermutation5.resolve(block.typeId, {
            "gs_season:growth": nextGrowth
          }));
        }
      } else {
        block.setPermutation(BlockPermutation5.resolve(block.typeId, {
          "gs_season:growth": nextGrowth
        }));
      }
    }
  });
  blockComponentRegistry.registerCustomComponent("gs_season:cave_vines_body", {
    onRandomTick: ({ block }) => {
      if (!block.isValid()) return;
      const blockPermutation = block.permutation;
      const blockId = block.typeId;
      const plantAge = blockPermutation.getState("gs_season:growing_plant_age");
      if (plantAge < 12) {
        block.setPermutation(blockPermutation.withState("gs_season:growing_plant_age", plantAge + 1));
        return;
      }
      const blockBelow = block.below(1);
      if (!blockBelow.isValid) return;
      if (blockBelow.typeId === "minecraft:air") {
        if (Math.random() < 0.5) {
          try {
            block.setPermutation(BlockPermutation5.resolve(`${getBasePrefix(block.typeId)}_vines`, { "gs_season:has_berries": true }));
          } catch (e) {
          }
        } else {
          try {
            block.setPermutation(BlockPermutation5.resolve(`${getBasePrefix(block.typeId)}_vines`, { "gs_season:has_berries": false }));
          } catch (e) {
          }
        }
        if (Math.random() < 0.25) {
          try {
            blockBelow.setPermutation(blockPermutation.withState("gs_season:has_berries", true).withState("gs_season:growing_plant_age", 0));
          } catch (e) {
          }
        } else {
          try {
            blockBelow.setPermutation(blockPermutation.withState("gs_season:growing_plant_age", 0));
          } catch (e) {
          }
        }
      }
    }
  });
  blockComponentRegistry.registerCustomComponent("gs_season:cave_vines", {
    onPlayerInteract: ({ block, dimension, player }) => {
      const hasBerries = block.permutation.getState("gs_season:has_berries");
      const isTopBlock = block.permutation.getState("gs_season:column") === 0;
      if (hasBerries && isTopBlock) {
        block.setPermutation(block.permutation.withState("gs_season:has_berries", false));
        dimension.spawnItem(new ItemStack5(`${getBasePrefix(block.typeId)}_berries`, Math.floor(Math.random() * 3) + 1), block.center());
        return;
      }
      if (isTopBlock && !hasBerries && player) {
        const equippable = player.getComponent("minecraft:equippable");
        const mainhand = equippable?.getEquipment(EquipmentSlot3.Mainhand);
        if (mainhand?.typeId === "minecraft:bone_meal") {
          block.setPermutation(block.permutation.withState("gs_season:has_berries", true));
          if (player.getGameMode() !== GameMode2.creative) {
            if (mainhand.amount > 1) {
              mainhand.amount--;
              equippable.setEquipment(EquipmentSlot3.Mainhand, mainhand);
            } else {
              equippable.setEquipment(EquipmentSlot3.Mainhand, void 0);
            }
          }
        }
      }
    },
    onPlayerDestroy: ({ block }) => {
      const blockAbove = block.above(1);
      if (blockAbove.typeId.includes("vines")) {
        blockAbove.setType(`${blockAbove.typeId}`);
      }
    }
  });
  blockComponentRegistry.registerCustomComponent("gs_season:cave_vines_growth", {
    onRandomTick: ({ block }) => {
      if (!block.isValid()) return;
      const blockPermutation = block.permutation;
      const isTopBlock = blockPermutation.getState("gs_season:column") === 0;
      if (!isTopBlock) return;
      if (blockPermutation.getState("gs_season:has_berries")) return;
      if (Math.random() < 0.1) {
        try {
          block.setPermutation(block.permutation.withState("gs_season:has_berries", true));
        } catch (e) {
        }
      }
    }
  });
  function getSetting2(setting) {
    try {
      return world8.scoreboard.getObjective(scoreboardName).getScore(setting) === 1;
    } catch {
      return false;
    }
  }
  blockComponentRegistry.registerCustomComponent("gs_season:scarlet_spore_blossom", {
    onTick: ({ block }) => {
      const blockParticles = getSetting2(settingPlayers.blockParticles);
      if (!blockParticles) return;
      let location = block.location;
      let anchorLoc = { x: location.x + 0.5, y: location.y, z: location.z + 0.5 };
      block.dimension.spawnParticle("gs_season:scarlet_spore.drip", anchorLoc);
    }
  });
  const berryTypeIds = /* @__PURE__ */ new Set([
    "gs_season:partridge_berry",
    "gs_season:alpine_bearberry",
    "gs_season:crowberry",
    "gs_season:bog_blueberry",
    "gs_season:oasis_cactus_1"
  ]);
  blockComponentRegistry.registerCustomComponent("gs_season:season_drop", {
    onPlayerDestroy: ({ destroyedBlockPermutation, block }) => {
      const typeId = destroyedBlockPermutation.type.id;
      if (!berryTypeIds.has(typeId)) return;
      const currentSeason = SeasonCycle.getCurrentSeason();
      if (typeId === "gs_season:oasis_cactus_1") {
        if (currentSeason === SEASON_IDS.Summer) {
          block.dimension.spawnItem(new ItemStack5("gs_season:fig_item", randomIntInRange(1, 2)), block.center());
        }
        return;
      }
      if (typeId === "gs_season:partridge_berry") {
        if (currentSeason === SEASON_IDS.Autumn) {
          block.dimension.spawnItem(new ItemStack5("gs_season:partridge_berry_item", randomIntInRange(1, 2)), block.center());
        }
        return;
      }
      if (typeId === "gs_season:alpine_bearberry") {
        if (currentSeason === SEASON_IDS.Autumn) {
          block.dimension.spawnItem(new ItemStack5("gs_season:wintergreen_berry_item", randomIntInRange(1, 2)), block.center());
        }
        return;
      }
      if (typeId === "gs_season:crowberry") {
        if (currentSeason === SEASON_IDS.Autumn) {
          block.dimension.spawnItem(new ItemStack5("gs_season:crowberry_berry_item", randomIntInRange(1, 2)), block.center());
        }
        return;
      }
      if (typeId === "gs_season:bog_blueberry") {
        if (currentSeason === SEASON_IDS.Summer) {
          block.dimension.spawnItem(new ItemStack5("gs_season:bog_blueberry_item", randomIntInRange(1, 2)), block.center());
        }
        return;
      }
    }
  });
  blockComponentRegistry.registerCustomComponent("gs_season:cactus_damage", {
    onTick: ({ block }) => {
      try {
        if (!block || !block.isValid || !block.isValid()) return;
        const { dimension, location } = block;
        const damageRadius = 1;
        const nearbyPlayers = dimension.getPlayers({
          location: {
            x: location.x + 0.5,
            y: location.y + 0.5,
            z: location.z + 0.5
          },
          maxDistance: damageRadius
        });
        for (const player of nearbyPlayers) {
          try {
            if (player.getGameMode() === GameMode2.Creative || player.getGameMode() === GameMode2.Spectator) {
              continue;
            }
            player.applyDamage(1, {
              cause: "contact"
            });
            dimension.playSound("damage.thorns", player.location, {
              volume: 0.5,
              pitch: 1.2
            });
          } catch (error) {
            continue;
          }
        }
      } catch (error) {
        return;
      }
    }
  });
  blockComponentRegistry.registerCustomComponent("gs_season:cow_spawner", {
    onTick: ({ block }) => {
      try {
        const location = block.location;
        const spawnLocation = {
          x: location.x + 0.1,
          y: location.y + 0.1,
          z: location.z + 0.1
        };
        for (let i = 0; i < 2; i++) {
          block.dimension.spawnEntity("minecraft:cow", spawnLocation);
        }
        block.setType("minecraft:air");
      } catch (error) {
        console.warn(`Failed to execute cow_spawner component: ${error}`);
      }
    }
  });
  blockComponentRegistry.registerCustomComponent("gs_season:chicken_spawner", {
    onTick: ({ block }) => {
      try {
        const location = block.location;
        const spawnLocation = {
          x: location.x + 0.1,
          y: location.y + 0.1,
          z: location.z + 0.1
        };
        for (let i = 0; i < 2; i++) {
          block.dimension.spawnEntity("minecraft:chicken", spawnLocation);
        }
        block.setType("minecraft:air");
      } catch (error) {
        console.warn(`Failed to execute chicken_spawner component: ${error}`);
      }
    }
  });
  blockComponentRegistry.registerCustomComponent("gs_season:honey_nest", {
    onPlayerInteract: ({ block, player, dimension }) => {
      try {
        const isEmpty = block.permutation.getState("gs_season:empty");
        if (isEmpty) return;
        const equippable = player.getComponent("minecraft:equippable");
        const mainhand = equippable?.getEquipment(EquipmentSlot3.Mainhand);
        if (!mainhand || mainhand.typeId !== "minecraft:glass_bottle") return;
        if (player.getGameMode() !== GameMode2.Creative) {
          if (mainhand.amount > 1) {
            mainhand.amount--;
            equippable.setEquipment(EquipmentSlot3.Mainhand, mainhand);
            const honeyBottle = new ItemStack5("minecraft:honey_bottle", 1);
            const inventory = player.getComponent("minecraft:inventory");
            if (inventory?.container) {
              const emptySlot = inventory.container.emptySlotsCount;
              if (emptySlot > 0) {
                inventory.container.addItem(honeyBottle);
              } else {
                dimension.spawnItem(honeyBottle, player.location);
              }
            }
          } else {
            equippable.setEquipment(EquipmentSlot3.Mainhand, new ItemStack5("minecraft:honey_bottle", 1));
          }
        } else {
          const honeyBottle = new ItemStack5("minecraft:honey_bottle", 1);
          const inventory = player.getComponent("minecraft:inventory");
          if (inventory?.container) {
            inventory.container.addItem(honeyBottle);
          }
        }
        dimension.playSound("bottle.fill", block.center(), {
          volume: 1,
          pitch: 1
        });
        block.setPermutation(
          block.permutation.withState("gs_season:empty", true)
        );
      } catch (error) {
        console.warn(`Failed to execute honey_nest interaction: ${error}`);
      }
    }
  });
  blockComponentRegistry.registerCustomComponent("gs_season:horse_spawner", {
    onTick: ({ block }) => {
      try {
        const location = block.location;
        const spawnLocation = {
          x: location.x + 0.1,
          y: location.y + 0.1,
          z: location.z + 0.1
        };
        for (let i = 0; i < 2; i++) {
          block.dimension.spawnEntity("minecraft:horse", spawnLocation);
        }
        block.setType("minecraft:air");
      } catch (error) {
        console.warn(`Failed to execute horse_spawner component: ${error}`);
      }
    }
  });
  blockComponentRegistry.registerCustomComponent("gs_season:pig_spawner", {
    onTick: ({ block }) => {
      try {
        const location = block.location;
        const spawnLocation = {
          x: location.x + 0.1,
          y: location.y + 0.1,
          z: location.z + 0.1
        };
        for (let i = 0; i < 2; i++) {
          block.dimension.spawnEntity("minecraft:pig", spawnLocation);
        }
        block.setType("minecraft:air");
      } catch (error) {
        console.warn(`Failed to execute pig_spawner component: ${error}`);
      }
    }
  });
  blockComponentRegistry.registerCustomComponent("gs_season:sheep_spawner", {
    onTick: ({ block }) => {
      try {
        const location = block.location;
        const spawnLocation = {
          x: location.x + 0.1,
          y: location.y + 0.1,
          z: location.z + 0.1
        };
        for (let i = 0; i < 2; i++) {
          block.dimension.spawnEntity("minecraft:sheep", spawnLocation);
        }
        block.setType("minecraft:air");
      } catch (error) {
        console.warn(`Failed to execute sheep_spawner component: ${error}`);
      }
    }
  });
  blockComponentRegistry.registerCustomComponent("gs_season:villager_spawner", {
    onTick: ({ block }) => {
      try {
        const location = block.location;
        const spawnLocation = {
          x: location.x + 0.1,
          y: location.y + 0.1,
          z: location.z + 0.1
        };
        for (let i = 0; i < 2; i++) {
          block.dimension.spawnEntity("minecraft:villager", spawnLocation);
        }
        block.setType("minecraft:air");
      } catch (error) {
        console.warn(`Failed to execute villager_spawner component: ${error}`);
      }
    }
  });
});
var INTERACT_COOLDOWNS = /* @__PURE__ */ new Set();
world8.beforeEvents.playerInteractWithBlock.subscribe(({ player, itemStack, block }) => {
  if (INTERACT_COOLDOWNS.has(player.id)) return;
  INTERACT_COOLDOWNS.add(player.id);
  system10.runTimeout(() => {
    INTERACT_COOLDOWNS.delete(player.id);
  }, 5);
  if (!itemStack) return;
  const { typeId: itemTypeId } = itemStack;
  if (!itemTypeId.endsWith("_hoe") && !itemTypeId.endsWith("_shovel")) return;
  const { typeId } = block;
  if (!typeId.startsWith("gs_season:") || typeId.endsWith("_moss")) return;
  if (!block.hasTag("grass") && !block.hasTag("dirt")) return;
  const { dimension } = player;
  system10.run(() => {
    if (player.getGameMode() !== GameMode2.Creative) {
      const equippable = player.getComponent("minecraft:equippable");
      if (!equippable) return;
      const durability = itemStack.getComponent(ItemComponentTypes.Durability);
      if (!durability) return;
      if (durability.damage + 1 < durability.maxDurability) {
        durability.damage++;
        equippable.setEquipment(EquipmentSlot3.Mainhand, itemStack);
      } else {
        equippable.setEquipment(EquipmentSlot3.Mainhand, void 0);
        dimension.playSound("random.break", player.location);
      }
    }
    if (itemTypeId.endsWith("_hoe")) {
      block.setType("minecraft:farmland");
      dimension.playSound("step.gravel", block.center(), {
        volume: 2
      });
    } else if (itemTypeId.endsWith("_shovel")) {
      block.setType("minecraft:grass_path");
      dimension.playSound("step.gravel", block.center(), {
        volume: 2
      });
    }
  });
});

// data/scripts/blocks/managers/plants-manager.ts
function isRestrictedItem(item) {
  const { typeId } = item;
  if (typeId === "minecraft:painting") return true;
  if (typeId.endsWith("door")) return true;
  if (typeId.endsWith("trapdoor")) return true;
  if (typeId.endsWith("sign")) return true;
  if (typeId.endsWith("ladder")) return true;
  if (typeId.endsWith("vine")) return true;
  if (typeId.endsWith("pressure_plate")) return true;
  if (typeId.endsWith("frame")) return true;
  if (typeId.includes("snow")) return true;
  return false;
}
var PlantsManager = class {
  static canPlace(block, itemStack) {
    const isCustomPlant = block.hasTag("gs_season:plants");
    return isCustomPlant ? !isRestrictedItem(itemStack) : true;
  }
};

// data/scripts/blocks/cauldron.ts
import {
  GameMode as GameMode3,
  ItemEnchantableComponent,
  ItemStack as ItemStack6,
  system as system11,
  TicksPerSecond as TicksPerSecond3,
  world as world9
} from "@minecraft/server";

// data/scripts/blocks/utils/safe-get-block.ts
function safeGetBlock(location, dimension) {
  try {
    return dimension.getBlock(location);
  } catch {
  }
}

// data/scripts/math/constants.ts
var VECTOR_UP = {
  x: 0,
  y: 1,
  z: 0
};
var VECTOR_DOWN = {
  x: 0,
  y: -1,
  z: 0
};

// data/scripts/blocks/utils/get-topmost-block.ts
function getTopBlock(dim, x, z) {
  try {
    const { max, min } = dim.heightRange;
    const ray = dim.getBlockFromRay({ x, y: max, z }, VECTOR_DOWN, {
      maxDistance: max - min,
      includeLiquidBlocks: true
    });
    return ray ? ray.block : void 0;
  } catch {
  }
}

// data/scripts/blocks/cauldron.ts
var CONFIG = {
  //   TIME_TO_FILL: TicksPerSecond * 8,
  //   UPDATE_INTERVAL: TicksPerSecond * 2,
  TIME_TO_FILL: TicksPerSecond3 * 60 * 10,
  UPDATE_INTERVAL: TicksPerSecond3 * 10
};
var cauldrons = /* @__PURE__ */ new Map();
world9.afterEvents.playerPlaceBlock.subscribe(
  ({ block, dimension }) => {
    if (dimension.id !== "minecraft:overworld") return;
    const fullness = 0;
    const { x, y, z } = block;
    const blockLoc = `${x}_${y}_${z}`;
    world9.setDynamicProperty(`gs_season:cauldron_${blockLoc}`, fullness);
    cauldrons.set(blockLoc, block.location);
  },
  {
    blockTypes: ["minecraft:cauldron", "gs_season:cauldron"]
  }
);
world9.afterEvents.playerBreakBlock.subscribe(
  ({
    block,
    dimension,
    itemStackBeforeBreak,
    player,
    brokenBlockPermutation
  }) => {
    if (dimension.id !== "minecraft:overworld") {
      const { x, y, z } = block;
      const blockLoc = `${x}_${y}_${z}`;
      world9.setDynamicProperty(`gs_season:cauldron_${blockLoc}`, void 0);
      cauldrons.delete(blockLoc);
    }
    const isInCreative = player.getGameMode() === GameMode3.creative;
    if (!isInCreative) {
      const brokenWithSilkTouch = !!itemStackBeforeBreak && itemStackBeforeBreak.getComponent(ItemEnchantableComponent.componentId)?.hasEnchantment("silk_touch");
      if (brokenWithSilkTouch) {
        dimension.spawnItem(
          new ItemStack6(brokenBlockPermutation.type.id),
          block.center()
        );
      } else {
        dimension.spawnItem(
          new ItemStack6("minecraft:cauldron"),
          block.center()
        );
      }
    }
  },
  {
    blockTypes: [
      "minecraft:cauldron",
      "gs_season:cauldron",
      "gs_season:cauldron_full"
    ]
  }
);
function updateCauldronFullness(cauldron, id, pointsToBecomeFull, halfPoints) {
  const propId = `gs_season:cauldron_${id}`;
  const fullness = Math.min(
    (world9.getDynamicProperty(propId) ?? 0) + 1,
    pointsToBecomeFull
  );
  world9.setDynamicProperty(propId, fullness);
  if (fullness < halfPoints) return;
  const stage = fullness >= pointsToBecomeFull ? "gs_season:cauldron_full" : "gs_season:cauldron";
  cauldron.setType(stage);
}
system11.runInterval(() => {
  if (!SeasonCycle.matches(SEASON_IDS.Spring)) return;
  const dimension = world9.getDimension("minecraft:overworld");
  const pointsToBecomeFull = CONFIG.TIME_TO_FILL / CONFIG.UPDATE_INTERVAL;
  const halfPoints = pointsToBecomeFull / 2;
  for (const [id, location] of cauldrons) {
    const cauldron = safeGetBlock(location, dimension);
    if (!cauldron) continue;
    const { typeId } = cauldron;
    if (typeId !== "minecraft:cauldron" && typeId !== "gs_season:cauldron") {
      world9.setDynamicProperty(`gs_season:cauldron_${id}`, void 0);
      cauldrons.delete(id);
      continue;
    }
    if (typeId === "minecraft:cauldron" && cauldron.permutation.getState("fill_level"))
      continue;
    updateCauldronFullness(cauldron, id, pointsToBecomeFull, halfPoints);
  }
}, CONFIG.UPDATE_INTERVAL);
var CAULDRON_BLOCKS = /* @__PURE__ */ new Map();
var SPAWN_COOLDOWN = [TicksPerSecond3 * 30, TicksPerSecond3 * 40];
var SPAWN_CHANCES = [
  {
    animalId: "minecraft:cow",
    chance: 22,
    minDistance: 2,
    maxDistance: 5
  },
  {
    animalId: "minecraft:sheep",
    chance: 20,
    minDistance: 2,
    maxDistance: 5
  },
  {
    animalId: "minecraft:pig",
    chance: 18,
    minDistance: 2,
    maxDistance: 5
  },
  {
    animalId: "minecraft:chicken",
    chance: 15,
    minDistance: 2,
    maxDistance: 5
  },
  {
    animalId: "minecraft:rabbit",
    chance: 10,
    minDistance: 2,
    maxDistance: 5
  },
  {
    animalId: "gs_season:black_bear",
    chance: 10,
    minDistance: 5,
    maxDistance: 10
  },
  {
    animalId: "gs_season:caribou",
    chance: 15,
    minDistance: 5,
    maxDistance: 10
  },
  {
    animalId: "gs_season:baboon",
    chance: 5,
    minDistance: 5,
    maxDistance: 10
  }
];
function getSpawneableBlockAround(block, dimension, range) {
  const tries = 10;
  const { min, max } = range;
  for (let i = 0; i <= tries; i++) {
    const x = block.x + randomIntInRange(min, max);
    const z = block.z + randomIntInRange(min, max);
    const surface = getTopBlock(dimension, x, z);
    if (surface && surface.y - block.y <= max) return surface;
  }
}
function trySpawnAnimal(block) {
  const { dimension } = block;
  const animalsAround = dimension.getEntities({
    location: block.location,
    maxDistance: 24,
    families: ["animal"]
  });
  if (animalsAround.length >= 15) return false;
  const chance = Math.random();
  let weight = 0;
  try {
    for (const {
      animalId,
      chance: ruleChance,
      minDistance,
      maxDistance
    } of SPAWN_CHANCES) {
      weight += ruleChance;
      if (chance < weight) {
        const surface = getSpawneableBlockAround(block, dimension, {
          min: minDistance,
          max: maxDistance
        });
        if (!surface) return false;
        dimension.spawnEntity(animalId, {
          ...surface,
          y: surface.y + 1
        });
        return true;
      }
    }
  } catch {
  }
  return false;
}
function runCauldronSpawnLoop(id, block) {
  const cooldown = randomIntInRange(SPAWN_COOLDOWN[0], SPAWN_COOLDOWN[1]);
  system11.runTimeout(() => {
    if (!block.isValid() || block.typeId !== "gs_season:cauldron_full") {
      CAULDRON_BLOCKS.delete(id);
      return;
    }
    trySpawnAnimal(block);
    runCauldronSpawnLoop(id, block);
  }, cooldown);
}
var event = world9.beforeEvents.worldInitialize.subscribe(
  ({ blockComponentRegistry }) => {
    blockComponentRegistry.registerCustomComponent("gs_season:cauldron", {
      onPlace({ block, dimension }) {
        if (dimension.id !== "minecraft:overworld") return;
        const blockId = `${block.x}_${block.y}_${block.z}`;
        if (CAULDRON_BLOCKS.has(blockId)) return;
        CAULDRON_BLOCKS.set(blockId, block);
        runCauldronSpawnLoop(blockId, block);
      },
      onRandomTick({ block, dimension }) {
        if (dimension.id !== "minecraft:overworld") return;
        const blockId = `${block.x}_${block.y}_${block.z}`;
        if (CAULDRON_BLOCKS.has(blockId)) return;
        CAULDRON_BLOCKS.set(blockId, block);
        runCauldronSpawnLoop(blockId, block);
      }
    });
    system11.run(() => {
      world9.beforeEvents.worldInitialize.unsubscribe(event);
      event = void 0;
    });
  }
);
WorldLoad.subscribe(() => {
  const ids = world9.getDynamicPropertyIds().filter((id) => id.startsWith("gs_season:cauldron_"));
  for (const id of ids) {
    const [x, y, z] = id.replace("gs_season:cauldron_", "").split("_").map(Number);
    const location = { x, y, z };
    cauldrons.set(`${x}_${y}_${z}`, location);
  }
  const rulesWeight = SPAWN_CHANCES.reduce((acc, rule) => acc + rule.chance, 0);
  for (const rule of SPAWN_CHANCES) {
    rule.chance = rule.chance / rulesWeight;
  }
  SPAWN_CHANCES.sort((a, b) => a.chance - b.chance);
});

// data/scripts/blocks/main.ts
var logStrip = new LogStrip([
  {
    fromId: "gs_season:acacia_log",
    toId: "gs_season:acacia_stripped_log",
    keepStates: true,
    sound: { id: "use.wood", volume: 1, pitch: 0.8 }
  },
  {
    fromId: "gs_season:acacia_wood",
    toId: "gs_season:acacia_wood_stripped",
    keepStates: true,
    sound: { id: "use.wood", volume: 1, pitch: 0.8 }
  },
  {
    fromId: "gs_season:boabab_log",
    toId: "gs_season:boabab_stripped_log",
    keepStates: true,
    sound: { id: "use.wood", volume: 1, pitch: 0.8 }
  },
  {
    fromId: "gs_season:boabab_wood",
    toId: "gs_season:boabab_wood_stripped",
    keepStates: true,
    sound: { id: "use.wood", volume: 1, pitch: 0.8 }
  },
  {
    fromId: "gs_season:bushwillow_log",
    toId: "gs_season:bushwillow_stripped_log",
    keepStates: true,
    sound: { id: "use.wood", volume: 1, pitch: 0.8 }
  },
  {
    fromId: "gs_season:bushwillow_wood",
    toId: "gs_season:bushwillow_wood_stripped",
    keepStates: true,
    sound: { id: "use.wood", volume: 1, pitch: 0.8 }
  },
  {
    fromId: "gs_season:beech_log",
    toId: "gs_season:beech_stripped_log",
    keepStates: true,
    sound: { id: "use.wood", volume: 1, pitch: 0.8 }
  },
  {
    fromId: "gs_season:beech_wood",
    toId: "gs_season:beech_wood_stripped",
    keepStates: true,
    sound: { id: "use.wood", volume: 1, pitch: 0.8 }
  },
  {
    fromId: "gs_season:sugar_maple_log",
    toId: "gs_season:sugar_maple_stripped_log",
    keepStates: true,
    sound: { id: "use.wood", volume: 1, pitch: 0.8 }
  },
  {
    fromId: "gs_season:sugar_maple_wood",
    toId: "gs_season:sugar_maple_wood_stripped",
    keepStates: true,
    sound: { id: "use.wood", volume: 1, pitch: 0.8 }
  },
  {
    fromId: "gs_season:red_oak_log",
    toId: "gs_season:red_oak_stripped_log",
    keepStates: true,
    sound: { id: "use.wood", volume: 1, pitch: 0.8 }
  },
  {
    fromId: "gs_season:red_oak_wood",
    toId: "gs_season:red_oak_wood_stripped",
    keepStates: true,
    sound: { id: "use.wood", volume: 1, pitch: 0.8 }
  },
  {
    fromId: "gs_season:aspen_log",
    toId: "gs_season:aspen_stripped_log",
    keepStates: true,
    sound: { id: "use.wood", volume: 1, pitch: 0.8 }
  },
  {
    fromId: "gs_season:aspen_wood",
    toId: "gs_season:aspen_wood_stripped",
    keepStates: true,
    sound: { id: "use.wood", volume: 1, pitch: 0.8 }
  },
  {
    fromId: "gs_season:palm_log",
    toId: "gs_season:palm_stripped_log",
    keepStates: true,
    sound: { id: "use.wood", volume: 1, pitch: 0.8 }
  },
  {
    fromId: "gs_season:palm_wood",
    toId: "gs_season:palm_wood_stripped",
    keepStates: true,
    sound: { id: "use.wood", volume: 1, pitch: 0.8 }
  },
  {
    fromId: "gs_season:jacaranda_log_1",
    toId: "gs_season:jacaranda_stripped_log_1",
    keepStates: true,
    sound: { id: "use.wood", volume: 1, pitch: 0.8 }
  },
  {
    fromId: "gs_season:jacaranda_wood_1",
    toId: "gs_season:jacaranda_wood_stripped_1",
    keepStates: true,
    sound: { id: "use.wood", volume: 1, pitch: 0.8 }
  },
  {
    fromId: "gs_season:jacaranda_log_2",
    toId: "gs_season:jacaranda_stripped_log_2",
    keepStates: true,
    sound: { id: "use.wood", volume: 1, pitch: 0.8 }
  },
  {
    fromId: "gs_season:jacaranda_wood_2",
    toId: "gs_season:jacaranda_wood_stripped_2",
    keepStates: true,
    sound: { id: "use.wood", volume: 1, pitch: 0.8 }
  }
]);
world10.beforeEvents.playerBreakBlock.subscribe((ev) => {
  system12.runTimeout(() => {
    FenceManager.updateAround(ev.block);
    WallManager.updateWallsAround(ev.block);
  });
  if (!ev.block.hasTag("gs_season:disable_silktouch") || !ev.itemStack) return;
  if (!ev.itemStack.getComponent(ItemEnchantableComponent2.componentId)?.hasEnchantment("silk_touch"))
    return;
  ev.cancel = true;
  system12.runTimeout(
    () => BlockManager.destroy(ev.dimension, ev.block.location)
  );
});
world10.afterEvents.playerPlaceBlock.subscribe((ev) => {
  const { block } = ev;
  FenceManager.updateAround(block);
  WallManager.updateWallsAround(block);
});
world10.beforeEvents.playerInteractWithBlock.subscribe((ev) => {
  const { block, itemStack } = ev;
  if (itemStack && !PlantsManager.canPlace(block, itemStack)) {
    ev.cancel = true;
  }
});
world10.beforeEvents.worldInitialize.subscribe((ev) => {
  const reg = ev.blockComponentRegistry;
  reg.registerCustomComponent(
    "gs_season:trapdoor",
    new TrapdoorComponent("gs_season:open", "gs_season:powered", {
      open: "open.wooden_trapdoor",
      close: "close.wooden_trapdoor"
    })
  );
  reg.registerCustomComponent("gs_season:fence", {
    onPlace({ block }) {
      block.setPermutation(
        block.permutation.withState("gs_season:display", false)
      );
    }
  });
  reg.registerCustomComponent(
    "gs_season:fence_gate",
    new FenceGateComponent(
      "gs_season:open",
      "gs_season:display",
      "gs_season:powered",
      { id: "open.fence_gate", volume: 1, pitch: 1 },
      { id: "close.fence_gate", volume: 1, pitch: 1 }
    )
  );
  const slabs = [
    [
      "gs_season:slab_mossy_stone",
      "gs_season:full_block",
      "gs_season:mossy_stone_slab",
      "dig.wood"
    ],
    [
      "gs_season:slab_acacia",
      "gs_season:full_block",
      "gs_season:acacia_slab",
      "dig.wood"
    ],
    [
      "gs_season:slab_baobab",
      "gs_season:full_block",
      "gs_season:baobab_slab",
      "dig.wood"
    ],
    [
      "gs_season:slab_bushwillow",
      "gs_season:full_block",
      "gs_season:bushwillow_slab",
      "dig.wood"
    ],
    [
      "gs_season:slab_beech",
      "gs_season:full_block",
      "gs_season:beech_slab",
      "dig.wood"
    ],
    [
      "gs_season:slab_sugar_maple",
      "gs_season:full_block",
      "gs_season:sugar_maple_slab",
      "dig.wood"
    ],
    [
      "gs_season:slab_red_oak",
      "gs_season:full_block",
      "gs_season:red_oak_slab",
      "dig.wood"
    ],
    [
      "gs_season:slab_aspen",
      "gs_season:full_block",
      "gs_season:aspen_slab",
      "dig.wood"
    ],
    [
      "gs_season:slab_palm",
      "gs_season:full_block",
      "gs_season:palm_slab",
      "dig.wood"
    ],
    [
      "gs_season:slab_jacaranda_1",
      "gs_season:full_block",
      "gs_season:jacaranda_1_slab",
      "dig.wood"
    ],
    [
      "gs_season:slab_jacaranda_2",
      "gs_season:full_block",
      "gs_season:jacaranda_2_slab",
      "dig.wood"
    ]
  ];
  for (const [id, state, item, sound] of slabs) {
    reg.registerCustomComponent(
      id,
      new SlabInteraction(state, item, { id: sound, volume: 1, pitch: 1 })
    );
  }
  const stairs = [
    "acacia",
    "baobab",
    "bushwillow",
    "beech",
    "sugar_maple",
    "red_oak",
    "aspen",
    "palm",
    "jacaranda_1",
    "jacaranda_2",
    "mossy_stone"
  ];
  for (const n of stairs) {
    reg.registerCustomComponent(
      `gs_season:stairs_${n}`,
      new StairsComponent(
        `gs_season:${n}_stairs`,
        "gs_season:connected_front",
        "gs_season:connected_back",
        "gs_season:display"
      )
    );
  }
});
logStrip.subscribe(world10, system12);
world10.beforeEvents.worldInitialize.subscribe((data) => {
  const { blockComponentRegistry } = data;
  const openSound = {
    id: "random.door_open",
    volume: 1,
    pitch: 1
  };
  const closeSound = {
    id: "random.door_close",
    volume: 1,
    pitch: 1
  };
  blockComponentRegistry.registerCustomComponent(
    "gs_season:door",
    new BlockComponentDoor([
      {
        id: "gs_season:aspen_door",
        itemID: "gs_season:aspen_door_item",
        openSound,
        closeSound
      },
      {
        id: "gs_season:beech_door",
        itemID: "gs_season:beech_door_item",
        openSound,
        closeSound
      },
      {
        id: "gs_season:jacaranda_door_1",
        itemID: "gs_season:jacaranda_door_1_item",
        openSound,
        closeSound
      },
      {
        id: "gs_season:jacaranda_door_2",
        itemID: "gs_season:jacaranda_door_2_item",
        openSound,
        closeSound
      },
      {
        id: "gs_season:palm_door",
        itemID: "gs_season:palm_door_item",
        openSound,
        closeSound
      },
      {
        id: "gs_season:sugar_maple_door",
        itemID: "gs_season:sugar_maple_door_item",
        openSound,
        closeSound
      },
      {
        id: "gs_season:acacia_door",
        itemID: "gs_season:acacia_door_item",
        openSound,
        closeSound
      },
      {
        id: "gs_season:baobab_door",
        itemID: "gs_season:baobab_door_item",
        openSound,
        closeSound
      },
      {
        id: "gs_season:bushwillow_door",
        itemID: "gs_season:bushwillow_door_item",
        openSound,
        closeSound
      },
      {
        id: "gs_season:red_oak_door",
        itemID: "gs_season:red_oak_door_item",
        openSound,
        closeSound
      }
    ])
  );
});

// data/scripts/items/main.js
import { world as world15, ItemStack as ItemStack10 } from "@minecraft/server";

// data/scripts/items/interactions.js
import { system as system13, world as world11, ItemStack as ItemStack7, GameMode as GameMode4 } from "@minecraft/server";
var hoeIds = [
  "gs_season:hoe_name"
];
var shovelIds = [
  "gs_season:shovel_name"
];
var axeIds = [
  "gs_season:axe_name"
];
world11.beforeEvents.itemUseOn.subscribe((evd) => {
  const { source: player, block, itemStack: itemUsed } = evd;
  if (!itemUsed) return;
  if (hoeIds.includes(itemUsed.typeId) || shovelIds.includes(itemUsed.typeId) || axeIds.includes(itemUsed.typeId)) {
    const playerEquippableComp = player.getComponent("equippable");
    if (!playerEquippableComp) return;
    if (hoeIds.includes(itemUsed.typeId)) {
      const blockAbove = block.dimension.getBlock(block.location).above(1);
      if (!blockAbove.isAir) return;
      if (block.permutation.matches("minecraft:dirt") || block.permutation.matches("minecraft:grass_block") || block.permutation.matches("minecraft:dirt_with_roots") || block.permutation.matches("minecraft:grass_path")) {
        system13.run(function() {
          player.playSound("use.gravel", { pitch: 1, location: block.location, volume: 1 });
        });
      } else return;
    }
    if (shovelIds.includes(itemUsed.typeId)) {
      const blockAbove = block.dimension.getBlock(block.location).above(1);
      if (!blockAbove.isAir) return;
      if (block.permutation.matches("minecraft:dirt") || block.permutation.matches("minecraft:grass_block") || block.permutation.matches("minecraft:dirt_with_roots") || block.permutation.matches("minecraft:mycelium") || block.permutation.matches("minecraft:podzol")) {
        if (!block.permutation.matches("minecraft:grass_block")) {
          system13.run(function() {
            block.setType("minecraft:grass_path");
          });
        }
        system13.run(function() {
          player.playSound("use.grass", { pitch: 1, location: block.location, volume: 0.5 });
        });
      } else return;
    }
    if (axeIds.includes(itemUsed.typeId)) {
      if (block.permutation.matches("minecraft:oak_log") || block.permutation.matches("minecraft:birch_log") || block.permutation.matches("minecraft:spruce_log") || block.permutation.matches("minecraft:dark_oak_log") || block.permutation.matches("minecraft:jungle_log") || block.permutation.matches("minecraft:acacia_log") || block.permutation.matches("minecraft:mangrove_log") || block.permutation.matches("minecraft:oak_wood") || block.permutation.matches("minecraft:birch_wood") || block.permutation.matches("minecraft:spruce_wood") || block.permutation.matches("minecraft:dark_oak_wood") || block.permutation.matches("minecraft:jungle_wood") || block.permutation.matches("minecraft:acacia_wood") || block.permutation.matches("minecraft:mangrove_wood"))
        system13.run(function() {
          player.playSound("use.wood", { pitch: 1, location: block.location, volume: 1 });
        });
      else if (block.permutation.matches("minecraft:cherry_log") || block.permutation.matches("minecraft:cherry_wood"))
        system13.run(function() {
          player.playSound("step.cherry_wood", { pitch: 1, location: block.location, volume: 1 });
        });
      else if (block.permutation.matches("minecraft:bamboo_block"))
        system13.run(function() {
          player.playSound("step.bamboo_wood", { pitch: 1, location: block.location, volume: 1 });
        });
      else if (block.permutation.matches("minecraft:crimson_stem") || block.permutation.matches("minecraft:warped_stem") || block.permutation.matches("minecraft:crimson_hyphae") || block.permutation.matches("minecraft:warped_hyphae"))
        system13.run(function() {
          player.playSound("use.stem", { pitch: 1, location: block.location, volume: 1 });
        });
      else return;
    }
    if (player.matches({ gameMode: GameMode4.creative })) return;
    const itemEnchantmentComp = itemUsed.getComponent("minecraft:enchantable");
    const unbreakingLevel = itemEnchantmentComp?.getEnchantment("unbreaking")?.level ?? 0;
    const breakChance = 100 / (unbreakingLevel + 1);
    const randomizeChance = Math.random() * 100;
    if (breakChance < randomizeChance) return;
    const itemUsedDurabilityComp = itemUsed.getComponent("durability");
    if (!itemUsedDurabilityComp) return;
    system13.run(function() {
      itemUsedDurabilityComp.damage += 1;
      const maxDurability = itemUsedDurabilityComp.maxDurability;
      const currentDamage = itemUsedDurabilityComp.damage;
      if (currentDamage >= maxDurability) {
        system13.run(() => {
          player.playSound("random.break", { pitch: 1, location: player.location, volume: 1 });
          playerEquippableComp.setEquipment("Mainhand", new ItemStack7("minecraft:air", 1));
        });
      } else if (currentDamage < maxDurability) {
        system13.run(() => {
          playerEquippableComp.setEquipment("Mainhand", itemUsed);
        });
      }
    });
  }
});

// data/scripts/items/durability.js
import { world as world12, ItemStack as ItemStack8, GameMode as GameMode5 } from "@minecraft/server";
var toolTypeIds = [
  "gs_season:tool_name"
];
var weaponTypeIds = [
  "gs_season:weapon_name"
];
world12.afterEvents.playerBreakBlock.subscribe((evd) => {
  const { player, itemStackBeforeBreak: itemUsed } = evd;
  if (!itemUsed || player.matches({ gameMode: GameMode5.creative })) return;
  if (toolTypeIds.includes(itemUsed.typeId) || weaponTypeIds.includes(itemUsed.typeId)) {
    const playerEquippableComp = player.getComponent("equippable");
    if (!playerEquippableComp) return;
    const itemEnchantmentComp = itemUsed.getComponent("minecraft:enchantable");
    const unbreakingLevel = itemEnchantmentComp?.getEnchantment("unbreaking")?.level ?? 0;
    const breakChance = 100 / (unbreakingLevel + 1);
    const randomizeChance = Math.random() * 100;
    if (breakChance < randomizeChance) return;
    const itemUsedDurabilityComp = itemUsed.getComponent("durability");
    if (!itemUsedDurabilityComp) return;
    let durabilityModifier = 0;
    if (toolTypeIds.includes(itemUsed.typeId)) {
      durabilityModifier = 1;
    } else {
      durabilityModifier = 2;
    }
    itemUsedDurabilityComp.damage += durabilityModifier;
    const maxDurability = itemUsedDurabilityComp.maxDurability;
    const currentDamage = itemUsedDurabilityComp.damage;
    if (currentDamage >= maxDurability) {
      player.playSound("random.break", { pitch: 1, location: player.location, volume: 1 });
      playerEquippableComp.setEquipment("Mainhand", new ItemStack8("minecraft:air", 1));
    } else if (currentDamage < maxDurability) {
      playerEquippableComp.setEquipment("Mainhand", itemUsed);
    }
  }
});

// data/scripts/items/backpacks.ts
import {
  EquipmentSlot as EquipmentSlot4,
  ItemStack as ItemStack9,
  world as world13,
  ItemLockMode,
  StructureSaveMode,
  system as system14,
  EntityComponentTypes,
  TicksPerSecond as TicksPerSecond4
} from "@minecraft/server";

// data/scripts/common/constants.ts
var GS_SEASON_NAMESPACE = "gs_season";
var SEA_LEVEL = 62;

// data/scripts/items/backpacks.ts
var BACKPACK_ENTITY_ID = "gs_season:backpack";
var BACKPACK_UPGRADEABLE_TYPE_IDS = /* @__PURE__ */ new Set([
  "gs_season:spring_backpack",
  "gs_season:summer_backpack",
  "gs_season:autumn_backpack",
  "gs_season:winter_backpack",
  "gs_season:spring_backpack_empty",
  "gs_season:summer_backpack_empty",
  "gs_season:winter_backpack_empty",
  "gs_season:autumn_backpack_empty"
]);
var BACKPACK_TYPE_IDS = /* @__PURE__ */ new Set([
  ...BACKPACK_UPGRADEABLE_TYPE_IDS,
  "gs_season:winter_savanna_backpack",
  "gs_season:winter_tundra_backpack",
  "gs_season:winter_forest_backpack",
  "gs_season:summer_savanna_backpack",
  "gs_season:summer_tundra_backpack",
  "gs_season:summer_forest_backpack",
  "gs_season:autumn_savanna_backpack",
  "gs_season:autumn_tundra_backpack",
  "gs_season:autumn_forest_backpack",
  "gs_season:spring_savanna_backpack",
  "gs_season:spring_tundra_backpack",
  "gs_season:spring_forest_backpack"
]);
var BACKPACK_UUID_AT_USAGE = {};
function generateUUID() {
  return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
    let r = Math.random() * 16 | 0;
    let v = c === "x" ? r : r & 3 | 8;
    return v.toString(16);
  });
}
function saveStructure(structure, dim, from, to) {
  try {
    if (world13.structureManager.get(structure)) {
      world13.structureManager.delete(structure);
    }
    world13.structureManager.createFromWorld(
      `mystructure:${structure}`,
      dim,
      from,
      to,
      {
        includeBlocks: false,
        includeEntities: true,
        saveMode: StructureSaveMode.World
      }
    );
  } catch (error) {
    console.error("backpacks:saveStructure", error);
  }
}
function spawnBackpack(player, backpackId) {
  const { dimension, location } = player;
  const entity = dimension.spawnEntity(BACKPACK_ENTITY_ID, location);
  entity.nameTag = "Backpack";
  entity.getComponent(EntityComponentTypes.Tameable)?.tame(player);
  entity.addTag(`${GS_SEASON_NAMESPACE}.backpack_id_${backpackId}`);
  entity.setDynamicProperty("uuid", backpackId);
  return entity;
}
function saveBackpack(dimension, backpackId) {
  const backpacks = dimension.getEntities({
    type: BACKPACK_ENTITY_ID,
    tags: [`${GS_SEASON_NAMESPACE}.backpack_id_${backpackId}`],
    excludeTags: [`${GS_SEASON_NAMESPACE}.backpack_deleted`]
  });
  for (const backpack of backpacks) {
    const { location, dimension: bDimension } = backpack;
    saveStructure(
      `${GS_SEASON_NAMESPACE}.backpack_${backpackId}`,
      bDimension,
      location,
      location
    );
    backpack.addTag(`${GS_SEASON_NAMESPACE}.backpack_deleted`);
    backpack.triggerEvent("gs_season:despawn");
  }
}
function unlockBackpack(player, uuid) {
  const inv = player.getComponent("inventory")?.container;
  if (!inv) return;
  for (let slot = 0; slot < inv.size; slot++) {
    const item = inv.getItem(slot);
    if (item && BACKPACK_TYPE_IDS.has(item.typeId) && item.lockMode === ItemLockMode.inventory && item.getDynamicProperty("uuid") === uuid) {
      item.lockMode = ItemLockMode.none;
      inv.setItem(slot, item);
    }
  }
}
function createBackpackItemFrom(oldBackpack, newBackpackTypeId) {
  const newBackpack = new ItemStack9(newBackpackTypeId, 1);
  const oldBackpackId = oldBackpack.getDynamicProperty("uuid");
  newBackpack.setDynamicProperty("uuid", oldBackpackId);
  const oldDurability = oldBackpack.getComponent("durability")?.damage ?? 0;
  newBackpack.getComponent("durability").damage = oldDurability;
  newBackpack.nameTag = oldBackpack.nameTag;
  const oldEnchantable = oldBackpack.getComponent("enchantable");
  const newEnchantable = newBackpack.getComponent("enchantable");
  if (oldEnchantable && newEnchantable) {
    for (const enchantment of oldEnchantable.getEnchantments()) {
      newEnchantable.addEnchantment(enchantment);
    }
  }
  if (BACKPACK_UPGRADEABLE_TYPE_IDS.has(newBackpackTypeId)) {
    if (newBackpackTypeId.endsWith("_empty")) {
      newBackpack.setLore(["", "\xA7r\xA7aCan be used for crafting"]);
    } else {
      newBackpack.setLore(["", "\xA7r\xA7cCan not be used for crafting"]);
    }
  }
  return newBackpack;
}
function validateSeason(backpack) {
  const { typeId } = backpack;
  const currentSeason = SeasonCycle.getCurrentSeason();
  let newSeasonType;
  switch (currentSeason) {
    case SEASON_IDS.Summer:
      if (typeId.includes("summer")) return void 0;
      newSeasonType = "summer";
      break;
    case SEASON_IDS.Winter:
      if (typeId.includes("winter")) return void 0;
      newSeasonType = "winter";
      break;
    case SEASON_IDS.Autumn:
      if (typeId.includes("autumn")) return void 0;
      newSeasonType = "autumn";
      break;
    case SEASON_IDS.Spring:
      if (typeId.includes("spring")) return void 0;
      newSeasonType = "spring";
      break;
  }
  if (!newSeasonType) return void 0;
  const seasonPart = typeId.replace(`${GS_SEASON_NAMESPACE}:`, "").split("_")[0];
  return createBackpackItemFrom(
    backpack,
    typeId.replace(seasonPart, newSeasonType)
  );
}
function removePlayerBackpack(player) {
  const { dimension, name } = player;
  player.removeTag(`${GS_SEASON_NAMESPACE}.spawned_backpack`);
  delete BACKPACK_UUID_AT_USAGE[name];
  player.getTags().forEach((t) => {
    if (t.startsWith(`${GS_SEASON_NAMESPACE}.backpack_id_`)) {
      const uuid = t.replace(`${GS_SEASON_NAMESPACE}.backpack_id_`, "");
      player.removeTag(t);
      saveBackpack(dimension, uuid);
      unlockBackpack(player, uuid);
    }
  });
}
function MainhandBackpack(equip, player) {
  const { dimension, location, name, isSneaking } = player;
  const mainhand = equip.getEquipment(EquipmentSlot4.Mainhand);
  if (mainhand && BACKPACK_TYPE_IDS.has(mainhand.typeId)) {
    let backpackId = mainhand.getDynamicProperty("uuid");
    if (!backpackId) {
      backpackId = generateUUID();
      mainhand.setDynamicProperty("uuid", backpackId);
      equip.setEquipment(EquipmentSlot4.Mainhand, mainhand);
      spawnBackpack(player, backpackId);
    }
    if (BACKPACK_UUID_AT_USAGE[name] && BACKPACK_UUID_AT_USAGE[name] !== backpackId) {
      const oldBackpackId = BACKPACK_UUID_AT_USAGE[name];
      saveBackpack(dimension, oldBackpackId);
      unlockBackpack(player, oldBackpackId);
      player.removeTag(`${GS_SEASON_NAMESPACE}.backpack_id_${oldBackpackId}`);
      player.removeTag(`${GS_SEASON_NAMESPACE}.spawned_backpack`);
    }
    BACKPACK_UUID_AT_USAGE[name] = backpackId;
    const hasBackpackTag = player.hasTag(
      `${GS_SEASON_NAMESPACE}.spawned_backpack`
    );
    if (!hasBackpackTag && !isSneaking) {
      player.addTag(`${GS_SEASON_NAMESPACE}.backpack_id_${backpackId}`);
      player.addTag(`${GS_SEASON_NAMESPACE}.spawned_backpack`);
      world13.gameRules.showTags = false;
      mainhand.lockMode = ItemLockMode.inventory;
      equip.setEquipment(EquipmentSlot4.Mainhand, mainhand);
      try {
        world13.structureManager.place(
          `${GS_SEASON_NAMESPACE}.backpack_${backpackId}`,
          dimension,
          {
            ...location,
            y: location.y + 1
          }
        );
        world13.structureManager.delete(
          `${GS_SEASON_NAMESPACE}.backpack_${backpackId}`
        );
      } catch (error) {
      }
    } else if (isSneaking) {
      removePlayerBackpack(player);
    }
    const view = player.getViewDirection();
    const backpacks = dimension.getEntities({
      type: BACKPACK_ENTITY_ID,
      tags: [`${GS_SEASON_NAMESPACE}.backpack_id_${backpackId}`],
      excludeTags: [`${GS_SEASON_NAMESPACE}.backpack_deleted`]
    });
    for (const backpack of backpacks) {
      backpack.teleport(
        {
          x: location.x,
          y: location.y,
          z: location.z
        },
        // @TODO: Make collision box smaller and teleport the backpack in front of the player
        {
          dimension
        }
      );
      let newBackpackItem = validateSeason(mainhand);
      if (newBackpackItem) {
        equip.setEquipment(EquipmentSlot4.Mainhand, newBackpackItem);
      } else {
        newBackpackItem = mainhand;
      }
      if (!BACKPACK_UPGRADEABLE_TYPE_IDS.has(newBackpackItem.typeId)) continue;
      const backpackContainer = backpack.getComponent(
        EntityComponentTypes.Inventory
      )?.container;
      if (backpackContainer) {
        const isCurrentEmpty = newBackpackItem.typeId.endsWith("_empty");
        if (backpackContainer.emptySlotsCount === backpackContainer.size) {
          if (!isCurrentEmpty) {
            newBackpackItem = createBackpackItemFrom(
              newBackpackItem,
              `${newBackpackItem.typeId}_empty`
            );
          }
        } else {
          if (isCurrentEmpty) {
            newBackpackItem = createBackpackItemFrom(
              newBackpackItem,
              `${newBackpackItem.typeId.replace("_empty", "")}`
            );
          }
        }
        if (newBackpackItem) {
          equip.setEquipment(EquipmentSlot4.Mainhand, newBackpackItem);
        }
      }
    }
    return;
  }
  if (player.hasTag(`${GS_SEASON_NAMESPACE}.spawned_backpack`)) {
    removePlayerBackpack(player);
  }
}
async function stopEquipmentSound(player) {
  for (let i = 0; i < 5; i++) {
    stopSound(player, "armor.equip_generic");
    await system14.waitTicks(1);
  }
}
function ChestBackpack(player, equip) {
  const chest = equip.getEquipment(EquipmentSlot4.Chest);
  if (chest && BACKPACK_TYPE_IDS.has(chest.typeId)) {
    if (chest.lockMode === ItemLockMode.inventory) {
      chest.lockMode = ItemLockMode.none;
      equip.setEquipment(EquipmentSlot4.Chest, chest);
    }
    const newBackpackItem = validateSeason(chest);
    if (newBackpackItem) {
      equip.setEquipment(EquipmentSlot4.Chest, newBackpackItem);
      stopEquipmentSound(player);
    }
  }
}
system14.runInterval(() => {
  for (const player of world13.getAllPlayers()) {
    try {
      const equip = player.getComponent(EntityComponentTypes.Equippable);
      if (!equip) return;
      MainhandBackpack(equip, player);
    } catch {
    }
  }
}, 2);
system14.runInterval(() => {
  for (const player of world13.getAllPlayers()) {
    try {
      const equip = player.getComponent(EntityComponentTypes.Equippable);
      if (!equip) return;
      ChestBackpack(player, equip);
    } catch {
    }
  }
}, TicksPerSecond4);
world13.beforeEvents.itemUse.subscribe((event2) => {
  const { source: player, itemStack } = event2;
  const { typeId } = itemStack;
  if (typeId.startsWith("gs_season") && typeId.includes("_backpack")) {
    if (player.isSneaking) return;
    event2.cancel = true;
  }
});

// data/scripts/items/season-clock.ts
import {
  EntityComponentTypes as EntityComponentTypes2,
  EquipmentSlot as EquipmentSlot5,
  system as system15,
  TicksPerSecond as TicksPerSecond5,
  world as world14
} from "@minecraft/server";
var ANGLE_STEP = 18;
function SeasonClock(player, index) {
  const equip = player.getComponent(EntityComponentTypes2.Equippable);
  if (!equip) {
    return;
  }
  const maihand = equip?.getEquipment(EquipmentSlot5.Mainhand);
  const offhand = equip?.getEquipment(EquipmentSlot5.Offhand);
  if ((!maihand || maihand.typeId !== "gs_season:season_clock_item") && (!offhand || offhand.typeId !== "gs_season:season_clock_item")) {
    return;
  }
  player.startItemCooldown(`season_clock_${index}`, 1);
}
var STEPS = 360 / ANGLE_STEP;
var STEPS_PER_SEASON = STEPS / 4;
system15.runInterval(() => {
  const seasonDuration = SeasonCycle.getSeasonDuration();
  const currentSeasonDuration = SeasonCycle.getCurrentSeasonDuration();
  const currentSeason = SeasonCycle.getCurrentSeason();
  const index = Math.floor(currentSeasonDuration / seasonDuration * STEPS_PER_SEASON) + STEPS_PER_SEASON * currentSeason;
  for (const player of world14.getAllPlayers()) {
    try {
      SeasonClock(player, index);
    } catch {
    }
  }
}, TicksPerSecond5 * 1);

// data/scripts/entities/main.js
import {
  system as system26,
  world as world28,
  EntityDamageCause,
  TicksPerSecond as TicksPerSecond16,
  EntityComponentTypes as EntityComponentTypes3
} from "@minecraft/server";

// data/scripts/entities/helper.js
function getDotProduct(vec1, vec2) {
  return vec1.x * vec2.x + vec1.z * vec2.z;
}
function knockbackPlayer(player, direction, strength = 1) {
  const knockback = {
    x: direction.x * strength,
    y: 0.4,
    z: direction.z * strength
  };
  player.applyKnockback({ x: knockback.x, z: knockback.z }, 0.5);
}

// data/scripts/entities/warthog.ts
import { BlockVolume, TicksPerSecond as TicksPerSecond6, world as world16 } from "@minecraft/server";

// data/scripts/math/utils/distance.ts
function distanceXZ(a, b) {
  return Math.hypot(a.x - b.x, a.z - b.z);
}
function distanceXYZ(a, b) {
  return Math.hypot(a.x - b.x, a.y - b.y, a.z - b.z);
}

// data/scripts/entities/warthog.ts
function findClosestBerry(entity) {
  const { location, dimension } = entity;
  const blocks = Array.from(
    dimension.getBlocks(
      new BlockVolume(
        {
          x: location.x + 1,
          y: location.y + 1,
          z: location.z + 1
        },
        {
          x: location.x - 1,
          y: location.y - 1,
          z: location.z - 1
        }
      ),
      {
        includeTypes: [
          "minecraft:sweet_berry_bush",
          "gs_season:partridge_berry",
          "gs_season:alpine_bearberry",
          "gs_season:bog_blueberry",
          "gs_season:crowberry"
        ]
      }
    ).getBlockLocationIterator()
  );
  return blocks.length > 0 ? blocks.sort(
    (a, b) => distanceXYZ(a, location) - distanceXYZ(b, location)
  )[0] : void 0;
}
world16.afterEvents.dataDrivenEntityTrigger.subscribe(
  ({ entity }) => {
    try {
      const closestBerry = findClosestBerry(entity);
      if (!closestBerry) {
        return;
      }
      entity.dimension.setBlockType(closestBerry, "air");
      entity.addEffect("minecraft:regeneration", TicksPerSecond6 * 2, {
        amplifier: 1,
        showParticles: false
      });
    } catch (error) {
    }
  },
  {
    entityTypes: ["gs_season:warthog"],
    eventTypes: ["gs:eat_berries"]
  }
);

// data/scripts/entities/caribou.ts
import { TicksPerSecond as TicksPerSecond7, world as world17 } from "@minecraft/server";
var GRASS_BLOCKS_TO_DIRT = {
  "minecraft:grass_block": "minecraft:dirt",
  "gs_season:overworld_grass": "gs_season:dirt",
  "gs_season:aspen_grass": "gs_season:dirt",
  "gs_season:jacaranda_grass": "gs_season:dirt",
  "gs_season:forest_grass": "gs_season:dirt",
  "gs_season:tundra_grass": "gs_season:tundra_dirt",
  "gs_season:savannah_grass": "gs_season:savannah_dirt"
};
world17.afterEvents.dataDrivenEntityTrigger.subscribe(
  ({ entity }) => {
    try {
      const { dimension, location } = entity;
      location.y -= 1;
      const block = safeGetBlock(location, dimension);
      if (!block) {
        return;
      }
      const { typeId } = block;
      if (!GRASS_BLOCKS_TO_DIRT[typeId]) {
        return;
      }
      dimension.setBlockType(location, GRASS_BLOCKS_TO_DIRT[typeId]);
      dimension.playSound("dig.grass", location);
      entity.addEffect("minecraft:regeneration", TicksPerSecond7 * 1, {
        amplifier: 1,
        showParticles: false
      });
    } catch {
    }
  },
  {
    entityTypes: ["gs_season:caribou"],
    eventTypes: ["gs:eating_completed"]
  }
);
world17.afterEvents.entitySpawn.subscribe(({ entity }) => {
  if (entity.typeId !== "gs_season:caribou") {
    return;
  }
});

// data/scripts/entities/snowy-owl.ts
import { system as system16, world as world18 } from "@minecraft/server";
async function findClosestLeaves(entity) {
  const TRIES = 20;
  for (let i = 0; i < TRIES; i++) {
    const ray = entity.getBlockFromViewDirection({
      // Should follow the target_blocks in the snowy_owl.json
      includeTypes: [
        "minecraft:oak_leaves",
        "minecraft:pale_oak_leaves",
        "minecraft:spruce_leaves",
        "minecraft:birch_leaves",
        "minecraft:jungle_leaves",
        "minecraft:acacia_leaves",
        "minecraft:dark_oak_leaves",
        "minecraft:azalea_leaves",
        "minecraft:mangrove_leaves",
        "minecraft:cherry_leaves",
        "gs_season:acacia_leaves",
        "gs_season:aspen_leaves",
        "gs_season:baobab_leaves",
        "gs_season:beech_leaves",
        "gs_season:bushwillow_leaves",
        "gs_season:jacaranda_leaves_1",
        "gs_season:jacaranda_leaves_2",
        "gs_season:palm_leaves",
        "gs_season:red_oak_leaves",
        "gs_season:sugar_maple_leaves"
      ],
      maxDistance: 7
    });
    if (ray) return ray.block;
    await system16.waitTicks(5);
  }
}
world18.afterEvents.dataDrivenEntityTrigger.subscribe(
  async ({ entity }) => {
    try {
      const closestLeaves = await findClosestLeaves(entity);
      if (!closestLeaves) return;
      entity.teleport({
        ...closestLeaves.center(),
        y: closestLeaves.y + 1
      });
      entity.clearVelocity();
    } catch (error) {
    }
  },
  {
    entityTypes: ["gs_season:snowy_owl"],
    eventTypes: ["gs:reach_tree"]
  }
);

// data/scripts/entities/black-bear.ts
import { system as system17, TicksPerSecond as TicksPerSecond8, world as world20 } from "@minecraft/server";

// data/scripts/entities/utils.ts
import { world as world19 } from "@minecraft/server";
function getAllEntities(options) {
  return [
    ...world19.getDimension("minecraft:overworld").getEntities(options),
    ...world19.getDimension("minecraft:nether").getEntities(options),
    ...world19.getDimension("minecraft:the_end").getEntities(options)
  ];
}

// data/scripts/entities/black-bear.ts
function getSleepEvent() {
  return SeasonCycle.matches(SEASON_IDS.Winter) ? "gs:go_to_sleep_winter" : "gs:wake_up_winter";
}
world20.afterEvents.entitySpawn.subscribe(({ entity }) => {
  if (entity.typeId !== "gs_season:black_bear") {
    return;
  }
  entity.triggerEvent(getSleepEvent());
});
world20.afterEvents.entityLoad.subscribe(({ entity }) => {
  if (entity.typeId !== "gs_season:black_bear") {
    return;
  }
  entity.triggerEvent(getSleepEvent());
});
SeasonCycle.subscribe((season) => {
  const sleepingEvent = getSleepEvent();
  const bears = getAllEntities({ families: ["bear"] });
  if (bears.length === 0) {
    return;
  }
  bears.forEach((bear) => {
    try {
      bear.triggerEvent(sleepingEvent);
    } catch {
    }
  });
});
system17.runInterval(() => {
  const bears = getAllEntities({ families: ["bear"] });
  if (bears.length === 0) {
    return;
  }
  const sleepingEvent = getSleepEvent();
  bears.forEach((bear) => {
    try {
      bear.triggerEvent(sleepingEvent);
    } catch {
    }
  });
}, TicksPerSecond8 * 5);

// data/scripts/entities/zebra.ts
import { system as system18, TicksPerSecond as TicksPerSecond9, world as world21 } from "@minecraft/server";
var LAST_HIT_BY_LION_TIME = TicksPerSecond9 * 10;
world21.afterEvents.entityHitEntity.subscribe(({ damagingEntity, hitEntity }) => {
  try {
    if (hitEntity.typeId !== "gs_season:zebra" || damagingEntity.typeId !== "gs_season:lion") {
      return;
    }
    hitEntity.addTag("gs:last_hit_by_lion");
    system18.runTimeout(() => {
      try {
        hitEntity.removeTag("gs:last_hit_by_lion");
      } catch {
      }
    }, LAST_HIT_BY_LION_TIME);
  } catch {
  }
});

// data/scripts/entities/marmot.ts
import {
  EntityEquippableComponent as EntityEquippableComponent4,
  EquipmentSlot as EquipmentSlot6,
  GameMode as GameMode6,
  system as system19,
  TicksPerSecond as TicksPerSecond10,
  world as world22
} from "@minecraft/server";
var COOLDOWN = /* @__PURE__ */ new Set();
world22.afterEvents.playerInteractWithEntity.subscribe(
  ({ target, player, beforeItemStack }) => {
    if (target.typeId !== "gs_season:marmot" || !target.isValid()) return;
    const velocity = target.getVelocity();
    const speed = Math.sqrt(velocity.x * velocity.x + velocity.z * velocity.z);
    if (speed > 0.01) return;
    if (player.getGameMode() === GameMode6.creative) return;
    if (!beforeItemStack || beforeItemStack.typeId !== "minecraft:stick")
      return;
    if (COOLDOWN.has(target.id)) return;
    COOLDOWN.add(target.id);
    system19.runTimeout(() => {
      COOLDOWN.delete(target.id);
    }, TicksPerSecond10 * 5);
    const item = ItemManager.consume(beforeItemStack);
    if (!item) return;
    player.getComponent(EntityEquippableComponent4.componentId)?.setEquipment(EquipmentSlot6.Mainhand, item);
  }
);

// data/scripts/entities/auto-breeding.ts
import { system as system20 } from "@minecraft/server";
var AUTO_BREEDING_LIMIT = 8;
system20.afterEvents.scriptEventReceive.subscribe(
  ({ id, message, sourceEntity }) => {
    if (id !== "gs_season:auto_breed" || message !== "validate") return;
    const { dimension, location, typeId } = sourceEntity;
    const entitiesAround = dimension.getEntities({
      type: typeId,
      location,
      maxDistance: 32
    });
    if (entitiesAround.length > AUTO_BREEDING_LIMIT) return;
    sourceEntity?.triggerEvent("gs:start_search_for_mate");
  },
  {
    namespaces: ["gs_season"]
  }
);

// data/scripts/entities/virtual_mob_spawn.ts
import {
  world as world25,
  system as system23,
  TicksPerSecond as TicksPerSecond13
} from "@minecraft/server";

// data/scripts/biome-identifier/biomes.ts
var BIOMES = {
  Default: "default",
  Savanna: "savanna",
  SavannaPlateau: "savanna_plateau",
  Plains: "plains",
  FlowerForest: "flower_forest",
  Forest: "forest",
  BirchForest: "birch_forest",
  RoofedForest: "roofed_forest",
  Taiga: "taiga",
  ColdTaiga: "cold_taiga",
  MegaTaiga: "mega_taiga",
  RedwoodTaiga: "redwood_taiga",
  SunflowerPlains: "sunflower_plains",
  Meadow: "meadow",
  BambooJungle: "bamboo_jungle",
  Jungle: "jungle",
  JungleEdge: "jungle_edge",
  Swampland: "swampland",
  MangroveSwamp: "mangrove_swamp",
  CherryGrove: "cherry_grove",
  Desert: "desert",
  Mesa: "mesa",
  MesaPlateau: "mesa_plateau",
  Grove: "grove",
  JaggedPeaks: "jagged_peaks",
  SnowySlopes: "snowy_slopes",
  FrozenPeaks: "frozen_peaks",
  Beach: "beach",
  ColdBeach: "cold_beach",
  StoneBeach: "stone_beach",
  IcePlains: "ice_plains",
  IceSpikes: "ice_spikes",
  River: "river",
  FrozenRiver: "frozen_river",
  IceMountains: "ice_mountains",
  StonyPeaks: "stony_peaks"
};
var BIOME_TAGS = new Set(Object.values(BIOMES));

// data/scripts/biome-identifier/custom-biomes.ts
var CUSTOM_BIOMES = {
  Aspen: "aspen_forest",
  Forest: "deciduous_forest",
  Jacaranda: "jacaranda_forest",
  Savannah: "savannah",
  Tundra: "tundra",
  Oasis: "oasis",
  Redwood: "redwood_forest",
  Scarlet: "scarlet_dripstone_caves",
  ScarletLush: "scarlet_lush_caves",
  Plains: "crops_plains"
};
var CUSTOM_BIOME_TAGS = new Set(
  Object.values(CUSTOM_BIOMES)
);

// data/scripts/biome-identifier/custom-biome-identifier.ts
import {
  system as system22,
  TicksPerSecond as TicksPerSecond12,
  world as world24
} from "@minecraft/server";

// data/scripts/biome-identifier/biome-identifier.ts
import {
  system as system21,
  TicksPerSecond as TicksPerSecond11,
  world as world23
} from "@minecraft/server";
var BIOME_STORAGE = {};
var CHUNK_SIZE = 16;
var BIOME_STORAGE_LOCK = /* @__PURE__ */ new Set();
system21.afterEvents.scriptEventReceive.subscribe(
  ({ id, message, sourceEntity }) => {
    if (id !== "gs_season:identify_biome" || !sourceEntity || !sourceEntity.isValid()) {
      return;
    }
    let biome = message;
    if (message.startsWith("custom.")) return;
    if (!BIOME_TAGS.has(biome)) {
      biome = BIOMES.Default;
    }
    const { dimension, location } = sourceEntity;
    const chunkXZ = {
      x: Math.floor(location.x / CHUNK_SIZE),
      z: Math.floor(location.z / CHUNK_SIZE)
    };
    const chunkKey = `${chunkXZ.x},${chunkXZ.z},${dimension.id}`;
    BIOME_STORAGE[chunkKey] = biome;
    try {
      sourceEntity.remove();
    } catch (error) {
    }
  },
  {
    namespaces: ["gs_season"]
  }
);
var BiomeIdentifier = class {
  static get(location, dimension = world23.getDimension("minecraft:overworld")) {
    const chunkXZ = {
      x: Math.floor(location.x / CHUNK_SIZE),
      z: Math.floor(location.z / CHUNK_SIZE)
    };
    const chunkKey = `${chunkXZ.x},${chunkXZ.z},${dimension.id}`;
    if (BIOME_STORAGE[chunkKey]) {
      return BIOME_STORAGE[chunkKey];
    }
    if (BIOME_STORAGE_LOCK.has(chunkKey)) {
      return void 0;
    }
    BIOME_STORAGE_LOCK.add(chunkKey);
    try {
      const biomeIdentifier = dimension.spawnEntity(
        "gs_season:biome_identifier",
        {
          x: chunkXZ.x * CHUNK_SIZE + CHUNK_SIZE / 2,
          y: location.y,
          z: chunkXZ.z * CHUNK_SIZE + CHUNK_SIZE / 2
        }
      );
      biomeIdentifier.triggerEvent("gs_season:identify_biome");
    } catch (error) {
      BIOME_STORAGE_LOCK.delete(chunkKey);
    }
  }
};
system21.runInterval(() => {
  const playerChunks = world23.getDimension("minecraft:overworld").getPlayers().map((player) => {
    return {
      x: Math.floor(player.location.x / CHUNK_SIZE),
      z: Math.floor(player.location.z / CHUNK_SIZE)
    };
  });
  for (const chunk of playerChunks) {
    const chunkKey = `${chunk.x},${chunk.z},minecraft:overworld`;
    if (BIOME_STORAGE[chunkKey]) continue;
    delete BIOME_STORAGE[chunkKey];
  }
}, TicksPerSecond11 * 60);

// data/scripts/biome-identifier/custom-biome-identifier.ts
var CHUNK_SIZE2 = 16;
var BIOME_STORAGE2 = {};
var BIOME_STORAGE_LOCK2 = /* @__PURE__ */ new Set();
var BIOME_PROMISES = {};
system22.afterEvents.scriptEventReceive.subscribe(
  ({ id, message, sourceEntity }) => {
    if (id !== "gs_season:identify_biome" || !sourceEntity || !sourceEntity.isValid()) {
      return;
    }
    if (!message.startsWith("custom.")) return;
    let biome = message.replace("custom.", "");
    if (!CUSTOM_BIOME_TAGS.has(biome)) {
      biome = BIOMES.Default;
    }
    const { dimension, location } = sourceEntity;
    const promiseKey = `${Math.floor(location.x)},${Math.floor(location.z)},${dimension.id}`;
    if (BIOME_PROMISES[promiseKey]) {
      BIOME_PROMISES[promiseKey](biome);
      delete BIOME_PROMISES[promiseKey];
    }
    const chunkXZ = {
      x: Math.floor(location.x / CHUNK_SIZE2),
      z: Math.floor(location.z / CHUNK_SIZE2)
    };
    const chunkKey = `${chunkXZ.x},${chunkXZ.z},${dimension.id}`;
    BIOME_STORAGE2[chunkKey] = biome;
    try {
      sourceEntity.remove();
    } catch (error) {
    }
  },
  {
    namespaces: ["gs_season"]
  }
);
var CustomBiomeIdentifier = class {
  static getBiomeFromBlock(block) {
    const { typeId } = block;
    if (!typeId.includes("gs_season:")) return;
    if (typeId.includes("aspen")) return CUSTOM_BIOMES.Aspen;
    if (typeId.includes("forest")) return CUSTOM_BIOMES.Forest;
    if (typeId.includes("jacaranda")) return CUSTOM_BIOMES.Jacaranda;
    if (typeId.includes("tundra")) return CUSTOM_BIOMES.Tundra;
    if (typeId.includes("oasis")) return CUSTOM_BIOMES.Oasis;
    if (typeId.includes("savannah")) {
      const vanillaBiome = BiomeIdentifier.get(block.location, block.dimension);
      return vanillaBiome === BIOMES.Desert || vanillaBiome === BIOMES.Mesa ? CUSTOM_BIOMES.Oasis : CUSTOM_BIOMES.Savannah;
    }
  }
  static getByRay(location, dimension) {
    try {
      const chunkXZ = {
        x: Math.floor(location.x / CHUNK_SIZE2),
        z: Math.floor(location.z / CHUNK_SIZE2)
      };
      const chunkKey = `${chunkXZ.x},${chunkXZ.z},${dimension.id}`;
      if (BIOME_STORAGE2[chunkKey]) return BIOME_STORAGE2[chunkKey];
      const { max, min } = dimension.heightRange;
      const ray = dimension.getBlockFromRay(
        {
          x: location.x,
          y: max,
          z: location.z
        },
        { x: 0, y: -1, z: 0 },
        {
          maxDistance: max - min,
          includeLiquidBlocks: false
        }
      );
      const biome = ray ? this.getBiomeFromBlock(ray.block) : void 0;
      if (biome) BIOME_STORAGE2[chunkKey] = biome;
      return biome;
    } catch (error) {
    }
  }
  static get(location, dimension = world24.getDimension("minecraft:overworld")) {
    const chunkXZ = {
      x: Math.floor(location.x / CHUNK_SIZE2),
      z: Math.floor(location.z / CHUNK_SIZE2)
    };
    const chunkKey = `${chunkXZ.x},${chunkXZ.z},${dimension.id}`;
    if (BIOME_STORAGE2[chunkKey]) {
      return BIOME_STORAGE2[chunkKey];
    }
    if (BIOME_STORAGE_LOCK2.has(chunkKey)) {
      return void 0;
    }
    BIOME_STORAGE_LOCK2.add(chunkKey);
    try {
      const biomeIdentifier = dimension.spawnEntity(
        "gs_season:biome_identifier",
        {
          x: chunkXZ.x * CHUNK_SIZE2 + CHUNK_SIZE2 / 2,
          y: location.y,
          z: chunkXZ.z * CHUNK_SIZE2 + CHUNK_SIZE2 / 2
        }
      );
      biomeIdentifier.triggerEvent("gs_season:identify_biome");
    } catch (error) {
      BIOME_STORAGE_LOCK2.delete(chunkKey);
    }
  }
  static async getFromLocation(location, dimension = world24.getDimension("minecraft:overworld")) {
    const x = Math.floor(location.x);
    const z = Math.floor(location.z);
    const promiseKey = `${x},${z},${dimension.id}`;
    if (BIOME_PROMISES[promiseKey]) {
      return void 0;
    }
    try {
      const biomeIdentifier = dimension.spawnEntity(
        "gs_season:biome_identifier",
        { x, y: location.y, z }
      );
      biomeIdentifier.triggerEvent("gs_season:identify_biome");
    } catch {
    }
    return new Promise((resolve) => {
      BIOME_PROMISES[promiseKey] = resolve;
    });
  }
};
system22.runInterval(() => {
  const playerChunks = world24.getDimension("minecraft:overworld").getPlayers().map((player) => {
    return {
      x: Math.floor(player.location.x / CHUNK_SIZE2),
      z: Math.floor(player.location.z / CHUNK_SIZE2)
    };
  });
  for (const chunk of playerChunks) {
    const chunkKey = `${chunk.x},${chunk.z},minecraft:overworld`;
    if (BIOME_STORAGE2[chunkKey]) continue;
    delete BIOME_STORAGE2[chunkKey];
  }
}, TicksPerSecond12 * 75);

// data/scripts/entities/virtual_mob_spawn.ts
var SPAWN_CHANCE = {
  COMMON: 0.9,
  UNCOMMON: 0.65,
  RARE: 0.4
};
var LOCAL_MOB_COUNT_PER_FAMILY = {
  animal: 18,
  insect: 8,
  bird: 4
};
var SPAWNEABLE_BLOCKS = {
  FOREST: ["gs_season:forest_grass", "gs_season:forest_dirt"],
  ASPEN: [
    "gs_season:aspen_dirt",
    "gs_season:aspen_grass",
    "gs_season:aspen_grass_1",
    "gs_season:aspen_grass_2",
    "gs_season:aspen_grass_3",
    "gs_season:aspen_grass_4"
  ],
  OASIS: [
    "gs_season:oasis_cactus",
    "gs_season:oasis_cactus_1",
    "gs_season:oasis_deadbush",
    "gs_season:oasis_fern",
    "gs_season:oasis_grass"
  ],
  JACARANDA: [
    "gs_season:jacaranda_dirt",
    "gs_season:jacaranda_grass",
    "gs_season:jacaranda_grass_1",
    "gs_season:jacaranda_grass_2",
    "gs_season:jacaranda_grass_3",
    "gs_season:jacaranda_grass_4",
    "gs_season:jacaranda_grass_5"
  ],
  SAVANNAH: ["gs_season:savannah_grass", "gs_season:savannah_dirt"],
  TUNDRA: [
    "gs_season:tundra_grass",
    "gs_season:tundra_dirt",
    "gs_season:tundra_podzol"
  ]
};
var VMS_SPAWN_RULES = [
  {
    mob_id: "gs_season:ant",
    family_type: "insect",
    spawn_chance: SPAWN_CHANCE.COMMON,
    biomes: [
      BIOMES.Plains,
      BIOMES.Meadow,
      BIOMES.FlowerForest,
      BIOMES.Savanna,
      BIOMES.Forest,
      BIOMES.BirchForest,
      CUSTOM_BIOMES.Forest,
      CUSTOM_BIOMES.Oasis,
      CUSTOM_BIOMES.Savannah,
      CUSTOM_BIOMES.Jacaranda
    ],
    min_spawn_distance: 16,
    max_spawn_distance: 32,
    dimension: "minecraft:overworld",
    block_whitelist: [
      "minecraft:grass_block",
      "minecraft:sand",
      "gs_season:overworld_grass",
      ...SPAWNEABLE_BLOCKS.FOREST,
      ...SPAWNEABLE_BLOCKS.SAVANNAH,
      "gs_season:savannah_grass_1",
      "gs_season:savannah_grass_2",
      "gs_season:savannah_grass_3",
      "gs_season:savannah_grass_long",
      ...SPAWNEABLE_BLOCKS.OASIS,
      ...SPAWNEABLE_BLOCKS.JACARANDA
    ],
    block_blacklist: ["minecraft:lava", "minecraft:barrier", "minecraft:water"],
    seasons: [SEASON_IDS.Spring, SEASON_IDS.Summer, SEASON_IDS.Autumn],
    allowed_time: [2e3, 9e3],
    max_local_mob_count: 6,
    herd: {
      chance: 1,
      min: 2,
      max: 6,
      spread_radius: 3,
      entries: [
        { mob_id: "gs_season:ant", weight: 50 },
        { mob_id: "gs_season:ant", weight: 50 }
      ]
    }
  },
  {
    mob_id: "gs_season:baboon",
    spawn_chance: SPAWN_CHANCE.UNCOMMON,
    biomes: [BIOMES.Savanna, CUSTOM_BIOMES.Oasis, CUSTOM_BIOMES.Savannah],
    seasons: [SEASON_IDS.Spring, SEASON_IDS.Summer, SEASON_IDS.Autumn],
    min_spawn_distance: 16,
    max_spawn_distance: 32,
    dimension: "minecraft:overworld",
    block_whitelist: [
      "minecraft:grass_block",
      "gs_season:overworld_grass",
      ...SPAWNEABLE_BLOCKS.OASIS,
      "gs_season:oasis_sand",
      "gs_season:oasis_sand_wet",
      ...SPAWNEABLE_BLOCKS.SAVANNAH,
      "gs_season:savannah_grass_long"
    ],
    block_blacklist: ["minecraft:lava", "minecraft:barrier", "minecraft:water"],
    allowed_time: [2e3, 9e3],
    max_local_mob_count: 7,
    herd: {
      chance: 1,
      min: 3,
      max: 7,
      spread_radius: 4,
      entries: [
        { mob_id: "gs_season:baboon", weight: 40 },
        { mob_id: "gs_season:baboon", weight: 60 }
      ]
    }
  },
  {
    mob_id: "gs_season:bird",
    family_type: "bird",
    spawn_chance: SPAWN_CHANCE.COMMON,
    biomes: [
      BIOMES.Forest,
      BIOMES.RedwoodTaiga,
      BIOMES.BirchForest,
      BIOMES.Plains,
      BIOMES.Meadow,
      BIOMES.FlowerForest,
      CUSTOM_BIOMES.Oasis,
      CUSTOM_BIOMES.Forest,
      CUSTOM_BIOMES.Tundra,
      CUSTOM_BIOMES.Jacaranda,
      CUSTOM_BIOMES.Aspen
    ],
    min_spawn_distance: 16,
    max_spawn_distance: 32,
    dimension: "minecraft:overworld",
    block_whitelist: [
      "minecraft:grass_block",
      "minecraft:leaves",
      "minecraft:dirt",
      "minecraft:podzol",
      "gs_season:overworld_grass",
      ...SPAWNEABLE_BLOCKS.FOREST,
      ...SPAWNEABLE_BLOCKS.TUNDRA,
      ...SPAWNEABLE_BLOCKS.ASPEN,
      "gs_season:oasis_cactus",
      "gs_season:oasis_cactus_1",
      "gs_season:oasis_deadbush",
      "gs_season:oasis_fern",
      ...SPAWNEABLE_BLOCKS.JACARANDA,
      "gs_season:jacaranda_leaves_1",
      "gs_season:jacaranda_leaves_2"
    ],
    block_blacklist: ["minecraft:lava", "minecraft:barrier", "minecraft:water"],
    allowed_time: [2e3, 9e3],
    max_local_mob_count: 4,
    herd: {
      chance: 0.5,
      min: 1,
      max: 3,
      spread_radius: 4,
      entries: [
        { mob_id: "gs_season:bird", weight: 40 },
        { mob_id: "gs_season:bird", weight: 60 }
      ]
    }
  },
  {
    mob_id: "gs_season:black_bear",
    spawn_chance: SPAWN_CHANCE.RARE,
    biomes: [
      BIOMES.Forest,
      BIOMES.BirchForest,
      BIOMES.Taiga,
      BIOMES.MegaTaiga,
      BIOMES.RedwoodTaiga,
      BIOMES.SnowySlopes,
      BIOMES.IcePlains,
      BIOMES.FrozenPeaks,
      CUSTOM_BIOMES.Tundra,
      CUSTOM_BIOMES.Forest,
      CUSTOM_BIOMES.Aspen
    ],
    min_spawn_distance: 16,
    max_spawn_distance: 32,
    dimension: "minecraft:overworld",
    block_whitelist: [
      "minecraft:grass_block",
      "minecraft:snow",
      "gs_season:overworld_grass",
      ...SPAWNEABLE_BLOCKS.FOREST,
      ...SPAWNEABLE_BLOCKS.TUNDRA,
      ...SPAWNEABLE_BLOCKS.ASPEN
    ],
    block_blacklist: ["minecraft:lava", "minecraft:barrier", "minecraft:water"],
    seasons: [SEASON_IDS.Spring, SEASON_IDS.Summer, SEASON_IDS.Autumn],
    allowed_time: [6e3, 14e3],
    max_local_mob_count: 3,
    herd: {
      chance: 0.5,
      min: 1,
      max: 2,
      spread_radius: 4,
      entries: [
        { mob_id: "gs_season:black_bear", weight: 40 },
        { mob_id: "gs_season:black_bear", weight: 60 }
      ]
    }
  },
  {
    mob_id: "gs_season:butterfly",
    family_type: "insect",
    spawn_chance: SPAWN_CHANCE.COMMON,
    biomes: [
      BIOMES.Forest,
      BIOMES.BirchForest,
      BIOMES.Plains,
      BIOMES.Meadow,
      BIOMES.FlowerForest,
      CUSTOM_BIOMES.Oasis,
      CUSTOM_BIOMES.Forest,
      CUSTOM_BIOMES.Jacaranda,
      CUSTOM_BIOMES.Aspen
    ],
    min_spawn_distance: 16,
    max_spawn_distance: 32,
    dimension: "minecraft:overworld",
    block_whitelist: [
      "minecraft:grass_block",
      "gs_season:overworld_grass",
      ...SPAWNEABLE_BLOCKS.FOREST,
      ...SPAWNEABLE_BLOCKS.ASPEN,
      ...SPAWNEABLE_BLOCKS.OASIS,
      ...SPAWNEABLE_BLOCKS.JACARANDA,
      "gs_season:jacaranda_leaves_1",
      "gs_season:jacaranda_leaves_2"
    ],
    block_blacklist: ["minecraft:lava", "minecraft:barrier", "minecraft:water"],
    seasons: [SEASON_IDS.Spring, SEASON_IDS.Summer],
    allowed_time: [2e3, 9e3],
    max_local_mob_count: 6,
    herd: {
      chance: 1,
      min: 2,
      max: 5,
      spread_radius: 4,
      entries: [
        { mob_id: "gs_season:butterfly", weight: 40 },
        { mob_id: "gs_season:butterfly", weight: 60 }
      ]
    }
  },
  {
    mob_id: "gs_season:caribou",
    spawn_chance: SPAWN_CHANCE.UNCOMMON,
    biomes: [
      BIOMES.Taiga,
      BIOMES.ColdTaiga,
      BIOMES.MegaTaiga,
      BIOMES.RedwoodTaiga,
      BIOMES.IcePlains,
      BIOMES.SnowySlopes,
      BIOMES.FrozenPeaks,
      CUSTOM_BIOMES.Tundra
    ],
    min_spawn_distance: 16,
    max_spawn_distance: 32,
    dimension: "minecraft:overworld",
    block_whitelist: [
      "minecraft:grass_block",
      "minecraft:snow",
      "minecraft:snow_layer",
      "gs_season:overworld_grass",
      ...SPAWNEABLE_BLOCKS.TUNDRA
    ],
    block_blacklist: ["minecraft:lava", "minecraft:barrier", "minecraft:water"],
    seasons: [SEASON_IDS.Winter, SEASON_IDS.Spring, SEASON_IDS.Summer],
    allowed_time: [2e3, 9e3],
    max_local_mob_count: 7,
    herd: {
      chance: 1,
      min: 2,
      max: 6,
      spread_radius: 4,
      entries: [
        { mob_id: "gs_season:caribou", weight: 40 },
        { mob_id: "gs_season:caribou", weight: 60 }
      ]
    }
  },
  {
    mob_id: "gs_season:cheetah",
    spawn_chance: SPAWN_CHANCE.RARE,
    biomes: [BIOMES.Savanna, CUSTOM_BIOMES.Oasis, CUSTOM_BIOMES.Savannah],
    min_spawn_distance: 16,
    max_spawn_distance: 32,
    dimension: "minecraft:overworld",
    block_whitelist: [
      "minecraft:grass_block",
      "gs_season:overworld_grass",
      ...SPAWNEABLE_BLOCKS.SAVANNAH,
      "gs_season:savannah_grass_long"
    ],
    block_blacklist: ["minecraft:lava", "minecraft:barrier", "minecraft:water"],
    allowed_time: [2e3, 9e3],
    max_local_mob_count: 3,
    herd: {
      chance: 0.5,
      min: 1,
      max: 2,
      spread_radius: 4,
      entries: [
        { mob_id: "gs_season:cheetah", weight: 40 },
        { mob_id: "gs_season:cheetah", weight: 60 }
      ]
    }
  },
  {
    mob_id: "gs_season:chinchilla",
    spawn_chance: SPAWN_CHANCE.UNCOMMON,
    biomes: [
      BIOMES.Forest,
      BIOMES.BirchForest,
      BIOMES.CherryGrove,
      BIOMES.Grove,
      CUSTOM_BIOMES.Forest,
      CUSTOM_BIOMES.Aspen
    ],
    min_spawn_distance: 16,
    max_spawn_distance: 32,
    dimension: "minecraft:overworld",
    block_whitelist: [
      "minecraft:grass_block",
      "minecraft:snow",
      "minecraft:stone",
      "minecraft:snow_block",
      "gs_season:overworld_grass",
      ...SPAWNEABLE_BLOCKS.FOREST,
      ...SPAWNEABLE_BLOCKS.ASPEN
    ],
    block_blacklist: ["minecraft:lava", "minecraft:barrier", "minecraft:water"],
    seasons: [SEASON_IDS.Spring, SEASON_IDS.Summer, SEASON_IDS.Autumn],
    allowed_time: [2e3, 9e3],
    max_local_mob_count: 4,
    herd: {
      chance: 0.5,
      min: 2,
      max: 4,
      spread_radius: 4,
      entries: [
        { mob_id: "gs_season:chinchilla", weight: 40 },
        { mob_id: "gs_season:chinchilla", weight: 60 }
      ]
    }
  },
  {
    mob_id: "gs_season:elephant",
    spawn_chance: SPAWN_CHANCE.RARE,
    biomes: [BIOMES.Savanna, CUSTOM_BIOMES.Oasis, CUSTOM_BIOMES.Savannah],
    min_spawn_distance: 16,
    max_spawn_distance: 32,
    dimension: "minecraft:overworld",
    block_whitelist: [
      "minecraft:grass_block",
      "gs_season:overworld_grass",
      ...SPAWNEABLE_BLOCKS.SAVANNAH,
      "gs_season:savannah_grass_long",
      ...SPAWNEABLE_BLOCKS.OASIS
    ],
    block_blacklist: [
      "minecraft:lava",
      "minecraft:barrier",
      "minecraft:water",
      "minecraft:acacia_leaves"
    ],
    allowed_time: [2e3, 9e3],
    max_local_mob_count: 3,
    herd: {
      chance: 0.5,
      min: 1,
      max: 3,
      spread_radius: 4,
      entries: [
        { mob_id: "gs_season:elephant", weight: 40 },
        { mob_id: "gs_season:elephant", weight: 60 }
      ]
    }
  },
  {
    mob_id: "gs_season:ermine",
    spawn_chance: SPAWN_CHANCE.UNCOMMON,
    biomes: [
      BIOMES.Taiga,
      BIOMES.ColdTaiga,
      BIOMES.MegaTaiga,
      BIOMES.RedwoodTaiga,
      BIOMES.FrozenPeaks,
      BIOMES.SnowySlopes,
      BIOMES.IcePlains,
      CUSTOM_BIOMES.Tundra
    ],
    min_spawn_distance: 16,
    max_spawn_distance: 32,
    dimension: "minecraft:overworld",
    block_whitelist: [
      "minecraft:grass_block",
      "minecraft:stone",
      "minecraft:snow",
      "minecraft:snow_layer",
      "minecraft:dirt",
      "minecraft:podzol",
      "gs_season:overworld_grass",
      ...SPAWNEABLE_BLOCKS.FOREST,
      ...SPAWNEABLE_BLOCKS.TUNDRA
    ],
    block_blacklist: [
      "minecraft:lava",
      "minecraft:barrier",
      "minecraft:spruce_leaves",
      "minecraft:water"
    ],
    allowed_time: [9e3, 18e3],
    max_local_mob_count: 3,
    herd: {
      chance: 0.5,
      min: 1,
      max: 2,
      spread_radius: 4,
      entries: [
        { mob_id: "gs_season:ermine", weight: 40 },
        { mob_id: "gs_season:ermine", weight: 60 }
      ]
    },
    // Boost spawn chance in winter
    boostCondition: (env) => env.season === SEASON_IDS.Winter ? { spawnChance: { add: 0.15 } } : {}
  },
  {
    mob_id: "gs_season:gray_wolf",
    spawn_chance: SPAWN_CHANCE.UNCOMMON,
    biomes: [
      BIOMES.Forest,
      BIOMES.Grove,
      BIOMES.BirchForest,
      BIOMES.Taiga,
      BIOMES.ColdTaiga,
      BIOMES.IcePlains,
      BIOMES.MegaTaiga,
      BIOMES.RedwoodTaiga,
      CUSTOM_BIOMES.Tundra
    ],
    min_spawn_distance: 16,
    max_spawn_distance: 32,
    dimension: "minecraft:overworld",
    block_whitelist: [
      "minecraft:grass_block",
      "minecraft:snow",
      "minecraft:snow_layer",
      "gs_season:overworld_grass",
      ...SPAWNEABLE_BLOCKS.FOREST,
      ...SPAWNEABLE_BLOCKS.TUNDRA,
      ...SPAWNEABLE_BLOCKS.ASPEN
    ],
    block_blacklist: [
      "minecraft:lava",
      "minecraft:barrier",
      "minecraft:spruce_leaves",
      "minecraft:water"
    ],
    allowed_time: [15e3, 23999],
    max_local_mob_count: 6,
    herd: {
      chance: 1,
      min: 2,
      max: 5,
      spread_radius: 4,
      entries: [
        { mob_id: "gs_season:gray_wolf", weight: 40 },
        { mob_id: "gs_season:gray_wolf", weight: 60 }
      ]
    }
  },
  {
    mob_id: "gs_season:lion",
    spawn_chance: SPAWN_CHANCE.RARE,
    biomes: [BIOMES.Savanna, CUSTOM_BIOMES.Oasis, CUSTOM_BIOMES.Savannah],
    min_spawn_distance: 16,
    max_spawn_distance: 32,
    dimension: "minecraft:overworld",
    block_whitelist: [
      "minecraft:grass_block",
      "minecraft:sand",
      ...SPAWNEABLE_BLOCKS.SAVANNAH,
      "gs_season:savannah_grass_long",
      ...SPAWNEABLE_BLOCKS.OASIS
    ],
    block_blacklist: [
      "minecraft:lava",
      "minecraft:barrier",
      "minecraft:water",
      "minecraft:acacia_leaves"
    ],
    allowed_time: [6e3, 14e3],
    max_local_mob_count: 3,
    herd: {
      chance: 0.5,
      min: 1,
      max: 2,
      spread_radius: 4,
      entries: [
        { mob_id: "gs_season:lion", weight: 40 },
        { mob_id: "gs_season:lion", weight: 60 }
      ]
    }
  },
  {
    mob_id: "gs_season:lizard",
    spawn_chance: SPAWN_CHANCE.COMMON,
    biomes: [
      BIOMES.Savanna,
      BIOMES.Desert,
      BIOMES.Mesa,
      CUSTOM_BIOMES.Oasis,
      CUSTOM_BIOMES.Savannah
    ],
    min_spawn_distance: 16,
    max_spawn_distance: 32,
    dimension: "minecraft:overworld",
    block_whitelist: [
      "minecraft:grass_block",
      "minecraft:sand",
      ...SPAWNEABLE_BLOCKS.SAVANNAH,
      "gs_season:savannah_grass_long",
      ...SPAWNEABLE_BLOCKS.OASIS
    ],
    block_blacklist: ["minecraft:lava", "minecraft:barrier", "minecraft:water"],
    seasons: [SEASON_IDS.Spring, SEASON_IDS.Summer, SEASON_IDS.Autumn],
    allowed_time: [2e3, 9e3],
    max_local_mob_count: 3,
    herd: {
      chance: 0.5,
      min: 1,
      max: 3,
      spread_radius: 4,
      entries: [
        { mob_id: "gs_season:lizard", weight: 40 },
        { mob_id: "gs_season:lizard", weight: 60 }
      ]
    }
  },
  {
    mob_id: "gs_season:marmot",
    spawn_chance: SPAWN_CHANCE.UNCOMMON,
    biomes: [
      BIOMES.Plains,
      BIOMES.Meadow,
      BIOMES.FlowerForest,
      CUSTOM_BIOMES.Aspen
    ],
    min_spawn_distance: 16,
    max_spawn_distance: 32,
    dimension: "minecraft:overworld",
    block_whitelist: [
      "minecraft:grass_block",
      "minecraft:dirt",
      ...SPAWNEABLE_BLOCKS.ASPEN
    ],
    block_blacklist: ["minecraft:lava", "minecraft:barrier", "minecraft:water"],
    seasons: [SEASON_IDS.Spring, SEASON_IDS.Summer, SEASON_IDS.Autumn],
    allowed_time: [2e3, 9e3],
    max_local_mob_count: 6,
    herd: {
      chance: 0.5,
      min: 2,
      max: 5,
      spread_radius: 4,
      entries: [
        { mob_id: "gs_season:marmot", weight: 40 },
        { mob_id: "gs_season:marmot", weight: 60 }
      ]
    }
  },
  {
    mob_id: "gs_season:raccoon",
    spawn_chance: SPAWN_CHANCE.COMMON,
    biomes: [
      BIOMES.Taiga,
      BIOMES.Forest,
      BIOMES.CherryGrove,
      BIOMES.ColdTaiga,
      BIOMES.MegaTaiga,
      BIOMES.RedwoodTaiga,
      CUSTOM_BIOMES.Forest,
      CUSTOM_BIOMES.Tundra,
      CUSTOM_BIOMES.Jacaranda
    ],
    min_spawn_distance: 16,
    max_spawn_distance: 32,
    dimension: "minecraft:overworld",
    block_whitelist: [
      "minecraft:grass_block",
      "minecraft:dirt",
      "minecraft:podzol",
      ...SPAWNEABLE_BLOCKS.TUNDRA,
      ...SPAWNEABLE_BLOCKS.JACARANDA
    ],
    block_blacklist: ["minecraft:lava", "minecraft:barrier", "minecraft:water"],
    allowed_time: [15e3, 18e3],
    max_local_mob_count: 3,
    herd: {
      chance: 0.5,
      min: 1,
      max: 3,
      spread_radius: 4,
      entries: [
        { mob_id: "gs_season:raccoon", weight: 40 },
        { mob_id: "gs_season:raccoon", weight: 60 }
      ]
    }
  },
  {
    mob_id: "gs_season:red_deer",
    spawn_chance: SPAWN_CHANCE.UNCOMMON,
    biomes: [
      BIOMES.Forest,
      BIOMES.BirchForest,
      BIOMES.Plains,
      BIOMES.FlowerForest,
      BIOMES.Meadow,
      BIOMES.RedwoodTaiga,
      CUSTOM_BIOMES.Aspen
    ],
    min_spawn_distance: 16,
    max_spawn_distance: 32,
    dimension: "minecraft:overworld",
    block_whitelist: [
      "minecraft:grass_block",
      "minecraft:dirt",
      "minecraft:podzol",
      "minecraft:snow_layer",
      "minecraft:snow",
      "gs_season:overworld_grass",
      ...SPAWNEABLE_BLOCKS.FOREST,
      ...SPAWNEABLE_BLOCKS.TUNDRA,
      ...SPAWNEABLE_BLOCKS.ASPEN
    ],
    block_blacklist: [
      "minecraft:lava",
      "minecraft:barrier",
      "minecraft:water",
      "minecraft:spruce_leaves",
      "minecraft:oak_leaves"
    ],
    allowed_time: [6e3, 14e3],
    max_local_mob_count: 8,
    herd: {
      chance: 1,
      min: 2,
      max: 6,
      spread_radius: 7,
      entries: [
        { mob_id: "gs_season:red_deer", weight: 40 },
        { mob_id: "gs_season:red_deer", weight: 60 }
      ]
    },
    boostCondition: (env) => env.season === SEASON_IDS.Autumn ? { spawnChance: { add: 0.15 } } : {}
  },
  {
    mob_id: "gs_season:snail",
    spawn_chance: SPAWN_CHANCE.COMMON,
    biomes: [
      BIOMES.Forest,
      BIOMES.Plains,
      BIOMES.Meadow,
      BIOMES.FlowerForest,
      BIOMES.CherryGrove,
      BIOMES.Grove,
      BIOMES.Swampland,
      BIOMES.MangroveSwamp,
      CUSTOM_BIOMES.Forest,
      CUSTOM_BIOMES.Oasis,
      CUSTOM_BIOMES.Jacaranda,
      CUSTOM_BIOMES.Aspen
    ],
    min_spawn_distance: 16,
    max_spawn_distance: 32,
    dimension: "minecraft:overworld",
    block_whitelist: [
      "minecraft:grass_block",
      "gs_season:overworld_grass",
      ...SPAWNEABLE_BLOCKS.FOREST,
      ...SPAWNEABLE_BLOCKS.JACARANDA,
      ...SPAWNEABLE_BLOCKS.OASIS
    ],
    block_blacklist: ["minecraft:lava", "minecraft:barrier", "minecraft:water"],
    seasons: [SEASON_IDS.Spring, SEASON_IDS.Summer, SEASON_IDS.Autumn],
    allowed_time: [2e3, 9e3],
    max_local_mob_count: 4,
    herd: {
      chance: 0.5,
      min: 1,
      max: 3,
      spread_radius: 4,
      entries: [
        { mob_id: "gs_season:snail", weight: 40 },
        { mob_id: "gs_season:snail", weight: 60 }
      ]
    }
  },
  {
    mob_id: "gs_season:snowy_owl",
    spawn_chance: SPAWN_CHANCE.RARE,
    family_type: "bird",
    biomes: [
      BIOMES.Taiga,
      BIOMES.ColdTaiga,
      BIOMES.MegaTaiga,
      BIOMES.RedwoodTaiga,
      BIOMES.SnowySlopes,
      BIOMES.FrozenPeaks,
      CUSTOM_BIOMES.Tundra
    ],
    min_spawn_distance: 16,
    max_spawn_distance: 32,
    dimension: "minecraft:overworld",
    block_whitelist: [
      "minecraft:grass_block",
      "minecraft:snow",
      "minecraft:snow_layer",
      "gs_season:overworld_grass",
      ...SPAWNEABLE_BLOCKS.TUNDRA,
      "gs_season:red_oak_leaves"
    ],
    block_blacklist: ["minecraft:lava", "minecraft:barrier", "minecraft:water"],
    seasons: [SEASON_IDS.Winter, SEASON_IDS.Spring, SEASON_IDS.Autumn],
    allowed_time: [15e3, 18e3],
    max_local_mob_count: 2,
    herd: {
      chance: 0.5,
      min: 1,
      max: 1,
      spread_radius: 4,
      entries: [
        { mob_id: "gs_season:snowy_owl", weight: 40 },
        { mob_id: "gs_season:snowy_owl", weight: 60 }
      ]
    },
    // Decrease spawn chance in spring and autumn
    boostCondition: (env) => env.season === SEASON_IDS.Spring || env.season === SEASON_IDS.Autumn ? { spawnChance: { add: -0.15 } } : {}
  },
  {
    mob_id: "gs_season:squirrel",
    spawn_chance: SPAWN_CHANCE.COMMON,
    biomes: [
      BIOMES.Forest,
      BIOMES.BirchForest,
      BIOMES.Plains,
      BIOMES.Meadow,
      BIOMES.FlowerForest,
      CUSTOM_BIOMES.Forest,
      CUSTOM_BIOMES.Aspen,
      CUSTOM_BIOMES.Jacaranda
    ],
    min_spawn_distance: 16,
    max_spawn_distance: 32,
    dimension: "minecraft:overworld",
    block_whitelist: [
      "minecraft:grass_block",
      "minecraft:dirt",
      "gs_season:overworld_grass",
      ...SPAWNEABLE_BLOCKS.FOREST,
      ...SPAWNEABLE_BLOCKS.JACARANDA,
      ...SPAWNEABLE_BLOCKS.ASPEN
    ],
    block_blacklist: ["minecraft:lava", "minecraft:barrier", "minecraft:water"],
    allowed_time: [2e3, 9e3],
    max_local_mob_count: 3,
    herd: {
      chance: 0.5,
      min: 1,
      max: 3,
      spread_radius: 4,
      entries: [
        { mob_id: "gs_season:squirrel", weight: 40 },
        { mob_id: "gs_season:squirrel", weight: 60 }
      ]
    }
  },
  {
    mob_id: "gs_season:tockus",
    family_type: "bird",
    spawn_chance: SPAWN_CHANCE.UNCOMMON,
    biomes: [BIOMES.Savanna, CUSTOM_BIOMES.Oasis, CUSTOM_BIOMES.Savannah],
    min_spawn_distance: 16,
    max_spawn_distance: 32,
    dimension: "minecraft:overworld",
    block_whitelist: [
      "minecraft:grass_block",
      "gs_season:overworld_grass",
      ...SPAWNEABLE_BLOCKS.SAVANNAH,
      "gs_season:savannah_grass_long",
      ...SPAWNEABLE_BLOCKS.OASIS
    ],
    block_blacklist: ["minecraft:lava", "minecraft:barrier", "minecraft:water"],
    seasons: [SEASON_IDS.Spring, SEASON_IDS.Summer, SEASON_IDS.Autumn],
    allowed_time: [2e3, 9e3],
    max_local_mob_count: 3,
    herd: {
      chance: 0.5,
      min: 1,
      max: 2,
      spread_radius: 4,
      entries: [
        { mob_id: "gs_season:tockus", weight: 40 },
        { mob_id: "gs_season:tockus", weight: 60 }
      ]
    }
  },
  {
    mob_id: "gs_season:warthog",
    spawn_chance: SPAWN_CHANCE.UNCOMMON,
    biomes: [BIOMES.Savanna, CUSTOM_BIOMES.Oasis, CUSTOM_BIOMES.Savannah],
    min_spawn_distance: 16,
    max_spawn_distance: 32,
    dimension: "minecraft:overworld",
    block_whitelist: [
      "minecraft:grass_block",
      "minecraft:sand",
      "gs_season:overworld_grass",
      ...SPAWNEABLE_BLOCKS.SAVANNAH,
      "gs_season:savannah_grass_long",
      ...SPAWNEABLE_BLOCKS.OASIS
    ],
    block_blacklist: ["minecraft:lava", "minecraft:barrier", "minecraft:water"],
    allowed_time: [2e3, 9e3],
    max_local_mob_count: 4,
    herd: {
      chance: 1,
      min: 2,
      max: 4,
      spread_radius: 4,
      entries: [
        { mob_id: "gs_season:warthog", weight: 40 },
        { mob_id: "gs_season:warthog", weight: 60 }
      ]
    }
  },
  {
    mob_id: "gs_season:yak",
    spawn_chance: SPAWN_CHANCE.UNCOMMON,
    biomes: [
      BIOMES.Taiga,
      BIOMES.ColdTaiga,
      BIOMES.MegaTaiga,
      BIOMES.RedwoodTaiga,
      BIOMES.IcePlains,
      BIOMES.SnowySlopes,
      BIOMES.FrozenPeaks,
      CUSTOM_BIOMES.Tundra
    ],
    min_spawn_distance: 16,
    max_spawn_distance: 32,
    dimension: "minecraft:overworld",
    block_whitelist: [
      "minecraft:grass_block",
      "minecraft:dirt",
      "minecraft:podzol",
      "minecraft:snow",
      "minecraft:snow_layer",
      "gs_season:overworld_grass",
      ...SPAWNEABLE_BLOCKS.TUNDRA
    ],
    block_blacklist: ["minecraft:lava", "minecraft:barrier", "minecraft:water"],
    allowed_time: [2e3, 9e3],
    max_local_mob_count: 6,
    herd: {
      chance: 1,
      min: 2,
      max: 5,
      spread_radius: 4,
      entries: [
        { mob_id: "gs_season:yak", weight: 40 },
        { mob_id: "gs_season:yak", weight: 60 }
      ]
    },
    // Boost spawn chance in winter
    boostCondition: (env) => env.season === SEASON_IDS.Winter ? { spawnChance: { add: 0.15 } } : {}
  },
  {
    mob_id: "gs_season:zebra",
    spawn_chance: SPAWN_CHANCE.COMMON,
    biomes: [
      BIOMES.Savanna,
      BIOMES.FlowerForest,
      BIOMES.Meadow,
      CUSTOM_BIOMES.Oasis,
      CUSTOM_BIOMES.Savannah
    ],
    min_spawn_distance: 16,
    max_spawn_distance: 32,
    dimension: "minecraft:overworld",
    block_whitelist: [
      "minecraft:grass_block",
      "gs_season:overworld_grass",
      ...SPAWNEABLE_BLOCKS.SAVANNAH,
      "gs_season:savannah_grass_long",
      ...SPAWNEABLE_BLOCKS.OASIS
    ],
    block_blacklist: ["minecraft:lava", "minecraft:barrier", "minecraft:water"],
    allowed_time: [2e3, 9e3],
    max_local_mob_count: 8,
    herd: {
      chance: 0.6,
      min: 3,
      max: 8,
      spread_radius: 4,
      entries: [
        { mob_id: "gs_season:zebra", weight: 40 },
        { mob_id: "gs_season:zebra", weight: 60 }
      ]
    }
  }
];
system23.runInterval(() => {
  if (!world25.gameRules.doMobSpawning) return;
  system23.runJob(
    // @TODO: Use job queue instead of system.runJob
    function* () {
      for (const player of world25.getPlayers()) {
        yield* PreTrySpawn(player);
      }
    }()
  );
}, TicksPerSecond13 * 1.5);
function* PreTrySpawn(player) {
  const env = {
    season: SeasonCycle.getCurrentSeason(),
    time: world25.getTimeOfDay()
  };
  for (const rule of VMS_SPAWN_RULES) {
    yield* trySpawn(player, env, rule);
  }
}
function* trySpawn(player, env, rule) {
  const { season, time } = env;
  if (rule.seasons && !rule.seasons.includes(season)) return;
  const [start, end] = rule.allowed_time;
  if (time < start || time > end) return;
  const dim = player.dimension;
  if (dim.id !== rule.dimension) return;
  const ruleBoost = rule.boostCondition ? rule.boostCondition(env) : {};
  if (Math.random() > rule.spawn_chance + (ruleBoost.spawnChance?.add ?? 0))
    return;
  const min = rule.min_spawn_distance;
  const radius = rule.max_spawn_distance;
  const pos = player.location;
  const x = pos.x + randomInRange(min, radius) * randomSign();
  const z = pos.z + randomInRange(min, radius) * randomSign();
  const topBlock = getTopBlock(dim, x, z);
  yield;
  if (!topBlock) return;
  const blockId = topBlock.typeId;
  if (rule.block_blacklist?.includes(blockId)) return;
  if (!rule.block_whitelist.includes(blockId)) return;
  const isCustomBiome = blockId.startsWith("gs_season:");
  const biome = isCustomBiome ? CustomBiomeIdentifier.get(topBlock, dim) ?? BiomeIdentifier.get(topBlock, dim) : BiomeIdentifier.get(topBlock, dim) ?? CustomBiomeIdentifier.get(topBlock, dim);
  if (!biome || rule.biomes.length && !rule.biomes.includes(biome)) return;
  let nearbyEntities = dim.getEntities({
    families: [rule.family_type ?? "animal"],
    location: { x, y: topBlock.location.y + 1, z },
    maxDistance: radius * 2
  });
  yield;
  const maxFamilyLocal = LOCAL_MOB_COUNT_PER_FAMILY[rule.family_type ?? "animal"];
  if (nearbyEntities.length >= maxFamilyLocal) {
    return;
  }
  const maxMobLocal = rule.max_local_mob_count ?? 4;
  const idsToCount = /* @__PURE__ */ new Set([
    rule.mob_id,
    ...rule.herd?.entries?.map((e) => e.mob_id) ?? []
  ]);
  nearbyEntities = nearbyEntities.filter((e) => idsToCount.has(e.typeId));
  if (nearbyEntities.length >= maxMobLocal) {
    return;
  }
  const herdCfg = rule.herd;
  const herdChance = Math.max(0, Math.min(1, herdCfg?.chance ?? 1));
  const rollIsHerd = herdCfg && Math.random() < herdChance;
  if (!rollIsHerd) {
    spawnOne(dim, rule.mob_id, topBlock.location, isCustomBiome);
    yield;
    return;
  }
  const herdSize = randomIntInRange(herdCfg.min ?? 2, herdCfg.max ?? 4) + (ruleBoost.mobsCount?.add ?? 0);
  const spread = Math.max(0, herdCfg.spread_radius ?? 4);
  const pool = Array.isArray(herdCfg.entries) && herdCfg.entries.length > 0 ? herdCfg.entries : [{ mob_id: rule.mob_id, weight: 1 }];
  if (nearbyEntities.length + herdSize > maxMobLocal) return;
  spawnOne(dim, rule.mob_id, topBlock.location, isCustomBiome);
  yield;
  for (let i = 1; i < herdSize; i++) {
    const offX = x + randomInRange(0, spread) * randomSign();
    const offZ = z + randomInRange(0, spread) * randomSign();
    const ground = getTopBlock(dim, offX, offZ) ?? topBlock;
    const groundBlockId = ground.typeId;
    if (rule.block_blacklist?.includes(groundBlockId)) continue;
    if (!rule.block_whitelist.includes(groundBlockId)) continue;
    spawnOne(dim, chooseWeighted(pool).mob_id, ground.location, isCustomBiome);
    yield;
  }
}
function spawnOne(dim, mobId, groundLoc, isCustomBiome) {
  try {
    const mob = dim.spawnEntity(mobId, {
      x: groundLoc.x,
      y: groundLoc.y + 1,
      z: groundLoc.z
    });
  } catch {
  }
}
function chooseWeighted(pool) {
  const total = pool.reduce((a, b) => a + Math.max(0, b.weight ?? 0), 0) || 1;
  let r = Math.random() * total;
  for (const e of pool) {
    r -= Math.max(0, e.weight ?? 0);
    if (r <= 0) return e;
  }
  return pool[pool.length - 1];
}

// data/scripts/entities/underground-mob-spawn.ts
import {
  system as system24,
  TicksPerSecond as TicksPerSecond14,
  world as world26
} from "@minecraft/server";
function isLocationSafe(dimension, location, clearanceNeeded) {
  const { y } = location;
  const x = Math.floor(location.x);
  const z = Math.floor(location.z);
  const ray = dimension.getBlockFromRay({ x, y, z }, VECTOR_UP, {
    maxDistance: clearanceNeeded
  });
  if (ray?.block.isAir) {
    return false;
  }
  const groundBlock = safeGetBlock({ x, y: y - 1, z }, dimension);
  return groundBlock && !groundBlock.isAir && !groundBlock.isLiquid;
}
async function findSafeUndergoundGroundLocation(center, dimension, options) {
  const {
    entityHeight = 2,
    maxRange = { x: 16, z: 16 },
    minRange = { x: 0, z: 0 },
    heightSearchRange = 10,
    maxAttempts = 10,
    filter = () => true
  } = options;
  const { x: cX, y: cY, z: cZ } = center;
  const { x: maxX, z: maxZ } = maxRange;
  const { x: minX, z: minZ } = minRange;
  const clearanceNeeded = Math.ceil(entityHeight);
  const startY = Math.floor(cY);
  function* scan(resolve) {
    for (let attempt = 0; attempt < maxAttempts; attempt++) {
      const randomOffsetX = randomIntInRange(minX, maxX) * randomSign();
      const randomOffsetZ = randomIntInRange(minZ, maxZ) * randomSign();
      const targetX = cX + randomOffsetX;
      const targetZ = cZ + randomOffsetZ;
      for (let yOffset = heightSearchRange; yOffset >= -heightSearchRange; yOffset--) {
        const currentY = startY + yOffset;
        const target = { x: targetX, y: currentY, z: targetZ };
        if (!isLocationSafe(dimension, target, clearanceNeeded)) {
          yield;
          continue;
        }
        if (!filter(target)) {
          yield;
          continue;
        }
        resolve(safeGetBlock(target, dimension));
        return;
      }
    }
    resolve(void 0);
    return;
  }
  return new Promise(
    (resolve) => system24.runJob(scan(resolve))
  );
}
var UNDGROUND_MOB_SPAWN_RULES = [
  {
    mob_id: "gs_season:lizard",
    family_type: "animal",
    spawn_chance: 1,
    min_spawn_distance: 16,
    max_spawn_distance: 32,
    dimension: "minecraft:overworld",
    block_whitelist: [
      "gs_season:scarlet_moss",
      "gs_season:scarlet_dripstone_block",
      "gs_season:scarlet_azalea",
      "gs_season:scarlet_grass"
    ],
    block_blacklist: ["minecraft:lava", "minecraft:barrier", "minecraft:water"],
    max_local_mob_count: 3,
    herd: {
      chance: 0.5,
      min: 1,
      max: 3,
      spread_radius: 4,
      entries: [
        { mob_id: "gs_season:lizard", weight: 40 },
        { mob_id: "gs_season:lizard", weight: 60 }
      ]
    }
  },
  {
    mob_id: "gs_season:butterfly",
    family_type: "insect",
    spawn_chance: 1,
    min_spawn_distance: 16,
    max_spawn_distance: 32,
    dimension: "minecraft:overworld",
    block_whitelist: [
      "gs_season:scarlet_moss",
      "gs_season:scarlet_dripstone_block",
      "gs_season:scarlet_azalea",
      "gs_season:scarlet_grass"
    ],
    block_blacklist: ["minecraft:lava", "minecraft:barrier", "minecraft:water"],
    max_local_mob_count: 3,
    herd: {
      chance: 0.5,
      min: 1,
      max: 3,
      spread_radius: 4,
      entries: [
        { mob_id: "gs_season:butterfly", weight: 40 },
        { mob_id: "gs_season:butterfly", weight: 60 }
      ]
    }
  }
];
async function processRules(location, dimension) {
  for (const rule of UNDGROUND_MOB_SPAWN_RULES) {
    if (rule.dimension !== dimension.id) continue;
    if (Math.random() > rule.spawn_chance) continue;
    const min = rule.min_spawn_distance;
    const max = rule.max_spawn_distance;
    const block = await findSafeUndergoundGroundLocation(location, dimension, {
      entityHeight: rule.mob_height ?? 2,
      heightSearchRange: 10,
      minRange: { x: min, z: min },
      maxRange: { x: max, z: max }
    });
    if (!block) continue;
    try {
      const blockId = block.below(1)?.typeId ?? "";
      if (rule.block_blacklist?.includes(blockId)) continue;
      if (!rule.block_whitelist?.includes(blockId)) continue;
    } catch {
      continue;
    }
    let nearbyEntities = dimension.getEntities({
      families: [rule.family_type ?? "animal"],
      location: block.location,
      maxDistance: max * 2
    });
    if (nearbyEntities.length >= (rule.max_local_mob_count ?? 4)) continue;
    try {
      block.dimension.spawnEntity(rule.mob_id, {
        ...block.location,
        y: block.y + 1
      });
    } catch {
    }
  }
}
WorldLoad.subscribe(() => {
  system24.runInterval(() => {
    for (const player of world26.getAllPlayers()) {
      if (!player.isValid()) continue;
      const { dimension, location } = player;
      if (location.y < SEA_LEVEL) {
        processRules(location, dimension);
      }
    }
  }, TicksPerSecond14 * 3);
});

// data/scripts/entities/reset-target.ts
import {
  EntityEquippableComponent as EntityEquippableComponent5,
  EquipmentSlot as EquipmentSlot7,
  GameMode as GameMode7,
  system as system25,
  TicksPerSecond as TicksPerSecond15,
  world as world27
} from "@minecraft/server";
var COOLDOWN2 = /* @__PURE__ */ new Set();
var MOBS = /* @__PURE__ */ new Set([
  "gs_season:marmot",
  "gs_season:black_bear",
  "gs_season:lion",
  "gs_season:elephant",
  "gs_season:warthog",
  "gs_season:yak",
  "gs_season:cheetah"
]);
world27.afterEvents.playerInteractWithEntity.subscribe(
  ({ target, player, beforeItemStack }) => {
    if (!MOBS.has(target.typeId) || !target.isValid()) return;
    if (player.getGameMode() === GameMode7.creative) return;
    if (!beforeItemStack || beforeItemStack.typeId !== "gs_season:crowberry_item")
      return;
    if (target.hasTag("gs_season.non_hostile")) return;
    target.addTag("gs_season.non_hostile");
    if (COOLDOWN2.has(target.id)) return;
    COOLDOWN2.add(target.id);
    system25.runTimeout(() => {
      COOLDOWN2.delete(target.id);
    }, TicksPerSecond15 * 5);
    const item = ItemManager.consume(beforeItemStack);
    if (!item) return;
    player.getComponent(EntityEquippableComponent5.componentId)?.setEquipment(EquipmentSlot7.Mainhand, item);
  }
);

// data/scripts/entities/main.js
var ENTITY_EXPERIENCE_REWARD = {
  "gs_season:ant": [1, 1],
  "gs_season:baboon": [6, 6],
  "gs_season:bird": [3, 3],
  "gs_season:black_bear": [10, 12],
  "gs_season:butterfly": [1, 1],
  "gs_season:caribou": [6, 8],
  "gs_season:cheetah": [8, 10],
  "gs_season:chinchilla": [2, 2],
  "gs_season:elephant": [10, 12],
  "gs_season:ermine": [3, 3],
  "gs_season:gray_wolf": [6, 6],
  "gs_season:lion": [10, 12],
  "gs_season:lizard": [3, 3],
  "gs_season:marmot": [3, 3],
  "gs_season:raccoon": [4, 6],
  "gs_season:red_deer": [6, 8],
  "gs_season:snail": [2, 2],
  "gs_season:snowy_owl": [3, 3],
  "gs_season:squirrel": [2, 2],
  "gs_season:tockus": [3, 3],
  "gs_season:warthog": [5, 5],
  "gs_season:yak": [8, 10],
  "gs_season:zebra": [6, 8]
};
var ENTITY_DEATH_ANIMATION_TO_DURATION = {
  "gs_season:elephant": 50,
  "gs_season:baboon": 17,
  "gs_season:lion": 17,
  "gs_season:cheetah": 13,
  "gs_season:zebra": 11,
  "gs_season:tockus": 11,
  "gs_season:ant": 7,
  "gs_season:warthog": 11,
  "gs_season:yak": 18,
  "gs_season:caribou": 13,
  "gs_season:chinchilla": 11,
  "gs_season:ermine": 11,
  "gs_season:marmot": 11,
  "gs_season:snowy_owl": 13,
  "gs_season:squirrel": 11,
  "gs_season:black_bear": 25,
  "gs_season:bird": 8,
  "gs_season:lizard": 13,
  "gs_season:butterfly": 13,
  "gs_season:red_deer": 13,
  "gs_season:raccoon": 13,
  "gs_season:snail": 13,
  "gs_season:gray_wolf": 13
};
var ENTITY_DEATH_SOUNDS = {
  "gs_season:ant": {
    name: "gs_season:ant_death",
    delay: 0
  },
  "gs_season:baboon": {
    name: "gs_season:baboon_death",
    delay: 0
  },
  "gs_season:bird": {
    name: "gs_season:bird_death",
    delay: 0
  },
  "gs_season:black_bear": {
    name: "gs_season:black_bear_death",
    delay: 0
  },
  "gs_season:butterfly": {
    name: "gs_season:butterfly_death",
    delay: 0
  },
  "gs_season:caribou": {
    name: "gs_season:caribou_death",
    delay: 0
  },
  "gs_season:cheetah": {
    name: "gs_season:cheetah_death",
    delay: 0
  },
  "gs_season:chinchilla": {
    name: "gs_season:chinchilla_death",
    delay: 0
  },
  "gs_season:elephant": {
    name: "gs_season:elephant_death",
    delay: 0
  },
  "gs_season:ermine": {
    name: "gs_season:ermine_death",
    delay: 0
  },
  "gs_season:gray_wolf": {
    name: "gs_season:gray_wolf_death",
    delay: 0
  },
  "gs_season:lion": {
    name: "gs_season:lion_death",
    delay: 0
  },
  "gs_season:lizard": {
    name: "gs_season:lizard_death",
    delay: 0
  },
  "gs_season:marmot": {
    name: "gs_season:marmot_death",
    delay: 0
  },
  "gs_season:raccoon": {
    name: "gs_season:raccoon_death",
    delay: 0
  },
  "gs_season:snowy_owl": {
    name: "gs_season:snowy_owl_death",
    delay: 0
  },
  "gs_season:squirrel": {
    name: "gs_season:squirrel_death",
    delay: 0
  },
  "gs_season:tockus": {
    name: "gs_season:tockus_death",
    delay: 0
  },
  "gs_season:warthog": {
    name: "gs_season:warthog_death",
    delay: 0
  },
  "gs_season:yak": {
    name: "gs_season:yak_death",
    delay: 0
  },
  "gs_season:zebra": {
    name: "gs_season:zebra_death",
    delay: 0
  }
};
var LAST_HIT_BY_PLAYER_TIME = TicksPerSecond16 * 10;
world28.afterEvents.entityHitEntity.subscribe(({ damagingEntity, hitEntity }) => {
  try {
    if (!ENTITY_EXPERIENCE_REWARD[hitEntity.typeId]) {
      return;
    }
    if (damagingEntity.typeId !== "minecraft:player") {
      return;
    }
    hitEntity.addTag("gs:last_hit_by_player");
    system26.runTimeout(() => {
      try {
        hitEntity.removeTag("gs:last_hit_by_player");
      } catch {
      }
    }, LAST_HIT_BY_PLAYER_TIME);
  } catch {
  }
});
function dropExperience(entity) {
  try {
    if (entity.getComponent(EntityComponentTypes3.IsBaby)) return;
    const { dimension, location, typeId } = entity;
    const [minExp, maxExp] = ENTITY_EXPERIENCE_REWARD[typeId];
    const exp = randomIntInRange(minExp, maxExp);
    location.y += 0.5;
    for (let i = 0; i < exp; i++) {
      dimension.spawnEntity("minecraft:xp_orb", location).clearVelocity();
    }
  } catch {
  }
}
function getDeathData(entity) {
  const { typeId } = entity;
  let animationName = `animation.gs_season_${typeId.split(":")[1]}.death`;
  if (typeId === "gs_season:zebra" && entity.hasTag("gs:last_hit_by_lion")) {
    animationName = "animation.gs_season_zebra.lion_death";
  }
  return {
    animation: {
      name: animationName,
      duration: ENTITY_DEATH_ANIMATION_TO_DURATION[typeId]
    },
    sound: ENTITY_DEATH_SOUNDS[typeId]
  };
}
world28.afterEvents.entityHealthChanged.subscribe(
  ({ newValue: health, entity: deadEntity }) => {
    if (!deadEntity.isValid()) return;
    const { typeId } = deadEntity;
    if (!ENTITY_DEATH_ANIMATION_TO_DURATION[typeId]) return;
    if (health > 1) return;
    const { animation, sound } = getDeathData(deadEntity);
    deadEntity.playAnimation(animation.name);
    deadEntity.setProperty("gs_season:is_dead", true);
    deadEntity.triggerEvent("gs:death");
    deadEntity.clearVelocity();
    deadEntity.addEffect("minecraft:resistance", 10, {
      amplifier: 255,
      showParticles: false
    });
    if (deadEntity.hasTag("gs:last_hit_by_player")) {
      dropExperience(deadEntity);
    }
    system26.runTimeout(() => {
      try {
        deadEntity.triggerEvent("gs:despawn");
      } catch {
      }
    }, animation.duration);
  }
);
system26.runInterval(() => {
  for (const zebra of world28.getDimension("overworld").getEntities({ type: "gs:zebra" })) {
    const zebraLoc = zebra.location;
    const zebraRot = zebra.getRotation();
    const forward = zebra.getViewDirection();
    for (const player of world28.getPlayers()) {
      const dx = player.location.x - zebraLoc.x;
      const dz = player.location.z - zebraLoc.z;
      const distSq = dx * dx + dz * dz;
      if (distSq < 4) {
        const dirToPlayer = { x: dx, z: dz };
        const dot = getDotProduct(forward, dirToPlayer);
        if (dot > 0.2) {
          zebra.playAnimation("animation.zebra.attack1");
          knockbackPlayer(player, forward, 1.2);
          player.applyDamage(2, {
            cause: EntityDamageCause.entityAttack,
            damagingEntity: zebra
          });
        } else if (dot < -0.2) {
          zebra.playAnimation("animation.zebra.attack2");
          const backward = { x: -forward.x, z: -forward.z };
          knockbackPlayer(player, backward, 1.2);
          player.applyDamage(2, {
            cause: EntityDamageCause.entityAttack,
            damagingEntity: zebra
          });
        }
      }
    }
  }
}, 40);

// data/scripts/settings/core.ts
import { world as world29 } from "@minecraft/server";
import { ActionFormData, ModalFormData } from "@minecraft/server-ui";

// data/scripts/settings/setting-ids.ts
var VFX_SETTING_IDS = {
  WindyLeaves: "gs_season:windy_leaves",
  FallingLeaves: "gs_season:falling_leaves",
  Wind: "gs_season:wind",
  Snowflakes: "gs_season:snowflakes",
  MorningMist: "gs_season:morning_mist",
  Fireflies: "gs_season:fireflies",
  SpringPollen: "gs_season:spring_polen",
  SunlightDust: "gs_season:sunlight_dust",
  Snowstorm: "gs_season:snowstorm",
  FrostBreath: "gs_season:frost_breath"
};
var CHAT_SETTING_IDS = {
  WelcomeMessage: "gs_season:welcome_message",
  ShowBiomeMessages: "gs_season:show_biome_messages",
  Tips: "gs_season:tips"
};

// data/scripts/settings/core.ts
var scoreboardName2 = "gs_season_settings";
function getSetting(setting) {
  try {
    return (world29.scoreboard.getObjective(scoreboardName2)?.getScore(setting) ?? 1) === 1;
  } catch {
    return false;
  }
}
function setSetting(setting, value) {
  let objective = world29.scoreboard.getObjective(scoreboardName2);
  if (!objective)
    objective = world29.scoreboard.addObjective(scoreboardName2, scoreboardName2);
  objective.setScore(setting, value ? 1 : 0);
}
function showVFXForm(player) {
  const windyLeaves = getSetting(VFX_SETTING_IDS.WindyLeaves);
  const fallingLeaves = getSetting(VFX_SETTING_IDS.FallingLeaves);
  const wind = getSetting(VFX_SETTING_IDS.Wind);
  const snowflakes = getSetting(VFX_SETTING_IDS.Snowflakes);
  const sunlightDust = getSetting(VFX_SETTING_IDS.SunlightDust);
  const snowstorm = getSetting(VFX_SETTING_IDS.Snowstorm);
  const frostBreath2 = getSetting(VFX_SETTING_IDS.FrostBreath);
  const morningMist = getSetting(VFX_SETTING_IDS.MorningMist);
  const fireflies = getSetting(VFX_SETTING_IDS.Fireflies);
  const springPollen = getSetting(VFX_SETTING_IDS.SpringPollen);
  new ModalFormData().title("VFX Settings").toggle("Windy Leaves", windyLeaves).toggle("Falling Leaves", fallingLeaves).toggle("Wind", wind).toggle("Snowflakes", snowflakes).toggle("Sunlight Dust", sunlightDust).toggle("Snowstorm", snowstorm).toggle("Frost Breath", frostBreath2).toggle("Morning Mist", morningMist).toggle("Fireflies", fireflies).toggle("Spring Pollen", springPollen).show(player).then((r) => {
    if (r.canceled) return;
    const [
      newWindyLeaves,
      newFallingLeaves,
      newWind,
      newSnowflakes,
      newSunlightDust,
      newSnowstorm,
      newFrostBreath,
      newMorningMist,
      newFireflies,
      newSpringPollen
    ] = r.formValues;
    if (windyLeaves !== newWindyLeaves)
      setSetting(VFX_SETTING_IDS.WindyLeaves, newWindyLeaves);
    if (fallingLeaves !== newFallingLeaves)
      setSetting(VFX_SETTING_IDS.FallingLeaves, newFallingLeaves);
    if (wind !== newWind) setSetting(VFX_SETTING_IDS.Wind, newWind);
    if (snowflakes !== newSnowflakes)
      setSetting(VFX_SETTING_IDS.Snowflakes, newSnowflakes);
    if (sunlightDust !== newSunlightDust)
      setSetting(VFX_SETTING_IDS.SunlightDust, newSunlightDust);
    if (snowstorm !== newSnowstorm)
      setSetting(VFX_SETTING_IDS.Snowstorm, newSnowstorm);
    if (frostBreath2 !== newFrostBreath)
      setSetting(VFX_SETTING_IDS.FrostBreath, newFrostBreath);
    if (morningMist !== newMorningMist)
      setSetting(VFX_SETTING_IDS.MorningMist, newMorningMist);
    if (fireflies !== newFireflies)
      setSetting(VFX_SETTING_IDS.Fireflies, newFireflies);
    if (springPollen !== newSpringPollen)
      setSetting(VFX_SETTING_IDS.SpringPollen, newSpringPollen);
  }).catch(console.error);
}
function showChatForm(player) {
  const welcomeMessage = getSetting(CHAT_SETTING_IDS.WelcomeMessage);
  const showBiomeMessages = getSetting(CHAT_SETTING_IDS.ShowBiomeMessages);
  const tips = getSetting(CHAT_SETTING_IDS.Tips);
  new ModalFormData().title("Chat Settings").toggle("Show Welcome Message", welcomeMessage).toggle("Show Biome Entry Messages", showBiomeMessages).toggle("Show Tips", tips).show(player).then((r) => {
    if (r.canceled) return;
    const [newWelcomeMessage, newShowBiomeMessages, newTips] = r.formValues;
    if (welcomeMessage !== newWelcomeMessage)
      setSetting(CHAT_SETTING_IDS.WelcomeMessage, newWelcomeMessage);
    if (showBiomeMessages !== newShowBiomeMessages)
      setSetting(CHAT_SETTING_IDS.ShowBiomeMessages, newShowBiomeMessages);
    if (tips !== newTips) setSetting(CHAT_SETTING_IDS.Tips, newTips);
  }).catch(console.error);
}
var SettingsCustomComponent = {
  onUse({ source }) {
    const player = source;
    new ActionFormData().title("Seasons Settings").body("Choose a settings category:\n\n").button("VFX Settings", "textures/gs/s/ui/vfx_icon").button("Chat Settings", "textures/gs/s/items/settings").show(player).then((r) => {
      if (r.canceled) return;
      const { selection } = r;
      if (selection === 0) showVFXForm(player);
      if (selection === 1) showChatForm(player);
    }).catch(console.error);
  }
};
world29.beforeEvents.worldInitialize.subscribe((e) => {
  e.itemComponentRegistry.registerCustomComponent(
    "gs_season:settings",
    SettingsCustomComponent
  );
});
world29.afterEvents.worldInitialize.subscribe((e) => {
  let objective = world29.scoreboard.getObjective(scoreboardName2);
  if (!objective) {
    objective = world29.scoreboard.addObjective(scoreboardName2, scoreboardName2);
  }
  const defaultValue = 1;
  for (const [key, value] of Object.entries(VFX_SETTING_IDS)) {
    try {
      objective.getScore(value);
    } catch {
      objective.setScore(value, defaultValue);
    }
  }
  for (const [key, value] of Object.entries(CHAT_SETTING_IDS)) {
    try {
      objective.getScore(value);
    } catch {
      objective.setScore(value, defaultValue);
    }
  }
});

// data/scripts/surface-sanner/core.ts
import { system as system28, world as world30 } from "@minecraft/server";

// data/scripts/surface-sanner/config.ts
import { TicksPerSecond as TicksPerSecond17 } from "@minecraft/server";
var SURFACE_SCAN_ENGINE_CONFIG = {
  CHUNK_SIZE: 16,
  /**
   * The interval at which the player location is updated in ticks
   */
  PLAYER_LOCATION_UPDATE_INTERVAL: TicksPerSecond17 * 0.5,
  /**
   * The interval at which the surface blocks are scanned in ticks
   */
  SURFACE_BLOCK_SCAN_INTERVAL: TicksPerSecond17 * 1,
  /**
   * The radius of the surface scan in chunks in diamond shape
   */
  SURFACE_SCAN_RADIUS: 2
};

// data/scripts/surface-sanner/chunk.ts
function createChunkLocation(location) {
  return {
    x: Math.floor(location.x / SURFACE_SCAN_ENGINE_CONFIG.CHUNK_SIZE),
    y: Math.floor(location.y / SURFACE_SCAN_ENGINE_CONFIG.CHUNK_SIZE),
    z: Math.floor(location.z / SURFACE_SCAN_ENGINE_CONFIG.CHUNK_SIZE)
  };
}
var VFXChunkFactory = class {
  static createFromDimensionLocation(loc) {
    const dimensionId = loc.dimension.id;
    const location = createChunkLocation(loc);
    const id = `${dimensionId}:${location.x}:${location.y}:${location.z}`;
    const min = {
      x: location.x * SURFACE_SCAN_ENGINE_CONFIG.CHUNK_SIZE,
      y: location.y * SURFACE_SCAN_ENGINE_CONFIG.CHUNK_SIZE,
      z: location.z * SURFACE_SCAN_ENGINE_CONFIG.CHUNK_SIZE
    };
    return {
      id,
      location,
      min,
      dimension: loc.dimension
    };
  }
  static createFromChunkLocation(loc, dimension) {
    const { x, y, z } = loc;
    const id = `${x}:${y}:${z}`;
    return {
      id,
      location: loc,
      min: {
        x: x * SURFACE_SCAN_ENGINE_CONFIG.CHUNK_SIZE,
        y: y * SURFACE_SCAN_ENGINE_CONFIG.CHUNK_SIZE,
        z: z * SURFACE_SCAN_ENGINE_CONFIG.CHUNK_SIZE
      },
      dimension
    };
  }
};
var VFXChunkUtils = class {
  static chubkIdFromDimensionLocation(location) {
    const { x, y, z } = createChunkLocation(location);
    return `${location.dimension.id}:${x}:${y}:${z}`;
  }
};

// data/scripts/math/shapes/dimanond.shape.ts
var DiamondShape = class {
  static *iterateByDiamondShapeFromCenter(center, radius) {
    const { x: cx, y: cy, z: cz } = center;
    yield { ...center };
    for (let r = 1; r <= radius; r++) {
      for (let x = -r; x <= r; x++) {
        const absX = Math.abs(x);
        for (let z = -r; z <= r; z++) {
          if (absX + Math.abs(z) <= r) {
            yield {
              x: cx + x,
              y: cy,
              z: cz + z
            };
          }
        }
      }
    }
  }
};

// data/scripts/system/system-job-queue.ts
import { system as system27 } from "@minecraft/server";
var SYSTEM_JOB_HANDLE;
var LIMIT = 20;
var JOB_QUEUE = [];
var SystemJobQueue = class {
  static setLimit(limit) {
    LIMIT = limit;
  }
  static add(job, start = false) {
    if (JOB_QUEUE.length >= LIMIT) return;
    JOB_QUEUE.push(job);
    if (start) {
      this.run();
    }
  }
  static run() {
    if (SYSTEM_JOB_HANDLE) return;
    function* process() {
      while (true) {
        const job = JOB_QUEUE.pop();
        if (!job) {
          SYSTEM_JOB_HANDLE = void 0;
          break;
        }
        yield* job;
      }
    }
    SYSTEM_JOB_HANDLE = system27.runJob(process());
  }
};

// data/scripts/surface-sanner/core.ts
function findRandomSurfaceBlock(chunk) {
  const { dimension, min } = chunk;
  const { CHUNK_SIZE: CHUNK_SIZE3 } = SURFACE_SCAN_ENGINE_CONFIG;
  const { max: maxHeight, min: minHeight } = dimension.heightRange;
  const x = randomIntInRange(min.x, min.x + CHUNK_SIZE3);
  const z = randomIntInRange(min.z, min.z + CHUNK_SIZE3);
  try {
    const ray = dimension.getBlockFromRay({ x, y: maxHeight, z }, VECTOR_DOWN, {
      includeLiquidBlocks: true,
      maxDistance: maxHeight - minHeight
    });
    return ray ? ray.block : void 0;
  } catch {
  }
}
var PLAYER_CHUNKS = /* @__PURE__ */ new Map();
WorldLoad.subscribe(() => {
  system28.runInterval(() => {
    for (const { id, location, dimension } of world30.getAllPlayers()) {
      const dimensionLocation = {
        ...location,
        dimension
      };
      const oldChunk = PLAYER_CHUNKS.get(id);
      if (oldChunk) {
        const playerChunkId = VFXChunkUtils.chubkIdFromDimensionLocation(dimensionLocation);
        if (playerChunkId === oldChunk.id) continue;
      }
      const playerChunk = VFXChunkFactory.createFromDimensionLocation(dimensionLocation);
      PLAYER_CHUNKS.set(id, playerChunk);
    }
  }, SURFACE_SCAN_ENGINE_CONFIG.PLAYER_LOCATION_UPDATE_INTERVAL);
});
system28.runInterval(() => {
  const visitedChunks = /* @__PURE__ */ new Set();
  const { SURFACE_SCAN_RADIUS } = SURFACE_SCAN_ENGINE_CONFIG;
  SystemJobQueue.add(
    function* () {
      for (const [, playerChunk] of PLAYER_CHUNKS) {
        const { location, dimension } = playerChunk;
        for (const offset of DiamondShape.iterateByDiamondShapeFromCenter(
          location,
          SURFACE_SCAN_RADIUS
        )) {
          const chunkId = `${offset.x}:${offset.y}:${offset.z}`;
          if (visitedChunks.has(chunkId)) continue;
          visitedChunks.add(chunkId);
          yield;
          const chunk = VFXChunkFactory.createFromChunkLocation(
            offset,
            dimension
          );
          const surfaceBlock = findRandomSurfaceBlock(chunk);
          yield;
          if (!surfaceBlock) continue;
          for (const callback of SUBSCRIBERS4.values()) {
            callback(
              surfaceBlock,
              Math.abs(offset.x - location.x) + Math.abs(offset.z - location.z)
            );
            yield;
          }
        }
      }
    }(),
    true
  );
}, SURFACE_SCAN_ENGINE_CONFIG.SURFACE_BLOCK_SCAN_INTERVAL);
var SUBSCRIBER_ID = 0;
var SUBSCRIBERS4 = /* @__PURE__ */ new Map();
var SurfaceBlockSearcher = class {
  static subscribe(callback) {
    const id = SUBSCRIBER_ID++;
    SUBSCRIBERS4.set(id, callback);
    return id;
  }
  static unsubscribe(id) {
    delete SUBSCRIBERS4[id];
  }
};

// data/scripts/vfx/particles/leaves.particle.ts
var LEAVES_TYPE_ID_TO_PARTICLE = {
  "gs_season:aspen_leaves": "gs_season:leaves_3",
  "gs_season:palm_leaves": "gs_season:leaves_1",
  "gs_season:acacia_leaves": "gs_season:leaves_1",
  "gs_season:baobab_leaves": "gs_season:leaves_1",
  "gs_season:bushwillow_leaves": "gs_season:leaves_1",
  "gs_season:jacaranda_leaves_1": "gs_season:leaves_5",
  "gs_season:jacaranda_leaves_2": "gs_season:leaves_5",
  "gs_season:beech_leaves": "gs_season:leaves_4",
  "gs_season:red_oak_leaves": "gs_season:leaves_3",
  "gs_season:sugar_maple_leaves": "gs_season:leaves_1"
};
SurfaceBlockSearcher.subscribe((block) => {
  if (!getSetting(VFX_SETTING_IDS.WindyLeaves) || !WindIntensity.isIntense || SeasonCycle.matches(SEASON_IDS.Winter))
    return;
  try {
    const particle = LEAVES_TYPE_ID_TO_PARTICLE[block.typeId];
    if (!particle) return;
    const { location, dimension } = block;
    dimension.spawnParticle(particle, {
      ...location,
      y: location.y - 10
    });
  } catch {
  }
});

// data/scripts/vfx/particles/falling-leaves.particle.ts
var LEAVES_TYPE_ID_TO_PARTICLE2 = {
  "gs_season:aspen_leaves": "gs_season:falling_leaves_3",
  "gs_season:palm_leaves": "gs_season:falling_leaves_1",
  "gs_season:acacia_leaves": "gs_season:falling_leaves_1",
  "gs_season:baobab_leaves": "gs_season:falling_qleaves_1",
  "gs_season:bushwillow_leaves": "gs_season:falling_leaves_1",
  "gs_season:beech_leaves": "gs_season:falling_leaves_4",
  "gs_season:red_oak_leaves": "gs_season:falling_leaves_3",
  "gs_season:jacaranda_leaves_1": "gs_season:falling_leaves_5",
  "gs_season:jacaranda_leaves_2": "gs_season:falling_leaves_5",
  "gs_season:sugar_maple_leaves": "gs_season:falling_leaves_1"
};
function findLowestLeavesBlock(block) {
  const { typeId, dimension } = block;
  function stepByStep(block2) {
    const maxTries = 10;
    let jumpStepY = 0;
    for (let y = 1; y <= maxTries; y++) {
      const below = safeGetBlock(
        {
          ...block2,
          y: block2.y - y - jumpStepY
        },
        dimension
      );
      if (!below) return void 0;
      if (below.isAir) {
        const fromJump = jumpDown(below);
        if (!fromJump) {
          return below;
        }
        jumpStepY = block2.y - fromJump.y;
        continue;
      }
      if (below.typeId !== typeId) return below;
    }
  }
  function jumpDown(block2) {
    try {
      const ray = dimension.getBlockFromRay(block2, VECTOR_DOWN, {
        includeTypes: [typeId],
        maxDistance: 10
      });
      return ray?.block;
    } catch {
    }
  }
  return stepByStep(block);
}
SurfaceBlockSearcher.subscribe((block) => {
  if (!getSetting(VFX_SETTING_IDS.FallingLeaves) || WindIntensity.isIntense || SeasonCycle.matches(SEASON_IDS.Winter))
    return;
  try {
    const particle = LEAVES_TYPE_ID_TO_PARTICLE2[block.typeId];
    if (!particle) return;
    const lowestLeavesBlock = findLowestLeavesBlock(block);
    if (!lowestLeavesBlock) return;
    const { location, dimension } = lowestLeavesBlock;
    dimension.spawnParticle(particle, location);
  } catch {
  }
});

// data/scripts/vfx/particles/wind.particle.ts
SurfaceBlockSearcher.subscribe((block) => {
  if (!getSetting(VFX_SETTING_IDS.Wind) || !WindIntensity.isIntense || SeasonCycle.matches(SEASON_IDS.Winter))
    return;
  try {
    const { location, dimension, typeId } = block;
    if (!typeId.startsWith("gs_season:"))
      return;
    dimension.spawnParticle("gs_season:wind", {
      ...location,
      y: location.y - 10
    });
  } catch {
  }
});

// data/scripts/biome-identifier/utils/get-biome-at.ts
function getBiomeAt(location) {
  const { dimension } = location;
  return BiomeIdentifier.get(location, dimension) ?? CustomBiomeIdentifier.get(location, dimension);
}

// data/scripts/vfx/particles/snowflakes.particle.ts
var SNOWFLAKES_CONFIG = {
  excludeBiomes: /* @__PURE__ */ new Set([
    CUSTOM_BIOMES.Oasis,
    CUSTOM_BIOMES.Savannah,
    BIOMES.Savanna,
    BIOMES.Jungle,
    BIOMES.JungleEdge,
    BIOMES.CherryGrove,
    BIOMES.Desert,
    BIOMES.Mesa,
    BIOMES.MesaPlateau
  ]),
  biomes: /* @__PURE__ */ new Set([
    CUSTOM_BIOMES.Tundra,
    CUSTOM_BIOMES.Aspen,
    CUSTOM_BIOMES.Forest,
    CUSTOM_BIOMES.Savannah,
    BIOMES.Taiga,
    BIOMES.MegaTaiga,
    BIOMES.Forest,
    BIOMES.BirchForest,
    BIOMES.Plains,
    BIOMES.ColdBeach,
    BIOMES.StoneBeach,
    BIOMES.Grove
  ])
};
SurfaceBlockSearcher.subscribe((block, distance) => {
  if (!getSetting(VFX_SETTING_IDS.Snowflakes) || !SeasonCycle.matches(SEASON_IDS.Winter) || WindIntensity.isIntense || distance > 2)
    return;
  const { typeId } = block;
  if (typeId.includes("leaves")) return;
  const biome = getBiomeAt(block);
  if (!biome || SNOWFLAKES_CONFIG.excludeBiomes.has(biome)) return;
  try {
    const { location, dimension } = block;
    dimension.spawnParticle("gs_season:snowflake", location);
  } catch {
  }
});

// data/scripts/world/time.ts
import { world as world31 } from "@minecraft/server";
function isMorning() {
  const time = world31.getTimeOfDay();
  return time > 23500 || time < 1e3;
}
function isDay() {
  const time = world31.getTimeOfDay();
  return time >= 1e3 && time <= 13e3;
}
function isNight() {
  const time = world31.getTimeOfDay();
  return time >= 13e3 && time <= 23500;
}

// data/scripts/vfx/particles/fireflies.particle.ts
var FIREFLIES_CONFIG = {
  chance: 0.1,
  biomes: /* @__PURE__ */ new Set([
    BIOMES.Plains,
    BIOMES.Swampland,
    BIOMES.MangroveSwamp,
    BIOMES.Taiga,
    CUSTOM_BIOMES.Tundra
  ])
};
SurfaceBlockSearcher.subscribe((block) => {
  if (!SeasonCycle.matches(SEASON_IDS.Summer)) return;
  if (!getSetting(VFX_SETTING_IDS.Fireflies)) return;
  if (Math.random() > FIREFLIES_CONFIG.chance) return;
  if (!isNight()) return;
  const biome = getBiomeAt(block);
  if (!biome || !FIREFLIES_CONFIG.biomes.has(biome)) return;
  try {
    const { location, dimension } = block;
    dimension.spawnParticle("gs_season:fireflies", {
      ...location,
      y: location.y + 1
    });
  } catch {
  }
});

// data/scripts/vfx/particles/morning-mist.particle.ts
var MORNING_MIST_CONFIG = {
  chance: 1,
  sideBlockChance: 0.5,
  excludeBiomes: /* @__PURE__ */ new Set([
    BIOMES.Desert,
    BIOMES.Mesa,
    BIOMES.MesaPlateau
  ]),
  //   chance: 0.6,
  biomes: /* @__PURE__ */ new Set([
    BIOMES.Plains,
    BIOMES.Forest,
    BIOMES.BirchForest,
    BIOMES.MangroveSwamp,
    BIOMES.Swampland,
    CUSTOM_BIOMES.Forest,
    CUSTOM_BIOMES.Jacaranda,
    CUSTOM_BIOMES.Aspen
  ])
};
SurfaceBlockSearcher.subscribe((block, distance) => {
  if (!getSetting(VFX_SETTING_IDS.MorningMist) || distance > 3) return;
  if (Math.random() > MORNING_MIST_CONFIG.chance) return;
  if (!isMorning()) return;
  const biome = getBiomeAt(block);
  if (!biome) return;
  try {
    const { typeId, location, dimension } = block;
    if (!typeId.endsWith("grass") && !typeId.endsWith("grass_block")) return;
    dimension.spawnParticle("gs_season:morning_mist", {
      ...location,
      y: location.y + 1
    });
    for (const side of ["north", "south", "east", "west"]) {
      if (Math.random() > MORNING_MIST_CONFIG.sideBlockChance) continue;
      const sideBlock = block[side](2);
      if (!sideBlock || sideBlock.typeId.endsWith("grass") || sideBlock.typeId.endsWith("grass_block"))
        continue;
      dimension.spawnParticle("gs_season:morning_mist", {
        ...sideBlock,
        y: sideBlock.y + 1
      });
    }
  } catch {
  }
});

// data/scripts/vfx/particles/spring-pollen.particle.ts
var SPRING_POLLEN_CONFIG = {
  chance: 0.8,
  biomes: /* @__PURE__ */ new Set([
    BIOMES.Forest,
    BIOMES.BirchForest,
    BIOMES.FlowerForest,
    CUSTOM_BIOMES.Forest,
    CUSTOM_BIOMES.Aspen
  ])
};
SurfaceBlockSearcher.subscribe((block, distance) => {
  if (!SeasonCycle.matches(SEASON_IDS.Spring)) return;
  if (!getSetting(VFX_SETTING_IDS.SpringPollen)) return;
  if (Math.random() > SPRING_POLLEN_CONFIG.chance) return;
  if (!isDay()) return;
  if (distance > 2) return;
  const biome = getBiomeAt(block);
  if (!biome || !SPRING_POLLEN_CONFIG.biomes.has(biome)) return;
  try {
    const { typeId, location, dimension } = block;
    if (!typeId.includes("grass")) return;
    dimension.spawnParticle("gs_season:spring_pollen", {
      ...location,
      y: location.y + 1
    });
  } catch {
  }
});

// data/scripts/vfx/particles/sunlight-dust.particle.ts
import {
  system as system29,
  TicksPerSecond as TicksPerSecond18,
  world as world32
} from "@minecraft/server";
var SUNLIGHT_DUST_CONFIG = {
  chance: 0.8,
  maxPointsPerPlayer: 10,
  maxPointsPerDimension: 75,
  getLimit() {
    const playersCount = world32.getAllPlayers().length;
    return playersCount >= 10 ? this.maxPointsPerDimension : Math.round(this.maxPointsPerPlayer * Math.pow(playersCount, 0.5));
  },
  /**
   * The radius of the area in which the sunlight dust is spawned.
   * This area prevents the sunlight dust from being spawned in the same area.
   */
  areaRadius: 8
};
function spawnSunlightDust(block) {
  try {
    block.dimension.spawnParticle("gs_season:sunlight_dust", block);
  } catch {
    return false;
  }
  return true;
}
function checkUpAndDown(block) {
  const { dimension } = block;
  const downRay = dimension.getBlockFromRay(block, VECTOR_DOWN, {
    maxDistance: 10,
    includeLiquidBlocks: false
  });
  if (!downRay || Math.abs(downRay.block.y - block.y) < 1) {
    return;
  }
  const upRay = dimension.getBlockFromRay(block, VECTOR_UP, {
    maxDistance: 10,
    includeLiquidBlocks: false
  });
  if (!upRay || Math.abs(upRay.block.y - block.y) < 2) {
    return;
  }
  return downRay.block;
}
function findCaveOrigin(block) {
  const origin = block.above(3);
  if (!origin) return;
  for (const direction of ["south", "north", "west", "east"]) {
    const block2 = origin[direction](3);
    if (block2 && block2.isAir) {
      const upAndDown = checkUpAndDown(block2);
      if (upAndDown) return upAndDown;
    }
  }
}
var CACHED_BLOCKS = /* @__PURE__ */ new Set();
function tryAddBlockToCachedBlocks(block) {
  try {
    const { typeId } = block;
    if (!typeId.includes("stone")) return;
    if ([...CACHED_BLOCKS].some(
      (b) => distanceXZ(b, block) < SUNLIGHT_DUST_CONFIG.areaRadius
    )) {
      return;
    }
    const origin = findCaveOrigin(block);
    if (!origin) return;
    CACHED_BLOCKS.add(origin);
  } catch {
  }
}
SurfaceBlockSearcher.subscribe((block) => {
  if (!SeasonCycle.matches(SEASON_IDS.Summer)) return;
  if (!getSetting(VFX_SETTING_IDS.SunlightDust)) return;
  if (CACHED_BLOCKS.size >= SUNLIGHT_DUST_CONFIG.getLimit()) return;
  if (!isDay()) return;
  if (block.typeId.includes("grass")) {
    if (Math.random() < SUNLIGHT_DUST_CONFIG.chance) spawnSunlightDust(block);
    return;
  }
  tryAddBlockToCachedBlocks(block);
});
var SCAN_FOR_CAVE_ENTRANCE_CONFIG = {
  radius: 10,
  tries: 5
};
system29.runInterval(() => {
  if (CACHED_BLOCKS.size >= SUNLIGHT_DUST_CONFIG.getLimit()) return;
  if (!SeasonCycle.matches(SEASON_IDS.Summer) || !getSetting(VFX_SETTING_IDS.SunlightDust) || !isDay()) {
    return;
  }
  const overworld = world32.getDimension("minecraft:overworld");
  const { radius, tries } = SCAN_FOR_CAVE_ENTRANCE_CONFIG;
  for (const { location } of overworld.getPlayers().filter(({ location: location2 }) => location2.y >= SEA_LEVEL)) {
    for (let i = 0; i < tries; i++) {
      try {
        const x = randomIntInRange(location.x - radius, location.x + radius);
        const z = randomIntInRange(location.z - radius, location.z + radius);
        const block = overworld.getTopmostBlock({ x, z });
        if (!block) continue;
        tryAddBlockToCachedBlocks(block);
      } catch {
      }
    }
  }
}, TicksPerSecond18 * 5);
system29.runInterval(() => {
  if (CACHED_BLOCKS.size === 0) return;
  if (!SeasonCycle.matches(SEASON_IDS.Summer) || !getSetting(VFX_SETTING_IDS.SunlightDust) || !isDay()) {
    CACHED_BLOCKS.clear();
    return;
  }
  for (const block of CACHED_BLOCKS) {
    if (!spawnSunlightDust(block)) {
      CACHED_BLOCKS.delete(block);
    }
  }
}, TicksPerSecond18 * 2);

// data/scripts/vfx/particles/snowstorm.particle.ts
import { system as system30, TicksPerSecond as TicksPerSecond19 } from "@minecraft/server";
var SNOWSTORM_CONFIG = {
  biomes: /* @__PURE__ */ new Set([
    // BIOMES.Taiga,
    // BIOMES.MegaTaiga,
    BIOMES.Grove,
    BIOMES.ColdTaiga,
    BIOMES.IceSpikes,
    BIOMES.FrozenPeaks,
    BIOMES.IceMountains,
    BIOMES.FrozenRiver,
    BIOMES.IcePlains,
    BIOMES.FrozenRiver,
    CUSTOM_BIOMES.Tundra
  ])
};
var SNOWSTORM_RADIUS = 8;
var LOCKED_CHUNKS = /* @__PURE__ */ new Set();
SurfaceBlockSearcher.subscribe((block, distance) => {
  if (!SeasonCycle.matches(SEASON_IDS.Winter)) return;
  if (!WindIntensity.isIntense) return;
  if (!getSetting(VFX_SETTING_IDS.Snowstorm)) return;
  if (distance > 2) return;
  const biome = getBiomeAt(block);
  if (!biome || !SNOWSTORM_CONFIG.biomes.has(biome)) return;
  try {
    const spawnLocation = {
      x: Math.floor(block.x / SNOWSTORM_RADIUS) * SNOWSTORM_RADIUS,
      y: block.y,
      z: Math.floor(block.z / SNOWSTORM_RADIUS) * SNOWSTORM_RADIUS
    };
    const chunkKey = `${Math.floor(
      spawnLocation.x / SNOWSTORM_RADIUS
    )},${Math.floor(spawnLocation.z / SNOWSTORM_RADIUS)}`;
    if (LOCKED_CHUNKS.has(chunkKey)) return;
    const { typeId, dimension } = block;
    if (!typeId.includes("snow") && !typeId.includes("ice")) return;
    LOCKED_CHUNKS.add(chunkKey);
    system30.runTimeout(() => {
      LOCKED_CHUNKS.delete(chunkKey);
    }, TicksPerSecond19 * 1);
    dimension.spawnParticle("gs_season:snowstorm_1", spawnLocation);
    dimension.spawnParticle("gs_season:snowstorm_2", spawnLocation);
  } catch {
  }
});

// data/scripts/vfx/particles/frost-breath.particle.ts
import {
  MolangVariableMap,
  system as system31,
  TicksPerSecond as TicksPerSecond20,
  world as world34
} from "@minecraft/server";
var FROST_BREATH_CONFIG = {
  randomDelay: [0, 0.5]
};
function frostBreath(player, overworld) {
  try {
    const { location } = player;
    if (location.y < SEA_LEVEL) return;
    const molang = new MolangVariableMap();
    const view = player.getViewDirection();
    molang.setVector3("direction", view);
    const vel = player.getVelocity();
    const head = player.getHeadLocation();
    const mouth = {
      x: head.x + view.x * 0.05 + vel.x * 0.7,
      y: head.y,
      z: head.z + view.z * 0.05 + vel.z * 0.7
    };
    const delay = randomInRange(
      FROST_BREATH_CONFIG.randomDelay[0],
      FROST_BREATH_CONFIG.randomDelay[1]
    );
    if (delay) {
      system31.runTimeout(() => {
        overworld.spawnParticle("gs_season:frost_breath", mouth, molang);
      }, delay / 10 * TicksPerSecond20);
    } else {
      overworld.spawnParticle("gs_season:frost_breath", mouth, molang);
    }
  } catch {
  }
}
system31.runInterval(() => {
  if (!getSetting(VFX_SETTING_IDS.FrostBreath)) return;
  const isDayNow = isDay();
  const isWinterSeason = SeasonCycle.matches(SEASON_IDS.Winter);
  const isIntenseWind = WindIntensity.isIntense;
  if (isDayNow && !isIntenseWind) return;
  const overworld = world34.getDimension("minecraft:overworld");
  for (const player of overworld.getPlayers()) {
    const biome = getBiomeAt({
      ...player.location,
      dimension: overworld
    });
    const isDesert = BIOMES.Desert === biome || BIOMES.Mesa === biome;
    if (isWinterSeason && !isDesert) {
      frostBreath(player, overworld);
      continue;
    }
    if (!isDayNow && isDesert) {
      frostBreath(player, overworld);
    }
  }
}, TicksPerSecond20 * 2);

// data/scripts/sfx/main.ts
import { TicksPerSecond as TicksPerSecond24 } from "@minecraft/server";

// data/scripts/sfx/entity-based.ts
import { system as system33, world as world35 } from "@minecraft/server";

// data/scripts/sfx/cooldown-areas.ts
import { system as system32 } from "@minecraft/server";
var COOLDOWN_AREA_STORAGE = {};
var CooldownAreas = class {
  static get(soundId) {
    return COOLDOWN_AREA_STORAGE[soundId] ??= /* @__PURE__ */ new Set();
  }
  static isInside(location, rule) {
    return Array.from(this.get(rule.soundId)).some((area) => {
      return distanceXZ(location, area) <= (rule.maxDistance ?? 32);
    });
  }
  static add(center, rule) {
    const list = this.get(rule.soundId);
    list.add(center);
    system32.runTimeout(
      () => {
        list.delete(center);
      },
      Array.isArray(rule.coolDown) ? randomIntInRange(rule.coolDown[0], rule.coolDown[1]) : rule.coolDown
    );
  }
};

// data/scripts/sfx/entity-based.ts
var DEBUG = false;
var CYCLE_INTERVAL;
var SOUND_RULES = [];
function getNormalizedDirection(from, to) {
  const direction = {
    x: to.x - from.x,
    y: to.y - from.y,
    z: to.z - from.z
  };
  const length = Math.hypot(direction.x, direction.y, direction.z);
  if (length === 0) return { x: 0, y: 0, z: 0 };
  return {
    x: direction.x / length,
    y: direction.y / length,
    z: direction.z / length
  };
}
function tryPlaySingleSound(dimension, center, rule) {
  if (Math.random() > rule.chance) return false;
  const {
    entityTypeId,
    maxDistance,
    minDistance,
    excludeEntityTypes: excludeEntities
  } = rule;
  const entities = dimension.getEntities({
    type: entityTypeId,
    location: center,
    maxDistance,
    minDistance,
    closest: 1,
    excludeTypes: excludeEntities
  });
  if (!entities.length) return false;
  const randomEntity = entities[0];
  if (rule.filterCondition && !rule.filterCondition(randomEntity)) return false;
  const { location } = randomEntity;
  const direction = getNormalizedDirection(center, location);
  const ray = dimension.getBlockFromRay(location, direction, {
    maxDistance: maxDistance ?? distanceXYZ(center, location)
  });
  if (ray) {
    const { block } = ray;
    if (distanceXYZ(center, block) <= (minDistance ?? 16)) {
      return false;
    }
    location.x = block.x;
    location.y = block.y;
    location.z = block.z;
  }
  const { soundId, volume = 1, pitch = 1 } = rule;
  dimension.playSound(soundId, location, {
    volume,
    pitch
  });
  CooldownAreas.add(center, rule);
  if (DEBUG) {
    console.log(
      "played",
      soundId,
      `@ ${Math.round(randomEntity.location.x)} ${Math.round(
        randomEntity.location.y
      )} ${Math.round(randomEntity.location.z)}`
    );
  }
  return true;
}
function processRulesPerPlayer() {
  for (const player of world35.getAllPlayers()) {
    const { dimension, location: center } = player;
    if (center.y < SEA_LEVEL) continue;
    for (const rule of SOUND_RULES) {
      if (!CooldownAreas.isInside(center, rule))
        tryPlaySingleSound(dimension, center, rule);
    }
  }
}
var EntityBasedSFX = class {
  static reload(cycleInterval) {
    if (CYCLE_INTERVAL) {
      system33.clearRun(CYCLE_INTERVAL);
    }
    CYCLE_INTERVAL = system33.runInterval(
      () => processRulesPerPlayer(),
      cycleInterval
    );
  }
  static register(config) {
    const { cycleInterval, sounds, debug } = config;
    DEBUG = debug ?? false;
    SOUND_RULES.length = 0;
    SOUND_RULES.push(...sounds);
    this.reload(cycleInterval);
  }
};

// data/scripts/sfx/player-based.ts
import { system as system35, world as world37 } from "@minecraft/server";

// data/scripts/sfx/utils.ts
function isPlayerUnderwater(player) {
  const { dimension, location, isInWater } = player;
  return isInWater ? safeGetBlock(
    {
      ...location,
      y: location.y + 1
    },
    dimension
  )?.isLiquid : false;
}

// data/scripts/sfx/sound-cache.ts
import { system as system34, TicksPerSecond as TicksPerSecond21, world as world36 } from "@minecraft/server";
var PLAYER_SOUNDS_CACHE = {};
var SoundCache = class {
  static get(player) {
    return PLAYER_SOUNDS_CACHE[player.name] ??= /* @__PURE__ */ new Set();
  }
  static add(player, soundId) {
    this.get(player).add(soundId);
  }
  static remove(player, soundId) {
    this.get(player).delete(soundId);
  }
};
world36.beforeEvents.playerLeave.subscribe(({ player }) => {
  delete PLAYER_SOUNDS_CACHE[player.name];
});
system34.runInterval(() => {
  const players = world36.getAllPlayers();
  for (const player of players) {
    if (isPlayerUnderwater(player)) {
      for (const soundId of SoundCache.get(player)) {
        SoundCache.remove(player, soundId);
        stopSound(player, soundId);
        PlayerBasedCooldowns.remove(soundId, player);
      }
    }
  }
}, TicksPerSecond21);

// data/scripts/sfx/player-based.ts
var DEBUG2 = false;
var CYCLE_INTERVAL2;
var PLAYER_BASED_SFX_SOUNDS = [];
var COOLDOWNS = /* @__PURE__ */ new Set();
var PlayerBasedCooldowns = class {
  static add(soundId, player, coolDown) {
    const { name } = player;
    COOLDOWNS.add(`${soundId}-${name}`);
    system35.runTimeout(
      () => {
        COOLDOWNS.delete(`${soundId}-${name}`);
      },
      Array.isArray(coolDown) ? randomIntInRange(coolDown[0], coolDown[1]) : coolDown
    );
  }
  static remove(soundId, player) {
    COOLDOWNS.delete(`${soundId}-${player.name}`);
  }
  static has(soundId, player) {
    return COOLDOWNS.has(`${soundId}-${player.name}`);
  }
};
function processRulesPerPlayer2() {
  for (const player of world37.getAllPlayers()) {
    const { dimension, location } = player;
    if (location.y < SEA_LEVEL) continue;
    if (isPlayerUnderwater(player)) continue;
    const biomeAtPosition = CustomBiomeIdentifier.get(location, dimension) ?? BiomeIdentifier.get(location, dimension);
    for (const rule of PLAYER_BASED_SFX_SOUNDS) {
      if (Math.random() > rule.chance) continue;
      if (PlayerBasedCooldowns.has(rule.soundId, player)) continue;
      const { seasons, biome, filterCondition } = rule;
      const currentSeason = SeasonCycle.getCurrentSeason();
      if (!seasons.includes(currentSeason)) continue;
      if (biome && biome.length && (!biomeAtPosition || !biome.includes(biomeAtPosition)))
        continue;
      if (filterCondition && !filterCondition(biomeAtPosition)) continue;
      const { soundId, volume, pitch } = rule;
      player.playSound(soundId, {
        volume,
        pitch
      });
      SoundCache.add(player, soundId);
      PlayerBasedCooldowns.add(soundId, player, rule.coolDown);
      if (DEBUG2)
        console.log(
          "played",
          soundId,
          `@ ${Math.round(location.x)} ${Math.round(location.y)} ${Math.round(
            location.z
          )}`
        );
    }
  }
}
var PlayerBasedSFX = class {
  static reload(cycleInterval) {
    if (CYCLE_INTERVAL2) {
      system35.clearRun(CYCLE_INTERVAL2);
    }
    CYCLE_INTERVAL2 = system35.runInterval(
      () => processRulesPerPlayer2(),
      cycleInterval
    );
  }
  static register(config) {
    const { cycleInterval, sounds, debug } = config;
    DEBUG2 = debug ?? false;
    PLAYER_BASED_SFX_SOUNDS.length = 0;
    PLAYER_BASED_SFX_SOUNDS.push(...sounds);
    this.reload(cycleInterval);
  }
};

// data/scripts/sfx/surface-based.ts
var DEBUG3 = false;
var SURFACE_BASED_SFX_SOUNDS = [];
function processBlock(block, sound) {
  if (Math.random() > sound.chance) return;
  if (CooldownAreas.isInside(block.location, sound)) return;
  const { biomes, filterCondition, blockTypes, seasons } = sound;
  if (seasons && seasons.length && !seasons.includes(SeasonCycle.getCurrentSeason()))
    return;
  if (blockTypes && blockTypes.length && !blockTypes.includes(block.typeId))
    return;
  const biome = CustomBiomeIdentifier.get(block.location, block.dimension) ?? BiomeIdentifier.get(block.location, block.dimension);
  if (!biome || biomes && biomes.length && !biomes.includes(biome)) return;
  if (filterCondition && !filterCondition({ biome, block })) return;
  const { soundId, volume, pitch } = sound;
  block.dimension.getPlayers({
    location: block,
    maxDistance: 60
  }).forEach((player) => {
    if (isPlayerUnderwater(player)) return;
    player.playSound(soundId, {
      location: block,
      volume,
      pitch
    });
    SoundCache.add(player, soundId);
  });
  CooldownAreas.add(block.location, sound);
  if (DEBUG3)
    console.log(
      "played",
      soundId,
      `@ ${Math.round(block.location.x)} ${Math.round(
        block.location.y
      )} ${Math.round(block.location.z)}`
    );
}
var SurfaceBasedSFX = class {
  static register(config) {
    const { sounds, debug } = config;
    DEBUG3 = debug ?? false;
    SURFACE_BASED_SFX_SOUNDS.length = 0;
    SURFACE_BASED_SFX_SOUNDS.push(...sounds);
    for (const sound of SURFACE_BASED_SFX_SOUNDS) {
      SurfaceBlockSearcher.subscribe((block) => {
        try {
          processBlock(block, sound);
        } catch (error) {
        }
      });
    }
  }
};

// data/scripts/sfx/shared/utils/has-players-nearby.ts
function hasPlayersNearby(location, dimension, maxDistance, minDistance) {
  return dimension.getPlayers({
    location,
    maxDistance,
    minDistance
  }).length > 0;
}

// data/scripts/sfx/special-cases/fog-croack.ts
import { system as system36, TicksPerSecond as TicksPerSecond22, world as world38 } from "@minecraft/server";

// data/scripts/sfx/shared/utils/try-get-oasis-water-block.ts
import { BlockVolume as BlockVolume2 } from "@minecraft/server";
function tryGetOasisWaterBlock(block) {
  const { typeId, dimension } = block;
  if (typeId === "minecraft:water") {
    const ray = dimension.getBlockFromRay(
      block,
      {
        x: 0,
        y: -1,
        z: 0
      },
      {
        includeLiquidBlocks: false,
        includeTypes: [`${GS_SEASON_NAMESPACE}:savannah_dirt`]
      }
    );
    return ray ? block : void 0;
  }
  if (typeId.startsWith(GS_SEASON_NAMESPACE) && typeId.includes("oasis_sand") || typeId === "minecraft:moss_block") {
    const volume = new BlockVolume2(
      {
        x: block.x + 3,
        y: block.y + 1,
        z: block.z + 3
      },
      {
        x: block.x - 3,
        y: block.y - 1,
        z: block.z - 3
      }
    );
    const waterBlocks = [
      ...block.dimension.getBlocks(volume, {
        includeTypes: ["minecraft:water"]
      }).getBlockLocationIterator()
    ];
    if (waterBlocks.length === 0) return;
    const waterBlock = block.dimension.getBlock(
      waterBlocks[Math.floor(Math.random() * (waterBlocks.length - 1))]
    );
    return waterBlock;
  }
}

// data/scripts/sfx/special-cases/fog-croack.ts
var FROG_CROACK_CONFIG = {
  interval: TicksPerSecond22 * 3,
  chance: 0.6,
  cooldownConfig: {
    soundId: "gs_season:frog_croak",
    maxDistance: 32,
    // It blocks the area for a certain amount of time
    // and allows us to switch the water block when the cooldown ends.
    coolDown: TicksPerSecond22 * 10
  }
};
var WATER_BLOCKS = /* @__PURE__ */ new Set();
SurfaceBlockSearcher.subscribe((block) => {
  try {
    const { typeId, location, dimension } = block;
    if (CooldownAreas.isInside(location, FROG_CROACK_CONFIG.cooldownConfig))
      return;
    let biome = CustomBiomeIdentifier.get(location, dimension) ?? BiomeIdentifier.get(location, dimension);
    if (!biome) {
      return;
    }
    if (biome === BIOMES.Desert) {
      const waterBlock = tryGetOasisWaterBlock(block);
      if (!waterBlock) return;
      block = waterBlock;
    } else if (biome === BIOMES.Plains && typeId === "minecraft:water") {
      const unsubscribe = SeasonCycle.subscribe((season) => {
        if (season !== SEASON_IDS.Spring) {
          WATER_BLOCKS.delete(block);
          unsubscribe();
        }
      });
    } else {
      return;
    }
    WATER_BLOCKS.add(block);
    CooldownAreas.add(block.location, FROG_CROACK_CONFIG.cooldownConfig);
  } catch (error) {
  }
});
system36.runInterval(() => {
  const time = world38.getTimeOfDay();
  if (time < 13e3 || time > 22e3) return;
  for (const block of WATER_BLOCKS) {
    try {
      if (!block.isValid()) {
        WATER_BLOCKS.delete(block);
        continue;
      }
      if (Math.random() > FROG_CROACK_CONFIG.chance) continue;
      const { location, dimension } = block;
      if (!CooldownAreas.isInside(location, FROG_CROACK_CONFIG.cooldownConfig)) {
        WATER_BLOCKS.delete(block);
        continue;
      }
      if (!hasPlayersNearby(location, dimension, 16)) continue;
      dimension.playSound("gs_season:frog_croak", location);
    } catch (error) {
      WATER_BLOCKS.delete(block);
    }
  }
}, FROG_CROACK_CONFIG.interval);

// data/scripts/sfx/special-cases/water-trickle.ts
import { system as system37, TicksPerSecond as TicksPerSecond23 } from "@minecraft/server";
var WATER_TRICKLE_CONFIG = {
  interval: TicksPerSecond23 * 20,
  chance: 1,
  cooldownConfig: {
    soundId: "gs_season:water_trickle",
    maxDistance: 16,
    // It blocks the area for a certain amount of time
    // and allows us to switch the water block when the cooldown ends.
    coolDown: TicksPerSecond23 * 30
  }
};
var WATER_BLOCKS2 = /* @__PURE__ */ new Set();
SurfaceBlockSearcher.subscribe((block) => {
  try {
    const { typeId, location, dimension } = block;
    if (CooldownAreas.isInside(location, WATER_TRICKLE_CONFIG.cooldownConfig))
      return;
    let biome = CustomBiomeIdentifier.get(location, dimension) ?? BiomeIdentifier.get(location, dimension);
    if (biome === BIOMES.Desert) {
      const waterBlock = tryGetOasisWaterBlock(block);
      if (!waterBlock) return;
      block = waterBlock;
    } else if (biome !== BIOMES.River || typeId !== "minecraft:water") {
      return;
    }
    WATER_BLOCKS2.add(block);
    CooldownAreas.add(block.location, WATER_TRICKLE_CONFIG.cooldownConfig);
  } catch (error) {
  }
});
system37.runInterval(() => {
  for (const block of WATER_BLOCKS2) {
    try {
      if (!block.isValid()) {
        WATER_BLOCKS2.delete(block);
        continue;
      }
      if (Math.random() > WATER_TRICKLE_CONFIG.chance) continue;
      const { location, dimension } = block;
      if (!CooldownAreas.isInside(location, WATER_TRICKLE_CONFIG.cooldownConfig)) {
        WATER_BLOCKS2.delete(block);
        continue;
      }
      if (!hasPlayersNearby(location, dimension, 16)) continue;
      dimension.playSound("gs_season:water_trickle", location);
    } catch (error) {
      WATER_BLOCKS2.delete(block);
    }
  }
}, WATER_TRICKLE_CONFIG.interval);

// data/scripts/sfx/main.ts
EntityBasedSFX.register({
  cycleInterval: TicksPerSecond24 * 5,
  sounds: [
    {
      soundId: "gs_season:wolf_howl",
      entityTypeId: "gs_season:gray_wolf",
      chance: 0.2,
      coolDown: TicksPerSecond24 * 30,
      maxDistance: 48,
      minDistance: 16,
      // Multiply volume to increase the sound distance
      volume: 3,
      filterCondition: () => isNight()
    },
    {
      soundId: "gs_season:owl_hoot",
      entityTypeId: "gs_season:snowy_owl",
      chance: 0.4,
      coolDown: TicksPerSecond24 * 15,
      maxDistance: 32,
      minDistance: 16,
      volume: 2
    },
    {
      soundId: "gs_season:elephant_trumpet",
      entityTypeId: "gs_season:elephant",
      chance: 0.2,
      coolDown: TicksPerSecond24 * 30,
      maxDistance: 48,
      minDistance: 16,
      volume: 3
    },
    {
      soundId: "gs_season:lion_roar",
      entityTypeId: "gs_season:lion",
      chance: 0.1,
      coolDown: TicksPerSecond24 * 30,
      maxDistance: 48,
      minDistance: 16,
      volume: 3
    },
    {
      soundId: "gs_season:baboon_chatter",
      entityTypeId: "gs_season:baboon",
      chance: 0.5,
      coolDown: TicksPerSecond24 * 15,
      maxDistance: 32,
      minDistance: 16,
      volume: 2,
      // Checking if there are other baboons around the entity
      // If there are, we can define it as a baboon spawn cluster
      filterCondition: (entity) => entity.dimension.getEntities({
        type: "gs_season:baboon",
        location: entity.location,
        maxDistance: 8
      }).length > 2
    },
    {
      soundId: "gs_season:footsteps_scurry",
      chance: 0.4,
      coolDown: TicksPerSecond24 * 15,
      maxDistance: 24,
      minDistance: 8,
      volume: 2,
      excludeEntityTypes: [
        "gs_season:elephant",
        "gs_season:black_bear",
        "gs_season:lion",
        "gs_season:red_deer",
        "gs_season:caribou",
        "gs_season:yak",
        "minecraft:polar_bear",
        "minecraft:panda",
        "minecraft:horse",
        "minecraft:donkey",
        "minecraft:iron_golem",
        "minecraft:ravager",
        "minecraft:phantom",
        "minecraft:parrot",
        "minecraft:bee"
      ],
      filterCondition: ({ location, dimension }) => {
        if (!isNight()) return false;
        const biome = BiomeIdentifier.get(location, dimension);
        return !!biome && (/* @__PURE__ */ new Set([
          BIOMES.Forest,
          BIOMES.Plains,
          BIOMES.BirchForest,
          BIOMES.FlowerForest,
          BIOMES.Taiga
        ])).has(biome);
      }
    }
  ]
});
PlayerBasedSFX.register({
  cycleInterval: TicksPerSecond24 * 5,
  sounds: [
    {
      soundId: "gs_season:gentle_breeze",
      seasons: [SEASON_IDS.Spring, SEASON_IDS.Autumn],
      chance: 1,
      maxDistance: 100,
      coolDown: TicksPerSecond24 * 19.5,
      filterCondition: () => isDay()
    },
    {
      soundId: "gs_season:birdsong_rich",
      seasons: [SEASON_IDS.Spring, SEASON_IDS.Summer],
      biome: [
        BIOMES.Forest,
        BIOMES.BirchForest,
        CUSTOM_BIOMES.Forest,
        CUSTOM_BIOMES.Aspen,
        CUSTOM_BIOMES.Jacaranda
      ],
      chance: 1,
      maxDistance: 60,
      coolDown: TicksPerSecond24 * 40,
      filterCondition: () => isDay()
    },
    {
      soundId: "gs_season:birdsong_light",
      seasons: [SEASON_IDS.Spring],
      biome: [BIOMES.Plains, BIOMES.Meadow],
      chance: 1,
      maxDistance: 60,
      coolDown: TicksPerSecond24 * 30,
      filterCondition: () => isMorning()
    },
    {
      soundId: "gs_season:warm_wind",
      seasons: [SEASON_IDS.Summer],
      biome: [BIOMES.Savanna, BIOMES.SavannaPlateau, CUSTOM_BIOMES.Savannah],
      chance: 1,
      coolDown: [TicksPerSecond24 * 30, TicksPerSecond24 * 60],
      filterCondition: () => isDay()
    },
    {
      soundId: "gs_season:leaves_rustling",
      seasons: [SEASON_IDS.Autumn],
      biome: [
        BIOMES.Forest,
        BIOMES.BirchForest,
        CUSTOM_BIOMES.Forest,
        CUSTOM_BIOMES.Aspen
      ],
      //   chance: 0.5,
      chance: 1,
      coolDown: TicksPerSecond24 * 25,
      filterCondition: () => {
        return WindIntensity.isIntense;
      }
    },
    {
      soundId: "gs_season:cold_gust",
      seasons: [SEASON_IDS.Winter],
      biome: [
        BIOMES.Taiga,
        BIOMES.ColdTaiga,
        BIOMES.IceMountains,
        BIOMES.FrozenPeaks,
        BIOMES.FrozenRiver,
        BIOMES.IcePlains,
        BIOMES.IceSpikes,
        CUSTOM_BIOMES.Tundra
      ],
      //   chance: 0.5,
      chance: 1,
      coolDown: TicksPerSecond24 * 20,
      filterCondition: () => WindIntensity.isIntense
    },
    {
      soundId: "gs_season:insect_buzz",
      seasons: [SEASON_IDS.Summer],
      biome: [
        BIOMES.Swampland,
        BIOMES.MangroveSwamp,
        BIOMES.Meadow,
        BIOMES.Savanna,
        BIOMES.SavannaPlateau,
        CUSTOM_BIOMES.Oasis,
        CUSTOM_BIOMES.Savannah
      ],
      //   chance: 0.5,
      chance: 1,
      coolDown: TicksPerSecond24 * 20,
      filterCondition: () => isDay()
    },
    {
      soundId: "gs_season:crickets_insects",
      seasons: [SEASON_IDS.Summer, SEASON_IDS.Autumn, SEASON_IDS.Spring],
      biome: [
        BIOMES.Plains,
        BIOMES.FlowerForest,
        BIOMES.Forest,
        BIOMES.BirchForest,
        BIOMES.Swampland,
        BIOMES.MangroveSwamp,
        BIOMES.Meadow,
        BIOMES.Jungle,
        BIOMES.JungleEdge,
        BIOMES.BambooJungle,
        BIOMES.RoofedForest,
        BIOMES.CherryGrove,
        BIOMES.Savanna,
        BIOMES.SavannaPlateau,
        CUSTOM_BIOMES.Oasis,
        CUSTOM_BIOMES.Savannah,
        CUSTOM_BIOMES.Forest,
        CUSTOM_BIOMES.Aspen,
        CUSTOM_BIOMES.Jacaranda
      ],
      chance: 1,
      coolDown: TicksPerSecond24 * 20,
      filterCondition: () => isNight()
    }
  ]
});
SurfaceBasedSFX.register({
  sounds: [
    {
      soundId: "gs_season:branch_creak",
      chance: 1,
      biomes: [CUSTOM_BIOMES.Tundra, CUSTOM_BIOMES.Aspen, BIOMES.Taiga],
      coolDown: TicksPerSecond24 * 15,
      maxDistance: 16,
      filterCondition: ({ block }) => {
        if (!WindIntensity.isIntense) return false;
        if (!block.typeId.includes("leaves")) return false;
        if (!hasPlayersNearby(block.location, block.dimension, 16))
          return false;
        return true;
      }
    },
    {
      soundId: "gs_season:ice_crack",
      chance: 1,
      seasons: [SEASON_IDS.Winter],
      biomes: [CUSTOM_BIOMES.Tundra, BIOMES.FrozenRiver, BIOMES.ColdTaiga],
      coolDown: [TicksPerSecond24 * 60, TicksPerSecond24 * 120],
      maxDistance: 16,
      filterCondition: ({ block }) => {
        return hasPlayersNearby(block.location, block.dimension, 16);
      }
    },
    {
      soundId: "gs_season:owl_hoot",
      chance: 0.5,
      seasons: [SEASON_IDS.Winter],
      biomes: [CUSTOM_BIOMES.Oasis],
      coolDown: [TicksPerSecond24 * 45, TicksPerSecond24 * 90],
      maxDistance: 16,
      filterCondition: ({ block }) => {
        return isNight() && hasPlayersNearby(block.location, block.dimension, 16);
      }
    },
    {
      soundId: "gs_season:hyena_laugh",
      chance: 0.1,
      biomes: [BIOMES.Savanna, CUSTOM_BIOMES.Savannah],
      coolDown: [TicksPerSecond24 * 45, TicksPerSecond24 * 90],
      maxDistance: 32,
      filterCondition: ({ block }) => {
        const { location, dimension } = block;
        if (BiomeIdentifier.get(location, dimension) !== BIOMES.Savanna)
          return false;
        return hasPlayersNearby(location, dimension, 24, 12);
      }
    }
  ]
});

// data/scripts/player/first-biome-entry.ts
import { system as system38, world as world40 } from "@minecraft/server";
var BIOME_MESSAGES = {
  [CUSTOM_BIOMES.Aspen]: {
    message: [
      "\n",
      "\xA7lYou just discovered the \xA7eAspen Forest\xA7f!\xA7r",
      "\xA77Here, you'll find these animals:",
      "- Red Deer",
      "- Raccoon",
      "- Squirrel",
      "- Bird",
      "- Butterfly",
      "- Snail",
      "\n"
    ].join("\n"),
    tag: `gs_season:discovered_${CUSTOM_BIOMES.Aspen}`
  },
  [CUSTOM_BIOMES.Forest]: {
    message: [
      "\n",
      "\xA7lYou just discovered the \xA7aDeciduous Forest\xA7f!\xA7r",
      "\xA77Here, you'll find these animals:",
      "- Red Deer",
      "- Raccoon",
      "- Squirrel",
      "- Bird",
      "- Butterfly",
      "\n"
    ].join("\n"),
    tag: `gs_season:discovered_${CUSTOM_BIOMES.Forest}`
  },
  [CUSTOM_BIOMES.Redwood]: {
    message: [
      "\n",
      "\xA7lYou just discovered the \xA7cRedwood Forest\xA7f!\xA7r",
      "\xA77Here, you'll find these animals:",
      "- Black Bear",
      "- Gray Wolf",
      "- Raccoon",
      "- Squirrel",
      "- Bird",
      "\n"
    ].join("\n"),
    tag: `gs_season:discovered_${CUSTOM_BIOMES.Redwood}`
  },
  [CUSTOM_BIOMES.Jacaranda]: {
    message: [
      "\n",
      "\xA7lYou just discovered the \xA75Jacaranda Forest\xA7f!\xA7r",
      "\xA77Here, you'll find these animals:",
      "- Chinchilla",
      "- Raccoon",
      "- Squirrel",
      "- Bird",
      "- Butterfly",
      "- Snail",
      "\n"
    ].join("\n"),
    tag: `gs_season:discovered_${CUSTOM_BIOMES.Jacaranda}`
  },
  [CUSTOM_BIOMES.Plains]: {
    message: [
      "\n",
      "\xA7lYou just discovered the \xA7ePlains\xA7f!\xA7r",
      "\xA77Here, you'll find these animals:",
      "- Red Deer",
      "- Squirrel",
      "- Bird",
      "- Zebra",
      "- Lizard",
      "- Marmot",
      "\n"
    ].join("\n"),
    tag: `gs_season:discovered_${CUSTOM_BIOMES.Plains}`
  },
  [CUSTOM_BIOMES.Savannah]: {
    message: [
      "\n",
      "\xA7lYou just discovered the \xA76Savannah\xA7f!\xA7r",
      "\xA77Here, you'll find these animals:",
      "- Zebra",
      "- Cheetah",
      "- Baboon",
      "- Warthog",
      "- Tockus",
      "- Elephant",
      "- Lion",
      "\n"
    ].join("\n"),
    tag: `gs_season:discovered_${CUSTOM_BIOMES.Savannah}`
  },
  [CUSTOM_BIOMES.Tundra]: {
    message: [
      "\n",
      "\xA7lYou just discovered the \xA7bTundra\xA7f!\xA7r",
      "\xA77Here, you'll find these animals:",
      "- Yak",
      "- Caribou",
      "- Snowy Owl",
      "- Gray Wolf",
      "\n"
    ].join("\n"),
    tag: `gs_season:discovered_${CUSTOM_BIOMES.Tundra}`
  },
  [CUSTOM_BIOMES.ScarletLush]: {
    message: [
      "\n",
      "\xA7lYou just discovered the \xA7cScarlet Lush Caves\xA7f!\xA7r",
      "\xA77Here, you'll find these animals:",
      "- Lizard",
      "- Butterfly",
      "\n"
    ].join("\n"),
    tag: `gs_season:discovered_${CUSTOM_BIOMES.ScarletLush}`
  },
  [CUSTOM_BIOMES.Scarlet]: {
    message: [
      "\n",
      "\xA7lYou just discovered the \xA7cScarlet Dripstone Caves\xA7f!\xA7r",
      "\xA77Here, you'll find these animals:",
      "- Lizard",
      "- Butterfly",
      "\n"
    ].join("\n"),
    tag: `gs_season:discovered_${CUSTOM_BIOMES.Scarlet}`
  },
  [CUSTOM_BIOMES.Oasis]: {
    message: [
      "\n",
      "\xA7lYou are in an \xA7eOasis\xA7f!\xA7r",
      "\xA77Here, you'll find these animals:",
      "- Lizard",
      "\n"
    ].join("\n"),
    tag: `gs_season:discovered_${CUSTOM_BIOMES.Oasis}`
  }
};
var ALL_BIOME_TAGS = new Set(
  Object.values(BIOME_MESSAGES).map(({ tag }) => tag)
);
async function processPlayers(players) {
  for (const player of players) {
    try {
      const biome = await CustomBiomeIdentifier.getFromLocation(
        player.location,
        player.dimension
      );
      if (!biome || player.hasTag(BIOME_MESSAGES[biome].tag)) continue;
      player.addTag(BIOME_MESSAGES[biome].tag);
      player.sendMessage(BIOME_MESSAGES[biome].message);
      if (player.getTags().every((tag) => ALL_BIOME_TAGS.has(tag))) {
        player.addTag("gs_season.discovered_all_biomes");
      }
    } catch {
    }
  }
}
WorldLoad.subscribe(() => {
  system38.runInterval(() => {
    const showBiomeMessages = getSetting(CHAT_SETTING_IDS.ShowBiomeMessages);
    if (!showBiomeMessages) return;
    const players = world40.getPlayers({
      excludeTags: ["gs_season.discovered_all_biomes"]
    });
    if (players.length) processPlayers(players);
  }, 10);
});

// data/scripts/index.ts
import { world as world41, ItemStack as ItemStack11, system as system39 } from "@minecraft/server";
world41.afterEvents.playerSpawn.subscribe(({ player }) => {
  if (player.hasTag("gs_season.guide_book")) return;
  WorldLoad.subscribe(() => {
    const container = player.getComponent("minecraft:inventory")?.container;
    if (!container) return;
    const { dimension, location } = player;
    location.y += 1;
    let { emptySlotsCount } = container;
    const guideBook = new ItemStack11("gs_season:guide_book", 1);
    if (emptySlotsCount > 0) {
      container.addItem(guideBook);
      emptySlotsCount--;
    } else {
      dimension.spawnItem(guideBook, location);
    }
    const settings = new ItemStack11("gs_season:settings", 1);
    if (emptySlotsCount > 0) {
      container.addItem(settings);
      emptySlotsCount--;
    } else {
      dimension.spawnItem(settings, location);
    }
    const season_clock = new ItemStack11("gs_season:season_clock_item", 1);
    if (emptySlotsCount > 0) {
      container.addItem(season_clock);
      emptySlotsCount--;
    } else {
      dimension.spawnItem(season_clock, location);
    }
    player.addTag("gs_season.guide_book");
  });
});
world41.afterEvents.playerSpawn.subscribe(({ player }) => {
  const welcomeMessage = getSetting(CHAT_SETTING_IDS.WelcomeMessage);
  if (!welcomeMessage) return;
  WorldLoad.subscribe(() => {
    system39.runTimeout(() => {
      player.sendMessage("\xA76\xA7l\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501");
      player.sendMessage("");
      player.sendMessage("\xA7e\xA7lWelcome to Seasons Add-On!");
      player.sendMessage("");
      player.sendMessage(
        "\xA77If you don't see your \xA7aGuide Book\xA77, \xA7bSettings Wheel\xA77, or \xA7dSeason Compass\xA77 in your inventory, just reload the game, they'll be waiting for you!"
      );
      player.sendMessage("");
      player.sendMessage(
        "\xA77Action & Stuff compatibility is now \xA7aenabled\xA77 on all our custom tools, and will soon arrive for blocks too."
      );
      player.sendMessage("");
      player.sendMessage(
        "\xA77RealismCraft support is \xA7afully functional\xA77! For the best visuals, go to \xA7eRealismCraft > VFX Settings > Sky > Clouds: OFF"
      );
      player.sendMessage("");
      player.sendMessage(
        "\xA7aRecommended Render Distance\xA77: play with \xA7e6-8\xA77 chunks for the best performance and experience!"
      );
      player.sendMessage("");
      player.sendMessage("\xA76\xA7l\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501");
    }, 20);
  });
});
WorldLoad.subscribe(() => {
  const time = 6e3;
  const tips = [
    "\xA7eTip: \xA77Farm Corns to make our custom animals breed in Seasons!",
    "\xA7eNeed Wool? \xA77You can actually craft it from Cotton too!",
    "\xA7eTip: \xA77Out of Sugar Canes? You can use Figs to get Sugar instead!",
    "\xA7eHave you tried dropping a Fig to a Monkey yet?\xA77 It's an interesting way to gather rare materials!"
  ];
  let currentTipIndex = 0;
  system39.runInterval(() => {
    const showTips = getSetting(CHAT_SETTING_IDS.Tips);
    if (!showTips) return;
    const players = world41.getAllPlayers();
    if (players.length === 0) return;
    const tip = tips[currentTipIndex];
    for (const player of players) {
      try {
        player.sendMessage("");
        player.sendMessage(tip);
        player.sendMessage("");
      } catch (error) {
        continue;
      }
    }
    currentTipIndex = (currentTipIndex + 1) % tips.length;
  }, time);
});
