Script API - v26.60
    Preparing search index...

    Class BiomeTypes

    Supports a catalog of available biome types registered within Minecraft.

    export class BiomeTypes {
    private constructor();
    static get(typeName: string): BiomeType | undefined;
    static getAll(): BiomeType[];
    }
    Index
    • Parameters

      • typeName: string

        Identifier of the biome. Generally, namespaced identifiers (e.g., minecraft:frozen_peaks) should be used.

      Returns BiomeType | undefined

      If the biome exists, a BiomeType object is returned. If not, undefined is returned.

      Returns a specific biome type.

      This function can't be called in early-execution mode.

      import { BiomeTypes, Player, system } from "@minecraft/server";

      // Run `/scriptevent example:findbiome` in chat to locate the nearest plains biome.
      system.afterEvents.scriptEventReceive.subscribe(({ id, sourceEntity }) => {
      if (id !== "example:findbiome" || !(sourceEntity instanceof Player)) return;

      const biomeType = BiomeTypes.get("minecraft:plains");
      if (!biomeType) return;

      const searchOptions = {
      boundingSize: { x: 100, y: 100, z: 100 },
      };
      const biomeLocation = sourceEntity.dimension.calculateClosestBiomeFromSeed(
      sourceEntity.location,
      biomeType,
      searchOptions,
      );

      if (biomeLocation) {
      sourceEntity.sendMessage(
      `Found '${biomeType.id}' at ${biomeLocation.x}, ${biomeLocation.y}, ${biomeLocation.z}.`,
      );
      } else {
      sourceEntity.sendMessage(`Biome '${biomeType.id}' was not found within 100 blocks.`);
      }
      });
    • Returns BiomeType[]

      Returns all registered biome types within Minecraft

      This function can't be called in early-execution mode.

      import { BiomeTypes, Player, system } from "@minecraft/server";

      // Run `/scriptevent example:listbiomes` in chat to list registered biome IDs.
      system.afterEvents.scriptEventReceive.subscribe(({ id, sourceEntity }) => {
      if (id !== "example:listbiomes" || !(sourceEntity instanceof Player)) return;

      const biomeIds = BiomeTypes.getAll().map((biomeType) => biomeType.id);
      sourceEntity.sendMessage(`Biomes (${biomeIds.length}): ${biomeIds.slice(0, 10).join(", ")}`);
      });