Minecolonies & A bunch more fixes

8개월 전

Hey everyone, I finally got some time again to write what I was up to the last days. I brought a bunch of fixes and improvements to minecolonies again.

You might be asking: "Dude, why so many fixes, is the mod so broken?"
But developing an integration within the world of Minecraft is extremely complex especially since there are a ton of other mods which change the world. Most of the fixes are cases we didn't think of when coding the AI or parts of the mod others are workarounds for things which are broken on the side of Minecraft itself. Others again are mod integrations and a bunch of them are really bugs in our code.

First Batch:

The first batch of fixes added that when a player tries to upgrade a building the builder can't build yet he will be notified.

For that, we created a method "canBeResolved" to each workOrder which checks if any builder in the colony can take care of this building.

     * Check if this workOrder can be resolved by an existing builder.
     * @param colony the colony to check in.
     * @param level the new level of the building.
     * @return true if so.
    public boolean canBeResolved(final Colony colony, final int level)
        return colony.getBuildingManager().getBuildings().values().stream().anyMatch(building -> building instanceof BuildingBuilder && building.getMainCitizen() != null && building.getBuildingLevel() >= level);

We would call this on request of the player and if not possible cancel the request.

Later I noticed that I didn't enable the builder to build his own hut which got an extra method called "canBeBuiltByBuilder".

    public boolean canBeBuiltByBuilder(final int newLevel) 
        return getBuildingLevel() + 1 == newLevel; 

Which a building can override to guarantee that the building can be built.

So I added "!canBeBuiltByBuilder(level)" to the if above.

Afterward, I made sure that invalid miner requests get sorted out since some colonies were reporting they were flowing over.

Then, there was a mod which called out getCitizenData() indirectly very early in the loading process before we finished instantiating the citizen resulting in a null pointer exception.

Then, I improved the deliveryman integration to better recognize all storage in a building.

By getting the building and not only the tileEntity.

On the way, I also made sure that if there was an issue when dumping he would dump the remaining request into the warehouse.

Then, I fixed the bed requesting for old beds (Scanned in Minecraft 1.10)

Finally, I added the composter string to the localization strings.

The second batch:

Assigning the new town hall to the colony when moving:

Caused citizens teleport into void since they didn't find it anymore when going to sleep there.

At the same time avoiding void teleport in any possible manner.

By not executing the code when trying to path to origin.

Never trying to path into the void to be sure:

And never teleporting somewhere where there is no solid ground under them.

The third batch:

Then I guaranteed a max level for citizens.

After that, we had a bunch of reports of people crashing their worlds by claiming way too many chunks for their colony (over 1000) which would try to manipulate 2000*2000 blocks (which is madness)

So I made sure that there is a max size and that never too many chunks are queued.

Afterward, I improved the archer target detection code since they were trying to shoot enemies which were out of range. Someone had the operators messed up.

Improved the detection of trees within a colony.

Barbarian Fixes:

Then I came to fixing the barbarians a bit. They had two issues:

  1. They were pushing each other off bridges
  2. They were spawning in the void in skyblock worlds.

For the first one, I created a method which checks if they are stuck and if so they would apply no collision to not push each other off.

    public void applyEntityCollision(@NotNull final Entity entityIn)
        if (entityIn instanceof AbstractEntityBarbarian
              && ((stuckCounter > 0 || ladderCounter > 0 || ((AbstractEntityBarbarian) entityIn).stuckCounter > 0 || ((AbstractEntityBarbarian) entityIn).ladderCounter > 0)))

Then I would make their code more efficient to not call it every tick.

Added better and earlier detection if they are stuck at all.

And if they'd not be stuck for a while I'd reset their stuck counters.

Additionally, I created some code to spawn a platform under them if their spawn point would be somewhere in the air.
I'd also put the spawn point on townhall level if I would detect that they are in the void.

Finally, I fixed that entities do not get stuck at too high blocks anymore by taking the collision bounding box into account.

Request System Issues:

Finally, we had some issues with the request system after the colonymanager rework since the request system wouldn't have the world on load.

For that I added the remote check in the colony interface.

and would then add the implementation if the world is remote or not on each side of the server.

For the server side colony.

For the client side colony.

And would then check if the colony is remote and not the world which would then finally correctly reset the system.



Pull Requests:


Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  trending

Thank you for your contribution. I really like the way you explain all the steps and the work you have done. Under Barbarian Fixes, you have done some computation, it would be nice to know what are the numbers for.

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.


I calculated a cylinder in the height of 1. But you're right I could've put some jdoc there.


Thank you for your review, @codingdefined!

So far this week you've reviewed 6 contributions. Keep up the good work!

Hello! Your post has been resteemed and upvoted by @ilovecoding because we love coding! Keep up good work! Consider upvoting this comment to support the @ilovecoding and increase your future rewards! ^_^ Steem On!

Reply !stop to disable the comment. Thanks!

Hi, @raycoms!

You just got a 10.85% 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.

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

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!