ReadonlyidThis property can't be read 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.`);
}
});
This function can't be called in early-execution mode.
The list of tags to check against the biome.
This function can't be called in early-execution mode.
Describes a type of biome.
Source