Add bowModelPredicateProvider
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
package net.arcmods.ryantlg.utils;
|
||||
|
||||
import net.arcmods.ryantlg.items.bows.strongBow;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.client.model.FabricModelPredicateProviderRegistry;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
public class bowModelPredicateProvider {
|
||||
|
||||
public static void registerBowModels() {
|
||||
registerBow(strongBow.STRONG_BOW);
|
||||
}
|
||||
|
||||
private static void registerBow(Item bow) {
|
||||
FabricModelPredicateProviderRegistry.register(bow, new Identifier("pull"),
|
||||
(stack, world, entity, seed) -> {
|
||||
if (entity == null) {
|
||||
return 0.0f;
|
||||
}
|
||||
if (entity.getActiveItem() != stack) {
|
||||
return 0.0f;
|
||||
}
|
||||
return (float)(stack.getMaxUseTime() - entity.getItemUseTimeLeft()) / 20.0f;
|
||||
});
|
||||
|
||||
FabricModelPredicateProviderRegistry.register(bow, new Identifier("pulling"),
|
||||
(stack, world, entity, seed) -> entity != null && entity.isUsingItem()
|
||||
&& entity.getActiveItem() == stack ? 1.0f : 0.0f);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user