From 6a4de332a6f64c86f3b9a27e2db3d4b412e2b077 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?N=C3=A9meth=20Noel?= Date: Wed, 30 Jun 2021 01:35:33 +0200 Subject: [PATCH] Updated RangedAttackGoal.java --- .../minestom/server/entity/ai/goal/RangedAttackGoal.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/minestom/server/entity/ai/goal/RangedAttackGoal.java b/src/main/java/net/minestom/server/entity/ai/goal/RangedAttackGoal.java index 4332ac8bd..d1d40d410 100644 --- a/src/main/java/net/minestom/server/entity/ai/goal/RangedAttackGoal.java +++ b/src/main/java/net/minestom/server/entity/ai/goal/RangedAttackGoal.java @@ -9,19 +9,20 @@ import net.minestom.server.entity.EntityProjectile; import net.minestom.server.utils.Position; import net.minestom.server.utils.time.Cooldown; import net.minestom.server.utils.time.TimeUnit; -import net.minestom.server.utils.time.UpdateOption; import net.minestom.server.utils.validate.Check; import org.jetbrains.annotations.NotNull; +import java.time.Duration; +import java.time.temporal.TemporalUnit; import java.util.function.Function; public class RangedAttackGoal extends GoalSelector { - private final Cooldown cooldown = new Cooldown(new UpdateOption(5, TimeUnit.TICK)); + private final Cooldown cooldown = new Cooldown(Duration.of(5, TimeUnit.SERVER_TICK)); private long lastShot; private final int delay; - private final TimeUnit timeUnit; + private final TemporalUnit timeUnit; private final int attackRangeSquared; private final int desirableRangeSquared; private final boolean comeClose; @@ -43,7 +44,7 @@ public class RangedAttackGoal extends GoalSelector { * @param power shot power (1 for normal). * @param timeUnit the unit of the delay. */ - public RangedAttackGoal(@NotNull EntityCreature entityCreature, int delay, int attackRange, int desirableRange, boolean comeClose, double power, double spread, @NotNull TimeUnit timeUnit) { + public RangedAttackGoal(@NotNull EntityCreature entityCreature, int delay, int attackRange, int desirableRange, boolean comeClose, double power, double spread, @NotNull TemporalUnit timeUnit) { super(entityCreature); this.delay = delay; this.timeUnit = timeUnit;