You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
West: "West" - Returns @minecraft/server.Block to the west (x - 1).
Block Class
Date: 06/11/2025
Description: Represents a block in a dimension at unique X, Y, Z coordinates. Updated significantly in version 1.17.10.21.
Properties
dimension: read-only Dimension - Dimension of the block.
isAir: read-only boolean - True if block is air (empty space). Throws LocationInUnloadedChunkError, LocationOutOfWorldBoundariesError.
isLiquid: read-only boolean - True if block is liquid (e.g., water, lava). Throws LocationInUnloadedChunkError, LocationOutOfWorldBoundariesError.
isValid: read-only boolean - True if block reference is valid.
isWaterlogged: read-only boolean - True if block has water. Throws LocationInUnloadedChunkError, LocationOutOfWorldBoundariesError.
localizationKey: read-only string - Localization key for block name in .lang files. Throws LocationInUnloadedChunkError, LocationOutOfWorldBoundariesError.
bottomCenter(): Vector3 - Returns center of block on X, Z axis.
canBeDestroyedByLiquidSpread(liquidType: LiquidType): boolean - Checks if block is removed by liquid. Throws Error, LocationInUnloadedChunkError, LocationOutOfWorldBoundariesError.
canContainLiquid(liquidType: LiquidType): boolean - Checks if block can be waterlogged. Throws Error, LocationInUnloadedChunkError, LocationOutOfWorldBoundariesError.
center(): Vector3 - Returns center of block on X, Y, Z axis.
east(steps?: number): Block | undefined - Returns block to east (X+). Throws LocationInUnloadedChunkError, LocationOutOfWorldBoundariesError.
setPermutation(permutation: BlockPermutation): void - Sets block state. Not allowed in read-only mode. Throws LocationInUnloadedChunkError, LocationOutOfWorldBoundariesError.
setType(blockType: BlockType | string): void - Sets block type. Not allowed in read-only mode. Throws Error, LocationInUnloadedChunkError, LocationOutOfWorldBoundariesError.
setWaterlogged(isWaterlogged: boolean): void - Sets waterlogged state. Not allowed in read-only mode. Throws Error, LocationInUnloadedChunkError, LocationOutOfWorldBoundariesError.
south(steps?: number): Block | undefined - Returns block to south (Z+). Throws LocationInUnloadedChunkError, LocationOutOfWorldBoundariesError.
west(steps?: number): Block | undefined - Returns block to west (X-). Throws LocationInUnloadedChunkError, LocationOutOfWorldBoundariesError.
Example
import{DimensionLocation}from"@minecraft/server";functioncheckBlockTags(log: (message: string,status?: number)=>void,targetLocation: DimensionLocation){constblock=targetLocation.dimension.getBlock(targetLocation);if(block){log(`Block is dirt: ${block.hasTag("dirt")}`);log(`Block is wood: ${block.hasTag("wood")}`);log(`Block is stone: ${block.hasTag("stone")}`);}}
BlockPermutation Class
Date: 04/09/2025
Description: Contains the combination of type @minecraft/server.BlockType and properties (block state) describing a block, but not tied to a specific @minecraft/server.Block.
Properties
type: read-only BlockType - The @minecraft/server.BlockType of the permutation.
Methods
canBeDestroyedByLiquidSpread(liquidType: LiquidType): boolean - Checks if block is removed by liquid. Throws errors.
canContainLiquid(liquidType: LiquidType): boolean - Checks if block can be waterlogged. Throws errors.
getAllStates(): Record<string, boolean | number | string> - Returns all block states of the permutation.
import{BlockPermutation,DimensionLocation}from"@minecraft/server";import{Vector3Utils}from"@minecraft/math";import{MinecraftBlockTypes}from"@minecraft/vanilla-data";functionaddBlockColorCube(targetLocation: DimensionLocation){constallWoolBlocks: string[]=[MinecraftBlockTypes.WhiteWool,MinecraftBlockTypes.OrangeWool,MinecraftBlockTypes.MagentaWool,MinecraftBlockTypes.LightBlueWool,MinecraftBlockTypes.YellowWool,MinecraftBlockTypes.LimeWool,MinecraftBlockTypes.PinkWool,MinecraftBlockTypes.GrayWool,MinecraftBlockTypes.LightGrayWool,MinecraftBlockTypes.CyanWool,MinecraftBlockTypes.PurpleWool,MinecraftBlockTypes.BlueWool,MinecraftBlockTypes.BrownWool,MinecraftBlockTypes.GreenWool,MinecraftBlockTypes.RedWool,MinecraftBlockTypes.BlackWool,];constcubeDim=7;letcolorIndex=0;for(letx=0;x<=cubeDim;x++){for(lety=0;y<=cubeDim;y++){for(letz=0;z<=cubeDim;z++){colorIndex++;targetLocation.dimension.getBlock(Vector3Utils.add(targetLocation,{ x, y, z }))?.setPermutation(BlockPermutation.resolve(allWoolBlocks[colorIndex%allWoolBlocks.length]));}}}}
import{world,BlockPermutation,BlockSignComponent,BlockComponentTypes,DimensionLocation}from"@minecraft/server";import{MinecraftBlockTypes}from"@minecraft/vanilla-data";functionaddTranslatedSign(log: (message: string,status?: number)=>void,targetLocation: DimensionLocation){constplayers=world.getPlayers();constdim=players[0].dimension;constsignBlock=dim.getBlock(targetLocation);if(!signBlock){log("Could not find a block at specified location.");return-1;}constsignPerm=BlockPermutation.resolve(MinecraftBlockTypes.StandingSign,{ground_sign_direction: 8});signBlock.setPermutation(signPerm);constsignComponent=signBlock.getComponent(BlockComponentTypes.Sign)asBlockSignComponent;signComponent?.setText({translate: "item.skull.player.name",with: [players[0].name]});}
BlockStates Class
Date: 02/10/2025
Description: Enumerates all @minecraft/server.BlockStateTypes.
Methods
get(stateName: string): BlockStateType | undefined - Retrieves specific block state.
getAll(): BlockStateType[] - Retrieves all block states.
Dimension Class
Date: 07/02/2025
Description: Represents a dimension (e.g., The End).
getPlayers(options?: EntityQueryOptions): Player[] - Returns players based on filter. Throws CommandError, InvalidArgumentError.
getTopmostBlock(locationXZ: VectorXZ, minHeight?: number): Block | undefined - Returns highest block at XZ. Not allowed in read-only mode. Throws errors.
placeFeature(featureName: string, location: Vector3, shouldThrow?: boolean): boolean - Places feature. Not allowed in read-only mode. Throws Error, InvalidArgumentError, LocationInUnloadedChunkError.
placeFeatureRule(featureRuleName: string, location: Vector3): boolean - Places feature rule. Not allowed in read-only mode. Throws InvalidArgumentError, LocationInUnloadedChunkError.
playSound(soundId: string, location: Vector3, soundOptions?: WorldSoundOptions): void - Plays sound for all players. Not allowed in read-only mode. Throws PropertyOutOfBoundsError.
runCommand(commandString: string): CommandResult - Runs command synchronously. Not allowed in read-only mode. Throws CommandError.
setBlockPermutation(location: Vector3, permutation: BlockPermutation): void - Sets block permutation. Not allowed in read-only mode. Throws LocationInUnloadedChunkError, LocationOutOfWorldBoundariesError.
setBlockType(location: Vector3, blockType: BlockType | string): void - Sets block type. Not allowed in read-only mode. Throws Error, LocationInUnloadedChunkError, LocationOutOfWorldBoundariesError.
setWeather(weatherType: WeatherType, duration?: number): void - Sets weather. Not allowed in read-only mode. Throws errors.
spawnItem(itemStack: ItemStack, location: Vector3): Entity - Spawns item stack as entity. Not allowed in read-only mode. Throws LocationInUnloadedChunkError, LocationOutOfWorldBoundariesError.
spawnParticle(effectName: string, location: Vector3, molangVariables?: MolangVariableMap): void - Spawns particle. Not allowed in read-only mode. Throws LocationInUnloadedChunkError, LocationOutOfWorldBoundariesError.
Examples
import{DimensionLocation}from"@minecraft/server";functioncreateExplosion(log: (message: string,status?: number)=>void,targetLocation: DimensionLocation){log("Creating an explosion of radius 10.");targetLocation.dimension.createExplosion(targetLocation,10);}
Effect Class
Date: 06/11/2025
Description: Represents an effect (e.g., poison) on an entity.
Properties
amplifier: read-only number - Effect amplifier (0-4). Throws errors.
hasComponent(componentId: string): boolean - Checks for component. Throws InvalidEntityError.
hasTag(tag: string): boolean - Checks for tag. Throws InvalidEntityError.
kill(): boolean - Kills entity. Not allowed in read-only mode. Throws InvalidEntityError.
lookAt(targetLocation: Vector3): void - Sets rotation to face location. Not allowed in read-only mode. Throws InvalidEntityError, UnsupportedFunctionalityError.
playAnimation(animationName: string, options?: PlayAnimationOptions): void - Plays animation. Not allowed in read-only mode. Throws InvalidEntityError.
remove(): void - Removes entity. Not allowed in read-only mode. Throws InvalidEntityError, UnsupportedFunctionalityError.
removeEffect(effectType: EffectType | string): boolean - Removes effect. Not allowed in read-only mode. Throws InvalidArgumentError, InvalidEntityError.
removeTag(tag: string): boolean - Removes tag. Not allowed in read-only mode. Throws InvalidEntityError.
resetProperty(identifier: string): boolean | number | string - Resets property. Not allowed in read-only mode. Throws EngineError, Error, InvalidEntityError.
runCommand(commandString: string): CommandResult - Runs command. Not allowed in read-only mode. Throws CommandError, InvalidEntityError.
matches(itemName: string, states?: Record<string, boolean | number | string>): boolean - Checks if item matches.
setCanDestroy(blockIdentifiers?: string[]): void - Sets block types item can break. Not allowed in read-only mode. Throws if identifiers invalid.
setCanPlaceOn(blockIdentifiers?: string[]): void - Sets block types item can be placed on. Not allowed in read-only mode. Throws if identifiers invalid.