Jump to content

[1.19.2] Bow animation doesn't work.


Lior Hassin

Recommended Posts

I am trying to create a custom bow as a practice with some range weapons.

The bow itself work just fine, but the pulling animation is not working.

Github repository : https://github.com/liorhassin/RPG-Mod

Files navigation in github that could be related to the issue:

1) main/rpgmod/rpgmod.java (I think the issue could be related to the onClientSetup function that doesn't seem to change anything/load my addCustomItemProperties)

2) main/rpgmod/util/ModItemProperties.java (Where I wrote the code to be like the classic bow from minecraft)

3) resource/assets/rpgmod/models/item/beginner_bow.json (Where I wrote the json file to describe the animation and position of the item)

4) resource/assets/rpgmod/models/item/beginner_bow_pulling_0 , 1 , 2 (all animations linked to main item parent but call different png to create the bow animation)

Thanks in advance.

Link to comment
Share on other sites

You are registering ItemProperties against the vanilla bow (Items.BOW) instead of the passed in item.

https://github.com/liorhassin/RPG-Mod/blob/3d693c2b4c0c6fd9190bfe18c3cd4d79585556cd/src/main/java/net/LiorNadav/rpgmod/util/ModItemProperties.java#L16

 

And, the ItemProperties.register() is not theadsafe - it updates a HashMap. So you need to put the call inside an event.enqueueWork() like you do for your registerPOIs().

 

Unrelated:

You are missing a value=Dist.CLIENT here: https://github.com/liorhassin/RPG-Mod/blob/3d693c2b4c0c6fd9190bfe18c3cd4d79585556cd/src/main/java/net/LiorNadav/rpgmod/RPGMod.java#L55

which means your mod will crash on a server when it tries to access client only classes.

You already have somewhere where you could put this event listener that is correctly defined:

https://github.com/liorhassin/RPG-Mod/blob/3d693c2b4c0c6fd9190bfe18c3cd4d79585556cd/src/main/java/net/LiorNadav/rpgmod/event/ClientEvents.java#L26

Edited by warjort
  • Like 1

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.

Link to comment
Share on other sites

I have a similar issue.
I made a weapon that extends BowItem.  The item animations work, but the screen doesn't zoom in like when you use the regular Bow.
Not sure if OP is having the same issue, but it may be related.
Github repository: https://github.com/DirtEngineers/Squirtgun-1.19

New to the forum, so let me know if I should move this to a fresh post.

Link to comment
Share on other sites

On 9/15/2022 at 4:00 PM, warjort said:

You are registering ItemProperties against the vanilla bow (Items.BOW) instead of the passed in item.

https://github.com/liorhassin/RPG-Mod/blob/3d693c2b4c0c6fd9190bfe18c3cd4d79585556cd/src/main/java/net/LiorNadav/rpgmod/util/ModItemProperties.java#L16

 

And, the ItemProperties.register() is not theadsafe - it updates a HashMap. So you need to put the call inside an event.enqueueWork() like you do for your registerPOIs().

 

Unrelated:

You are missing a value=Dist.CLIENT here: https://github.com/liorhassin/RPG-Mod/blob/3d693c2b4c0c6fd9190bfe18c3cd4d79585556cd/src/main/java/net/LiorNadav/rpgmod/RPGMod.java#L55

which means your mod will crash on a server when it tries to access client only classes.

You already have somewhere where you could put this event listener that is correctly defined:

https://github.com/liorhassin/RPG-Mod/blob/3d693c2b4c0c6fd9190bfe18c3cd4d79585556cd/src/main/java/net/LiorNadav/rpgmod/event/ClientEvents.java#L26

Sorry for the delay busy with my exams.

Thank you very much for the help, Fixed all client related stuff to that one file that got Dist.client there.

also its much cleaner now and easy to understand.
fixing the ItemPropeties.register() if you could tell me on which file you see that problem, I couldn't find the file with ItemPropeties.register() and also has the event parameter in it so I can fix that problem.
Also having issue with rendering my new arrow when it fly, will dig into it later.

Again super thank you for helped me understand my issue quickly.

Link to comment
Share on other sites

I linked it above, you need to change Items.BOW to item

- ItemProperties.register(Items.BOW, new ResourceLocation("pull"), (itemStack, level, entity, i) -> {
+ ItemProperties.register(item, new ResourceLocation("pull"), (itemStack, level, entity, i) -> {

 

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.

Link to comment
Share on other sites

39 minutes ago, DirtEngineer said:

I have a similar issue.

Please start your own thread.

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.

Link to comment
Share on other sites

The same code. Those ItemProperties.registers needs to be called within an enqueueWork() so they run on the main render thread instead of concurrently with other mods doing the same thing.

Edited by warjort
  • Thanks 1

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.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.