Hey everyone, over the weekend I was able to cut some slack and fix some important long-time bug, I also got finally time to debug some parts of our code which enabled me to fix some bugs we didn't even notice until now.
First of all, sometimes we got some weird crashes with Minecraft classes. Debugging it I found out it happens here.
Getting into the code of the RandomPositionGenerator.
Brought me right here.
It seemed that at "distanceSq" of the getHomePosition the crash occurred.
I noticed then that we were overriding this method.
Basically:
For us, the Home position is where he sleeps, for Minecraft, where the entity initially spawned.
Therefore, after a lot of time of digging, the fix was easy:
The second bug has been around for a long time.
Minecraft has a bunch of blocks like grass paths or tilled dirt which are slightly lower than the default block height.
As soon as a nonsolid block was underneath them, our citizens would get stuck on top of them and stop moving or pathing.
After a lot of time of wondering, I figured that the issue probably is that the pathfinding does pick the block underneath it and not the block itself when trying to get the block under the entity.
Or better:
If citizens stand on a normal block -> pos.down returns the block they stand on
If citizens stand on this kind of block -> pos.down returns the block underneath the block they stand on
The fix was then to set the position to 1 up if we detect that the citizens stand on top of one of those blocks.
And they start moving smoothly again.
The next bug is related to square colonies, as I explained a few weeks ago, we decided to move to square colonies and decides to store the data in the chunks of Minecraft itself.
Yesterday we wanted to put this on the official server but decided to put it on the test server first, weirdly we noticed a few strange buts since colonies started to take this shape:
We noticed that this happened when two colonies were quite close to each other.
Meaning that our merge wasn't working the right way.
First of all, we noticed that we were merging storage with newStorage but were still saving storage to the file.
Which was easy to fix.
Then after restarting the tests, we noticed that still, something was off, so it must be inside the merge.
Where I noticed that we were always overriding the colony id and not checking if it was actually a delete request (noticeable if coloniesToRemove is not empty) or if it actually had a colony id.
Besides that, I found a small bug where we send items to the workers and do not calc the correct amount.
And a small bug in the Mod compatability PR I released 3 days ago.
Which caused the game to crash.
Since the method was abstract it wasn't callable when the mod wasn't installed.
I am sure our players will be extremely happy with these changes because they will make our mod a whole more stable!
Posted on Utopian.io - Rewarding Open Source Contributors
- https://github.com/Minecolonies/minecolonies/pull/2318 (couldn't append this pr)
Did you know you can sell your vote to Minnowbooster?
You don't even need high voting power to get it sold and you will get out 85% of the profits!If you register via my link you will get a tip of 0.5% on each of your sold votes and BuildTeam puts another 1.5% on top of it for me!
https://www.minnowbooster.com/referral/49434
Nice! Thanks for the fixes. I know my wife will be pleased with the lower-level ground fix. Her solution had been to beat her farmers, sometimes to death! :P
Knowing that they were stuck in the dirt (because they thought they were sunk into the ground? This a psychotropic bug??) helps ease the burden since we now know it's not lazy farmers (just high farmers...).
On the matter of stuckedness though, I have seen citizens periodically get stuck for a moment where the ground goes up in elevation. I guess they need to repath at that point? Not sure if it is related to the ground level bug.
Glad to hear that, and yes when they get stuck at elevated ground they have to repath.
That happens because we let them repath slowly to avoid a too big load on the server, atm 90% of the mods load is pathing already
I Like your post.
Please follow me and upvote my post.
ok do the same haha
very good
I have not understood about this, obviously I like your post master @raycoms lord hope will help me, let me can develop like master, thank you
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
nice