Skip to content

Commit

Permalink
CEs Work on MultiArrow (#857)
Browse files Browse the repository at this point in the history
Make CEs work on all the arrows shot by MultiArrow.
  • Loading branch information
TrueDarkLord authored Sep 29, 2024
1 parent 8a4b0e5 commit 0765aee
Showing 1 changed file with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@
import org.bukkit.entity.AbstractArrow;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.entity.LivingEntity;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.projectiles.ProjectileSource;
import org.bukkit.util.Vector;
import org.jetbrains.annotations.NotNull;

Expand Down Expand Up @@ -69,14 +68,14 @@ public EnchantedArrow getEnchantedArrow(Arrow arrow) {

// Multi Arrow Start!

public void spawnArrows(Entity entity, Entity projectile, ItemStack bow) {
Arrow spawnedArrow = entity.getWorld().spawn(projectile.getLocation(), Arrow.class);
public void spawnArrows(LivingEntity shooter, Entity projectile, ItemStack bow) {
Arrow spawnedArrow = shooter.getWorld().spawn(projectile.getLocation(), Arrow.class);

EnchantedArrow enchantedMultiArrow = new EnchantedArrow(spawnedArrow, bow, enchantmentBookSettings.getEnchantments(bow));

this.enchantedArrows.add(enchantedMultiArrow);

spawnedArrow.setShooter((ProjectileSource) entity);
spawnedArrow.setShooter(shooter);

Vector vector = new Vector(randomSpread(), 0, randomSpread());

Expand All @@ -87,8 +86,6 @@ public void spawnArrows(Entity entity, Entity projectile, ItemStack bow) {
if (projectile.getFireTicks() > 0) spawnedArrow.setFireTicks(projectile.getFireTicks());

spawnedArrow.setPickupStatus(AbstractArrow.PickupStatus.DISALLOWED);

this.enchantedArrows.remove(enchantedMultiArrow);
}

private float randomSpread() {
Expand Down

0 comments on commit 0765aee

Please sign in to comment.