HomeBedrockAddonsOffhand
Offhand
AddonsBedrock

Offhand

[setup required ](/scriptevent run:offhand) Very Simple Script That Changes your mainhand item to offhand with a scriptevent

⬇ Download on CurseForge
This Minecraft Bedrock ScriptAPI code lets a player move an item from their main hand to their empty offhand slot by triggering a /scriptevent command. It checks if the main hand has an item, ensures the offhand is empty, copies the item data, and updates the inventory slots using commands.
How It Works
Event Listener: Listens for a script event with the ID run:offhand fired by a player.
Slot Validation: Checks if the player's main hand has an item and their offhand slot is completely empty.
Data Transfer: Reads the item's ID, stack amount, damage value, and keepOnDeath component properties.
Command Execution: Uses /replaceitem to place the item in the offhand and clear the main hand slot, while keeping data like durability intact.
Audio Feedback: Plays an equipment sound effect when the swap succeeds.
How to Use It
Enable Beta APIs in your world settings under the Experiments tab.
Add the script inside your behavior pack's server-side script file (e.g., main.js).
Set up a repeating command block or a behavior pack system to trigger the event when a player performs an action.
Run the trigger command in-game:
text (customizable)
/execute as @e run scriptevent run:offhand
Use code with caution.
<button class="FTsWP RmjGdc IsqrXb" aria-label="Copy code text to clipboard." aria-describedby="undefined" data-tooltip-classes="undefined" data-is-tooltip-wrapper="undefined" data-sfc-cp="" data-wiz-attrbind="disabled=zOUKPe_1x/ggNWmb" data-sfc-root="c" data-copy-service-computed-style="font-family: Arial; font-size: 13.3333px; font-weight: 400; margin: 0px; text-decoration: none; border-bottom: 0px rgb(84, 93, 126);"></button>
 
<button id="" class="FTsWP RmjGdc IsqrXb" aria-label="Copy code text to clipboard." aria-describedby="undefined" data-tooltip-classes="undefined" data-is-tooltip-wrapper="undefined" data-sfc-cp="" data-wiz-attrbind="disabled=zOUKPe_1x/ggNWmb" data-sfc-root="c" data-copy-service-computed-style="font-family: Arial; font-size: 13.3333px; font-weight: 400; margin: 0px; text-decoration: none; border-bottom: 0px rgb(84, 93, 126);"></button>
     

    Offhand is a free Minecraft Bedrock addon. Compatible with Minecraft 26.40. Downloaded 21 times (via CurseForge). Download it and open it directly in the game.

    Explore more