Ryu -san

Create a Minecraft Java 1.21.11 Fabric mod featuring a fully functional TNT Minecart Cannon inspired by the Unstable SMP Orbital Strike Cannon. The cannon must use TNT Minecarts as its primary ammunition and launch them directly toward a selected target. Its activation mechanism must be a Fishing Rod with exactly 1 durability, which breaks immediately after activating the cannon. The firing system should deliver a powerful, consistent, and synchronized attack while maintaining reliable targeting and preventing duplicate activation. Ensure the entire system is compatible with Fabric 1.21.11 and functions correctly in both single-player and multiplayer environments. The final result should be a stable, fully functional cannon with no unrelated weapons or abilities.

Kodari AI
KodariNov 11 at 7:16 pm 5
OrbitalMinecartCannon
A Fabric 1.21.11 mod adding a TNT Minecart cannon that launches minecarts toward a targeted block. Activated by right-clicking with a Fishing Rod having exactly 1 durability, which breaks after use. The cannon delivers a synchronized, powerful volley of TNT minecarts to the target location, with reliable aiming and duplicate-activation prevention. Works in single-player and multiplayer.
  1. Add a single-use, one-durability fishing-rod trigger and a survival recipe.

  2. Fire a server-spawned TNT minecart toward the entity under the player’s crosshair, consuming one TNT minecart.

  3. Guide each fired cart server-side and detonate it at the selected target, with guards against duplicate firing.

Implemented the Fabric 1.21.11 Orbital Cannon mod. Aim at an entity and use the trigger: it consumes one TNT minecart from your inventory, launches it toward the target, and breaks the one-durability trigger on a successful shot. Server-side targeting and flight control prevent duplicate firing in the same player tick.

In survival, craft the trigger from a vanilla fishing rod; carry TNT minecarts as ammunition. The trigger appears in its own creative tab.

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

import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;

public final class OrbitalCannonMod implements ModInitializer {
    public static final String MOD_ID = "orbitalcannon";

    @Override
    public void onInitialize() {
        StrikeTriggerItem.register();
        ServerTickEvents.END_WORLD_TICK.register(StrikeTriggerItem::tickFlights);
    }
}