EDIT: I somehow managed to solve the problem, it seems to work well now.
I am trying to make an item that acts like fishing rod as in sticking to and pulling mobs to the user; so I wanted to start with creating a copy of fishing rod and then cut/add functionality because I don't have enough experience to create one from scratch. While it was a pain in the butt to create new ItemFishingRod, EntityFishHook and RenderFish (their names are ItemGrap, EntityGrapHook, RenderGrapHook) ; I managed to make it basically work so I can use it to catch mobs and pull them but the problem is that there is no string. The hook itself is showing well and I can modify the maths in EntityGrapHook to make it work differently but the code about the string in RenderGrapHook just doesn't work.
Any help would be appreciated.
Extra Information: This is the method of RenderGrapHook class that does all the work:
I think the part about the string is after the statement if (par1EntityGrapHook.angler != null) because I found out that it doesn't work, which brought me to the conclusion that par1EntityGrapHook.angler is always null. I put print commands everywhere and it seems the angler is really null. Angler is the player that uses the item. It is declared in EntityGrapHook. That class has three constructors:
There are minor differences from EntityFishHook because it couldn't work otherwise but I did not touch anything with this.angler. I put print commands to test it and found out that the constructer with two parameters is called first, it puts the parameter par2EntityPlayer's value into this.angler. This constructer is the one called in ItemGrap's onRightClick method. Printed output also shows that this angler has the right value so no problem yet. Just after this, the constructer with one parameter is called. I have no idea from where it is called but it does. And the printed output shows that this.angler is now null! After that a print command in RenderGrapHook starts to work and outputs that the angler is null repeatedly.
I couldn't find out what the problem was so I tried to see how the original fishing rod works. I tried the same test on vanilla classes and as it goes the same for first two constructer calls, this time also the other constructer with many parameters is called and the angler is set once again to the right player value and the print command in renderer confirms this. Also the string shows perfectly of course.
Now, these are my tests and thoughts and I might be working on a completely wrong way since I am not even sure if that piece of code actually draws the string but there is definitely a problem there. The constructor with lots of parameters is never called in my version and I don't know why.
I am not an experience modder and definitely not a java expert so I am just stuck. Please help if you can, and thank you if you paid time to read all this post.
EDIT: I somehow managed to solve the problem, it seems to work well now.
I am trying to make an item that acts like fishing rod as in sticking to and pulling mobs to the user; so I wanted to start with creating a copy of fishing rod and then cut/add functionality because I don't have enough experience to create one from scratch. While it was a pain in the butt to create new ItemFishingRod, EntityFishHook and RenderFish (their names are ItemGrap, EntityGrapHook, RenderGrapHook) ; I managed to make it basically work so I can use it to catch mobs and pull them but the problem is that there is no string. The hook itself is showing well and I can modify the maths in EntityGrapHook to make it work differently but the code about the string in RenderGrapHook just doesn't work.
Any help would be appreciated.
Extra Information: This is the method of RenderGrapHook class that does all the work:
I think the part about the string is after the statement if (par1EntityGrapHook.angler != null) because I found out that it doesn't work, which brought me to the conclusion that par1EntityGrapHook.angler is always null. I put print commands everywhere and it seems the angler is really null. Angler is the player that uses the item. It is declared in EntityGrapHook. That class has three constructors:
There are minor differences from EntityFishHook because it couldn't work otherwise but I did not touch anything with this.angler. I put print commands to test it and found out that the constructer with two parameters is called first, it puts the parameter par2EntityPlayer's value into this.angler. This constructer is the one called in ItemGrap's onRightClick method. Printed output also shows that this angler has the right value so no problem yet. Just after this, the constructer with one parameter is called. I have no idea from where it is called but it does. And the printed output shows that this.angler is now null! After that a print command in RenderGrapHook starts to work and outputs that the angler is null repeatedly.
I couldn't find out what the problem was so I tried to see how the original fishing rod works. I tried the same test on vanilla classes and as it goes the same for first two constructer calls, this time also the other constructer with many parameters is called and the angler is set once again to the right player value and the print command in renderer confirms this. Also the string shows perfectly of course.
Now, these are my tests and thoughts and I might be working on a completely wrong way since I am not even sure if that piece of code actually draws the string but there is definitely a problem there. The constructor with lots of parameters is never called in my version and I don't know why.
I am not an experience modder and definitely not a java expert so I am just stuck. Please help if you can, and thank you if you paid time to read all this post.
How did you get it to work? I'm having the same problem.
I am trying to make an item that acts like fishing rod as in sticking to and pulling mobs to the user; so I wanted to start with creating a copy of fishing rod and then cut/add functionality because I don't have enough experience to create one from scratch. While it was a pain in the butt to create new ItemFishingRod, EntityFishHook and RenderFish (their names are ItemGrap, EntityGrapHook, RenderGrapHook) ; I managed to make it basically work so I can use it to catch mobs and pull them but the problem is that there is no string. The hook itself is showing well and I can modify the maths in EntityGrapHook to make it work differently but the code about the string in RenderGrapHook just doesn't work.
Any help would be appreciated.
Extra Information: This is the method of RenderGrapHook class that does all the work:
I think the part about the string is after the statement if (par1EntityGrapHook.angler != null) because I found out that it doesn't work, which brought me to the conclusion that par1EntityGrapHook.angler is always null. I put print commands everywhere and it seems the angler is really null. Angler is the player that uses the item. It is declared in EntityGrapHook. That class has three constructors:
There are minor differences from EntityFishHook because it couldn't work otherwise but I did not touch anything with this.angler. I put print commands to test it and found out that the constructer with two parameters is called first, it puts the parameter par2EntityPlayer's value into this.angler. This constructer is the one called in ItemGrap's onRightClick method. Printed output also shows that this angler has the right value so no problem yet. Just after this, the constructer with one parameter is called. I have no idea from where it is called but it does. And the printed output shows that this.angler is now null! After that a print command in RenderGrapHook starts to work and outputs that the angler is null repeatedly.
I couldn't find out what the problem was so I tried to see how the original fishing rod works. I tried the same test on vanilla classes and as it goes the same for first two constructer calls, this time also the other constructer with many parameters is called and the angler is set once again to the right player value and the print command in renderer confirms this. Also the string shows perfectly of course.
Now, these are my tests and thoughts and I might be working on a completely wrong way since I am not even sure if that piece of code actually draws the string but there is definitely a problem there. The constructor with lots of parameters is never called in my version and I don't know why.
I am not an experience modder and definitely not a java expert so I am just stuck. Please help if you can, and thank you if you paid time to read all this post.
How did you get it to work? I'm having the same problem.