![Flan's Mod Ultimate Stability Edition](https://media.forgecdn.net/avatars/thumbnails/228/314/256/256/637049574570422621.jpeg)
Small change in EntityBullet to prevent possible cast exceptions
AntonIT99 opened this issue ยท 2 comments
I would like to suggest a small change in EntityBullet. I've been working on a compatibility feature project between Flan's Mod and Custom NPCs and I ran into a casting problem in EntityBullet#readSpawnData():
At line 1538, the member owner is cast into EntityPlayer. This behavior generates an exception if the owner is actually not an EntityPlayer for some reason (like in my case). Since is owner is of type Entity, and since there is instance checks everywhere else, casting it to EntityLivingBase instead would not negatively affect anything while allowing more versatility/compatibility. This solution would be similar to the member thrower in EntityGrenade which is currently cast into EntityLivingBase.
Suggested Fix:
replace owner = (EntityPlayer) obj;
by owner = (EntityLivingBase) obj;
on line 1538 of EntityBullet
That sounds reasonable to me. Given its a small change, would it be possible for you to submit it as a pull request? Otherwise I'll add it to the Trello board and get to it at some point.