blob: fa46a704286bcbd9057a3556ba243d3bc20103bc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
package moe.nea.firmament.features.texturepack.predicates
import com.google.gson.JsonElement
import net.minecraft.entity.LivingEntity
import net.minecraft.item.BowItem
import net.minecraft.item.ItemStack
import moe.nea.firmament.features.texturepack.FirmamentModelPredicate
import moe.nea.firmament.features.texturepack.FirmamentModelPredicateParser
class PullingPredicate(val percentage: Double) : FirmamentModelPredicate {
companion object {
val AnyPulling = PullingPredicate(0.1)
}
object Parser : FirmamentModelPredicateParser {
override fun parse(jsonElement: JsonElement): FirmamentModelPredicate? {
return PullingPredicate(jsonElement.asDouble)
}
}
override fun test(stack: ItemStack, holder: LivingEntity?): Boolean {
if (holder == null) return false
return BowItem.getPullProgress(holder.itemUseTime) >= percentage
}
}
|