KappaReal

can u make me a 1.21.11 plugin to make it so spears can be enchanted with riptide 3 and they work out of water? pls and thank you.

Kodari AI
KodariSep 7 at 2:01 am 1
SpearRiptideEnchant
This plugin enables spears to be enchanted with Riptide level 3 and function effectively outside of water. It modifies the enchantment rules to allow Riptide on spear-type weapons, overriding the vanilla restriction that limits Riptide to tridents. The plugin also removes the water requirement for Riptide activation, allowing players to launch themselves with spears on land. It includes custom enchantment validation, a listener for enchantment attempts, and a mechanic that triggers the Riptide effect when a spear is thrown or used, providing the same propulsion and damage capabilities as a trident but on any terrain. Compatible with Minecraft 1.21.11.

I’ll create a minimal Paper 1.21.11 plugin with:

  1. Riptide III offers for spear enchanting.

  2. Riptide spear support through anvils.

  3. Dry-land launching for Riptide spears while preserving normal wet-weather behavior.

  4. Gradle and plugin metadata.

Created the Paper 1.21.11 plugin.

  • Adds Riptide III as an enchantment-table option for spears.

  • Allows applying Riptide books to spears through anvils.

  • Lets Riptide-enchanted spears launch players on dry land.

  • Preserves normal water and rain behavior.

  • Added Gradle setup and plugin.yml.

Main class: com.kodari.spearriptide.SpearRiptidePlugin

KappaReal

thats just a dash its meant to actually meant to look like the animation and the noise, everything. also when i hold right click i want it to dash once and the spear to actually work like how its meant to in the normal game

Kodari AI
KodariSep 7 at 2:08 am 2
  1. Replace the custom dash with the native spear/Riptide behavior so the launch animation, sound, particles, and cooldown match vanilla.

  2. Prevent held right-click from repeatedly triggering, while allowing a fresh dash after the normal use cycle.

  3. Keep the Riptide III enchanting support intact.

Updated the plugin to use Paper’s native Riptide spin attack instead of a custom velocity dash.

  • Uses the real Riptide animation, movement, particles, collision damage, and sound.

  • Works on land, in water, and during rain.

  • Holding right-click triggers only one dash per press.

  • Releasing right-click resets it so the next press can dash again.

  • Normal spear behavior is no longer cancelled.

  • Added cleanup when the player releases the item, changes hotbar slot, or quits.

KappaReal

it does the animation now but it doesnt actually do the dash

Kodari AI
KodariSep 7 at 2:12 am 1
  1. Keep Paper’s native startRiptideAttack(...) for the animation and sound.

  2. Add the missing vanilla-style launch velocity immediately after the native animation call.

  3. Prevent duplicate launches during the same held-right-click and retain the existing reset behavior.

Fixed the missing movement. The plugin now:

  • Keeps the native Riptide animation and sound.

  • Applies vanilla-style Riptide launch velocity afterward.

  • Uses Riptide level scaling: level 3 launches at 2.5x direction speed.

  • Still prevents repeated launches while holding right-click.

KappaReal

perfect but can u make it so it has the riptide sound?

Kodari AI
KodariSep 21 at 8:19 pm 1

Added the Riptide sound effect. The sound now matches the enchantment level, including the level 3 Riptide sound.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
4 174
src/main/java/com/kodari/spearriptide/SpearRiptidePlugin.java
package com.kodari.spearriptide;

import com.cryptomorin.xseries.XSound;
import org.bukkit.Registry;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.enchantments.EnchantmentOffer;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.enchantment.EnchantItemEvent;
import org.bukkit.event.enchantment.PrepareItemEnchantEvent;
import org.bukkit.event.inventory.PrepareAnvilEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerItemHeldEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import io.papermc.paper.event.player.PlayerStopUsingItemEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;

import java.util.HashMap;
import java.util.Map;
import java.util.UUID;

public final class SpearRiptidePlugin extends JavaPlugin implements Listener {

    private static final int RiptideLevel = 3;
    private Enchantment riptide;
    private final Map<UUID, Boolean> riptideActive = new HashMap<>();

    @Override
    public void onEnable() {
        riptide = Registry.ENCHANTMENT.get(org.bukkit.NamespacedKey.minecraft("riptide"));
        if (riptide == null) {
            getLogger().severe("The Riptide enchantment is unavailable; disabling plugin.");
            getServer().getPluginManager().disablePlugin(this);
            return;
        }

        getServer().getPluginManager().registerEvents(this, this);
    }

    @EventHandler
    public void onPrepareItemEnchant(PrepareItemEnchantEvent event) {
        ItemStack item = event.getItem();
        if (!isSpear(item)) {
            return;
        }

        EnchantmentOffer[] offers = event.getOffers();
        if (offers.length > 0) {
            offers[0] = new EnchantmentOffer(riptide, RiptideLevel, 30);
        }
    }

    @EventHandler
    public void onEnchantItem(EnchantItemEvent event) {
        if (isSpear(event.getItem())) {
            event.getEnchantsToAdd().put(riptide, RiptideLevel);
        }
    }

    @EventHandler
    public void onPrepareAnvil(PrepareAnvilEvent event) {
        ItemStack base = event.getInventory().getItem(0);
        ItemStack addition = event.getInventory().getItem(1);
        if (!isSpear(base) || !hasRiptide(addition)) {
            return;
        }

        ItemStack result = base.clone();
        int level = Math.min(RiptideLevel, Math.max(1, addition.getEnchantmentLevel(riptide)));
        result.addUnsafeEnchantment(riptide, level);
        event.setResult(result);
        event.getInventory().setRepairCost(1);
    }

    @EventHandler
    public void onPlayerInteract(PlayerInteractEvent event) {
        ItemStack item = event.getItem();
        if (!isSpear(item) || item.getEnchantmentLevel(riptide) <= 0) {
            return;
        }

        if (!event.getAction().isRightClick()) {
            return;
        }

        UUID playerId = event.getPlayer().getUniqueId();
        if (!riptideActive.containsKey(playerId)) {
            riptideActive.put(playerId, true);
            event.getPlayer().startRiptideAttack(20, 8.0F, item);

            int level = item.getEnchantmentLevel(riptide);
            Vector direction = event.getPlayer().getLocation().getDirection().normalize();
            double multiplier = 1.0D + (level * 0.5D);
            event.getPlayer().setVelocity(direction.multiply(multiplier));
            XSound.matchXSound("ITEM_TRIDENT_RIPTIDE_" + Math.min(level, 3))
                    .ifPresent(sound -> sound.play(event.getPlayer()));
        }
    }

    @EventHandler
    public void onPlayerStopUsingItem(PlayerStopUsingItemEvent event) {
        if (isSpear(event.getItem()) && hasRiptide(event.getItem())) {
            riptideActive.remove(event.getPlayer().getUniqueId());
        }
    }

    @EventHandler
    public void onPlayerItemHeld(PlayerItemHeldEvent event) {
        riptideActive.remove(event.getPlayer().getUniqueId());
    }

    @EventHandler
    public void onPlayerQuit(PlayerQuitEvent event) {
        riptideActive.remove(event.getPlayer().getUniqueId());
    }

    private boolean isSpear(ItemStack item) {
        if (item == null) {
            return false;
        }

        String materialName = item.getType().getKey().getKey();
        return materialName.endsWith("_spear") || materialName.equals("spear");
    }

    private boolean hasRiptide(ItemStack item) {
        return item != null && item.getEnchantmentLevel(riptide) > 0;
    }

}