GenesisCanCode

make mod to let me hold any weapon in off hand and left click to attack with it and it can be done at the same time as mainhand attack

Kodari AI
KodariJun 27 at 2:08 pm 1

I’ll create a Dual Wield Weapons mod. The core mechanic: when you left-click to attack with your main hand, the off-hand weapon also strikes the same target simultaneously.

Architecture:

  1. Mixin into PlayerEntity.attack() at TAIL

  2. Calculate off-hand damage from the weapon’s attribute modifiers

  3. Apply damage to the same target

Let me create all project files.

DualWieldWeapons
A Fabric 1.21.11 mod that enables dual-wielding combat. Hold any weapon in your off-hand and left-click to attack with both hands simultaneously. The off-hand weapon deals its full damage including weapon attribute modifiers. Works with swords, axes, and any item with attack damage attributes.

New project — empty directory. I’ll create the DualWieldWeapons mod that lets you hold any weapon in your off-hand and attack with both hands simultaneously.

DualWieldWeapons
A Fabric 1.21.11 mod enabling dual-wielding combat. Hold any weapon in your off-hand and left-click to attack with both hands simultaneously. The off-hand weapon deals its full damage including weapon attribute modifiers while the main hand attack proceeds normally. No config needed — works out of the box with swords, axes, and any item carrying attack damage attributes.</project_description<kodariProjectNamed>DualWieldWeapons</kodariProjectNamed>
Kodari can make mistakes. Review important code before using.
Files
build.gradle
dualwield.mixins.json
DualWieldHelper.java
DualWieldMod.java
DualWieldModClient.java
en_us.json
fabric.mod.json
gradle.properties
PlayerEntityMixin.java
settings.gradle
Code
10 210
/home/user/src/main/java/com/example/dualwield/DualWieldMod.java
package com.example.dualwield;

import net.fabricmc.api.ModInitializer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class DualWieldMod implements ModInitializer {
    public static final String MOD_ID = "dualwield";
    public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);

    @Override
    public void onInitialize() {
        LOGGER.info("Dual Wield Weapons initialized!");
    }
}