Posted April 8, 20232 yr I want to make a custom UseAnim for my item AdrenalineSyringe but i don't know how to do it.. @Override public UseAnim getUseAnimation(ItemStack itemstack) { return UseAnim.CUSTOM; }
April 8, 20232 yr https://forge.gemwire.uk/wiki/Custom_Item_Animations Boilerplate: If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one. If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install Large files should be posted to a file sharing site like https://gist.github.com You should also read the support forum sticky post.
April 8, 20232 yr Author well, the initializeClient method doesn't load, even tho I put @Override above it.. I'm on 1.19.2 btw
April 8, 20232 yr People that don't show their code, will usually just be ignored. And just posting snippets of code out of context will also likely be ignored unless the problem is obvious from what you post. Boilerplate: If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one. If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install Large files should be posted to a file sharing site like https://gist.github.com You should also read the support forum sticky post.
April 8, 20232 yr Author Here is my item class : it's an adrenaline syringe but it seem that the initializeClient method isn't called public class Adrenaline extends Item { public Adrenaline(Properties p_41383_) {super(p_41383_);} @Override public void initializeClient(Consumer<IClientItemExtensions> consumer) { MilitaryElements.LOGGER.info("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"); consumer.accept(new IClientItemExtensions() { private static final HumanoidModel.ArmPose EXAMPLE_POSE = HumanoidModel.ArmPose.create("EXAMPLE", false, (model, entity, arm) -> { if (arm == HumanoidArm.RIGHT) { model.rightArm.xRot = (float) (Math.random() * Math.PI * 2); } else { model.leftArm.xRot = (float) (Math.random() * Math.PI * 2); } }); @Override public HumanoidModel.ArmPose getArmPose(LivingEntity entityLiving, InteractionHand hand, ItemStack itemStack) { if (!itemStack.isEmpty()) { if (entityLiving.getUsedItemHand() == hand && entityLiving.getUseItemRemainingTicks() > 0) { return EXAMPLE_POSE; } } return HumanoidModel.ArmPose.EMPTY; } @Override public boolean applyForgeHandTransform(PoseStack poseStack, LocalPlayer player, HumanoidArm arm, ItemStack itemInHand, float partialTick, float equipProcess, float swingProcess) { int i = arm == HumanoidArm.RIGHT ? 1 : -1; poseStack.translate(i * 0.56F, -0.52F, -0.72F); if (player.getUseItem() == itemInHand && player.isUsingItem()) { poseStack.translate(0.0, -0.05, 0.0); } return true; } }); } @Override public InteractionResultHolder<ItemStack> use(Level world, Player entity, InteractionHand hand) { InteractionResultHolder<ItemStack> ar = super.use(world, entity, hand); ItemStack itemstack = ar.getObject(); double x = entity.getX(); double y = entity.getY(); double z = entity.getZ(); //Sounds return ar; } }
April 8, 20232 yr 26 minutes ago, warjort said: And just posting snippets of code out of context will also likely be ignored unless the problem is obvious from what you post. Where is the code that registers that item? Instead of posting snippets in the forum and making us play a tortuous game of 20 questions, put the necessary code to reproduce the problem on github where we can see everything and maybe run it for ourselves if we can't spot the problem from just reading the code. Boilerplate: If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one. If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install Large files should be posted to a file sharing site like https://gist.github.com You should also read the support forum sticky post.
April 8, 20232 yr That code works for me: Quote [13:47:35] [modloading-worker-0/INFO] [ne.mi.co.MinecraftForge/FORGE]: MinecraftForge v43.2.0 Initialized [13:47:35] [Render thread/INFO] [co.wi.mi.MilitaryElements/]: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA assuming you don't have somewhere else that logs "AAAAAAAAAAA"? 🙂 Boilerplate: If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one. If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install Large files should be posted to a file sharing site like https://gist.github.com You should also read the support forum sticky post.
April 8, 20232 yr Author Nope, i don't log it anywhere else.. Must be a problem on my side.. thx a lot for your time !
April 8, 20232 yr Author btw, how did you make it log "AAAAAAAAAAAA", did you right clicked with the item in hand or did you do something else i'm missing ?
April 8, 20232 yr Author Sorry, it was working for me all along... i just didn't see it.. i'm soo stoopid.. Anyway, the animation is not playing.. is it normal ?
April 8, 20232 yr As the class name suggests, it runs at initialisation. Search your logs/debug.log towards the top. It is the callbacks within that class that run when you use the item. Boilerplate: If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one. If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install Large files should be posted to a file sharing site like https://gist.github.com You should also read the support forum sticky post.
April 8, 20232 yr Author I don't really understand... concretely how do i make the anim play when i rightclick with the item ?
April 8, 20232 yr Quote Anyway, the animation is not playing.. is it normal ? If you look at the code you copied, it depends upon the "use item ticks". You don't have any code that makes the use take any time. Look at how the plain Item class handles items with FoodProperties or any other vanilla item that overrides Item.getUseDuration(). Or you can search github for other mods that does something similar to whatever you want to do. https://github.com/search?l=Java&q=IClientItemExtensions&type=Code Edited April 8, 20232 yr by warjort Boilerplate: If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one. If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install Large files should be posted to a file sharing site like https://gist.github.com You should also read the support forum sticky post.
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.