SkyBlock Minecraft Addon #21 - Improved island calculation process & language function addedsteemCreated with Sketch.

in #utopian-io5 years ago
The contents of storage units and chests can now also be calculated to the island level, a great way for server operators to add some more competition to the game.

Hello everyone,

Here are some new changes to the SKYBLOCK.SK Minecraft Server add-on I want to show you guys today. Some quite big changes happened to SKYBLOCK.SK which increased the overall performance and the speed of some functions. One of the new changes is the increased speed of the island calculation process, which is in some cases almost 10 times faster than before. Another big change is the new getlang function, which has replaced all variables for language translations.

1. Repository

https://github.com/Abwasserrohr/SKYBLOCK.SK

2. Index

  1. Repository
  2. Index
  3. New Features and changes
    3.1. Added getTranslatableComponentFromItem function
    3.2. Added client based item translation to store.sk
    3.3. Language translations are now stored using metadata
    3.4. Increased performance of calcisland function
    3.5. Add calculation for contents of chests and storage units to calcisland function
    3.6. Added flag for storage unit access
    3.7. store.sk now uses metadata for configuration
  4. Pull requests
  5. GitHub Account
  6. How to contribute

3. New Features

3.1. Added getTranslatableComponentFromItem function

This new function is an exciting thing, it takes any ItemStack and returns a valid TranslateableComponent back. If you didn't know, TranslateableComponents can be sent to the client and the client then translates it depending on the client side language settings. The advantage here is big since there aren't any translations for items and blocks needed on the SKYBLOCK.SK side. The usage of it is quite simple, here is a small example:


This example above is going to send the player the current item amount and the name of the item the player is holding with the language of the client.

This could be something like:

You're currently holding 50 of Cobblestone in your hand.

I have seen that there is a variable set on line 108 of the openbook.sk file, where the function is in. This is a leftover I forgot to remove from testing and gets removed soon.

Pull request: https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/181


3.2. Added client based item translation to store.sk

Now, there is finally a function for item based translations which is very useful, because there are some add-on's which needed this feature, it comes quite handy for store.sk. While I also want to add these to the challenge.sk functions, it is currently not possible because the ChatComponent feature for the item lore is added in the next upcoming update of Minecraft 1.14 which should be released in this quarter of the year.

But now back to the change. store.sk sends messages to the player, which tells them, how much of which item has been bought or sold, this is very useful for the player to see what they have been doing in the shop. But without translations, it wouldn't have been looking that good, because the item names would either have to be translated or displayed in English. I'm very glad that I found this opportunity to use client-side translations since there is now no need to have all the Minecraft blocks and items translated. =)

Pull request: https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/182


3.3. Language translations are now stored using metadata

Storing the translations for the language within the variables of Skript is completely fine for a single language, but as there are some other languages planned to be added, there would be quite a massive amount of these variables just from the language translations. While variables in Skript are quite efficient if the right database is selected, I can't control what the server operator chooses or how fast the connected database is. This is why I decided to store the translations only in the ram of the server as metadata.

Storing the data only in ram has multiple advantages over a file only or variable storage:

  • The translation is almost instantly there, we don't have to load a file first
  • The database doesn't get messed up with all the translation variables
  • Slow databases don't suffer from too many variables at once

But there is also one big disadvantage: It takes some ram since they're saved there. But Minecraft itself needs much ram and the translations are not that big to make a difference at all.

Because there is now a function used to get the translations, it will be easier in the future to change the format of the translations and languages, since only the function has to be changed.

There isn't much to say about the change other than I didn't enjoy changing all the variables to the new function. :3 I really don't know how to do multiple commits at once, this is one place where it would have been nice but I don't see the option on the GitHub front end, maybe I missed something...^^

This is how the current state of the getlang function looks like:


This function has 4 parameters and returns colored text.

  • ID (text): The name of the translation
  • Language code (text): The language code, example: en
  • Prefix (text): A (colored) text which is added in front of the translation
  • Suffix (text): A (colored) text which is added at the end of the translation

Pull request: https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/185


3.4. Increased performance of calcisland function

The calcisland function was pretty slow and the new changes to it increased the performance. There are some reasons why it is now faster:

  • Blocks are now looped differently (only x- and z-coordinate is looped first), within this loop, the y-coordinate is looped again, which speeds up the looping process.
  • All chunks of the island are preloaded and kept loaded while the calculation is running
  • The level calculation is now done at the end of the island calculation

These three changes are the main reason for the better performance.

Here are two videos where the increase of the speed can be seen easily:

The old island calculation process
The new island calculation process

These videos are displayed as big videos on Steemit, but on other platforms like Busy or Steempeak, they are side by side thanks to <div>'s with the pull-left or pull-right class. I currently don't have a program to edit the video files, otherwise, I would have made a side by side video in itself. =)

Pull request: https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/191


3.5. Add calculation for contents of chests and storage units to calcisland function

Some server operators may want to calculate the contents of chests and storage units as well as the blocks of the island. This has now been added for those who need it. It can be configured if needed.

Adding this feature to the already existing calcisland function was pretty easy. Since we can check if the block, we're currently looping has an inventory, we know if it is a chest or a storage unit for example.


Then we only have to loop through the inventory. For storage units, it is a little bit more "work" to do. But here is the chest part:


There is not that much difference to looping through all the blocks of the island. Instead of blocks, all the slots of the inventory are being looped through and the items in the inventory are converted to their types, which then can be loaded from the configuration and added to the overall island experience.

Pull request: https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/194


3.6. Added flag for storage unit access

Before, the storage system had no special flag for accessing it, which meant that even trusted players could have accessed them. Now, the island leader can change the flag as desired to prevent everyone from accessing the storage units or even let everyone access them.

Pull request: https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/195


3.7. store.sk now uses metadata for configuration

Temporary metadata is a great improvement for many parts of the configuration, which is saved within files anyway. It greatly reduces stress on the database, which is why the store.sk add-on now uses metadata for its configuration part.

Within this pull request, also a daily limit for each player has been added, which can be changed by the server operator to limit the sells of each player to a specific amount of money.

Pull request: https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/198


4. Pull requests

https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/181
https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/182
https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/185
https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/191
https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/194
https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/195
https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/198


5. GitHub Account

https://github.com/Abwasserrohr


6. How to contribute

You're interested in contributing to SKYBLOCK.SK? Get in touch with me on Discord. I'm the sewage pipe there. I'm also looking forward to meeting beginners who haven't been used Skript yet. =)

Discord: https://discord.gg/FRuK5BC


Thank you for reading my contribution post. This time, some big changes have been made which aren't really visible to the player but are very important for the future to keep SKYBLOCK.SK simple to maintain and run.

Using the metadata to prevent many read/write actions for configurations will increase the performance of SKYBLOCK.SK and also hopefully increase the lifetime of the storage device.

If you have feedback about this contribution post, the new features I showed off today or SKYBLOCK.SK as a whole, feel free to share it with me in the commands. =)

Have a great Friday and then a nice weekend

@immanuel94

Sort:  
  • Great post with animated gifs, code samples and explanations, even a video.
  • Good job on the comments in the code and also the commit messages are a beauty to look at.

Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, click here.


Need help? Chat with us on Discord.

[utopian-moderator]

Thank you for reviewing my contribution post. =)

Thank you for your review, @helo! Keep up the good work!

Great work well done @immanuel94. I am not so knowledgeable about coding but scanning through your work it just shows me the passion and professionalism you have in this coding work. Have you had about the Utopian's Steem Secrete Bundles? Let me hope so since you are an Utopian Contributor. I have written a blog post about the latest bundles that Utopian is selling in order to build the Utopian Colony.
Here is the link to it.
https://steemit.com/utopiancolony/@yohan2on/nmggckd-get-yourself-utopian-s-steem-secrete-bundles
I hope it may interest you!
Have a great time.

Hey @yohan2on! =)

I already have backed 35$ for two badges on the indiegogo campaign.
Thank you for supporting the Utopian Colony campaign. ^^

If it gets closer to the end, I might end up buying another perk. The secret bundle is one that I would really like to get.

That's so great of you. I am glad you secured yourself some. Its an amazing innovation from Utopian. I am looking forward to participate in the Upcoming Utopian Colony.

Ich finde den Skyblock derzeit richtig cool. Es ist nicht so wie andere Skyblock server, es hat viele Funktionen die es auf normalen servern nicht gibt.

Freut mich, dass dir SKYBLOCK.SK bisher gefällt. =)

Wenn du Ideen hast, melde dich gerne!^^

Hi @immanuel94!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your post is eligible for our upvote, thanks to our collaboration with @utopian-io!
Feel free to join our @steem-ua Discord server

Congratulations @immanuel94! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

You got more than 500 replies. Your next target is to reach 600 replies.

You can view your badges on your Steem Board and compare to others on the Steem Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

Do not miss the last post from @steemitboard:

Are you a DrugWars early adopter? Benvenuto in famiglia!
Vote for @Steemitboard as a witness to get one more award and increased upvotes!

Congratulations! Your post has been selected as a daily Steemit truffle! It is listed on rank 2 of all contributions awarded today. You can find the TOP DAILY TRUFFLE PICKS HERE.

I upvoted your contribution because to my mind your post is at least 9 SBD worth and should receive 98 votes. It's now up to the lovely Steemit community to make this come true.

I am TrufflePig, an Artificial Intelligence Bot that helps minnows and content curators using Machine Learning. If you are curious how I select content, you can find an explanation here!

Have a nice day and sincerely yours,
trufflepig
TrufflePig

Hey, @immanuel94!

Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Get higher incentives and support Utopian.io!
Simply set @utopian.pay as a 5% (or higher) payout beneficiary on your contribution post (via SteemPlus or Steeditor).

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!

Coin Marketplace

STEEM 0.35
TRX 0.12
JST 0.040
BTC 70351.33
ETH 3563.43
USDT 1.00
SBD 4.72