abhinaba
๐Ÿ“Ž 1 file 3,295 chars
๐Ÿ“„
pasted-code-1793699208861.txt
txt 28 lines
โ–ถ
Build a Minecraft mod for Minecraft 1.21.1 using Fabric (Fabric Loader + Fabric API, Java 21, Yarn or Mojang mappings; provide the full project: build.gradle, gradle.properties, fabric.mod.json, main class, and any mixins).

MOD NAME: Mace Wind Launcher

FEATURE: While the player is holding a Mace in their main hand, the mace itself acts like a wind charge launcher. The player must NOT need to switch to a Wind Charge item or have one in their hotbar/inventory by default.

1) RIGHT CLICK (use item) with Mace:
- Launch the player with a wind-charge-style boost (the same effect as being hit by a wind charge burst at their feet): strong upward velocity (configurable, default about 1.2 to 1.6 blocks/tick upward) plus a small forward push in the look direction (configurable).
- Play the wind charge burst sound and spawn wind burst particles at the player's position.
- Reset fall distance after the boost, so the player can chain it into a mace smash attack (the Mace's fall-damage bonus should still work naturally when the player comes down).
- Add a cooldown (default 20 ticks, configurable) shown as an item cooldown on the mace.
- Must work on both client and server correctly: apply the velocity server-side and sync it to the client (send velocity update packet), so it works in multiplayer without rubber-banding.
- Cancel the default right-click behavior of the mace so nothing else triggers.

2) LEFT CLICK (attack/swing) with Mace:
- Fire a real wind charge projectile (WindChargeEntity) from the player's eye position in the direction they are looking, with the standard wind charge speed and the player as owner.
- Do not consume any item and do not require a wind charge in the inventory (optional config: "requireWindChargeItem" default false).
- Play the wind charge throw sound. Add a short cooldown (default 10 ticks, configurable).
- If the player left-clicks an entity directly in melee range, still allow the normal mace melee attack, and only fire the projectile when no entity is targeted (or make this configurable: "fireOnMeleeHit").
- Use Fabric's AttackEntityCallback / ClientPreAttackCallback or a mixin on the client attack keybind, and send a custom C2S packet (Fabric Networking API) so the server spawns the projectile (server-authoritative, no client-side spawning).

REQUIREMENTS:
- Server-authoritative logic with a custom payload packet for the left-click action.
- Config file (JSON) in /config/mace-wind-launcher.json with: upwardBoost, forwardBoost, rightClickCooldown, leftClickCooldown, requireWindChargeItem, fireOnMeleeHit, enableRightClick, enableLeftClick.
- Prevent exploits: validate that the player is actually holding a mace on the server before doing anything; enforce cooldowns server-side.
- Clean, commented code, with package structure (com.example.macewind), proper registration in the mod initializer and client initializer.
- Give me the complete file tree, every file's full code, and the exact commands to build the jar (./gradlew build) and where to find the output jar.
- Make sure all class names, method names, and APIs match Minecraft 1.21.1 exactly (for example the 1.21.1 CustomPayload packet system and the 1.21.1 WindChargeEntity constructor), and avoid APIs that only exist in 1.21.2 or later.
Kodari AI
KodariNov 3 at 9:47 am 2
MaceWindLauncher
Adds wind charge abilities to the Mace in Minecraft 1.21.1 Fabric. Right-click launches the player upward with configurable boost velocity, plays wind burst effects, resets fall distance, and applies cooldown. Left-click fires a server-authoritative WindChargeEntity projectile from the player's eye position without consuming items. Features JSON config for boost values, cooldowns, and toggle options. Uses custom C2S payload packets for projectile spawning, validates mace holding server-side, and prevents exploits through server-side cooldown enforcement. Works in multiplayer without rubber-banding.

This project is for Fabric 1.21.11, while the requested mod targets Fabric 1.21.1. Kodari supports Fabric 1.21.1:

Fabric 1.21.1 isn't available in Kodari. Fabric versions: 26.3, 26.2, 1.21.11, 1.21.4, 1.20.4, 1.19.4, 1.18.2.

Kodari can make mistakes. Review important code before using.
Files

No files in this session

Code