Ruan silva Martins

Create a Minecraft Forge 1.20.1 mod that adds a magic staff item. When the player right-clicks with the staff, it shoots a fireball projectile. When the fireball hits a block, it should cause a small explosion that breaks blocks

Kodari AI
KodariOct 25 at 5:30 pm 1
ArcaneStaffMod
A Minecraft Forge 1.20.1 mod that introduces a craftable magic staff item. Right-clicking with the staff launches a fireball projectile toward the player's look direction. Upon impact with a block or entity, the fireball detonates in a small explosion that breaks nearby blocks and damages entities. The staff has a cooldown to prevent rapid-fire usage, and the explosion radius is balanced to avoid excessive terrain destruction. Includes custom item texture, recipe, and localized name.
  1. Set up the Forge 1.20.1 Gradle project and mod metadata.

  2. Register a magic staff in the Combat creative tab.

  3. Make right-click launch a small-explosion fireball that breaks blocks on impact.

Created the Forge 1.20.1 mod. The Magic Staff appears in the Combat tab; right-click launches a small vanilla fireball with a one-second cooldown. Its explosion breaks blocks when the world’s mobGriefing rule allows it.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
10 204
src/main/java/com/example/magicstaff/MagicStaffMod.java
package com.example.magicstaff;

import com.example.magicstaff.registry.ModItems;
import net.minecraft.world.item.CreativeModeTabs;
import net.minecraftforge.event.BuildCreativeModeTabContentsEvent;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;

@Mod(MagicStaffMod.MOD_ID)
public class MagicStaffMod {
    public static final String MOD_ID = "magicstaff";

    public MagicStaffMod() {
        IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
        ModItems.ITEMS.register(modEventBus);
        modEventBus.addListener(this::addCreative);
    }

    private void addCreative(BuildCreativeModeTabContentsEvent event) {
        if (event.getTabKey() == CreativeModeTabs.COMBAT) {
            event.accept(ModItems.MAGIC_STAFF);
        }
    }
}