mirror of
https://github.com/Artillex-Studios/AxMinions.git
synced 2025-01-09 19:17:40 +01:00
Fixed oopsie
This commit is contained in:
parent
00090ce56e
commit
6789d80d47
@ -6,8 +6,10 @@ import com.artillexstudios.axminions.api.minions.miniontype.MinionType
|
||||
import com.artillexstudios.axminions.minions.MinionTicker
|
||||
import com.artillexstudios.axminions.utils.LocationUtils
|
||||
import com.artillexstudios.axminions.utils.fastFor
|
||||
import kotlin.math.roundToInt
|
||||
import org.bukkit.Material
|
||||
import org.bukkit.block.data.Ageable
|
||||
import org.bukkit.enchantments.Enchantment
|
||||
import org.bukkit.inventory.ItemStack
|
||||
|
||||
class FarmerMinionType : MinionType("farmer", AxMinionsPlugin.INSTANCE.getResource("minions/farmer.yml")!!) {
|
||||
@ -16,6 +18,13 @@ class FarmerMinionType : MinionType("farmer", AxMinionsPlugin.INSTANCE.getResour
|
||||
return MinionTicker.getTick() % minion.getNextAction() == 0L
|
||||
}
|
||||
|
||||
override fun onToolDirty(minion: Minion) {
|
||||
val minionImpl = minion as com.artillexstudios.axminions.minions.Minion
|
||||
minionImpl.range = getDouble("range", minion.getLevel())
|
||||
val efficiency = 1.0 - (minion.getTool()?.getEnchantmentLevel(Enchantment.DIG_SPEED)?.div(10.0) ?: 0.1)
|
||||
minionImpl.nextAction = (getLong("speed", minion.getLevel()) * efficiency).roundToInt()
|
||||
}
|
||||
|
||||
override fun run(minion: Minion) {
|
||||
LocationUtils.getAllBlocksInRadius(minion.getLocation(), minion.getRange(), false).fastFor { location ->
|
||||
val block = location.block
|
||||
|
Loading…
Reference in New Issue
Block a user