mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2025-01-21 00:21:20 +01:00
commit
f00ed90b76
@ -1,5 +1,7 @@
|
||||
package com.willfp.ecoenchants.enchantments.ecoenchants.special;
|
||||
|
||||
import com.willfp.eco.core.entities.Entities;
|
||||
import com.willfp.eco.core.entities.TestableEntity;
|
||||
import com.willfp.eco.core.integrations.antigrief.AntigriefManager;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchant;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||
@ -15,16 +17,23 @@ import org.bukkit.event.entity.ProjectileLaunchEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
@SuppressWarnings({"unchecked", "unused"})
|
||||
public class Aiming extends EcoEnchant {
|
||||
private final List<TestableEntity> targets = new ArrayList<>();
|
||||
|
||||
public Aiming() {
|
||||
super(
|
||||
"aiming", EnchantmentType.SPECIAL
|
||||
);
|
||||
targets.clear();
|
||||
targets.addAll(this.getConfig().getStrings(EcoEnchants.CONFIG_LOCATION + "targets").stream().map(
|
||||
Entities::lookup
|
||||
).toList());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -74,6 +83,7 @@ public class Aiming extends EcoEnchant {
|
||||
Runnable runnable = this.getPlugin().getRunnableFactory().create(bukkitRunnable -> {
|
||||
List<LivingEntity> nearbyEntities = (List<LivingEntity>) (List<?>) Arrays.asList(arrow.getNearbyEntities(finalDistance, finalDistance, finalDistance).stream()
|
||||
.filter(entity -> entity instanceof LivingEntity)
|
||||
.filter(entity -> this.targets.stream().anyMatch(target -> target.matches(entity)))
|
||||
.map(entity -> (LivingEntity) entity)
|
||||
.filter(entity -> !entity.equals(player))
|
||||
.filter(entity -> !(entity instanceof Enderman))
|
||||
|
@ -30,3 +30,20 @@ config:
|
||||
require-full-force: true # Require full bow pull (works with rapid) If true, then scale-on-force is irrelevant.
|
||||
check-ticks: 10 # Ticks between rotations
|
||||
checks-per-level: 2 # Amount of times to rotate arrow per level (prevents "floating")
|
||||
targets: # List of entity lookups (https://plugins.auxilor.io/all-plugins/the-entity-lookup-system)
|
||||
- "zombie"
|
||||
- "creeper"
|
||||
- "player"
|
||||
- "skeleton"
|
||||
- "spider"
|
||||
- "wither"
|
||||
- "ender_dragon"
|
||||
- "wither_skeleton"
|
||||
- "husk"
|
||||
- "piglin"
|
||||
- "hoglin"
|
||||
- "pig"
|
||||
- "chicken"
|
||||
- "cow"
|
||||
- "cave_spider"
|
||||
- "horse"
|
||||
|
Loading…
Reference in New Issue
Block a user