itzvoidsnare

create a plugin for java 1.21.11 where we can select an area either by using commands or a wand like that in WorldEdit Plugin/Mod, and example I set a 55 area so now the opposite side's 55 area will be like a mirror and whatever blocks I place will be placed in the opposite area too. Make the suitable commands for the function.

Kodari AI
KodariAug 6 at 12:48 pm 2
MirrorBuild
A Minecraft 1.21.11 Bukkit plugin that enables mirrored building. Players select two opposite regions using a WorldEdit-style wand (wooden axe) or commands (/mb wand, /mb pos1, /mb pos2). Once both corners are set, the plugin calculates the mirrored counterpart of the first region across the second region's center. Any block placed, broken, or interacted with in the primary region is automatically replicated in the mirrored region, including block states, rotations, and tile entities. Commands include /mb toggle to enable/disable mirroring, /mb clear to reset selections, and /mb info to display region dimensions. Supports multiple players with independent selections and provides visual selection outlines via particles.
  1. Create the Gradle/Paper plugin project targeting Java 21 and Minecraft 1.21.x.

  2. Implement persistent mirror definitions, paired cuboid validation, and block synchronization for placements and breaks.

  3. Add WorldEdit-style wand selection plus command-based selection and management commands.

  4. Register permissions, configuration, and user-facing command help.

Created the MirrorBlocks Paper plugin for Java 21 / Minecraft 1.21.x.

Features:

  • WorldEdit-style blaze rod selection wand.

  • Separate source and target region selection.

  • Command-based position selection.

  • Supports mirrored axes: x, z, and xz.

  • Synchronizes block placement and breaking in both regions.

  • Requires source and target regions to have identical dimensions.

  • Persistent mirror configuration in config.yml.

  • Enable, disable, delete, list, inspect, and reload commands.

  • Permissions for regular users and administrators.

Usage:

Plain Text
/mirror wand source
/mirror pos1 source
/mirror pos2 source

/mirror wand target
/mirror pos1 target
/mirror pos2 target

/mirror create house x

Available commands:

Plain Text
/mirror help
/mirror wand [source|target]
/mirror mode <source|target>
/mirror pos1 [source|target]
/mirror pos2 [source|target]
/mirror create <name> [x|z|xz]
/mirror delete <name>
/mirror toggle <name>
/mirror list
/mirror info <name>
/mirror reload

Permissions:

Plain Text
mirrorblocks.use
mirrorblocks.admin
itzvoidsnare

can you please explain the commands and how to use them please?

Kodari AI
KodariAug 6 at 12:50 pm 1

Basic idea

Each mirror consists of two equally sized rectangular regions:

  • Source: the area where you build normally.

  • Target: the opposite area where the same blocks appear automatically.

For example, if both regions are 5×5×5 and the mirror axis is x, placing a block in the source region copies it to the corresponding position in the target region.

You need the permission:

Plain Text
mirrorblocks.use

To create, delete, toggle, or reload mirrors, you need:

Plain Text
mirrorblocks.admin

Option 1: Select regions with the wand

1. Get the wand

Use:

Plain Text
/mirror wand

The plugin gives you a Blaze Rod selection wand.

The wand initially selects the source region.

2. Select the source region

Left-click one corner of the source area:

Plain Text
Left-click with the wand = source position 1

Right-click the opposite corner:

Plain Text
Right-click with the wand = source position 2

The source area is now selected.

3. Switch to the target region

Use:

Plain Text
/mirror mode target

You can also get a wand with the target side already active:

Plain Text
/mirror wand target

4. Select the target region

With the target side active:

Plain Text
Left-click with the wand = target position 1
Right-click with the wand = target position 2

The target region must have the same dimensions as the source region.

For a 5×5 source region, the target region must also be 5×5. The regions do not need to touch each other.

5. Create the mirror

Use:

Plain Text
/mirror create house x

Here:

  • house is the mirror’s name.

  • x mirrors across the X axis.

The mirror is created and enabled immediately.


Option 2: Select regions with commands

The command positions are set at your current block location.

Select the source

Stand at the first source corner and run:

Plain Text
/mirror pos1 source

Stand at the opposite source corner and run:

Plain Text
/mirror pos2 source

Select the target

Stand at the first target corner and run:

Plain Text
/mirror pos1 target

Stand at the opposite target corner and run:

Plain Text
/mirror pos2 target

You can omit source or target if you first set the active side:

Plain Text
/mirror mode source
/mirror pos1
/mirror pos2

Then change sides:

Plain Text
/mirror mode target
/mirror pos1
/mirror pos2

Mirror axis options

X axis

Plain Text
/mirror create house x

Mirrors the region across the X direction.

Z axis

Plain Text
/mirror create house z

Mirrors the region across the Z direction.

Both X and Z axes

Plain Text
/mirror create house xz

This mirrors across both horizontal axes.

If no axis is supplied, the default is x:

Plain Text
/mirror create house

Complete example

Suppose you want two identical 5×5 areas.

Source selection

Plain Text
/mirror wand source

Left-click the first source corner and right-click the opposite source corner.

Target selection

Plain Text
/mirror mode target

Left-click the first target corner and right-click the opposite target corner.

Create the mirror

Plain Text
/mirror create wall x

Now build inside the source region. Blocks placed or broken there will be synchronized with the target region.


Managing mirrors

View all mirrors

Plain Text
/mirror list

Shows each mirror’s:

  • Name

  • Axis

  • Enabled/disabled status

View detailed information

Plain Text
/mirror info wall

Shows:

  • World

  • Mirror axis

  • Status

  • Source coordinates

  • Target coordinates

Temporarily disable or enable a mirror

Plain Text
/mirror toggle wall

Running it again toggles the mirror back.

Permanently delete a mirror

Plain Text
/mirror delete wall

This removes the mirror definition. It does not automatically erase blocks from either region.

Reload the configuration

Plain Text
/mirror reload

This reloads saved mirror definitions from the configuration file.

Show command help

Plain Text
/mirror help

or simply:

Plain Text
/mirror

Important notes

  • The source and target regions must be in the same world.

  • Both regions must have matching dimensions.

  • Use unique names for mirrors.

  • The wand is a Blaze Rod marked by the plugin; ordinary Blaze Rods should not select regions.

  • Selection commands use the block underneath your current position.

  • Only one side is active at a time: source or target.

  • Build inside the configured source or target region after creating the mirror.

  • The mirror can be disabled temporarily with /mirror toggle <name>.

itzvoidsnare

can you make an exact version,but for 1.21.11 fabric as a mod used for singleplayer, basically client side? And it should be completely without cheats so whatever the blocks will be mirrored, like if i place a block and other block gets placed too so 2 blocks should be used so its not a cheat.

Kodari AI
KodariAug 6 at 1:50 pm 5
  1. Convert the project from Paper plugin structure to a Fabric 1.21.11 client-side mod.

  2. Recreate wand/command region selection and mirror management for singleplayer.

  3. Mirror legitimate placement and breaking while consuming/using the corresponding second block without cheats.

  4. Add Fabric metadata, keybind/chat-command handling, and configuration persistence.

The Paper implementation has been replaced with a Fabric client-mod structure. I’m tightening the survival-side mechanics now: the mirror must run on the integrated server, consume an additional matching block, and avoid any creative/command-based placement.

Implemented the project as a Fabric 1.21.11 client-side mod for singleplayer.

Main behavior

  • Works in singleplayer through the integrated server.

  • Uses a blaze rod as the selection wand.

  • Mirrors block placements and breaks between two selected regions.

  • Survival-only: creative players are ignored.

  • A mirrored placement requires an additional matching block in the inventory.

  • The second block is consumed normally.

  • If no extra block is available, only the original block is placed.

  • Mirrored blocks retain the placed block’s state, such as orientation.

Commands

Plain Text
/mirror help
/mirror wand [source|target]
/mirror mode <source|target>
/mirror pos1 [source|target]
/mirror pos2 [source|target]
/mirror create <name> [x|z|xz]
/mirror list
/mirror info <name>
/mirror toggle <name>
/mirror delete <name>
/mirror clear
/mirror reload

Example usage

Plain Text
/mirror wand source

Hold a blaze rod:

  • Left-click a block to set source position 1.

  • Right-click a block to set source position 2.

Then select the target:

Plain Text
/mirror mode target

Use the blaze rod again:

  • Left-click one target corner.

  • Right-click the opposite target corner.

Create the mirror:

Plain Text
/mirror create house x

You can use:

Plain Text
/mirror create house z
/mirror create house xz

The source and target regions must have identical dimensions, such as both being 5×5×5.

A keybind is also included:

Plain Text
M

Pressing M toggles wand-selection mode.

Configuration is saved automatically to:

Plain Text
.minecraft/config/mirrorblocks.json

The project now includes Fabric Loom, Fabric metadata, client commands, integrated-server mixins, persistent configuration, and survival inventory consumption logic.

itzvoidsnare

download?

Kodari AI
KodariAug 6 at 2:31 pm 2

The mod project is available in the workspace, but I can’t attach a compiled .jar directly from this chat.

To download/build it:

  1. Use the workspace Download/Export project option to download the source.

  2. Extract it.

  3. Run:

Shell
./gradlew build

On Windows:

Shell
gradlew.bat build

The compiled mod will be located in:

Plain Text
build/libs/

Copy the .jar into your Minecraft instance’s:

Plain Text
.minecraft/mods/

You’ll need Fabric Loader, Fabric API, and Minecraft 1.21.11 installed.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
15 873
src/main/java/com/kodari/mirrorblocks/MirrorBlocksClient.java
package com.kodari.mirrorblocks;

import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientLifecycleEvents;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents;
import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback;
import net.fabricmc.fabric.api.event.player.AttackBlockCallback;
import net.fabricmc.fabric.api.event.player.UseBlockCallback;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.option.KeyBinding;
import net.minecraft.client.util.InputUtil;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.text.Text;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Formatting;
import net.minecraft.util.Hand;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
import org.lwjgl.glfw.GLFW;

public class MirrorBlocksClient implements ClientModInitializer {

    private static MirrorManager mirrorManager;
    private KeyBinding toggleWand;

    public static MirrorManager getMirrorManager() {
        return mirrorManager;
    }

    @Override
    public void onInitializeClient() {
        mirrorManager = new MirrorManager();
        mirrorManager.load();

        toggleWand = KeyBindingHelper.registerKeyBinding(new KeyBinding(
                "key.mirrorblocks.toggle_wand", InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_M, "category.mirrorblocks"));

        ClientCommandRegistrationCallback.EVENT.register((dispatcher, registryAccess) ->
                MirrorCommand.register(dispatcher));

        AttackBlockCallback.EVENT.register((player, world, hand, pos, direction) -> {
            MinecraftClient client = MinecraftClient.getInstance();
            SelectionSession selection = mirrorManager.getSelection();
            if (!selection.isWandEnabled() || !isWand(player.getStackInHand(hand))) {
                return ActionResult.PASS;
            }
            setWandPoint(selection, pos, 1, client);
            return ActionResult.FAIL;
        });

        UseBlockCallback.EVENT.register((player, world, hand, hitResult) -> {
            MinecraftClient client = MinecraftClient.getInstance();
            SelectionSession selection = mirrorManager.getSelection();
            if (!selection.isWandEnabled() || !isWand(player.getStackInHand(hand))) {
                return ActionResult.PASS;
            }
            setWandPoint(selection, hitResult.getBlockPos(), 2, client);
            return ActionResult.FAIL;
        });

        ClientTickEvents.END_CLIENT_TICK.register(client -> {
            while (toggleWand.wasPressed()) {
                SelectionSession selection = mirrorManager.getSelection();
                selection.setWandEnabled(!selection.isWandEnabled());
                message((selection.isWandEnabled() ? "Selection wand enabled; hold a blaze rod." : "Selection wand disabled."),
                        selection.isWandEnabled() ? Formatting.GREEN : Formatting.YELLOW);
            }
        });

        ClientPlayConnectionEvents.DISCONNECT.register((handler, client) -> mirrorManager.clearSelection());
        ClientLifecycleEvents.CLIENT_STOPPING.register(client -> mirrorManager.save());
    }

    private static void setWandPoint(SelectionSession selection, BlockPos pos, int point, MinecraftClient client) {
        if (client.world == null) {
            return;
        }
        selection.setPoint(selection.getActiveSide(), point,
                client.world.getRegistryKey().getValue().toString(), pos);
        message(selection.getActiveSide().name() + " position " + point + " set at "
                + pos.getX() + ", " + pos.getY() + ", " + pos.getZ(), Formatting.GREEN);
    }

    public static boolean isWand(ItemStack stack) {
        return !stack.isEmpty() && stack.isOf(Items.BLAZE_ROD);
    }

    public static void handlePlacedBlock(net.minecraft.server.network.ServerPlayerEntity player, Hand hand,
                                         BlockHitResult hitResult, net.minecraft.block.BlockState before,
                                         ItemStack originalStack) {
        MinecraftClient client = MinecraftClient.getInstance();
        if (!client.isInSingleplayer() || mirrorManager == null || originalStack.isEmpty()
                || !(originalStack.getItem() instanceof net.minecraft.item.BlockItem blockItem)
                || player.isCreative()) {
            return;
        }

        net.minecraft.server.world.ServerWorld world = player.getServerWorld();
        BlockPos clicked = hitResult.getBlockPos();
        BlockPos adjacent = clicked.offset(hitResult.getSide());
        BlockPos placed = before.isReplaceable() ? clicked : adjacent;
        net.minecraft.block.BlockState state = world.getBlockState(placed);
        if (!state.isOf(blockItem.getBlock())) {
            return;
        }
        mirrorManager.mirrorPlacedBlock(world, placed, state, originalStack, player);
    }

    public static void handleBrokenBlock(net.minecraft.server.network.ServerPlayerEntity player, BlockPos pos) {
        MinecraftClient client = MinecraftClient.getInstance();
        if (!client.isInSingleplayer() || mirrorManager == null) {
            return;
        }
        mirrorManager.clearMirroredBlock(player.getServerWorld(), pos);
    }

    private static void message(String text, Formatting formatting) {
        MinecraftClient client = MinecraftClient.getInstance();
        if (client.player != null) {
            client.player.sendMessage(Text.literal(text).formatted(formatting), true);
        }
    }
}