Vilho Pietarinen

the mod adds staffs and water weapons one of the staffs will be a ender dragon staff that shoots dragon fire balls

Kodari AI
KodariThu at 3:24 pm 15
DragonStaffArsenal
Adds a collection of magical staffs and water-based weapons to Minecraft. Features a legendary Ender Dragon Staff that launches explosive dragon fireballs, alongside various elemental staffs including water, ice, and lightning variants. Each staff has unique particle effects, cooldowns, and crafting recipes. Water weapons include a hydro blaster and tidal trident with special aquatic abilities. All items are fully configurable with balanced damage values and enchantment support.
  • Add a dragon-fire staff and a tidal staff with distinct right-click abilities.

  • Make both craftable in survival and available in the combat tab.

Added two craftable staffs:

  • Ender Dragon Staff: Fires dragon fireballs. Craft with dragon’s breath, a nether star, and blaze rods.

  • Tidal Staff: Throws splash water, extinguishing fires and harming water-sensitive mobs. Craft with prismarine shards, a heart of the sea, and sticks.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
staffs&sunken
Code
15 174
src/main/java/com/kodari/tidestaffs/TideStaffs.java
package com.kodari.tidestaffs;

import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.creativetab.v1.CreativeModeTabEvents;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.Identifier;
import net.minecraft.resources.ResourceKey;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.entity.projectile.hurtingprojectile.DragonFireball;
import net.minecraft.world.entity.projectile.throwableitemprojectile.ThrownSplashPotion;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.alchemy.PotionContents;
import net.minecraft.world.item.alchemy.Potions;
import net.minecraft.world.level.Level;

public class TideStaffs implements ModInitializer {
    private static final String MOD_ID = "tidestaffs";
    private static final Item DRAGON_STAFF = register("dragon_staff", true);
    private static final Item TIDAL_STAFF = register("tidal_staff", false);

    private static Item register(String name, boolean dragon) {
        Identifier id = Identifier.fromNamespaceAndPath(MOD_ID, name);
        ResourceKey<Item> key = ResourceKey.create(Registries.ITEM, id);
        return Registry.register(BuiltInRegistries.ITEM, key, new Staff(new Item.Properties().setId(key).stacksTo(1), dragon));
    }

    @Override
    public void onInitialize() {
        CreativeModeTabEvents.modifyOutputEvent(ResourceKey.create(Registries.CREATIVE_MODE_TAB, Identifier.withDefaultNamespace("combat")))
                .register(output -> {
                    output.prepend(new ItemStack(DRAGON_STAFF));
                    output.prepend(new ItemStack(TIDAL_STAFF));
                });
    }

    private static class Staff extends Item {
        private final boolean dragon;

        private Staff(Properties properties, boolean dragon) {
            super(properties);
            this.dragon = dragon;
        }

        @Override
        public InteractionResult use(Level level, Player player, InteractionHand hand) {
            if (!level.isClientSide()) {
                if (dragon) {
                    DragonFireball fireball = new DragonFireball(level, player, player.getLookAngle());
                    fireball.setPos(player.getEyePosition().add(player.getLookAngle().scale(1.5)));
                    level.addFreshEntity(fireball);
                    player.playSound(SoundEvents.FIRECHARGE_USE, 1.0F, 1.0F);
                } else {
                    ItemStack water = PotionContents.createItemStack(Items.SPLASH_POTION, Potions.WATER);
                    ThrownSplashPotion projectile = new ThrownSplashPotion(level, player, water);
                    projectile.shootFromRotation(player, player.getXRot(), player.getYRot(), 0.0F, 1.5F, 0.5F);
                    level.addFreshEntity(projectile);
                    player.playSound(SoundEvents.SNOWBALL_THROW, 1.0F, 1.0F);
                }
                player.getCooldowns().addCooldown(player.getItemInHand(hand), dragon ? 60 : 10);
            }
            return InteractionResult.SUCCESS;
        }
    }
}