elijahfullington67

make a mod where you get a cool looking sword with the comand "/sword" and it gives a sword and if right clicked it summons a nuke but you can pick where it goes if you look out and press right click and it has a cooldown

Kodari AI
KodariNov 7 at 11:43 pm 5
NukeSwordMod
A Minecraft Fabric mod that adds a custom sword obtainable via the /sword command. When right-clicked while looking at a location, the sword summons a devastating nuke explosion at that targeted point. The ability has a configurable cooldown period to prevent spam. The sword features a unique, visually striking texture and enchantment glint, providing players with a powerful and cinematic combat tool.
  • Add the Fabric 1.20.4 mod setup and register a custom sword.

  • Add /sword to give it, plus an aimed explosion and per-player cooldown on right-click.

  • Add the sword’s texture and item name.

Added the Fabric 1.20.4 mod. Use /sword in-game to get the Nuclear Sword; right-click to detonate a TNT-style blast where you’re aiming (up to 80 blocks away). It has a 30-second cooldown.

Switch to Fabric 1.20.4 mod

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
9 135
src/main/java/com/kodari/arsenal/ArsenalMod.java
package com.kodari.arsenal;

import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.server.command.CommandManager;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.util.Identifier;

public final class ArsenalMod implements ModInitializer {
    public static final Item NUCLEAR_SWORD = Registry.register(
            Registries.ITEM,
            new Identifier("arsenal", "nuclear_sword"),
            new NuclearSwordItem(new Item.Settings().maxCount(1))
    );

    @Override
    public void onInitialize() {
        CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) ->
                dispatcher.register(CommandManager.literal("sword").executes(context -> {
                    ServerPlayerEntity player = context.getSource().getPlayerOrThrow();
                    player.giveItemStack(new ItemStack(NUCLEAR_SWORD, 1));
                    return 1;
                }))
        );
    }
}