MCMrARM / toolbox-issue-tracker

6 stars 0 forks source link

ModPE.save/readData broken #42

Closed Blakintosh closed 8 years ago

Blakintosh commented 8 years ago

EDIT: This was only caused due to ModPE.readData being broken. Sorry about that!

Please fill out the information below before hitting submit!

Details

_What did you expect to happen?_

The UIs of my mod which are essential for guns should display without error.

_What happened?_

My mod, which works fine on BlockLauncher does not work properly on Toolbox. It uses lots of UIs and a couple of essential ones for guns are not working properly. They are just giving errors and are not displaying. I am unsure why this is happening.

_When does this happen?_

This happens in a match of my mod when I have a gun as my current item.

Mods/Texture Packs

ZOMWar (3.0) (Mod made by me) ZOMWar texture packs (2 of them)

What mods and or texture packs do you have installed?

Above ^

Logcat

Shoot, reload & aim buttons: http://i.imgur.com/UXQ0vOP.jpg

Gun name & ammo: I just need to get the error, currently the error is not in the error print.

Note: I know that I shouldn't really be posting a mod issue here, but I am completely unsure why this is happening and it only started happening when I put the mod onto Toolbox. I have not edited the UI code since I changed to Toolbox so I believe it is an error to do with the Java bridge.

If you'd like the code message me privately and I can send it. As this is an unreleased version I do not want to release the code to the public.

Blakintosh commented 8 years ago

Here's the error relating to gun name & ammo HUD: http://i.imgur.com/wNMFbxK.jpg

Also, I'll DM @MCMrARM the code.

slice commented 8 years ago

I'm not sure if TB exposes the android object, which has a lot of the GUI stuff you are mentioning. I'm asking him now.

EDIT: Looks like all android APIs are exposed. Not sure what the problem is, has to do with the ModPE Java side in TB.

Blakintosh commented 8 years ago

Glad you're investigating the issue, thanks for the help 👍 Hopefully it's not too difficult to fix :)

Blakintosh commented 8 years ago

Also, if this helps at all, this is the code that has the issues: http://pastebin.com/KMRmaL5V One thing I've noticed is that sometimes the gun name & ammo will appear on screen, but that's rare to happen I've found.

Oh, and also one thing I've forgotten to report is that ModPE.saveData appears to be broken. ZOMWar and DesnoGuns crash the game when any settings are changed (which use saveData to save)

Blakintosh commented 8 years ago

And if if helps at all, the HUD refreshes at a rate of 3 ticks, if the player is not holding a gun and the hud is up it is dismissed. If they hold a gun and the hud is not there it appears. If someone changes gun the gun buttons remain the same and the gun name & ammo updates by changing the text.

slice commented 8 years ago

What's most interesting are those NullPointerExceptions. Hopefully we can isolate the problem.

Can you try using printStackTrace on those Java exceptions so we can see a trace?

Blakintosh commented 8 years ago

Will try

Blakintosh commented 8 years ago

How do I go about using printStackTrace? I've tried: err.printStackTrace() on it's own; err.getStackTrace() added to an error string and err.printStackTrace() in a string, all causing crashes.

Blakintosh commented 8 years ago

What I'll do for now is find functions in common of these UIs that are not in the other UIs and disable them to see if that fixes the issue.

Blakintosh commented 8 years ago

Good news. I think I've isolated the issue. It appears to just be readData. 4 UIs I've found are broken and they all use inSampleSize which depends on a readData. I'm going to disable the readData and see if it works. Fingers crossed!

Blakintosh commented 8 years ago

Excellent news! The reason it wasn't working was readData. I've successfully got the UIs working by commenting out the readData code in them :D

Blakintosh commented 8 years ago

One thing I've also discovered, lol, is Entity.remove(ent) is not working.

Blakintosh commented 8 years ago

Temporarily using Entity.setHealth(e, 0) as a workaround

Blakintosh commented 8 years ago

Closing this issue as I have opened another issue with other bugs and this one.