# Minecolonies & The little things in life #4

in #utopian-io6 years ago (edited)

Hey everyone, a small continuation of this series to get the code further cleaned up and important issues resolved.

Metadata issues:

First of all, several users had reported issues with the builder not requesting the right metadata of blocks.
When I looked into the code I found out that in the map where we store the requested items of the builder.

We were only storing the block and not the block and its metadata.

Therefore I added a ":metadata" each time we query or put to the map to fix this issue.

While debugging this I also noticed we weren't calculating the hashCode correctly for the ItemStorage.

Since we're not considering if we ignore or not ignore the damage value of it.

HashCode is used to retrieve an object from a map for example.

TimberFrame improvements:

We also have a nice new block, the timber-frames.

Which has been added by one of our programmers, they look quite nice and have a range of styles and wood types.
Nevertheless, we noticed that if you want to build a connected form like that:

You had to place the blocks exactly like they are.
Therefore, to improve this I code something so the blocks auto adjusts to this, as I did for the shingle slabs.

So I check if the block above or under it is of a certain blockstate and if so I adapt the block based on that.

Meaning, if the block above and under it is of the state I make it a middle piece.

If only under it a top piece and if only above a bottom piece.

Dumping issues:

Also, a few workers seem to have issues dumping their inventories when the hut inventory was full, this was annoying because:

  • The worker didn't complain,
  • and the worker stopped working;

I, therefore, added that the worker complains and continues working until both his inventory and the hut inventory are full. At the same time, I increase the gathering priority for the dman hoping that the dman will resolve to pick up the extra items.

Fixing style:

While I was around there I already fixed some style issues with the code.

Like removing lambda for method references

and simplified return statements.

Fixing messages

The last fix was quite important since we had problems with concurrency since Minecraft messages have concurrent access to the code.
That's why I coded that all client messages are scheduled to the client thread as we did it previously already with the server messages.

For that, I added a check if a message is on client or server side and if client side I will send it to the child message type.

Then I had to extend each client class from the abstract parent.

And change the onMessage to the messageOnClientThread counterpart.

I hope you liked those small changes and the way minecolonies is going.
If you're interested in joining us or want to give us some feedback, feel free to join us on discord: https://discord.gg/gA7T6ma, our forums: https://forum.minecolonies.com/ or comment here.#



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

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!
  • 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

Thank you for the contribution. It has been approved.

You can contact us on Discord.
[utopian-moderator]

ok .... nice post for any one want learn :)

Nice post..

You could help yourself and the colony a lot if you reply with longer and more detailed replies which actually contribute something to the post.

Good post, thanks for your post information. See you next time

You using forge for your mods?

Yes we're coding forge mods.

@raycoms the contribution is really good and helpful for the people that want to use it. Good job.

Coin Marketplace

STEEM 0.20
TRX 0.13
JST 0.030
BTC 63793.25
ETH 3410.80
USDT 1.00
SBD 2.59