Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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.

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

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.

  • Author
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.

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.

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.

  • Author

Oh sorry if I didn’t explain myself right. The animation is working I meant where should I add the event.enqueueWork() so I will make sure I update the hashmap on the server side.

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

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.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.