@minecraft/server as Basalt provides it: the part of Mojang's Script API (2.x) that Basalt binds, with Mojang's names and shapes, plus a few Basalt additions marked as such.
@minecraft/server as Basalt provides it: the part of Mojang’s Script API (2.x) that Basalt
binds, with Mojang’s names and shapes, plus a few Basalt additions marked as such.
Reads such as Player.location or Dimension.getBlock ask the server and wait for
its answer. In a before event or command the server itself waits on, a read the waiting thread
would have to answer can’t be waited for: the world can’t be read in block and mob before
events, and a player is read as the plugin last saw them in player before events and commands
(a first read there throws). Read in system.run instead when that matters.
import { world } from '@minecraft/server';Categories
Section titled “Categories”Constants
Section titled “Constants”EnchantmentTypes
Section titled “EnchantmentTypes”const EnchantmentTypes: { get(enchantmentId: string): EnchantmentType | undefined; getAll(): EnchantmentType[];};Every enchantment the server knows.
TicksPerSecond
Section titled “TicksPerSecond”const TicksPerSecond = 20;Ticks in a second.
TicksPerDay
Section titled “TicksPerDay”const TicksPerDay = 24000;Ticks in a Minecraft day.
EffectTypes
Section titled “EffectTypes”const EffectTypes: { /** The effect type for a name, or undefined for an empty one. */ get(name: string): EffectType | undefined; /** PARITY-RISK: Basalt keeps no enumerable effect registry; returns nothing. */ getAll(): EffectType[];};The effect registry.
EntityTypes
Section titled “EntityTypes”const EntityTypes: { get(name: string): EntityType | undefined; getAll(): EntityType[];};The entity-type registry.
ItemTypes
Section titled “ItemTypes”const ItemTypes: { get(name: string): ItemType | undefined; getAll(): ItemType[];};The item-type registry.
BlockTypes
Section titled “BlockTypes”const BlockTypes: { get(name: string): BlockType | undefined; getAll(): BlockType[];};The block-type registry.
MinecraftDimensionTypes
Section titled “MinecraftDimensionTypes”const MinecraftDimensionTypes: { readonly overworld: "minecraft:overworld"; readonly nether: "minecraft:nether"; readonly theEnd: "minecraft:the_end"; readonly Overworld: "minecraft:overworld"; readonly Nether: "minecraft:nether"; readonly TheEnd: "minecraft:the_end";};The dimension ids, as the legacy @minecraft/server exposed them.
const world: World;system
Section titled “system”const system: System;server
Section titled “server”const server: Server;Basalt’s own.
HudElementsCount
Section titled “HudElementsCount”const HudElementsCount = 13;HudVisibilityCount
Section titled “HudVisibilityCount”const HudVisibilityCount = 2;MoonPhaseCount
Section titled “MoonPhaseCount”const MoonPhaseCount = 8;