A Festive Flutter for Christmas

After unwrapping presents and gorging on roast dinners, I thought it was time to bring some Christmas magic to Bok’s Banging Butterflies. The new butterfly would look different at Christmas, providing another small Easter Egg (or should I say “Christmas Gift?”) for players to discover.

The Christmas Butterfly

I did a quick bit of research (i.e. a Google search) and I discovered that there is actually a butterfly know as the Christmas Butterfly in real life. It is a type of Swallowtail native to Kenya, also known as the Citrus Swallowtail due to their love of citrus fruits.

Naturally I based the design of the new butterfly around this one. It looks very similar to the swallowtail that is already in the mod, but it has a special property that you will only discover around Christmas.

The Easter Egg

This butterfly will look different over Christmas, in a similar way to how chests look like Christmas presents. Basing the texture on the normal butterfly, I gave it a Christmassy red and green palette, with small yellow accents to feel like ornaments on a tree.

To have this texture applied during Christmas, I set a different texture in the butterfly entity constructor for the Christmas Butterfly. I used Java’s Calendar to get the current date, which is the same method the base game uses to change the chests.

        // Support for Christmas Butterfly texture change.
        String species = ButterflyData.getSpeciesString(this);

        // If this is the Christmas Butterfly.
        if (species.contains("christmas")) {

            // If it's Christmas today.
            Calendar calendar = Calendar.getInstance();
            if (calendar.get(Calendar.MONTH) + 1 == 12 &&
                    calendar.get(Calendar.DAY_OF_MONTH) >= 24 &&
                    calendar.get(Calendar.DAY_OF_MONTH) <= 26) {

                // Then change the species string to use the alt texture.
                species = "christmas_alt";
            }
        }

        // Set the texture based on the current species string.
        this.texture = new ResourceLocation(ButterfliesMod.MOD_ID, "textures/entity/butterfly/butterfly_" + species + ".png");

This is an extremely simple method that could be used to add other seasonal features to the game, such as an actual Easter egg during Easter. The Calendar class simply pulls from the system time, so will account for any time zone by default. Players can change their system time if they want to see this feature at a different date, but since that doesn’t bother Mojang, it doesn’t bother me either.

I hope this small Christmas surprise brings joy to many Minecraft worlds. Have a wonderful new year, and may your butterfly hunts be fruitful!

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.