Visualmodder v2.0 Python Examples
The following examples demonstrate how to use Visualmodder v2.0 to create structures in Minecraft.
Example : Creating an Empty Square

vm.createSquare(4, False, Block.GOLD_BLOCK)
This example uses createSquare(width, filled, blocks…)
to create a hollow square centered at the cursor. The filled parameter is set to False, so only the outline of the square is created using gold blocks.
Example: Creating an Empty Tower

for count in range(10):
vm.createSquare(4, False, Block.GOLD_BLOCK, Block.DIAMOND_BLOCK);
vm.moveTo(1, Direction.UP)
This example uses createSquare(width, filled, blocks…)
This example builds a tower by stacking hollow squares and moving the
cursor upward after each layer. Each iteration adds one level to the tower, resulting in a total height
of 10 blocks.
Example: Creating an Aquarium with dolphins

for count in range(10):
vm.createRectangle(6, 10, True, Block.GLASS);
vm.createRectangle(4, 8, True, Block.WATER);
vm.moveTo(1, Direction.UP)
vm.createLine(3, Entity.DOLPHIN);
This code creates a vertical aquarium with dolphins. For 10 layers, it first uses createRectangle(width, height, filled, blocks...) to build a 6×10 glass rectangle as the outer walls, then another createRectangle call to fill a 4×8 inner rectangle with water. After each layer, moveTo(1, Direction.UP) moves the cursor up by one block. Finally, createLine(length, entities...) is used to place 3 dolphins inside the aquarium.
Example: Get your armor

vm.giveToPlayer(Equip.GARMENT, Item.GOLDEN_CHESTPLATE, Item.DIAMOND_HELMET, Item.GOLDEN_BOOTS, Item.NETHERITE_LEGGINGS)
vm.giveToPlayer(Equip.RIGHT_HAND, Item.NETHERITE_SWORD)
vm.giveToPlayer(Equip.INVENTORY, Item.BOW, Item.GOLDEN_APPLE)
for count in range(64):
vm.giveToPlayer(Equip.INVENTORY, Item.ARROW)
This code gives the player a complete set of specific items in different slots. The armor pieces, including a golden chestplate, diamond helmet, golden boots, and netherite leggings, are equipped automatically.
A netherite sword is placed in the player’s right hand, while a bow and a golden apple are added to the inventory.
Finally, the code adds 64 arrows to the inventory using a loop.
Example: Iron Cone

for i in range(30, 0, -1):
vm.createCircle(i, False, Block.IRON_BLOCK);
vm.moveTo(1, Direction.UP)
This code creates a vertical, hollow cone or tower made of iron blocks. It uses a loop that starts with a circle of radius 30 and decreases the radius down to 1. In each iteration, createCircle(radius, filled, blocks...) is used to create a hollow circle of iron blocks, and moveTo(1, Direction.UP) moves the cursor up by one block for the next layer, resulting in a tapering, stacked structure.
Example: Random Dungeon Sign

num = random.randint(1, 3)
vm.createBlock(Block.SEA_LANTERN)
vm.moveTo(1, Direction.UP)
if num == 1:
text = 'go right'
elif num == 2:
text = 'go left'
else:
text = 'go back'
vm.createBlock(dict(SIGN=text, TYPE=Block.ACACIA_SIGN))
This code randomly chooses one of three directions and displays it on a sign. First, random.randint(1, 3) generates a number between 1 and 3.
A sea lantern is placed at the cursor using createBlock(Block.SEA_LANTERN), and moveTo(1, Direction.UP) moves the cursor up by one block. Depending on the random number, a text string is assigned to indicate “go right,” “go left,” or “go back.”
Finally, createBlock(dict(SIGN=text, TYPE=Block.ACACIA_SIGN)) places an acacia sign with the chosen text at the current cursor position.
Example: Firework Stars when the player moves

vm.onEvent(Event.MOVED, 'fireworks');
def fireworks():
global num, text, colors
for count5 in range(3):
vm.createSquare(4, False, Particle.FIREWORK);
vm.moveTo(1, Direction.UP)
This code sets up an automatic reaction to the player moving. The call to onEvent(Event.MOVED, 'fireworks') registers the fireworks function to execute whenever the player moves. The fireworks function itself creates three layers of hollow squares made of firework particles using createSquare(4, False, Particle.FIREWORK) and moves the cursor up one block after each layer with moveTo(1, Direction.UP).
If you later call clearEvents(), this automatic execution will stop, preventing the fireworks function from triggering on player movement.
Example: Cover a village with snow

vm.createSquare(50, True, dict(GROUND=True, TYPE=Block.SNOW))
This code creates a large, filled square of snow and applies a special placement rule using a dictionary attribute. The createSquare(50, True, dict(GROUND=True, TYPE=Block.SNOW)) call builds a filled square with a width of 50 blocks, using snow as the block type.
By setting the GROUND attribute to True, each snow block is placed on the first non-air block found when searching downward from the cursor position, ensuring the snow correctly settles on the terrain instead of floating in the air.
Example: Create a disco light covered ground

len2 = 20
inner_len = len2 - 2
vm.moveTo(2, Direction.DOWN)
# Base frame of the disco floor
vm.createRectangle(len2, len2, False, Block.BLACK_CONCRETE)
# Interactive pressure-plate floor
vm.createRectangle(inner_len, inner_len, True, Block.SPRUCE_PRESSURE_PLATE)
# Move up to place entities and lighting
vm.moveTo(1, Direction.UP)
# Parrots placed underneath to randomly activate pressure plates
vm.createRectangle(5, 5, False, Entity.PARROT)
# Redstone lamps that light up when plates are activated
vm.createRectangle(inner_len, inner_len, True, Block.REDSTONE_LAMP)
# Build enclosing layers above the disco floor
for count in range(3):
vm.createRectangle(len2, len2, False, Block.BLACK_CONCRETE)
vm.moveTo(1, Direction.UP)
This program creates a disco floor effect using pressure plates, parrots, and redstone lamps.
It starts by defining the size of the floor and moving the cursor two blocks downward to position the structure correctly. A black concrete frame is then created to outline the base of the disco floor. Inside this frame, a filled square of spruce pressure plates is placed, forming the interactive surface of the floor. The cursor is moved up one block, and a small square of parrots is spawned underneath; when parrots stand on pressure plates, they trigger them, creating the illusion of randomly lighting tiles. Above the parrots, a filled square of redstone lamps is created, which will light up when the pressure plates are activated. Finally, the program builds three additional layers of black concrete above the structure, enclosing the mechanism and giving the disco floor a clean, finished look.