Visualmodder Python Application Programming Interface (API)
Method: createRectangle
Creates a rectangle shape using Minecraft blocks at the current position in the X/Y plane.
Python Signature
vm.createRectangle(width: float, height: float, filled: bool, blocks: list)
Parameters
Name | Type | Description |
---|---|---|
width |
float |
Width of the rectangle in blocks. |
height |
float |
Height of the rectangle in blocks. Can be None for default. |
filled |
bool |
True for solid shape; False for outline only. |
blocks |
list |
A list of block types or block dictionaries. Examples: [“b.grass_block”], [{“TYPE”: “b.acacia_door”}] |
Python Usage Example ()
vm.createRectangle(4, None, False, [{"DIRECTION": "LEFT", "TYPE": "b.grass_block"}, {"PART": "UP", "TYPE": "b.acacia_door"}])
Notes
- Draws the rectangle in the X/Y plane.
- Set filled to True for solid fill, or False for outline.
- Multiple blocks will be cycled during placement.
- Supports both simple strings and detailed block dictionaries.
Method: createLine
Creates a straight line forward from the current position using the specified blocks.
Python Signature
vm.createLine(length: int, blocks: list)
Parameters
Name | Type | Description |
---|---|---|
length |
int |
Length of the line in blocks. |
blocks |
list |
List of blocks to use for the line. |
Python Usage Example ()
vm.createLine(10, ["b.stone", "b.brick_block"])
Notes
- Draws a straight line extending in the player’s forward direction.
- Block list can be cycled.
Method: moveToPlayer
Moves the current working position to the player’s current location.
Python Signature
vm.moveToPlayer()
Parameters
Name | Type | Description |
---|
Python Usage Example ()
vm.moveToPlayer()
Notes
- Can be used to align block placement with the player’s position.
Method: createBlock
Places a block or block pattern at the current location.
Python Signature
vm.createBlock(blocks: list)
Parameters
Name | Type | Description |
---|---|---|
blocks |
list |
Block or block pattern list. |
Python Usage Example ()
vm.createBlock(["b.dirt", "b.grass_block"])
Notes
- Block list is placed at the current location.
Method: movePositionRelative
Moves the current position in a specified direction by a number of steps.
Python Signature
vm.movePositionRelative(steps: float, direction: str)
Parameters
Name | Type | Description |
---|---|---|
steps |
float |
The number of blocks to move. |
direction |
str |
Direction to move in. Valid values: “FORWARD”, “BACKWARD”, “LEFT”, “RIGHT”, “UP”, “DOWN”. |
Python Usage Example ()
vm.movePositionRelative(3, "FORWARD")
Notes
- Used for relative movement in a direction.
Method: movePositionAbsolute
Moves the current position using absolute coordinates in a given coordinate system.
Python Signature
vm.movePositionAbsolute(coordSystem: str, x: float, y: float, z: float)
Parameters
Name | Type | Description |
---|---|---|
coordSystem |
str |
Coordinate system: SPHERICAL, CYLINDRICAL, CARTESIAN |
x |
float |
First coordinate component (e.g., radius). |
y |
float |
Second coordinate component (e.g., theta or y). |
z |
float |
Third coordinate component (e.g., phi or z). |
Python Usage Example ()
vm.movePositionAbsolute("CARTESIAN", 5, 10, 2)
Notes
- Interpretation of x, y, z depends on coordinate system.
Method: moveToViewTarget
Moves the current position to where the player is currently looking.
Python Signature
vm.moveToViewTarget()
Parameters
Name | Type | Description |
---|
Python Usage Example ()
vm.moveToViewTarget()
Notes
- Uses raycasting to determine the target location.
Method: resetPosition
Moves the current position to the initial starting point.
Python Signature
vm.resetPosition()
Parameters
Name | Type | Description |
---|
Python Usage Example ()
vm.resetPosition()
Notes
- Useful for returning to origin of script logic.
Method: moveToLastMark
Moves the current position to the last marked position.
Python Signature
vm.moveToLastMark()
Parameters
Name | Type | Description |
---|
Python Usage Example ()
vm.moveToLastMark()
Notes
- Used with vm.markPosition() to return to saved locations.
Method: moveToNextSolidBlock
Moves the current position forward until it finds a solid block.
Python Signature
vm.moveToNextSolidBlock()
Parameters
Name | Type | Description |
---|
Python Usage Example ()
vm.moveToNextSolidBlock()
Notes
- Useful for scanning environments.
Method: rotateYawRelative
Rotates the horizontal (yaw) orientation by a relative angle.
Python Signature
vm.rotateYawRelative(angle: float)
Parameters
Name | Type | Description |
---|---|---|
angle |
float |
Angle in degrees to rotate. |
Python Usage Example ()
vm.rotateYawRelative(90)
Notes
Method: rotateYawAbsolute
Sets the yaw (horizontal view) to an absolute direction.
Python Signature
vm.rotateYawAbsolute(direction: str)
Parameters
Name | Type | Description |
---|---|---|
direction |
str |
Absolute direction: PLAYER_YAW, N, S, E, W. |
Python Usage Example ()
vm.rotateYawAbsolute("N")
Notes
Method: setPitchAbsolute
Sets the vertical pitch angle to an absolute value.
Python Signature
vm.setPitchAbsolute(angle: float)
Parameters
Name | Type | Description |
---|---|---|
angle |
float |
Pitch angle in degrees. |
Python Usage Example ()
vm.setPitchAbsolute(30)
Notes
Method: setPitchRelative
Changes the pitch angle by a relative amount.
Python Signature
vm.setPitchRelative(angle: float)
Parameters
Name | Type | Description |
---|---|---|
angle |
float |
Relative angle to change pitch. |
Python Usage Example ()
vm.setPitchRelative(-15)
Notes
Method: createPolygon
Creates a regular polygon or circular arc with the given block materials.
Python Signature
vm.createPolygon(sides: int, radiusX: float, radiusY: float, arcAngle: int, filled: bool, blocks: list)
Parameters
Name | Type | Description |
---|---|---|
sides |
int |
Number of polygon sides. |
radiusX |
float |
X-radius. |
radiusY |
float |
Y-radius. |
arcAngle |
int |
Angle (0–360) for circular arc. |
filled |
bool |
Whether the shape is filled. |
blocks |
list |
Block pattern to use. |
Python Usage Example ()
vm.createPolygon(6, 5, 5, 360, True, ['b.stone'])
Notes
Method: createStar
Creates a star pattern using blocks at the current location.
Python Signature
vm.createStar(points: int, innerRadius: float, outerRadius: float, filled: bool, blocks: list)
Parameters
Name | Type | Description |
---|---|---|
points |
int |
Number of star points. |
innerRadius |
float |
Inner radius. |
outerRadius |
float |
Outer radius. |
filled |
bool |
Whether the shape is filled. |
blocks |
list |
Blocks to use. |
Python Usage Example ()
vm.createStar(5, 2, 5, False, ['b.stone'])