Posted June 21, 20223 yr Heya, so I'm making an old-style revolver and have mostly everything working aside from the reload animation. I have a condition set so that the animation is supposed to play while the reload method is being executed. However, the reload method executes immediately and the animation never plays because it never has time to. Will I have to make the item a tile entity for this to work or is there a way for me to use ticks in the class without a tile entity? Here is the relevant methods I used: public static int magazine = 6; public void reload(Level worldIn, Player playerIn) { worldIn.playSound((Player) null, playerIn.getX(), playerIn.getY(), playerIn.getZ(), SoundInit.CALDWELL_RELOAD_SOUND.get(), SoundSource.NEUTRAL, 2.0F, 1.0F); playerIn.getCooldowns().addCooldown(this, 60); magazine = 6; } @Override public InteractionResultHolder<ItemStack> use(Level level, Player player, InteractionHand handIn) { ItemStack stack = player.getItemInHand(InteractionHand.MAIN_HAND); player.getCooldowns().addCooldown(this, 10); if(!level.isClientSide) { if (magazine > 0) { shoot(level, player); } else { reload(level, player); } } player.awardStat(Stats.ITEM_USED.get(this)); return InteractionResultHolder.sidedSuccess(stack, true); } private <E extends IAnimatable>PlayState predicate(AnimationEvent<E> event) { if (magazine > 0) { event.getController().setAnimation(new AnimationBuilder().addAnimation("caldwell_reload_anim", true)); return PlayState.CONTINUE; } else { return PlayState.STOP; } } Any help or points in the right direction are much appreciated!
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.