This commit is contained in:
Minecon724 2022-01-29 16:03:13 +01:00
parent d2e0f4ef33
commit f4daa14bd5
2 changed files with 10 additions and 4 deletions

View file

@ -37,6 +37,8 @@ public class Main extends JavaPlugin implements Listener {
boolean headRotations;
double chance;
double attackDamage;
double attackReach;
double expandUp;
long refreshDelay;
Map<PotionEffectType, Integer> effects = new HashMap<PotionEffectType, Integer>();
@ -50,6 +52,8 @@ public class Main extends JavaPlugin implements Listener {
ai = config.getBoolean("ai");
chance = config.getDouble("chance");
attackDamage = config.getDouble("attackDamage");
attackReach = config.getDouble("attackReach");
expandUp = config.getDouble("expandUp");
for (Object s : config.getList("effects")) {
try {
String[] parts = ((String) s).split(":");
@ -74,7 +78,7 @@ public class Main extends JavaPlugin implements Listener {
@Override
public void run() {
for (Entity e : giants) {
Collection<Entity> nearby = e.getWorld().getNearbyEntities(e.getBoundingBox(), n -> (n instanceof Player));
Collection<Entity> nearby = e.getWorld().getNearbyEntities(e.getBoundingBox().expand(attackReach, expandUp, attackReach), n -> (n instanceof Player));
for (Entity p : nearby) {
((LivingEntity) p).damage(attackDamage, e);
}

View file

@ -4,7 +4,8 @@ attackDamage: 1.0
chance: 0.02
# Attack delay in ticks, smaller values will lag the server more
hitDelay: 20
# if too high the entity will hit through walls
# 0 - attack only entities touching the giant, if too high the entity will hit through walls
# fun fact: you can use negative values
attackReach: 2
# Additional potion effects
# type:amplifier
@ -15,4 +16,5 @@ effects:
# No need to change this
headRotations: true
refreshDelay: 40
refreshDelay: 20
expandUp: 0