Releasing the Butterflies

We are on the road to release! This week I finally finished the first version of the mod and have pushed an official version of my mod out to the world. It’s taken me a while, but I finally have this simple butterfly mod out in the wild.

Finishing Touches

Before I released the mod, there were still a few minor features and issues to wrap up. I wanted to the game to be as final as it could be before I made an official release.

Animals

When I first started this mod, I envisioned butterflies as ambient background creatures similar to bats. It’s obvious in hindsight that this was the wrong decision. Butterflies have a full life cycle, can be caught, and even bred by players if they create the right conditions. They aren’t just ambient creatures, and as such shouldn’t derive from the AmbientCreature class.

I changed the Butterfly Class so that it derives from Animal instead. In doing so I was able to remove the PERSISTENT attribute and data since all animals implement it by default. The only unusual thing about butterflies is that they lay eggs rather than giving birth, so when we override the getBreedOffSpring method, we return null.

    @Nullable
    @Override
    public AgeableMob getBreedOffspring(@NotNull ServerLevel level,
                                        @NotNull AgeableMob mob) {
        return null;
    }

I also changed the DirectionalCreature class so that it derives from Animal. This allowed me to remove the PERSISTENT and AGE parts of this class as we can just use the implementation in Animal instead. It also leads to a much cleaner class, since it now only holds the directional information as the class’ name would suggest.

Rare Eggs

During my playtesting I realised that butterfly eggs drop a lot more than I liked. I started a new world, and before I had even begun planning my starter base my inventory was filling up with butterfly eggs. While I want players using the mod to be able to find the new features, I don’t want the mod to overwhelm the vanilla game or any other mods they might be using.

So I had to reduce the amount of eggs players could find. The easiest way to do this was to simply reduce the chances of an egg being laid. All it took was changing a single number.

        if (this.random.nextInt(320) == 1) {

I also didn’t like the eggs being in the Natural Blocks inventory in Creative Mode, so I moved them into the Spawn Eggs inventory instead.

Hanging Chrysalises

It turns out when I implemented the chrysalis, I messed up. A lot. I don’t think I’d had enough coffee that day. For some reason I was trying to recalculate the spawn block’s position and the position the chrysalis need to spawn in, when I already had all that information in the caterpillar. I rewrote the spawn method so it would take all the information it needed instead.

    public static void spawn(ServerLevel level,
                             String entityId,
                             BlockPos spawnBlock,
                             Direction surfaceDirection,
                             Vec3 position,
                             float yRotation) {

        ResourceLocation key = new ResourceLocation(entityId + "_chrysalis");

        EntityType<?> entityType = ForgeRegistries.ENTITY_TYPES.getValue(key);
        if (entityType != null) {
            Entity entity = entityType.create(level);
            if (entity instanceof Chrysalis chrysalis) {

                chrysalis.moveTo(position.x, position.y, position.z, 0.0F, 0.0F);
                chrysalis.setYRot(yRotation);
                chrysalis.setSurfaceDirection(surfaceDirection);
                chrysalis.setSurfaceBlock(spawnBlock);

                chrysalis.finalizeSpawn(level,
                        level.getCurrentDifficultyAt(spawnBlock),
                        MobSpawnType.NATURAL,
                        null,
                        null);

                level.addFreshEntity(chrysalis);
            }
        }
    }

It’s now much shorter, straight to the point, and easy to call from the Caterpillar class. It also actually works, which is extremely nice.

Forge Version

Finally, I wanted to ensure that I was using a stable release of Forge. At the time of writing the recommended version of Forge to use is 7.2.0, so I updated my gradle.properties, reloaded the gradle project, and ran generateIntelliJRuns. With this done I was able to both test and create a .jar ready for release.

Release

Now I’m ready to actually release the mod. I did a quick search and made a list of a few sites I could try and upload my mod. I settled on the following:

  • GitHub
  • CurseForge
  • modrinth
  • Planet Minecraft
  • Home (i.e. this website)

Preparation

I’d like to say that I had everything prepared in advance, but I’m still learning. If I had known what I was doing, I would have made sure I had these things ready before I started uploading to various websites.

Jar File

Obviously you need an actual build of your mod. You can do this by running build in gradle and it will create a jar file under ./build/libs/ in your project’s root folder.

Description

You need a solid description of your mod. You want to keep it short, but you also want people to know what features they can expect to find in your mod.

Screenshots

Most mods will add things to the world, so it’s wise to have some screenshots of the new features at the ready. All of the websites I used had options to create screenshot galleries, and it’s with good reason.

Icon

CurseForge requires an icon for your mod, and you can also use this in Modrinth. When I realised this, I threw together a quick 400px by 400px image that I could use. It’s not amazing, but it gets the point across.

GitHub

GitHub is oriented toward a more open source and technical crowd, so it will also create a zip file containing the source code at the point the release was generated. This way, people can see the code that was used to create the jar, and can even build it themselves. It’s also a good place for people to report any issues they may find.

Third Party Sites

CurseForge

This is the first place I decided to upload the mod. They require a moderator’s approval before the mod will be visible, and as I would find out this is pretty standard. At the moment the mod is still in review.

Modrinth

Similar to CurseForge, this upload is still in review. They give you a timeframe of 24 to 48 hours for approval, so hopefully we will see it there soon.

Planet Minecraft

This site was quick to approve my mod and you can see it on there now. It hasn’t got much interest yet, but I’m not expecting this humble little mod about butterflies to become spectacularly popular.

Home

Of course, the most obvious place to release this mod is right here on this website! I have created a page just for this purpose now, and I’ve also updated the menu and some links to point to this page.

The End?

Now the mod has been released we are finally at the beginning of the journey. I have a lot of ideas planned out for future versions of this mod. Now we have one release out there, it’s time to start working on the second release. I don’t want to reveal too much right away, but I will drop a hint.

PAPER

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.