Bug Fixes and Optimisations

Minecraft Feature

This week I’m creating a new release that includes some bug fixes and optimisations for Bok’s Banging Butterflies. This time I had a little help, and learned a bit more on how Minecraft works under the hood. I’ve also updated the license so that it includes a clause specifying that code cannot be used in AI models.

Memory Leak Bug Fix


The first bug reported by Zelioth was a memory leak in the network buffer when Butterly Data was synchronised from server to client. This surprised me because Java usually releases all memory for you, but Netty’s network buffers don’t work this way.

This wouldn’t have impacted games too much, since data is only synchronised to each player once after they join. However, memory leaks are always bad, especially in a game that needs a lot of memory to run mods. This will also have affected single player games, since Minecraft is implemented as a listen server.

So with the help of Zelioth this bug is now fixed in the latest release.

Possession Config Options


As it turns out, the code for possessing illagers/villages with Peacemaker Butterflies was a bit of a mess. Generally there was nothing wrong with the code, except when entities are created during world generation. I didn’t fully understand the problem at first, but Zelioth took the time to walk me through the problem which I really appreciate.

This doesn’t add any new features, but since I was digging into the code anyway, I took the time to add a few more config options so players and modpack creators can further customise how often Peacemaker Butterflies spawn:

  • villager_possession_chance
    Chance out of 1000 that Villagers are spawned with Peacemaker Butterflies.
  • wandering_trader_possession_chance
    Chance out of 1000 that Wandering Traders are spawned with Peacemaker Butterflies.
  • illager_possession_chance
    Chance out of 1000 that Illagers/Witches are spawned with Peacemaker Butterflies.
  • butterfly_golem_spawn_chance
    Chance out of 1000 that a Butterfly Golem will spawn instead of an Iron Golem.

Of course, the possession chances will only work if enable_hostile_butterflies is true. Setting these values will only disable entities spawning with Peacemaker Butterflies inside them. If you want to disable them completely, set enable_hostile_butterflies to false.

Block Search Optimisation


BonsUnleashed created a pull request that optimised the block lookups used by Butterflie Entitiess to determine where they can land, lay eggs, and so on. Since this is something butterflies do very often, this means that Butterfly Entities will now run their AI more efficiently.

And a faster running mod means faster gameplay and less impact on other mods you will be using as part of your modpack.

Updated MIT License


I’ve update the license to include the following text:

  • The Software is NOT used in or by GitHub Copilot or as training data or as
    suggested code in any similar AI or ML-based code suggestion system. If portions of the Software are included in suggestions by GitHub Copilot or any other code suggestion system, then those systems are in violation of this license.

Generally this doesn’t change anything. You can still use the project for anything you need, but I don’t want my code to be included in any AI models. There are a couple of reasons for this:

Attribution
Code included in AI models is buried inside the guess-the-next-word algorithm and thus cannot be attributed properly. The only thing I ask of anyone who uses my code is to credit the source, so I don’t want it being somewhere where this is impossible.

Morality
The current trend of LLMs is causing a wealth of problems around the world, from stealing from artists and coders, to hoarding graphics cards, and building data centers that damage the environment around them. This is not something I want to be a part of.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.