Minecolonies & The Archery
Hi everyone, Minecolonies updates are here and I'm here with a new building type: The Archery.
Previously players were quite unhappy since their guards were dying quite regularly at early levels and there was no good way to level them up.
That's why we created the Archery.
What does it do:
It is a building which levels up your archers without any risk of them dying. Then they can be employed to the job as an archer guard.
What I had to prepare:
To get started I had to make sure that the levels and experience the archers get at the archery will be stored.
This way, the previously double experience field and int level field got into a map of their job description to a tuple of the level and experience.
To guarantee backward compatibility I had to load this correctly from NBT.
If the new system would be in place, I would load the whole list, else I would load the old field and put it in the list.
Writing was easier since I only had to write the new data then.
The getters and setters I then changed to job-specific getters and setters.
Where I would in all cases query the list entry, change it and then put it back in.
To make sure that the query always returns a value for a job key I used the computeIfAbsent map method which was quite handy for that.
The advantage of this was that I was able to remove all the code which previously handled losing the experience when changing the job.
I also created the getExperienceTag method to jobs.
Which a job can override if it wants to level up a different job.
The new Hut:
To create the new Hut a few things had to be taken care of.
Creating the block.
Adding it to our modblock registry.
Add a mapping in our building registry from the block to the building.
Create the building:
The building itself would store a position to shoot from and a position to shoot at for the archers to train.
To find this in the world there is the registerBlockPosition method which is called by the builder when building.
There we would check for a hay block with a fence under it as a target and glowstone as the standing position.
Then, I had to write and read this from NBT (omitted here because boring) and two methods to get one of the position by random.
The job:
To actually make them work I had to create the job class (which stores job-related info for the worker) and override the getExperienceTag method to level up the archer.
And not forget to register that.
Finally, I was able to start coding the AI itself.
The AI descriptions always get a bit more complex.
We naturally map different states to different method calls.
Initially, we map IDLE to decide and then from there we go to different states.
Decide would, in this case, make sure it has a bow, equip it and then decide on random if it should wander or find a shooting stand position.
Wandering would then get a random target and try to walk to it.
When it reaches the random position it would then decide again.
The shooting stand selection would get the random position from the building and then transfer to the walk to it state.
Which, itself, when reaching it would switch to the select target state.
There it will check if he is finished shooting and, if not, select a shooting target and go to the shoot job.
Shooting would check if he is in the progress of shooting (if hand is active)
and then to all the preparations to try to hit the target.
If not it would reduce the attack delay and eventually set the hand active.
After shooting it would then check out the result.
Depending on how successful it was it will earn some experience and then go to target selection again.
Repository:
https://github.com/ldtteam/minecolonies
Pull Requests:
https://github.com/ldtteam/minecolonies/pull/3107
https://github.com/ldtteam/minecolonies/pull/3118
Made with Blockbench
, that's a tool to make Minecraft structures it seems, was it useful in this build?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]
For the block models, I usually have graphic artists. I have an intolerance for creativity =P
Thank you for your review, @helo! Keep up the good work!
Hi @raycoms!
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
Hi, @raycoms!
You just got a 11.08% upvote from SteemPlus!
To get higher upvotes, earn more SteemPlus Points (SPP). On your Steemit wallet, check your SPP balance and click on "How to earn SPP?" to find out all the ways to earn.
If you're not using SteemPlus yet, please check our last posts in here to see the many ways in which SteemPlus can improve your Steem experience on Steemit and Busy.
Hey, @raycoms!
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!
This is quite interesting. I have looked into helping Minecraft admins monetize their servers, but most said that they thought it wasn't worth it at this point due to the Microsoft EULA changes.
So my question is... How does one monetize this with block chain if you have to pay for the network costs?
This is more of a problem for server admins rather than mod developers, but something I would like to figure out someday.
This kind of reminds me of a Dwarf Fortress system... I would be interested in testing, but does one have to use the JRE version with your mod? Or can they use the MS binary?
Atm there is not any blockchain integration at all, although we plan to monetize ingame schematica eventually over Steemit, so you can upvote building styles you like etc.
And yeah, monetizing servers is difficult due to the EULA.
You can test this my putting the jar in your minecraft forge mod folder. Or by building the mod with intellij which will load up minecraft
That's a great progress mate.Ur effort is never gonna waste output looks awesome
Please Check My post For Private Data :( http://bit.do/eDv5r