Hi everyone, I almost finished most of my backlog and am coming to more recent changes now.
First of all, I noticed that we had some duplicated code in the warehouse tileEntity handling, while we changed the handling in the super class we didn't adapt it in the warehouse which caused some bugs.
With a relatively simple solution.
Another long term bug was farmers not working the fields when there were multiple was related to these farmers not freeing the field case it was assigned to them.
Which caused them to go back and forth without actually doing anything.
Citizen Building Assignment:
Something people have been complaining about for a long time is the citizen housing assignment where citizens would have to be unassigned from one building to be then assigned at another causing a lot of running around.
Where we were previously filter only by citizens without a home.
.filter(citizen -> citizen.getHomeBuilding() == null).sorted(Comparator.comparing(CitizenDataView::getName))
we now sort by the ones not assigned to the current building and not assigned to a barracks tower.
.filter(cit -> cit.getHomeBuilding() == null || !(colony.getBuilding(cit.getHomeBuilding()) instanceof BuildingBarracksTower.View) && !cit.getHomeBuilding().equals(building.getID()))
Additionally, to allow players to find the perfect citizen for the home I added a bit more information as the distance of the work and home building.
So we would now display the distance to the work building and, if the worker has a job the current distance he has to do, if not we just display the position.
At the site of the building I then only had to make sure that we can unassign a worker and then assign to another building at the same time.
Many minecraft players know it, besides the normal overworld there are many other popular gamemodes as skyblock where you'd play on an island in the sky or stoneblock where you'd be underground.
In these gamemodes it's usually much more difficult to get certain resources.
For these resources we set some things up to make minecolonies more enjoyable in these settings.
The first thing I did was adding to the composter a way to obtain not only compost but also dirt (a rare resources in these game modes).
For that, I added, programatically, a button to the GUI of the composter.
Which allows the player to choose if he wants dirt or compost as a reward.
The setup method would check what the current mode is and then name the button accordingly to the option.
Then on switching we would choose the mode and send the result to the server.
For which I registered a message.
Which sets this on arrival on the server site.
The building then got this additional value.
Takes care of writing and reading from file and of sending the data to the client side.
And, depending on which one is activated the worker would then return a quantity which is defined in the config.
As a second setting, we allowed the miner to get a certain quantity of ores from mining normal stone.
Here, we made it possible to select the percentage, which blocks should result in the additional chance and which ores with which multiplier get dropped.
This allows the player or modpack creater to define extra modded ores to be configured.
To avoid overhead from loading this I added it to our Compatibility class.
Where, on loading, we'd run through the player defined strings. Check if the string is correctly configured (separated by "!") and if the item actually exists. If so we would add the configured quantity of this item to the list.
Additionally, I added a way to detect if a block is such a lucky block.
Here we would check if the stack exists, and if so check if either the name of the stack matches the configured name or at least the tag (ore id) matches.
Finally, I added a way to get a random ore.
The easiest way for me was to shuffle this array and then just return the first one of it.
At the AI, I only had to override the triggerMinedBlock method and add some logic to check if the block is one of the lucky blocks and then add a random ore to the inventory.