Minecolonies & The barbarians Work!
Hi everyone,
After some more complaints on the barbarian, I sat down and tried to identify the issues they were facing and tried to improve their code where possible.
The fixes I made in the last Barbarian post already helped a lot but didn't take care of everything.
First of all, I removed a whole bunch of the static variables of the Barbarian Util class to our Constant classes so I can have access to them from everywhere I might need.
Then, I cleaned up the loot files which needed an empty drop to make sure barbarians don't drop something on every occasion.
Which the last Developer forgot.
Minecraft allows you to edit the loot tables of mobs via JSON files.
The weights in the file do not represent percentages like our developer thought, they represent the weight they have when rolling a dice.
This means that if you have 3 items with a weight of 50, each one has a 1/3 chance to be picked.
This, unfortunately, also means that you need an "empty type" with a certain weight if you want to make sure that mobs have no 100% drops.
The next thing I did was balancing the barbarians a bit further.
I decreased the general armor and health of all barbarians but gave them a bit additional speed (citizens move at 0.3 in comparison).
To balance this out, I gave the chief a bunch of additional armor so he really has a power position in the team.
Then, several players on our discord requested an indication of how many barbarians are left to kill within their colony.
For that, I created a list of barbarians in the colony and methods to register and unregister them.
The registered event gets called when the barbarian spawns and sets the colony he will attack.
On unregister (on death) we check the number of barbarians and print a message depending on that.
Then, I found out that we were wasting resources on the client side.
Since the onLivingUpdate() method, ticks on the client AND server side, I disabled the client side part of it, since our specialized code doesn't require any client-side actions.
After that, I got complains that when people spawn barbarians manually they run like crazy.
That happened since their previous registering didn't set their base stats, which caused them to be waaay overpowered.
Therefore, I added to the onLivingUpdate method to the part where we instantiate their initial speed boost, also the setting of their attribute.
BarbarianSpawnUtils.setBarbarianAttributes
I also improved the stream to not require a temporary variable, the garbage collector will be thankful about that, additionally, I checked if the entity already has the special effect to avoid the effects adding up if several chiefs are close.
I hope you liked this update, our testers told us that the barbarians are working great now, and no one else could think of anything they could be needing.
This means, in the next posts I'll be able to focus on some other important parts of the mod.
Posted on Utopian.io - Rewarding Open Source Contributors








Am always happy seeing people write code, I so much believe I will make it as a programmer. Thanks for the work you did
Thanks for the contribution. It has been approved.
Need help? Write a ticket on https://support.utopian.io.
Chat with us on Discord.
[utopian-moderator]
Hey @raycoms I am @utopian-io. I have just upvoted you!
Achievements
Utopian Witness!
Participate on Discord. Lets GROW TOGETHER!
Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x
minecraft
spam