Token导航 LogoToken导航TokenDH.com
研究检索执行命令github未标认证来源可访问许可证需确认审计通过

minecraft-server-scriptapi我的世界服务器脚本 API

Agent Skill

minecraft-server-scriptapi 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

685

周安装

28

GitHub Stars

1

下载量

220
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:minecraft-server-scriptapi(我的世界服务器脚本 API)
来源仓库:https://github.com/kaaariyaaa/scriptapiserverskill
仓库路径:skills/minecraft-server-scriptapi
安装命令:
npx skills add https://github.com/kaaariyaaa/scriptapiserverskill --skill minecraft-server-scriptapi
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/kaaariyaaa/scriptapiserverskill --skill minecraft-server-scriptapi

简介

用于 Minecraft 服务器脚本 API 的使用指南和示例查找。

  • 可获取命令执行、事件监听和数据操作接口说明。
  • 需匹配服务器类型和脚本语言环境。
  • 调用 API 前应确认权限和安全性设置。
  • minecraft-server-scriptapi 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Minecraft Server ScriptAPI

Workflow

  1. Scope: Identify task (events, entities, components, commands, timing). Default to latest stable version unless beta/preview requested.
  2. Docs: Navigate from module index to specific class/interface/event. Use Microsoft Learn as source of truth. Search via MCP when details missing.
  3. Output: Quote exact API names. Provide minimal working example with required imports. Verify no official equivalent exists before creating custom helpers.

- For enums like CustomCommandParamType, always check Microsoft Learn to confirm availability. - @minecraft/vanilla-data is not on Microsoft Learn, so skip MCP searches for those enums.

Common patterns

Events

  • Subscribe/unsubscribe on world/system events. Guard logic for performance.

Dimensions

  • Use world.getDimension(MinecraftDimensionTypes.<Dimension>) and pick the appropriate dimension for the task.

Components

  • Check existence before access.
  • Use typed IDs: EntityComponentTypes, BlockComponentTypes, ItemComponentTypes.

Scheduling

  • Use system.run, system.runTimeout, system.runInterval, system.runJob.

Identifiers

  • MUST use @minecraft/vanilla-data enums: MinecraftBlockTypes, MinecraftEntityTypes, MinecraftItemTypes, MinecraftDimensionTypes, MinecraftEffectTypes, potionEffect, potionDelivery, feature, enchantment, cooldownCategory, cameraPresets, biome.
  • Custom IDs: Must include namespace prefix (e.g., example:cmd). One consistent prefix per addon.

Example:

import { world, system } from "@minecraft/server";
import { MinecraftDimensionTypes, MinecraftBlockTypes } from "@minecraft/vanilla-data";

system.runInterval(() => {
  const dimensions = [MinecraftDimensionTypes.Overworld, MinecraftDimensionTypes.Nether];
  const blocks = [MinecraftBlockTypes.Stone, MinecraftBlockTypes.Sand, MinecraftBlockTypes.GrassBlock];
  for (const dimension of dimensions) {
    for (const block of blocks) {
      world.getDimension(dimension).setBlockType({ x: 0, y: 0, z: 0 }, block);
    }
  }
});

Permission modes

Read-only

  • Before simulation/events/tick start. No world mutations.
  • Fix: defer to system.run/runTimeout/runJob.

Doc verification

  • When using any method/property, always check Microsoft Learn to confirm whether it is read-only safe or early-execution safe.
  • Look for explicit notes in the API reference (read-only / early-execution) and follow them strictly.
  • For arrow-function callbacks only, also check for restricted-execution notes like:

- "This closure is called with restricted-execution privilege." - "This function can't be called in restricted-execution mode."

  • If a restricted-execution note applies, review the arrow-function body to ensure no read-only or early-execution violations; defer with system.run if needed.

Example (read-only deferral):

world.beforeEvents.playerInteractWithBlock.subscribe((event) => {
  const player = event.player;
  system.run(() => {
    player.runCommand("say ok");
  });
});

Early-execution

  • Before world loads. Many APIs unavailable.
  • Fix: defer to world.afterEvents.worldLoad or system.run.
  • Subscribe at root to avoid missing events.

Safe in early-execution:

  • Event subscriptions (world/system beforeEvents/afterEvents)
  • system.clearJob, clearRun, run, runInterval, runJob, runTimeout, waitTicks
  • BlockComponentRegistry.registerCustomComponent, ItemComponentRegistry.registerCustomComponent

Custom commands

  • Interface: CustomCommand (name, description, permissionLevel, mandatoryParameters, optionalParameters).
  • Parameters: CustomCommandParameter (name, type, optional enumName).
  • Param types and arrow-function argument types:

- String -> String - PlayerSelector -> Player - Location -> Vector3 - ItemType -> ItemType - Integer -> Number - Float -> Number - Enum -> String - EntityType -> EntityType - EntitySelector -> Entity - Boolean -> Bool - BlockType -> BlockType

  • Register enums: CustomCommandRegistry.registerEnum(name, values).
  • Register cmd: CustomCommandRegistry.registerCommand(customCommand, callback).
  • Callback: (origin,...args) => CustomCommandResult.
  • Custom command callbacks run with restricted-execution privileges, so do not call read-only-restricted methods directly; defer with system.run if needed.
  • When using an arrow function, align parameter names and order with the CustomCommandParameter.name list; avoid mismatched names or generic args when parameters are defined.

Example:

import {
  system,
  StartupEvent,
  CommandPermissionLevel,
  CustomCommandParamType,
  CustomCommandStatus,
} from "@minecraft/server";

system.beforeEvents.startup.subscribe((init: StartupEvent) => {
  init.customCommandRegistry.registerEnum("example:mode", ["on", "off"]);

  init.customCommandRegistry.registerCommand(
    {
      name: "example:demo",
      description: "Command demo",
      permissionLevel: CommandPermissionLevel.GameDirectors,
      cheatsRequired: true,
      mandatoryParameters: [
        {  type: CustomCommandParamType.String, name: "msg", },
        {  type: CustomCommandParamType.Enum, name: "example:mode"},
      ],
      optionalParameters: [
        { type: CustomCommandParamType.Boolean, name: "silent" },
        { type: CustomCommandParamType.Integer, name: "count" },
      ],
    },
    (origin, msg, mode, silent, count) => {
      const msgValue = String(msg ?? "ok");
      const modeValue = String(mode ?? "off");
      const silentValue = Boolean(silent ?? false);
      const countValue = Number(count ?? 1);

      return {
        status: CustomCommandStatus.Success,
        message: silentValue
          ? undefined
          : `[${origin.sourceType}] ${msgValue} mode=${modeValue} count=${countValue}`,
      };
    }
  );
});

Script events

  • Send: system.sendScriptEvent(id, message) (namespaced ID, payload string).
  • Receive: system.afterEvents.scriptEventReceive.subscribe(callback, options?).
  • Event: ScriptEventCommandMessageAfterEvent (id, message, sourceType, optional sourceEntity/sourceBlock/initiator).
  • Filter: ScriptEventMessageFilterOptions.namespaces.

Example:

import { system, world, ScriptEventSource } from "@minecraft/server";

system.afterEvents.scriptEventReceive.subscribe((event) => {
  const { id, message, sourceType, initiator, sourceEntity, sourceBlock } = event;
  if (id !== "example:say") return;

  switch (sourceType) {
    case ScriptEventSource.Block:
      world.sendMessage(`sendBy:${sourceBlock?.typeId ?? "unknown"} ${message}`);
      break;
    case ScriptEventSource.Entity:
      world.sendMessage(`sendBy:${sourceEntity?.typeId ?? "unknown"} ${message}`);
      break;
    case ScriptEventSource.NPCDialogue:
      world.sendMessage(`sendBy:${initiator?.typeId ?? "unknown"} ${message}`);
      break;
    case ScriptEventSource.Server:
      world.sendMessage(`sendBy:server ${message}`);
      break;
  }
});

Performance

  • Expensive work in events: use system.runJob(generator) to spread across ticks.
  • Short-circuit before iterating large sets.

system.run variants

  • run: next tick.
  • runTimeout(cb, ticks): delay N ticks. 0 can cause tight loops if misused.
  • runInterval(cb, ticks): repeat every N ticks until clearRun.
  • runJob(generator): long-running work. Keep iterations small.

Type safety

  • Use typeId checks and verify component existence.
  • instanceof only for documented @minecraft/server classes.

Minimal templates

Event subscription:

world.afterEvents.playerJoin.subscribe((event) => {
  const player = event.player;
});

Tick loop:

system.runInterval(() => {
  // tick logic
}, 1);

Get dimension:

const overworld = world.getDimension(MinecraftDimensionTypes.Overworld);

Spawn entity:

const overworld = world.getDimension(MinecraftDimensionTypes.Overworld);
overworld.spawnEntity(MinecraftEntityTypes.Zombie, { x: 0, y: 80, z: 0 });

Give item:

const item = new ItemStack(MinecraftItemTypes.Diamond, 1);
player.getComponent("inventory")?.container?.addItem(item);

Apply effect:

player.addEffect(MinecraftEffectTypes.Speed, 200, { amplifier: 1 });

Get component (typed):

const health = entity.getComponent(EntityComponentTypes.Health);

Pitfalls

  • Null components: Check existence before access.
  • Heavy events: Use system.runJob.
  • Permissions: Avoid read-only/early-execution violations.
  • Raw IDs: Use typed enums.
  • Namespaces: One consistent prefix per addon.

MCP tools

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

34.26%
按下载量换算75

Claude

34.12%
按下载量换算75

Cursor

18.11%
按下载量换算40

Gemini CLI

10.48%
按下载量换算23

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

执行命令

安装流程涉及命令执行,可能通过 npx skills add https://github.com/kaaariyaaa/scriptapiserverskill --skill minecraft-server-scriptapi 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills