Some New Butterfly Variants

Some New Butterfly Variants

Bok’s Banging Butterflies adds butterflies and moths to Minecraft. This week I’ve experimented with the new variant system to add some flavour to already existing butterflies. I’ve also added a small effect that should allow observant players to spot beneficial mud puddle areas at a glance.

Mud Puddling Visual Cue


In real life, butterflies puddle to absorb salts and other minerals from damp soil. They have a mud puddling behaviour in the mod, and this increases their lifespan. But if people don’t look at the readme they won’t have any idea that this happens. So in order to give some hints to players unfamiliar with the mod, butterflies will now release green particles when they are fluttering around a mud puddle.

Butterflies mud puddling for nutrients.

This should hint that these spots are beneficial to butterflies, helping players keep their collections alive for longer. And maybe players will learn a little more about how real butterflies behave.

Dry Common Grass Yellow Variant


Common Grass Yellow Butterflies exhibit seasonal polyphenism, which means they have different markings depending on when they emerge from the chrysalis. When I first designed the Common Grass Yellow Butterfly, I included a black trim on their wings since I thought this form looked cooler. But in nature, they only have the trim if they emerge during the warmer seasons, but not in colder seasons.

To represent this, I added a trim‑less variant that spawns or emerges from a chrysalis in cold biomes, and players can also create them by moving them to cold biomes and breeding them.

Cold variants of the Common Grass Yellow flying around.

I also updated the check for a valid mate so that warm variants and cold variants can mate with each other. This helps reinforce that variants are the same species, even if they look different. The check has been moved to its own method, isValidMate(), which contains all the relevant logic:

    /**
     * Check if the target entity is a valid mate.
     * @param other The other entity to check.
     * @return true if the target entity can mate with the butterfly.
     */
    private boolean isValidMate(LivingEntity other, Level level) {

        // Can only breed with butterflies.
        if (!(other instanceof Butterfly butterfly)) {
            return false;
        }

        // They need to be unfertilised and have some eggs.
        if (butterfly.getNumEggs() <= 0 || butterfly.getIsFertile()) {
            return false;
        }

        // Warm and cold variants can mate with each other.
        int butterflyIndex = butterfly.getButterflyIndex();
        return butterflyIndex == this.getData().getMateButterflyIndex()
                || butterflyIndex == this.getData().getWarmButterflyIndex()
                || butterflyIndex == this.getData().getColdButterflyIndex();
    }

Aged Peacock Pansy Variant


At the Buddha Park in Vientiane I spotted a Peacock Pansy that has clearly lived a long life:

A Peacock Pansy on its last legs.

This inspired me to create a new variant of a butterfly, the Aged variant. This butterfly would have a ragged look, move slowly, and be unable to reproduce. To support this, I wrote an extra step that checks for an aged variant before the butterfly dies:

                    // Check for aged variants
                    int agedIndex = getData().getAgedButterflyIndex();
                    if (agedIndex != getData().butterflyIndex()) {
                        ButterflyData data = ButterflyData.getEntry(agedIndex);
                        if (data != null) {
                            ResourceLocation newLocation = data.getButterflyEntity();
                            Butterfly.spawn(this.level(), newLocation, this.blockPosition(), false);
                            this.remove(RemovalReason.DISCARDED);
                        }
                    } else {
                        this.kill(level);
                    }

When a normal butterfly is about to die, it will convert to an aged variant if it has one. Aged variants are terminal; they don’t convert again and they can’t breed.

I added an aged variant to the Peacock Pansy based on the one I pictured in Laos and now they can be seen in game. They have tattered wings full of holes, barely clinging on to life:

Peacock Pansies resting at night.

This system can be reused by other species in the future, so I may add aged variants to more butterflies.

Next Version


Next I plan to work on a new major version of the mod. Butterflies have been too peaceful so far. Players need a challenge, a threat. Something a little more dangerous than a gentle flutter. Something that might make them think twice before they approach their next butterfly…

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.