12323acdf

Help me make a mod that even if the server doesn;t have the mod it'll still work i want a mod that when i use a fishing rod with infinity enchant it'll summon a nuke shot with 10 rings

Kodari AI
KodariSep 11 at 1:13 pm 2
InfinityNukeRod
A Minecraft Fabric mod that transforms an Infinity-enchanted fishing rod into a devastating weapon. When casting the rod, it launches a powerful "nuke" projectile that explodes on impact, creating 10 expanding shockwave rings that damage entities and destroy terrain. The mod is designed to work on servers without the mod installed, using only vanilla-compatible mechanics and packets to ensure cross-compatibility.
  1. Client-only trigger: detect an Infinity-enchanted fishing rod locally so vanilla servers remain compatible.

  2. Nuke shot effect: render a forward-moving projectile with ten expanding rings, particles, sound, and a final client-side blast.

  3. Standalone project: create the Fabric 1.21.11 Gradle setup, client entrypoint, resources, and mixin configuration from scratch.

Created the Fabric 1.21.11 client-only Nuke Fishing mod.

  • Fires when right-clicking with an Infinity-enchanted fishing rod.

  • Displays a moving nuke projectile with a trail.

  • Generates 10 expanding particle rings on detonation.

  • Plays launch and explosion sounds.

  • Works on vanilla servers because it has no server-side classes or networking.

  • The effect is visual/client-side only; it does not create real server damage or terrain destruction without a server mod.

The project includes Gradle setup, Fabric metadata, client source, and language resources.

12323acdf

The compilation failed with this error:

code
Compilation failed with 24 error(s):

ERROR in src/main/java/client/java/com/kodari/nukefishing/NukeFishingClient.java at line 11: cannot find symbol
import net.minecraft.component.type.ItemEnchantments;
                                   ^
  symbol: class ItemEnchantments
  location: package net.minecraft.component.type

ERROR in src/main/java/client/java/com/kodari/nukefishing/NukeFishingClient.java at line 47: cannot find symbol
            ItemStack rod = client.player.getStackInHand(Hand.MAIN);
                                                             ^
  symbol: variable MAIN
  location: class Hand

ERROR in src/main/java/client/java/com/kodari/nukefishing/NukeFishingClient.java at line 50: cannot find symbol
                client.player.playSound(SoundEvents.ENTITY_FIREWORK_ROCKET_LAUNCH.value(), 1.3F, 0.55F);
                                                                                 ^
  symbol: method value()
  location: variable ENTITY_FIREWORK_ROCKET_LAUNCH of type SoundEvent

ERROR in src/main/java/client/java/com/kodari/nukefishing/NukeFishingClient.java at line 64: cannot find symbol
        ItemEnchantments enchantments = stack.get(DataComponentTypes.ENCHANTMENTS);
        ^
  symbol: class ItemEnchantments
  location: class NukeFishingClient

ERROR in src/main/java/client/java/com/kodari/nukefishing/NukeFishingClient.java at line 110: no suitable method found for addParticle(SimpleParticleType,double,double,double,double,double,double)
            client.world.addParticle(ParticleTypes.END_ROD,
                        ^

ERROR in src/main/java/client/java/com/kodari/nukefishing/NukeFishingClient.java at line 112: no suitable method found for addParticle(SimpleParticleType,double,double,double,double,double,double)
            client.world.addParticle(ParticleTypes.FLAME,
                        ^

ERROR in src/main/java/client/java/com/kodari/nukefishing/NukeFishingClient.java at line 115: no suitable method found for addParticle(SimpleParticleType,double,double,double,double,double,double)
                client.world.addParticle(ParticleTypes.SMOKE,
                            ^

ERROR in src/main/java/client/java/com/kodari/nukefishing/NukeFishingClient.java at line 133: no suitable method found for addParticle(DustParticleEffect,double,double,double,double,double,double)
                    client.world.addParticle(RING_DUST,
                                ^

ERROR in src/main/java/client/java/com/kodari/nukefishing/NukeFishingClient.java at line 148: no suitable method found for addParticle(DustParticleEffect,double,double,double,double,double,double)
                    client.world.addParticle(CORE_DUST,
                                ^

ERROR in src/main/java/client/java/com/kodari/nukefishing/NukeFishingClient.java at line 151: no suitable method found for addParticle(DustParticleEffect,double,double,double,double,double,double)
                    client.world.addParticle(CORE_DUST,
                                ^

ERROR in src/main/java/client/java/com/kodari/nukefishing/NukeFishingClient.java at line 165: no suitable method found for addParticle(SimpleParticleType,double,double,double,double,double,double)
                client.world.addParticle(ParticleTypes.EXPLOSION,
                            ^

ERROR in src/main/java/client/java/com/kodari/nukefishing/NukeFishingClient.java at line 168: no suitable method found for addParticle(SimpleParticleType,double,double,double,double,double,double)
                client.world.addParticle(ParticleTypes.FLAME,
                            ^

ERROR in   src/main/java/client/java/com/kodari/nukefishing/NukeFishingClient.java at line 110: no suitable method found for addParticle(SimpleParticleType,double,double,double,double,double,double)
              client.world.addParticle(ParticleTypes.END_ROD,
                          ^

ERROR in   src/main/java/client/java/com/kodari/nukefishing/NukeFishingClient.java at line 112: no suitable method found for addParticle(SimpleParticleType,double,double,double,double,double,double)
              client.world.addParticle(ParticleTypes.FLAME,
                          ^

ERROR in   src/main/java/client/java/com/kodari/nukefishing/NukeFishingClient.java at line 115: no suitable method found for addParticle(SimpleParticleType,double,double,double,double,double,double)
                  client.world.addParticle(ParticleTypes.SMOKE,
                              ^

ERROR in   src/main/java/client/java/com/kodari/nukefishing/NukeFishingClient.java at line 133: no suitable method found for addParticle(DustParticleEffect,double,double,double,double,double,double)
                      client.world.addParticle(RING_DUST,
                                  ^

ERROR in   src/main/java/client/java/com/kodari/nukefishing/NukeFishingClient.java at line 148: no suitable method found for addParticle(DustParticleEffect,double,double,double,double,double,double)
                      client.world.addParticle(CORE_DUST,
                                  ^

ERROR in   src/main/java/client/java/com/kodari/nukefishing/NukeFishingClient.java at line 151: no suitable method found for addParticle(DustParticleEffect,double,double,double,double,double,double)
                      client.world.addParticle(CORE_DUST,
                                  ^

ERROR in   src/main/java/client/java/com/kodari/nukefishing/NukeFishingClient.java at line 165: no suitable method found for addParticle(SimpleParticleType,double,double,double,double,double,double)
                  client.world.addParticle(ParticleTypes.EXPLOSION,
                              ^

ERROR in   src/main/java/client/java/com/kodari/nukefishing/NukeFishingClient.java at line 168: no suitable method found for addParticle(SimpleParticleType,double,double,double,double,double,double)
                  client.world.addParticle(ParticleTypes.FLAME,
                              ^

ERROR in   src/main/java/client/java/com/kodari/nukefishing/NukeFishingClient.java at line 11: cannot find symbol
  import net.minecraft.component.type.ItemEnchantments;
                                     ^
  symbol: class ItemEnchantments
  location: package net.minecraft.component.type

ERROR in   src/main/java/client/java/com/kodari/nukefishing/NukeFishingClient.java at line 47: cannot find symbol
              ItemStack rod = client.player.getStackInHand(Hand.MAIN);
                                                               ^
  symbol: variable MAIN
  location: class Hand

ERROR in   src/main/java/client/java/com/kodari/nukefishing/NukeFishingClient.java at line 64: cannot find symbol
          ItemEnchantments enchantments = stack.get(DataComponentTypes.ENCHANTMENTS);
          ^
  symbol: class ItemEnchantments
  location: class NukeFishingClient

ERROR in   src/main/java/client/java/com/kodari/nukefishing/NukeFishingClient.java at line 50: cannot find symbol
                  client.player.playSound(SoundEvents.ENTITY_FIREWORK_ROCKET_LAUNCH.value(), 1.3F, 0.55F);
                                                                                   ^
  symbol: method value()
  location: variable ENTITY_FIREWORK_ROCKET_LAUNCH of type SoundEvent


=== COMPILATION ERROR ANALYSIS ===

MISSING CLASSES:
  - ItemEnchantments
ACTION: Create these classes or check imports

MISSING METHODS:
  - value()
ACTION: Check method names and signatures

FILES TO INVESTIGATE:
  - src/main/java/client/java/com/kodari/nukefishing/NukeFishingClient.java
  -   src/main/java/client/java/com/kodari/nukefishing/NukeFishingClient.java

Please fix this error by creating a new artifact with the corrected code.

Kodari AI
KodariSep 11 at 1:17 pm 2
  1. Inspect the current client entrypoint and verified 1.21.11 API guidance.

  2. Replace the outdated enchantment, hand, sound, and particle calls.

  3. Patch the source under the correct split client source path.

Fixed the compilation errors in NukeFishingClient.java:

  • Removed the invalid ItemEnchantments import and used inferred enchantment data.

  • Changed Hand.MAIN to Hand.MAIN_HAND.

  • Removed .value() from sound events.

  • Replaced ClientWorld.addParticle(...) with addParticleClient(...).

  • Kept the existing Infinity enchantment registry lookup compatible with Yarn 1.21.11.

The corrected artifact is now at:

src/client/java/com/kodari/nukefishing/NukeFishingClient.java

12323acdf

The compilation failed with this error:

code
Compilation failed with 2 error(s):

ERROR in src/main/java/client/java/com/kodari/nukefishing/NukeFishingClient.java at line 139: incompatible types: Reference<SoundEvent> cannot be converted to SoundEvent
            client.player.playSound(SoundEvents.ENTITY_GENERIC_EXPLODE, 2.5F, 0.55F);
                                               ^

ERROR in   src/main/java/client/java/com/kodari/nukefishing/NukeFishingClient.java at line 139: incompatible types: Reference<SoundEvent> cannot be converted to SoundEvent
              client.player.playSound(SoundEvents.ENTITY_GENERIC_EXPLODE, 2.5F, 0.55F);
                                                 ^


=== COMPILATION ERROR ANALYSIS ===

TYPE MISMATCHES:
  - incompatible types: Reference<SoundEvent> cannot be converted to SoundEvent
  - incompatible types: Reference<SoundEvent> cannot be converted to SoundEvent
ACTION: Fix variable types or casting

FILES TO INVESTIGATE:
  - src/main/java/client/java/com/kodari/nukefishing/NukeFishingClient.java
  -   src/main/java/client/java/com/kodari/nukefishing/NukeFishingClient.java

Please fix this error by creating a new artifact with the corrected code.

Kodari AI
KodariSep 11 at 1:20 pm 1

Fixed the sound type mismatch by unwrapping ENTITY_GENERIC_EXPLODE with .value():

src/client/java/com/kodari/nukefishing/NukeFishingClient.java

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
6 277
src/client/java/com/kodari/nukefishing/NukeFishingClient.java
package com.kodari.nukefishing;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.minecraft.client.MinecraftClient;
import net.minecraft.component.DataComponentTypes;
import net.minecraft.enchantment.Enchantments;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.particle.DustParticleEffect;
import net.minecraft.particle.ParticleTypes;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.sound.SoundEvents;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;

public final class NukeFishingClient implements ClientModInitializer {
    private static final int RING_COUNT = 10;
    private static final int MAX_AGE = 52;
    private static final DustParticleEffect CORE_DUST = new DustParticleEffect(0xFF3B0A, 1.15F);
    private static final DustParticleEffect RING_DUST = new DustParticleEffect(0xFFB300, 0.85F);

    private final List<NukeShot> shots = new ArrayList<>();
    private boolean useKeyWasDown;

    @Override
    public void onInitializeClient() {
        ClientTickEvents.END_CLIENT_TICK.register(this::tick);
    }

    private void tick(MinecraftClient client) {
        if (client.player == null || client.world == null) {
            shots.clear();
            useKeyWasDown = false;
            return;
        }

        boolean useKeyDown = client.options.useKey.isPressed();
        if (useKeyDown && !useKeyWasDown) {
            ItemStack rod = client.player.getStackInHand(Hand.MAIN_HAND);
            if (rod.isOf(Items.FISHING_ROD) && hasInfinity(client, rod)) {
                shots.add(new NukeShot(client.player));
                client.player.playSound(SoundEvents.ENTITY_FIREWORK_ROCKET_LAUNCH, 1.3F, 0.55F);
            }
        }
        useKeyWasDown = useKeyDown;

        Iterator<NukeShot> iterator = shots.iterator();
        while (iterator.hasNext()) {
            if (iterator.next().tick(client)) {
                iterator.remove();
            }
        }
    }

    private static boolean hasInfinity(MinecraftClient client, ItemStack stack) {
        var enchantments = stack.get(DataComponentTypes.ENCHANTMENTS);
        if (enchantments == null) {
            return false;
        }

        return enchantments.getLevel(
                client.world.getRegistryManager()
                        .getOrThrow(RegistryKeys.ENCHANTMENT)
                        .getOrThrow(Enchantments.INFINITY)) > 0;
    }

    private static final class NukeShot {
        private final Vec3d direction;
        private final Vec3d right;
        private final Vec3d up;
        private Vec3d position;
        private int age;

        private NukeShot(PlayerEntity player) {
            this.position = player.getCameraPosVec(1.0F).add(player.getRotationVec(1.0F).multiply(0.8));
            this.direction = player.getRotationVec(1.0F).normalize();

            Vec3d referenceUp = Math.abs(direction.y) > 0.9
                    ? new Vec3d(1.0, 0.0, 0.0)
                    : new Vec3d(0.0, 1.0, 0.0);
            this.right = direction.crossProduct(referenceUp).normalize();
            this.up = right.crossProduct(direction).normalize();
        }

        private boolean tick(MinecraftClient client) {
            age++;
            position = position.add(direction.multiply(1.35));

            spawnTrail(client);
            spawnRings(client);

            BlockPos blockPos = BlockPos.ofFloored(position);
            boolean hitBlock = age > 2 && !client.world.getBlockState(blockPos).isAir();
            if (hitBlock || age >= MAX_AGE) {
                spawnDetonation(client);
                return true;
            }
            return false;
        }

        private void spawnTrail(MinecraftClient client) {
            client.world.addParticleClient(ParticleTypes.END_ROD,
                    position.x, position.y, position.z, 0.0, 0.0, 0.0);
            client.world.addParticleClient(ParticleTypes.FLAME,
                    position.x, position.y, position.z, 0.0, 0.015, 0.0);
            if (age % 2 == 0) {
                client.world.addParticleClient(ParticleTypes.SMOKE,
                        position.x, position.y, position.z, 0.0, 0.02, 0.0);
            }
        }

        private void spawnRings(MinecraftClient client) {
            for (int ring = 0; ring < RING_COUNT; ring++) {
                int ringAge = age - 2 - ring * 4;
                if (ringAge < 0 || ringAge > 18) {
                    continue;
                }

                double radius = 0.18 + ringAge * 0.23;
                for (int point = 0; point < 40; point++) {
                    double angle = point * Math.PI * 2.0 / 40.0;
                    Vec3d offset = right.multiply(Math.cos(angle) * radius)
                            .add(up.multiply(Math.sin(angle) * radius));
                    Vec3d ringPoint = position.add(offset);
                    client.world.addParticleClient(RING_DUST,
                            ringPoint.x, ringPoint.y, ringPoint.z, 0.0, 0.0, 0.0);
                }
            }
        }

        private void spawnDetonation(MinecraftClient client) {
            client.player.playSound(SoundEvents.ENTITY_GENERIC_EXPLODE.value(), 2.5F, 0.55F);

            for (int ring = 0; ring < RING_COUNT; ring++) {
                double radius = 0.7 + ring * 0.42;
                for (int point = 0; point < 48; point++) {
                    double angle = point * Math.PI * 2.0 / 48.0;
                    double y = Math.sin(angle) * radius;
                    double horizontal = Math.cos(angle) * radius;
                    client.world.addParticleClient(CORE_DUST,
                            position.x + horizontal, position.y + y, position.z,
                            0.0, 0.02, 0.0);
                    client.world.addParticleClient(CORE_DUST,
                            position.x, position.y + y, position.z + horizontal,
                            0.0, 0.02, 0.0);
                }
            }

            for (int particle = 0; particle < 90; particle++) {
                double theta = particle * 0.71;
                double phi = particle * 1.17;
                double spread = 0.25 + (particle % 9) * 0.12;
                Vec3d velocity = new Vec3d(
                        Math.cos(theta) * Math.sin(phi),
                        Math.cos(phi),
                        Math.sin(theta) * Math.sin(phi)).multiply(spread);
                client.world.addParticleClient(ParticleTypes.EXPLOSION,
                        position.x, position.y, position.z,
                        velocity.x, velocity.y, velocity.z);
                client.world.addParticleClient(ParticleTypes.FLAME,
                        position.x, position.y, position.z,
                        velocity.x, velocity.y, velocity.z);
            }
        }
    }
}