Minecolonies & The Quality of Playing - Update #1

in #utopian-io6 years ago (edited)

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.

  1. Search method which loads the structure of a building
  2. Search the method which creates the list of required blocks
  3. Configure a GUI to display the data.
  4. 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

Sort:  

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:

 +    /**
 +     * Mirror of the building.
 +     */
 +    private boolean isMirrored;

> codacy-bot 5 hours ago
> Codacy Issue found: Field isMirrored has the same name as a method

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

looks great, keep up the hard work :)

Very good man

Great article

Hey @raycoms I am @utopian-io. I have just upvoted you!

Achievements

  • You have less than 500 followers. Just gave you a gift to help you succeed!
  • You are generating more rewards than average for this category. Super!;)
  • Seems like you contribute quite often. AMAZING!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

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

Coin Marketplace

STEEM 0.19
TRX 0.12
JST 0.027
BTC 60231.85
ETH 3263.34
USDT 1.00
SBD 2.43