PrivateconstructorStaticgetIdentifier of the biome. Generally, namespaced identifiers (e.g., minecraft:frozen_peaks) should be used.
If the biome exists, a BiomeType object is returned. If not, undefined is returned.
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.`);
}
});
StaticgetThis 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(", ")}`);
});
Supports a catalog of available biome types registered within Minecraft.
Source