Leon Schütrumpf

make me an mace that swings at a speed as an sword and it can have every sword enchant and every mace enchant and the crafting recipe shuld be heavy core in the middle an heavycore mid left and right an diamond sword and in the corners egaps

Kodari AI
KodariSep 18 at 5:02 pm 2
MaceSwordHybrid
Creates a hybrid Mace-Sword weapon that swings at sword speed while retaining mace smash mechanics. The weapon supports all sword enchantments and all mace enchantments simultaneously. Crafting recipe requires a Heavy Core in the center, Heavy Cores on the mid-left and mid-right, a Diamond Sword in the bottom-middle position, and Ender Pearls in the four corners. The weapon combines sword attack speed with mace damage and knockback properties, offering a unique combat experience for players seeking versatility in melee combat.
  1. Create a Paper plugin with a custom Heavy Mace item and sword-speed attributes.

  2. Add the requested shaped recipe using enchanted golden apples, heavy cores, and a diamond sword.

  3. Support sword and mace enchantments through anvil combinations, with plugin metadata and Gradle setup.

Created the Heavy Mace plugin with:

  • Sword-speed attack behavior.

  • Support for sword and mace enchantments.

  • Custom crafting recipe:

    • Corners: Enchanted Golden Apples

    • Middle row: Heavy Core, Heavy Core, Heavy Core

    • Bottom center: Diamond Sword

  • Anvil support for applying supported enchantments.

  • Paper 1.21.4 Gradle setup and plugin metadata.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
6 222
src/main/java/com/example/heavymace/HeavyMacePlugin.java
package com.example.heavymace;

import org.bukkit.Bukkit;
import org.bukkit.NamespacedKey;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.RecipeChoice;
import org.bukkit.inventory.ShapedRecipe;
import org.bukkit.plugin.java.JavaPlugin;

import com.cryptomorin.xseries.XMaterial;

public final class HeavyMacePlugin extends JavaPlugin {

    private NamespacedKey maceKey;

    @Override
    public void onEnable() {
        this.maceKey = new NamespacedKey(this, "heavy_mace");
        registerRecipe();
        getServer().getPluginManager().registerEvents(new HeavyMaceListener(this), this);
    }

    public NamespacedKey getMaceKey() {
        return maceKey;
    }

    private void registerRecipe() {
        ItemStack enchantedGoldenApple = XMaterial.matchXMaterial("ENCHANTED_GOLDEN_APPLE")
                .map(XMaterial::parseItem)
                .orElseThrow(() -> new IllegalStateException("Enchanted golden apples are unavailable"));
        ItemStack heavyCore = XMaterial.matchXMaterial("HEAVY_CORE")
                .map(XMaterial::parseItem)
                .orElseThrow(() -> new IllegalStateException("Heavy cores are unavailable"));
        ItemStack diamondSword = XMaterial.matchXMaterial("DIAMOND_SWORD")
                .map(XMaterial::parseItem)
                .orElseThrow(() -> new IllegalStateException("Diamond swords are unavailable"));

        ShapedRecipe recipe = new ShapedRecipe(new NamespacedKey(this, "heavy_mace"), HeavyMaceItem.create(this));
        recipe.shape("E E", "HHH", "ES E".replace(" ", ""));
        recipe.setIngredient('E', new RecipeChoice.ExactChoice(enchantedGoldenApple));
        recipe.setIngredient('H', new RecipeChoice.ExactChoice(heavyCore));
        recipe.setIngredient('S', new RecipeChoice.ExactChoice(diamondSword));
        Bukkit.addRecipe(recipe);
    }
}