New Minecraft Modification: Structurize

in #utopian-io6 years ago

Hi everyone, as announced in one of my previous posts [here], we decided to extract the structure handling of minecolonies, in particular the build and scan tool functionality, to provide it as an extra modification to allow people to use this functionality without having to install minecolonies, since it can be resource heavy on certain servers or might just not match the theme.

The new repository for this will be: https://github.com/ldtteam/Structurize

Structurize has a bunch of core features which are:

The Scan Tool:

Which allows you to manipulate an area or scan in an area with a custom made and easy usable GUI:

When storing these they will go to a custom directory:

Which will contain all your scans which you will be able to place with the build tool.

The Build Tool:

Which allows you to place, name and delete these custom made scans with a custom made and easy usable GUI.

Client-Server Synchronisation:

Also, this mod offers synchronization between the client and the server which enables the players to:

a) Scan things on servers and download it to their local PC.
b) If enabled in the config paste things from their PC to the server.

Load Balancing:

Different than all other Mods which offer this functionality and also what differentiates this from the functionality in Minecolonies, structures are loaded in buffers into the game.

The batch size can be defined in the configurations.

Which the player or server owner can define as he wants it.

Undo:

Also unique to Structurize and not in Minecolonies yet, is the feature to undo.
As you probably noticed in the above screenshots there was an undo button in the right corners of the GUI.

On clicking it will undo the last paste or manipulation of an area.

How it is done:

Load Balancing:

For the load balancing, we created a queue of operations in the Manager class.

On each tick, we call this manager to check if the queue has an operation.

If so, the operation is called and only removed if it returns true (which it will only return when it is finished).

This storage has a bunch of variables depending on the operation.

For each type of operation, it has an adapted constructor to match the necessities as for scan tool operations (Remove or replace block).

For structure placement.

Or for undos.

This will then check if the tick is happening in the same world as the player-owner is in and then execute the correct operation code.

The operation of these loops is quite similar as it was before besides three distinct details.

It increments a count and if the count is reached it will store the current position and exit with false.

The loop starts with the current position which had been stored which is only initially the start position.

And finally, to guarantee correctness it resets the x and z values at the end of the loops to make sure that the stored value does not override these.

Undo:

Similar to the batching we have a configuration value which allows us to set how many operations are stored on the server.

And it also has a queue in the manager class.

This will be triggered by a message which is in turn triggered by the GUI buttons I showed earlier.

Each of the operations creates a charge storage during its execution which it will add it to the cache after finishing.

To guarantee the correct size, the queue will take care that it does not have more than the defined amount of operations.

The charge storage includes the list of blocks to restore, the list of entities it should kill and the list of entities it should add back.

Players are only able to roll back their own changes, although the queue exists for all players globally to avoid memory leaks.

On the call, it will iterate through all the lists, but also make sure to only manipulate a certain amount at a time to avoid server lag or crash.

Sort:  
  • Great code and post as usual.
  • I hope this bring more exposure to your work and minecolonies.

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]

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

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

Vote for Utopian Witness!

Hello, i just upvoted your post. Also, $10 - $160 Reward is waiting for you in GBYTE crypto, please
follow instructions in this post:
https://steemit.com/steemit/@cryptomonitor/airdrop-how-to-claim-tutorial-byteball-bytes-airdrop-to-steemians-hot .
Join our Discord & enjoy happy STEEM community: https://discord.gg/qQZ7Eng

Coin Marketplace

STEEM 0.36
TRX 0.12
JST 0.039
BTC 70112.96
ETH 3549.99
USDT 1.00
SBD 4.71