feat: create mod support
This commit is contained in:
Binary file not shown.
@@ -304,12 +304,13 @@ async def teleport(x: float, y: float, z: float) -> str:
|
||||
|
||||
|
||||
@mcp.tool()
|
||||
async def place_block(x: int, y: int, z: int, block_type: str) -> str:
|
||||
async def place_block(x: int, y: int, z: int, block_type: str, properties: dict | None = None) -> str:
|
||||
"""Place a block at the given coordinates. block_type is a Minecraft block ID like 'stone' or 'oak_planks'."""
|
||||
await _ensure_build_session(x, y, z)
|
||||
return _fmt(await _request("POST", "/place_block", json={
|
||||
"x": x, "y": y, "z": z, "type": block_type,
|
||||
}))
|
||||
payload: dict = {"x": x, "y": y, "z": z, "type": block_type}
|
||||
if properties:
|
||||
payload["properties"] = properties
|
||||
return _fmt(await _request("POST", "/place_block", json=payload))
|
||||
|
||||
|
||||
@mcp.tool()
|
||||
@@ -324,14 +325,17 @@ async def place_blocks(blocks: list[dict]) -> str:
|
||||
|
||||
|
||||
@mcp.tool()
|
||||
async def fill(x1: int, y1: int, z1: int, x2: int, y2: int, z2: int, block_type: str) -> str:
|
||||
async def fill(x1: int, y1: int, z1: int, x2: int, y2: int, z2: int, block_type: str, properties: dict | None = None) -> str:
|
||||
"""Fill a bounding box with a single block type. Max volume 32x32x32."""
|
||||
await _ensure_build_session((x1 + x2) / 2, (y1 + y2) / 2, (z1 + z2) / 2)
|
||||
return _fmt(await _request("POST", "/fill", json={
|
||||
payload: dict = {
|
||||
"x1": x1, "y1": y1, "z1": z1,
|
||||
"x2": x2, "y2": y2, "z2": z2,
|
||||
"type": block_type,
|
||||
}))
|
||||
}
|
||||
if properties:
|
||||
payload["properties"] = properties
|
||||
return _fmt(await _request("POST", "/fill", json=payload))
|
||||
|
||||
|
||||
@mcp.tool()
|
||||
@@ -396,7 +400,8 @@ async def save_schematic(name: str, x1: int, y1: int, z1: int, x2: int, y2: int,
|
||||
async def load_schematic(name: str, x: int, y: int, z: int) -> str:
|
||||
"""Load a previously saved schematic and place it at the given origin coordinates.
|
||||
Name may only contain letters, numbers, underscore, and hyphen.
|
||||
Supports both .litematic (Litematica) and .json formats — .litematic is checked first."""
|
||||
Supports .litematic (Litematica), .nbt (Create mod / vanilla structure), and .json formats.
|
||||
Priority: .litematic → .nbt → .json. Create mod .nbt schematics preserve tile entity data."""
|
||||
await _ensure_build_session(x, y, z)
|
||||
return _fmt(await _request("POST", "/load_schematic", json={
|
||||
"name": name, "x": x, "y": y, "z": z,
|
||||
@@ -432,6 +437,7 @@ _SNARKY_75 = [
|
||||
async def build_schematic(name: str, x: int, y: int, z: int) -> str:
|
||||
"""Load a schematic and build it layer by layer (bottom to top) with chat progress.
|
||||
Creates a satisfying visual building effect. Use load_schematic for instant placement instead.
|
||||
Supports .litematic, .nbt (Create mod / vanilla structure), and .json formats.
|
||||
Name may only contain letters, numbers, underscore, and hyphen."""
|
||||
# 1. Get schematic info
|
||||
info = await _request("POST", "/get_schematic_info", json={
|
||||
@@ -524,8 +530,8 @@ async def build_schematic(name: str, x: int, y: int, z: int) -> str:
|
||||
|
||||
@mcp.tool()
|
||||
async def list_schematics() -> str:
|
||||
"""List all available schematics (.json and .litematic) in the world's schematics folder.
|
||||
Returns name, format, and file size for each schematic."""
|
||||
"""List all available schematics (.litematic, .nbt, and .json) in the world's schematics folder.
|
||||
Returns name, format, and file size for each schematic. Supports Create mod .nbt schematics."""
|
||||
return _fmt(await _request("GET", "/list_schematics"))
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user