orbital destroyer

make a mod where theres a god mace and everytime you mace somebody and kill them you steal one of their hearts and make a orbital strike cannon one bigger to the smallest to ten rings and it give pvp effects and theres ten charges for nukes and stabs version 1.21.11 and when you do /godmace it gives you the item ops can only have it and theres a crafting recpie like 4 elytas in each corner and 4 glowstone in the sides and a mace in the middle the mace is blue

Kodari AI
KodariFri at 5:30 pm 8
GodMaceOrbitalStrike
A Fabric mod for Minecraft 1.21.1 adding a blue God Mace. Killing players with it steals a heart and charges an orbital strike cannon with up to ten rings, granting PvP effects. Includes ten nuke charges and a stab attack. The /godmace command grants the item to operators only. Crafting recipe: four elytras in corners, four glowstone on sides, mace in center.
  • I’ll make the blue God Mace craftable and available through the operator-only command.

  • Its orbital attack will be built into the mace: right-click to fire one of ten charges at the point you’re looking at.

Created the God Mace for Fabric 1.21.11.

  • Obtain it: Craft it with four elytra in the corners, four glowstone on the sides, and a mace in the center. Operators can also use /godmace.

  • Steal hearts: Killing a player with it transfers one permanent heart, provided they have more than one heart left.

  • Orbital strike: Right-click to fire at the point you’re looking at. It creates ten rings, damages nearby enemies, and applies Slowness and Weakness. Each mace has ten charges; craft another for more.

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

import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
import net.fabricmc.fabric.api.entity.event.v1.ServerLivingEntityEvents;
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
import net.minecraft.command.permission.Permission;
import net.minecraft.command.permission.PermissionLevel;
import net.minecraft.component.DataComponentTypes;
import net.minecraft.component.type.WeaponComponent;
import net.minecraft.entity.attribute.EntityAttributeInstance;
import net.minecraft.entity.attribute.EntityAttributes;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.item.MaceItem;
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.network.ServerPlayerEntity;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import net.minecraft.util.Rarity;

public class GodMace implements ModInitializer {
    private static final RegistryKey<Item> KEY = RegistryKey.of(RegistryKeys.ITEM, Identifier.of("godmace", "god_mace"));
    public static final Item GOD_MACE = Registry.register(Registries.ITEM, KEY, new GodMaceItem(
        new Item.Settings().registryKey(KEY).rarity(Rarity.EPIC).maxDamage(500)
            .component(DataComponentTypes.TOOL, MaceItem.createToolComponent())
            .repairable(Items.BREEZE_ROD).attributeModifiers(MaceItem.createAttributeModifiers())
            .enchantable(15).component(DataComponentTypes.WEAPON, new WeaponComponent(1))
    ));

    @Override
    public void onInitialize() {
        ItemGroupEvents.modifyEntriesEvent(RegistryKey.of(RegistryKeys.ITEM_GROUP, Identifier.ofVanilla("combat")))
            .register(entries -> entries.add(GOD_MACE));

        CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> dispatcher.register(
            CommandManager.literal("godmace")
                .requires(source -> source.getPermissions().hasPermission(new Permission.Level(PermissionLevel.GAMEMASTERS)))
                .executes(context -> {
                    ServerPlayerEntity player = context.getSource().getPlayerOrThrow();
                    ItemStack stack = new ItemStack(GOD_MACE);
                    if (!player.getInventory().insertStack(stack)) {
                        player.sendMessage(Text.literal("Your inventory is full."), false);
                        return 0;
                    }
                    player.sendMessage(Text.literal("You received the God Mace."), false);
                    return 1;
                })
        ));

        ServerLivingEntityEvents.AFTER_DEATH.register((victim, source) -> {
            if (!(victim instanceof ServerPlayerEntity target)
                || !(source.getAttacker() instanceof ServerPlayerEntity killer) || target == killer) return;
            ItemStack weapon = source.getWeaponStack();
            if (weapon == null || !weapon.isOf(GOD_MACE)) return;
            EntityAttributeInstance from = target.getAttributeInstance(EntityAttributes.MAX_HEALTH);
            EntityAttributeInstance to = killer.getAttributeInstance(EntityAttributes.MAX_HEALTH);
            if (from == null || to == null || from.getBaseValue() < 4.0 || to.getBaseValue() > 1022.0) return;
            from.setBaseValue(from.getBaseValue() - 2.0);
            to.setBaseValue(to.getBaseValue() + 2.0);
            killer.sendMessage(Text.literal("You stole one heart from " + target.getName().getString() + "!"), false);
            target.sendMessage(Text.literal("The God Mace stole one of your hearts!"), false);
        });
    }
}