SkyBlock Minecraft Addon #16 - The robots are coming!

in #utopian-io5 years ago (edited)
The robots are coming to SKYBLOCK.SK, here is an example of a robot with a chicken design.

Hello everyone,

Today, I have a big new add-on to show off you guys. While creating, testing, debugging and integrating it into SKYBLOCK.SK took some time, I think it is a very nice feature for server operators to make the late game of SkyBlock way more interesting with this add-on. As you seen in the thumbnail of this post, it is about adding robots to the game. Some other changes have been done too.

1. Repository

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

2. Index

  1. Repository
  2. Index
  3. New Features
    3.1. Split config.sk into multiple configurations
    3.2. Custom heads now use NBT
    3.3. Added robots
  4. Pull requests
  5. GitHub Account
  6. How to contribute

3. New Features

3.1. Split config.sk into multiple configurations

The config.sk grew into a massive file. While it is very handy to just have one file, it is confusing to find the right part to configure. Because it should be easy to configure SKYBLOCK.SK, I decided to split the config.sk into multiple parts, which are now located in the SkyBlock/config/ folder:

  • core.sk
  • challenges.sk
  • upgrades.sk
  • oregenerator.sk
  • islands.sk
  • flags.sk
  • blocks.yml
  • biomes.sk

These files are named to be easy understandable for what they're there.

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


3.2. Custom heads now use NBT

Previously, the heads have got their custom NBT using Minecraft vanilla commands, which isn't the best way of doing it. While it was short and easy to do, saving NBT using nms classes from Minecraft is the best way of doing so.

That's why NBT for custom heads is now saved with nms classes. Because I'm going to do some stuff with custom NBT with the robots, I decided to not go any further here how I accomplished doing it. But understanding how NBT works was quite a task for me. I'm now really happy about the first working results with NBT here with the custom heads and the robots. =)
Pull request: https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/129


3.3. Added robots

Robots are there to automate things, while it is already possible for players to run client mods, which do the exactly same, with the robots, we can control how fast and efficient they are. Next to the robots are standing players with client mods, which can farm with maximum enchantments which would be much more efficient.

The robots are a nice enhancement of servers which do not allow players to use these mods or farm afk. Because these are limited in their efficiency and can be sold expensive, it isn't possible for everyone to use them instantly.

These robots are not only interesting for SKYBLOCK.SK but could also be used on other servers. While there are already plugins which do almost the same thing as I did with these robots, I have ensured to have the following things which others may lack of:

  • It is written in Skript instead of Java to make it easy to configure and integrate into existing systems
  • Storage based on NBT (a compressed file format included in Minecraft)
  • Handling of unloading chunks & server stops
  • Open Source (MIT licence) others I have seen are proprietary and some also cost money to use, around 10 - 20 USD
  • Multiple designs and jobs the player can use for his robot (also easy customizable)
  • The robot stores statistics can be relocated and keeps the statistics.
  • Multiple languages can be used at the same time for each user. Most plugins only allow one language for the entire server.

These things above where the main reasons why I created an alternative for it in Skript.

Here is a video of them and how they work. This is the first version of them. They still need some more jobs but the core features and functions are there.

One part that I wanted to do here is to use NBT instead of variables or item lore. With NBT, I can store much more data without using the Skript variables or setting the lore, which is visible to the player. That makes NBT a really nice option.
For that, I created two new functions which allow saving and loading strings using NBT.

To make the functions fully work, I had to import some nms classes using skript-mirror.


After importing I tried to create the functions, once I got into the process of how this works, it is pretty easy to understand what it does. But understanding it in the first place on how it works and what NBT is wasn't that easy for me. =)

NBT is a great way to save data directly to an item or an armor stand in the game. The game handles saving the data directly, which is very handy, because we're dealing with robots. These robots are placed in the world and it makes sense to save their data directly in the world. The advantage over saving the data in a variable is also that it is only loaded if it is really needed. This way, millions of robots could be placed all over the server without a problem.

Here is the function for setting a string in the NBT format.


This function is doing only basic stuff. But we don't need more than that here.

Here is how it works in steps:

  1. The function is called with an item, a tag and a string.
    The item is the item which should get the NBT tag written to it, the tag is like the variable name and the string is any string we want to save to the item.
  2. The function coverts the item to an nms CraftItemStack.
    With these nms CraftItemStacks, we can do more than with the normal ItemStack. Saving NBT data to it is possible through these nms CraftItemStacks.
  3. Get already existing NBT data or create a new NBT data format.
  4. Set a string to a tag into the NBT data format using the NBTTagCompound api.
  5. Parse the NBT back to the right format and save it with the MojangsonParser Java class.
  6. Set the valid NBT back to the item and return the new item with the new NBT data.

Now, we can also get strings out of it, with this function:


Loading data out is easier than saving new data.

  1. Call the function with an item and the tag we want.
  2. Convert the item to an nms CraftItemStack.
  3. Get the NBT data as local variable.
  4. Check if the tag which has been set as parameter is there.
  5. If there is no such tag, return false. If it exists, get the string and then return it.

Now this is only a very small part of the robots, but it is a very important part of it.

There is much, what the robot has to be able to do. You can view all the tasks which have been done in the pull request here.

Here is another important step, which needs to be handled by the skript. If the robot is running and the server is stopping, the robot should stop correctly. If it wouldn't stop correctly, it might have problems starting again later or would confuse the player with incorrect display information.


While I didn't need any variables for saving anything about the robot, I needed a variable to know if a robot is currently loaded. That way, I can easily stop it on unload by looping through all robots.

Stopping it is done by changing its name and the metadata value of the key "robo" to 2. Because the robots are available in multiple languages later, it is also needed that the robot doesn't set its state as [ON|OFF] but in the right language, as example in German in [AN|AUS]. This is why it takes here also the uuid of the owner and gets the language code. That way, the robot keeps always the language of the owner.

The movement of the robots is done by changing their EulerAngle, this way, we can change every body part of the robot, which is going to be very useful for animations in the future.


4. Pull requests

https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/127
https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/129
https://github.com/Abwasserrohr/SKYBLOCK.SK/pull/130


5. GitHub Account

https://github.com/Abwasserrohr


6. How to contribute

If you're interested in contributing to SKYBLOCK.SK, you could join the Discord server below to get more information on how to join. You can also contact me, Abwasserrohr, the sewage pipe on GitHub or directly here in the comments. However you want to contact me, I'm looking forward to meet you. :3

Discord: https://discord.gg/FRuK5BC


Thank you for reading my contribution post about the new features of SKYBLOCK.SK. I hope that these code snippet images make it easier to read through it. Instead of making gifs, I again decided to make a video, because it is easier to see what has been done with the new changes.

Create these new robots was quite fun for me. Even though I had to recreate some parts multiple times and find a good working process, I'm happy that it now works as expected and is also stable. Learning and getting used to the nms classes is a nice opportunity for me to customize the game furthermore. Also to give the server operators who use SKYBLOCK.SK the tools to not have to buy proprietary robot add-ons for the game is a nice achievement in my opinion.

Have you feedback regarding this contribution post, SKYBLOCK.SK or something else? Feel free to tell me your feedback. If you have any suggestions regarding SKYBLOCK.SK, bugs or something else you want to share with me, you can do that too, of course. =)

Have a great week and keep on steeming

@immanuel94

Sort:  
  • Great post as usual, video, images, code samples. Wow!
  • Good job on refactoring your code. It's important.

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!

Sieht sehr interessant aus der Roboter. Wuerde natuerlich den Abbau automatisieren aber auch den Spielspass im SB nehmen, wenn alle Spieler wieder AFK stehen.

Hallo @flyerchen. =)

Ja, zum einen automatisieren diese Roboter diverse Aufgaben und können dadurch den Spaß am Spiel nehmen.

Andererseits gibt es auch im späteren Spielverlauf wenig teure Ziele, die man anstreben kann. Die Insel dann mit solchen Robotern zu erweitern wäre ein solches Ziel. Wobei man diese dann auch mit einer Tankfüllung betreiben müsste, nicht komplett ohne Tank wie hier gezeigt.

Ob es die dann wirklich gibt, entscheidet jeder Serverbetreiber für sich. =)

Congratulations @immanuel94! You've received the second place upvote this week :)

Thanks for participating in the Seeking Open-Source Projects contest! If you haven't already. Swing by our Discord and say hello https://discord.gg/MacHHF9

Thank you. =)

Finde die Roboter vol cooool, ich hoffe die kommen in den Sb rein, duerfen aber nicht zu Op sein

Hallo @jongartv!^^

Freut mich, dass dir die neuen Roboter gefallen. Ja, diese Roboter sind schon ziemlich op. Ob man diese hinzufügt, liegt dann dem Serverbetreiber in der Hand. Aber es gibt da Nachfrage von Serverbetreibern und daher wurde diese Funktion hinzugefügt. =)

der roboter ist ein praktisches neues feature fuer den sb ^^

Ja, praktisch in jedem Fall. :) Möglicherweise etwas zu praktisch. Diese Roboter müssten, wenn man diese wirklich anbietet, sehr teuer anbieten oder mit Tank arbeiten, dass diese Roboter befüllt werden müssen.

=)

Ich finde das die Roboter sehr gut umgesetzt wurden und das es die im SB fuer ein angemessenen Preis geben soll :D

Ok, mal schauen. ^^

Congratulations! Your post has been selected as a daily Steemit truffle! It is listed on rank 1 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 105 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

Coole Funktion

Freut mich, dass dir die neuen Roboter gefallen, @solerohot2018!^^

die vielen moeglichkeiten im SB machen mir bald stress

Hallo @sausemaus!^^

Dazu wird es demnächst eine praktische Übersicht über alles geben, was es im SkyBlock so gibt. ;)

Coin Marketplace

STEEM 0.30
TRX 0.11
JST 0.033
BTC 64275.05
ETH 3147.49
USDT 1.00
SBD 4.29