#crossbow load animation (fabric 1.21.1)
40 messages · Page 1 of 1 (latest)
dont the animations depend on a property that is calculated based on use time?
no they dont
then use a mixin and do so
my custom crossbow extends crossbow item and me changing DEFAULT_PULL_TIME doesnt do anything to the animation
idk how to mixin to animation stuff nothin ive tried works
right, its a default constant, its inlined when compiled
so what could i do
ye i replaced that in my item with default pull time
its a static method
are you making sure you override whatever is using the static methods
i am to everything in the crossbowitem class
but if its using something not in there
for instance
yes i am
and just to make sure, you are using a custom NumericProperty for item rendering?
(not the crossbow one with hardcoded static method usage)
the crossbow's model predicate wont work for you
i have all the attributes from the crossbowitem in my class aswell remade and i copied all the other methods from crossbow item that use them
if thats what u mean
show me how you register the model predicate for your item
public class ModModelPredicates {
public static void registerModelPredicates() {
registerCustomCrossbow(ModItems.LONGCROSSBOW);
}
private static void registerCustomCrossbow(Item item) {
register(
item,
Identifier.ofVanilla("pull"),
(stack, world, entity, seed) -> {
if (entity == null) {
return 0.0F;
} else {
return CrossbowItem.isCharged(stack)
? 0.0F
: (float)(stack.getMaxUseTime(entity) - entity.getItemUseTimeLeft()) / (float)CrossbowItem.getPullTime(stack, entity);
}
}
);
register(
item,
Identifier.ofVanilla("pulling"),
(stack, world, entity, seed) -> entity != null && entity.isUsingItem() && entity.getActiveItem() == stack && !CrossbowItem.isCharged(stack) ? 1.0F : 0.0F
);
register(item, Identifier.ofVanilla("charged"), (stack, world, entity, seed) -> CrossbowItem.isCharged(stack) ? 1.0F : 0.0F);
register(item, Identifier.ofVanilla("firework"), (stack, world, entity, seed) -> {
ChargedProjectilesComponent chargedProjectilesComponent = stack.get(DataComponentTypes.CHARGED_PROJECTILES);
return chargedProjectilesComponent != null && chargedProjectilesComponent.contains(Items.FIREWORK_ROCKET) ? 1.0F : 0.0F;
});
}
}```
ngl i think i did it wrong it makes it render like a block
(stack.getMaxUseTime(entity) - entity.getItemUseTimeLeft()) / (float)CrossbowItem.getPullTime(stack, entity);
}
}
);
isnt that thet hardcoded static method?
ye just thought that but changing it does nothing
well, there are other parts that need changing. this is in regards to the animation of the model itself
it has every animation the load animations dont change duration tho
also this might be a cause idk but its flat normally then when i load it it becomes a block
sounds like the model in your override is missing
the console should be telling you that at game load time
i dont have any models yet my friend is makin them for me