I'm trying to make spear items like the vanilla tridents that are throwable. the throwing part with entity and all I got right. But the rendering part got me, the vanilla trident renders as a sprite in GUI and as a model when held, I'm trying to replicate this behavior. After some digging I found that I need to use an ISTER to do it. So I followed a tutorial (boson modding tutorial) to set the whole thing up. But after tinkering around with the code, looking at vanilla code and trying to wrap my head around how the process work still doesn't do it for me. Any help and pointers will be appreciated! Maybe an example to show how it is done?
The repo is here: https://github.com/LocusAzzurro/icaruswings_mod/tree/spear-ister
most of the related code for the render are in the render folder with "Spear" in the name and
https://github.com/LocusAzzurro/icaruswings_mod/blob/spear-ister/src/main/java/org/mineplugin/locusazzurro/icaruswings/event/ClientRenderHandler.java
At current state (commit 6be5b20) it gives a StackOverFlowError on world load
[21:18:38] [Render thread/INFO] [STDOUT/]: [net.minecraft.util.registry.Bootstrap:realStdoutPrintln:123]: ---- Minecraft Crash Report ----
// Hi. I'm Minecraft, and I'm a crashaholic.
Time: 21-12-22 9:18
Description: Unexpected error
java.lang.StackOverflowError: Unexpected error
at com.mojang.blaze3d.matrix.MatrixStack.pushPose(MatrixStack.java:53) ~[forge:?] {re:classloading,pl:runtimedistcleaner:A,re:mixin,pl:runtimedistcleaner:A}
at net.minecraft.client.renderer.ItemRenderer.render(ItemRenderer.java:92) ~[forge:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
at org.mineplugin.locusazzurro.icaruswings.render.SpearItemStackTileEntityRenderer.renderByItem(SpearItemStackTileEntityRenderer.java:26) ~[?:?] {re:classloading}
at net.minecraft.client.renderer.ItemRenderer.render(ItemRenderer.java:137) ~[forge:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
(The above line is repeated many times)
Update: It was a trainwreck and half, but I somehow got it to work
https://github.com/LocusAzzurro/icaruswings_mod/commit/96be28d1dd85e253afa86551cdcb336a25d85d36
Update 2: With the helps of fellow devs It works mostly as intended now, had to do some nbt to make the throwing animation render correctly. Not the prettiest solution but works.
https://github.com/LocusAzzurro/icaruswings_mod/commit/425a32b126b0d6fd268df20ede12156435dd7c20