Jaeliv Concepts

make a orbital strike cannon mod where whenever u say /mobOrbital then u type a mobs then it gives u a fishing rod whenever u release that fishing rod the mobs name u typed gets summoned for any tame able mob that is will be tamed by u like a happy ghast spawns with a red harness and a wolf spawns with ur tamed player data and u can set how many mobs u want to spawn

Kodari AI
KodariNov 5 at 5:09 pm 9
OrbitalMobStrike
A Fabric mod adding an orbital strike cannon system. Players type /mobOrbital followed by a mob name and quantity, receiving a special fishing rod. When the rod is released, the specified number of mobs spawn at the target location. Tameable mobs automatically become tamed by the player, with special handling for happy ghasts (red harness) and wolves (player's tamed data). Configurable spawn counts via command arguments.
  1. Register /mobOrbital <mob> [count] and give the player a dedicated orbital rod.

  2. On rod release, spawn the selected mob count and tame supported mobs to the player.

  3. Add the rod’s model, texture, and survival recipe.

Added the Fabric 1.21.11 Orbital Strike Cannon mod.

Use /mobOrbital <mob> [count] to get a configured rod; the count defaults to 1 and can be set from 1 to 64. For example: /mobOrbital minecraft:wolf 3. Hold right-click, then release to summon the mobs around you. Tameable mobs are assigned to you, and Happy Ghasts receive a red harness.

The cannon is also craftable in survival from a fishing rod, 2 ender eyes, 2 redstone dust, and 4 iron ingots.

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

import com.mojang.brigadier.arguments.IntegerArgumentType;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
import net.minecraft.command.argument.IdentifierArgumentType;
import net.minecraft.entity.SpawnGroup;
import net.minecraft.entity.EntityType;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemGroups;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.component.DataComponentTypes;
import net.minecraft.component.type.NbtComponent;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.server.command.CommandManager;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;

public class OrbitalCannonMod implements ModInitializer {
    public static final String MOD_ID = "orbitalcannon";
    private static final RegistryKey<Item> ORBITAL_CANNON_KEY = RegistryKey.of(
            RegistryKeys.ITEM,
            Identifier.of(MOD_ID, "orbital_cannon")
    );
    public static final Item ORBITAL_CANNON = Registry.register(
            Registries.ITEM,
            Identifier.of(MOD_ID, "orbital_cannon"),
            new OrbitalCannonItem(new Item.Settings().maxCount(1).registryKey(ORBITAL_CANNON_KEY))
    );

    @Override
    public void onInitialize() {
        RegistryKey<net.minecraft.item.ItemGroup> toolsGroup = RegistryKey.of(
                RegistryKeys.ITEM_GROUP,
                Identifier.ofVanilla("tools_and_utilities")
        );
        ItemGroupEvents.modifyEntriesEvent(toolsGroup).register(entries -> entries.add(new ItemStack(ORBITAL_CANNON)));

        CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) ->
                dispatcher.register(CommandManager.literal("mobOrbital")
                        .then(CommandManager.argument("mob", IdentifierArgumentType.identifier())
                                .executes(context -> giveCannon(context.getSource(),
                                        IdentifierArgumentType.getIdentifier(context, "mob"), 1))
                                .then(CommandManager.argument("count", IntegerArgumentType.integer(1, 64))
                                        .executes(context -> giveCannon(context.getSource(),
                                                IdentifierArgumentType.getIdentifier(context, "mob"),
                                                IntegerArgumentType.getInteger(context, "count"))))))
        );
    }

    private static int giveCannon(ServerCommandSource source, Identifier mobId, int count) {
        ServerPlayerEntity player = source.getPlayer();
        if (player == null) {
            source.sendFeedback(() -> Text.literal("This command can only be used by a player."), false);
            return 0;
        }

        if (!Registries.ENTITY_TYPE.containsId(mobId)) {
            source.sendFeedback(() -> Text.literal("Unknown mob: " + mobId), false);
            return 0;
        }

        EntityType<?> entityType = Registries.ENTITY_TYPE.get(mobId);
        if (entityType.getSpawnGroup() == SpawnGroup.MISC) {
            source.sendFeedback(() -> Text.literal("Choose a mob entity type."), false);
            return 0;
        }

        ItemStack cannon = new ItemStack(ORBITAL_CANNON);
        NbtComponent.set(DataComponentTypes.CUSTOM_DATA, cannon, nbt -> {
            nbt.putString("Mob", mobId.toString());
            nbt.putInt("Count", count);
        });
        if (!player.giveItemStack(cannon)) {
            player.dropItem(cannon, false, false);
        }

        source.sendFeedback(() -> Text.literal("Orbital cannon calibrated for " + mobId + " ×" + count
                + ". Hold and release the rod to summon."), false);
        return 1;
    }
}