Minecolonies & The Quality of Playing - Update #1
Hey everyone, the last days I worked on a quite special update which a lot of people will appreciate for sure.
At the moment, if a player wants to build a building of one of the workers he enters in his GUI:
And then clicks "Upgrade/Build - Building".
This will then automatically trigger a job for the builder to build this building.
But, it also comes with a risk since the player doesn't know how much the building is going to cost. Additionally, Minecolonies offers several styles of buildings which the player can choose from when he first places a building.
That's why I added two new principal features, first of all, the player can see the cost of the upgrade the moment he clicks on the build/upgrade button.
And second, he will be able to switch between the different styles inside this window as well.
The code of this wasn't as hard. We had already code somewhere to list the blocks we need to build a certain building, for this case I only had to combine the existing code.
- Search method which loads the structure of a building
- Search the method which creates the list of required blocks
- Configure a GUI to display the data.
- Write a message to notify the building that its style changed.
Afterwards, I sent this to our testers, which shortly after complained that the scrollbar doesn't scroll with the mouse wheel...
Therefore, I had to go into our screen class and add an event to capture the mouse wheel input:
From this class I delegate the event to the window where the event happends.
And from there I delegate it to all child panes.
This way I was able to delegate it until it arrives at the scrolling pane.
Where I only had to set the amount of scroll depending on the movement of the mousewheel. Since it adds up when it goes down I had to invert the amount.
Besides that I added some other small improvements.
First of all I improved our detection of missing colonists to respawn them accordingly.
Then I refactored our code to move some code into utility and constant classes to make the current code more clear and easier to understand.
Overally I was able to delete a lot of lines and had the pull request only contain 600 new lines while adding a huge new lines like the new GUI class and its handling.
I hope you liked our new additions.
And I'll see you the next time around!
Posted on Utopian.io - Rewarding Open Source Contributors
Thank you for the contribution. It has been approved.
Very good explanations and graphics. That's a good mix of description and code.
Perhaps you could tell us about the tools you use to keep all that great new code in check. For example, it looks like you are using codacy bot to check on some common issues:
Another great post overall.
You can contact us on Discord.
[utopian-moderator]
@kodieamos this might just be the thing to get us back into good ol minecraft ;) Doing great job so far @raycoms cant wait to see where you keep taking this
We also have an awesome server and amazing community =D
Where can we find this server id love to check it out
Download it here: https://minecraft.curseforge.com/projects/minecolonies-testpack
It has the position preset.
looks great, keep up the hard work :)
Nice history
Very good man
Great article
good
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
I like your this new additions