Noah Gordon

Actually instead make me a mod when i type /OrbitalWindcharge. It gives me a fishing rod and wherever i look when throwing it 300 wind charges show up on that spot. Wait not where the hook lands make it where im looking when i throw it and make it so the fish has 1 durability so it breaks when i throw it.

MAKE IT PAPER 1.21.11

Kodari AI
KodariOct 26 at 6:55 am 1
OrbitalWindchargeRod
A Paper 1.21.11 plugin adding a /OrbitalWindcharge command that grants a fishing rod with 1 durability. When thrown, instead of the hook landing point, it spawns 300 wind charges at the player's crosshair target location at the moment of casting. The rod breaks after a single throw due to its single durability point.
  1. Create a Paper 1.21.11 Gradle plugin project.

  2. Add /OrbitalWindcharge to give a custom one-durability fishing rod.

  3. On cast, spawn 300 wind charges at the point the player is looking and consume the rod.

Created a Paper 1.21.11 plugin. Use /OrbitalWindcharge to get the custom fishing rod; casting it spawns 300 wind charges at your aimed block (or at the end of a 128-block aim range if no block is hit), then consumes the rod.

Noah Gordon

It says missing required files for fabric mod

Kodari AI
KodariOct 26 at 7:16 am 7
  1. Replace the Paper plugin files with the Fabric project structure this workspace requires.

  2. Preserve the command, one-use fishing-rod behavior, and 300 wind charges at the player’s aim point.

[Generation stopped]

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
5 121
src/main/java/com/kodari/orbitalwindcharge/OrbitalWindchargePlugin.java
package com.kodari.orbitalwindcharge;

import java.util.Map;
import org.bukkit.ChatColor;
import org.bukkit.EntityEffect;
import org.bukkit.EntityType;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerFishEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.persistence.PersistentDataType;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.RayTraceResult;
import org.bukkit.util.Vector;

public final class OrbitalWindchargePlugin extends JavaPlugin implements Listener {
	private static final int CHARGE_COUNT = 300;
	private static final double AIM_RANGE = 128.0;
	private NamespacedKey rodMarker;

	@Override
	public void onEnable() {
		rodMarker = new NamespacedKey(this, "orbital_windcharge_rod");
		getServer().getPluginManager().registerEvents(this, this);
		getCommand("orbitalwindcharge").setExecutor((sender, command, label, args) -> {
			if (!(sender instanceof Player player)) {
				sender.sendMessage("This command can only be used by a player.");
				return true;
			}

			ItemStack rod = createRod();
			Map<Integer, ItemStack> leftovers = player.getInventory().addItem(rod);
			leftovers.values().forEach(item -> player.getWorld().dropItemNaturally(player.getLocation(), item));
			player.sendMessage(ChatColor.AQUA + "You received an Orbital Windcharge Rod.");
			return true;
		});
	}

	private ItemStack createRod() {
		ItemStack rod = new ItemStack(Material.FISHING_ROD);
		ItemMeta meta = rod.getItemMeta();
		meta.setDisplayName(ChatColor.AQUA + "Orbital Windcharge Rod");
		meta.setMaxDamage(1);
		meta.getPersistentDataContainer().set(rodMarker, PersistentDataType.BYTE, (byte) 1);
		rod.setItemMeta(meta);
		return rod;
	}

	@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
	public void onCast(PlayerFishEvent event) {
		if (event.getState() != PlayerFishEvent.State.FISHING) {
			return;
		}

		Player player = event.getPlayer();
		ItemStack rod = player.getInventory().getItemInMainHand();
		if (rod.getType() != Material.FISHING_ROD || !rod.hasItemMeta()
				|| !rod.getItemMeta().getPersistentDataContainer().has(rodMarker, PersistentDataType.BYTE)) {
			return;
		}

		Location eye = player.getEyeLocation();
		Vector direction = eye.getDirection().normalize();
		RayTraceResult trace = player.getWorld().rayTraceBlocks(eye, direction, AIM_RANGE);
		Location target;
		if (trace != null && trace.getHitPosition() != null) {
			Vector hit = trace.getHitPosition();
			target = new Location(player.getWorld(), hit.getX(), hit.getY(), hit.getZ())
					.subtract(direction.clone().multiply(0.25));
		} else {
			target = eye.clone().add(direction.clone().multiply(AIM_RANGE));
		}

		for (int i = 0; i < CHARGE_COUNT; i++) {
			Entity charge = player.getWorld().spawnEntity(target, EntityType.WIND_CHARGE);
			charge.setVelocity(direction.clone().multiply(1.6));
		}

		player.getInventory().setItemInMainHand(new ItemStack(Material.AIR));
		player.sendMessage(ChatColor.GREEN + "300 wind charges launched at your aim point. The rod broke.");
	}
}