[Open Source] SkyBlock Minecraft Addon [New features #8]steemCreated with Sketch.

in #utopian-io5 years ago (edited)
A island with the new progress bar for /island calc

Hello steemians and minecraft players,

I want to wish everyone a happy new year and good luck with everything you want to accomplish. Today, I want to share some new changes to the SKYROAD.SK game add-on to Minecraft, which is licenced under the MIT licence.

1. Repository

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

2. Index

  1. Repository
  2. Index
  3. New Features and changes
    3.1. Added lava buckets and obsidian to island bound items
    3.2. Outsource admin commands into functions
    3.3. Generate the structure file folders in the world
    3.4. Added progressing loading bar to calcisland function
    3.5. Added admintools_create function
  4. Pull requests
  5. GitHub Account
  6. How to contribute

3. New Features

3.1. Added lava buckets and obsidian to island bound items

Lava buckets are now also bound to the island.

In the last couple of days, the island bound dirt, grass and farmland has been introduced. Since people had no longer the chance to gain profit from this, they have seen that lava buckets and also obsidian is still possible to share. With this change, it is no longer possible for players to pick up lava from new islands and place it on other islands. This prevents now, that players join with alt accounts and loot the island faucet by creating an island, taking the lava and then deleting the island to repeat the process over and over.

Since we already had the binddirt function, I renamed this function into binditem and changed it. Instead of only binding dirt, it can now bind everything we want to the island. Also lava, lava buckets and obsidian.

Here is how the new function can be called. This is also how lava is now bound to the island:

on bucket fill:
    if target block is lava:
        set {_allowed} to checkislandaccess(player,event-location)
        if {_allowed} is not false:
            cancel event
            binditem(event-location, player,lava bucket)

If the player fills his bucket while looking at lava, the player is going to fill the lava into his bucket.
Since we want to prevent vanilla behaviour, we check first, if this is allowed by calling the checkislandaccess function, which returns a Boolean and if it is not false, cancel it and bind it using binditem.

Now, we have an island bound bucket of lava, which we can check on the bucket empty event like this:

on bucket empty:
    if player's tool is lava bucket:
        set {_allowed} to checkislandaccess(player,event-location)
        if {_allowed} is not false:
            set {_allowed} to bindcheck(player's tool, player)
            if {_allowed} is false:
                cancel event

Here, we again check if the player wants to empty a bucket of lava and check, if the player is allowed to do so. If the player is allowed, we use the bindcheck function to check the current tool of the player (the bucket of lava). bindcheck is going to return false if the lava bucket is bound to another island.

The pull request also added grass paths to the island bound protection, which I forgot as I added the binddirt function.

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

3.2. Outsource admin commands into functions

Reducing the size of the Events.sk and Commands.sk files and adding more functions to the game to also allow server operators to use these functions for themselves how they want is on the roadmap of SKYBLOCK.SK, this also makes the code easier to read and later much easier to change things.
With this change, all bigger code parts of /islandadmin have been seperated into multiple functions and relocated into SkyBlock/SKYBLOCK.SK/Functions/admintools.sk. This reduced the line size of Commands.sk by around 338 lines.

I also made the following change for arguments, which called the warphandler and homehandler functions:

        else if arg-1 is "warp":
            warphandler(player,"warp",arg-2)
        else if arg-1 is "setwarp":
            warphandler(player,"setwarp",arg-2)
        else if arg-1 is "delwarp":
            warphandler(player,"delwarp",arg-2)

Instead of calling the warphandler for all the different arguments, it is now more compact, since we can check multiple arguments at once, we know that the argument is correct and can passed as a parameter to the warphandler.

        else if arg-1 is "warp" or "setwarp" or "delwarp":
            warphandler(player,arg-1,arg-2)

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

3.3. Generate the structure file folders in the world

Minecraft doesn't create the structure file folders by default. Only if someone on the server decides to create a structure, this folder is created. At the moment where I created the loadislandstoworld function, I didn't know about that. While testing for the first releases in the future, I found this issue, which is now fixed.

This is only one line, if the folder is already there, there is no error going to be outputted in the logs, since I catch the error using the try before the actual code.

 try new File("%{SB::config::world}%/generated/minecraft/structures/").mkdirs()

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

3.4. Added progressing loading bar to calcisland function

Progress of the new progress bar for island calculation.
Some players experienced endless loading bars while using the ```calcisland``` function. I never really had opportunity to get it reproduced on my side. I changed the progressing bar to now show actual progress. This way, the player knows how far it got and sees directly how much progress has been made. This process is calculated by knowing how many blocks we have on the island and then checking on how many blocks we already have gone through.

That way, we can inform the player, how many blocks we already got and then also make a nice looking progress bar, which changes colours as the progress goes on.

I did it the following way:

 set {_progress} to "%{SB::config::color::secondary::2}%||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||&r"

We have a progress bar, which contains | 100 times. Since it is coloured like the secondary 2 colour, configured in the config.sk, we can change the colour of one |, once we have progressed 1 percent further than before.

 replace all "%{SB::config::color::secondary::2}%|" with "%{SB::config::color::primary::1}%|%{SB::config::color::secondary::2}%" in {_progress}

By replacing some colour variables, we now have a progress bar, which looks like in the gif. Players also like that the block counter is so fast and they now can view the progress going on. =)

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

3.5. Added admintools_create function

Now, finally, the admin can create new and empty islands anywhere needed. If someone want to get a specific neighbour, it is now possible to create the island at the right place and copy the island over and then re-adding the players to this island. Many people on my test server asked for this, I hope they now want to move to other places. =D

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

4. Pull requests

https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/65
https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/67
https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/69
https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/71
https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/74

5. GitHub Account

https://github.com/Abwasserrohr

6. How to contribute

If you want to contribute to SKYBLOCK.SK, you can contact me using Discord or create a pull requests directly on GitHub, I'm looking forward to meet you. I'm Abwasserrohr on the Discord. =)

Discord: https://discord.gg/FRuK5BC


Thank you for reading this contribution post. If you have feedback, I'm looking forward to hear about it. ^^
This time, some very frequently asked features, like the progress bar for /island calc and the new island creation function where added. I'm glad that this is done, since people have been asking all the time for stuff like this. =D

Keep on steeming and I wish you a successful new year

@immanuel94

Sort:  
  • Great post with code samples and explanations.
  • Good use of animated gifs, could have used a few more images.
  • If you could switch from "tab" as spacing to two spaces, it would make the code more readable.

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? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

Hello @helo. =)

Thank you for reviewing my contribution post. Yeah, on GitHub, it is spaced way too much, I might change to spaces soon, I created a issue for that.

Until that happens, it is also possible to change the size by a get parameter like this: https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/74/files?ts=2 =)

I'm gonna add more pictures in the future, there are some new menus with language flags, challenges and other visual things coming for which I add more pictures. :3

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

Sieht sehr schön aus der neue Ladebalken. Vor allem kann man besser erkennen, ob der Calc hängt oder nicht.

Ja, stimmt.^^ So können wir dann ggf. auch ermitteln, an welcher Stelle genau es gehangen hat... =)

ich finde es cool , das Skyblock nicht so ist wie es schon 1000 mal gibt sondern einbischen einzigartig

Freut mich, dass dir diese Version von SkyBlock gefällt.^^

Sieht echt gut aus. Viel besser als die alte Version.

Ja, vorallem sieht es weniger "ewig lang ladend" aus als vorher... =D

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

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.28
TRX 0.13
JST 0.032
BTC 61626.58
ETH 2940.28
USDT 1.00
SBD 3.66