Minecolonies & Bug Hunting
Hey everyone, in the last 2 days a huge amount of issues got reported with our request system we had pushed out a few days ago.
https://github.com/Minecolonies/minecolonies/issues/1779
https://github.com/Minecolonies/minecolonies/issues/1778
https://github.com/Minecolonies/minecolonies/issues/1777
https://github.com/Minecolonies/minecolonies/issues/1774
https://github.com/Minecolonies/minecolonies/issues/1773
https://github.com/Minecolonies/minecolonies/issues/1772
https://github.com/Minecolonies/minecolonies/issues/1769
https://github.com/Minecolonies/minecolonies/issues/1765
Those are only a part of the issues we got, involving crashes, failed delivery.
Or to be more honest, our latest builds were barely playable.
That's why I worked the last 2 days a lot of time on resolving these issues.
Our main issues were the following:
a) Citizens didn't go home at night anymore.
b) Unemployed citizens inventories weren't opening
c) Barrack guards were causing issues with double requests
d) Crashes in multi-player worlds when opening GUIs
e) Occasional crashes when opening the clipboard.
The first bug - a) - was kind of a stupid bug since it got introduced by a merge conflict from 1.10.
Since we had removed in a merge conflict the line:
citizen.isWorkerAtSiteWithMove(pos, 2);
Which let's the citizen actually walk home, so he was trying to walk home but not running into the code to actually bring him there.
The second bug - b) - was not much harder to track down.
In our new code, employed workers have to track down changes to their inventories, therefore we added a Listener to changes, which requires a building, and if the building is null, it would not open - oops.
Now - c) - was a bit harder to find, we first thought it might be a failure of the system until we tracked down where we retrieve the information and noticed that we try to get all requests from the citizens home and from his work building, but barracks guards have their home at their work building, so he would retrieve the same one twice:
d) is harder to explain. In minecraft there is a part of the world which is called the "Server" and a part which is the "client". The server part is basically the part which runs on a server and the client part deals with client interactions and notifies the server about them.
The issue which arose there was that, a part of the minecraft code is only callable from the server part of the code and we were trying to retrieve the server part of the world from GUI interaction of the client which, then failed.
To fix this we introduced some code which detects the interactive side and will retrieve the correct world depending on that.
e) is a rather strange crash since it was a nullpointer exception somewhere in classes regarding minecrafts inner workings, the last call in our code was here:
Unfortunately, mc (which is the minecraft client instance) can actually never be null, in this case we had to get some ductape and:
Our assumption is that in some cases the "mc" object hasn't fully loaded when the client code reaches this part so, this one tick when it will fail we will protect it from crashing.
I hope you liked my travel into some deeper parts of minecolonies code realm.
See you the next time.
Posted on Utopian.io - Rewarding Open Source Contributors
Thank you for the contribution. It has been approved.
You can contact us on Discord.
[utopian-moderator]
Hey @raycoms I am @utopian-io. I have just upvoted you!
Achievements
Community-Driven Witness!
I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!
Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x
goodvyour sharing
Thnx to share this
thanks for sharing