Small Eggs and Better Buckeyes

I’ve talked about how details matter before. So this week I’ve focused on a couple of things that have been bugging me for a while now. These aren’t major features, but they do help to make the mod feel like it’s been crafted by someone who cares.

Resizing the Eggs


One thing that has been bugging me is that butterfly eggs are so big. Although I based their designs on real butterfly eggs, they still appear the same size as every other Minecraft item. If you compare them to butterflies in-game, they are 2 or 3 times the size of them!

That’s way too big, especially since they’re supposed to be smaller than the caterpillars they hatch. It’s something I don’t like and I’ve been wanting to fix it since I first added them to the game. So I finally got around to it.

Make sure you don’t screw up your JSON or you may end up faced with this…

Making the eggs a realistic size wouldn’t work. They would be so small that they would barely render, and be near impossible to spot. In the inventory they would appear as a dot, if anything at all. I can still give a sense of “smallness” by reducing their size, however. So I started out by reducing the size of the egg items to 50% of the original, then I tweaked it until they looked right.

Minecraft’s Item Models allow us to scale the item when it is rendered, so we can achieve this without altering any code. First we need to create a JSON file under ./models/items/ to define how we want every egg in the game to be displayed.

{
  "parent": "item/generated",
  "display": {
    "thirdperson_righthand": {
      "rotation": [ 0, 0, 0 ],
      "translation": [ 0, 1.5, 1 ],
      "scale": [ 0.255, 0.255, 0.255 ]
    },
    "firstperson_righthand": {
      "rotation": [ 0, -90, 25 ],
      "translation": [ 1.13, 1.6, 1.13],
      "scale": [ 0.204, 0.204, 0.204 ]
    },
    "gui": {
      "scale": [ 0.45, 0.45, 0.45 ]
    },
    "head": {
      "rotation": [ 0, 180, 0 ],
      "translation": [ 0, 13, 7],
      "scale": [ 0.3, 0.3, 0.3 ]
    },
    "ground": {
      "rotation": [ 0, 0, 0 ],
      "translation": [ 0, 1, 0],
      "scale":[ 0.15, 0.15, 0.15 ]
    },
    "fixed": {
      "rotation": [ 0, 180, 0 ],
      "scale": [ 0.3, 0.3, 0.3 ]
    }
  }
}

When you override anything under "display", it resets all three transformations. So in order to keep them, I had to copy the values from item/generated and reproduce them here. Of course, I reduced the "scale" to the values I needed. They’re not quite at 50%, but these are values I figured out looked nice after some trial and error.

After this we can simply change the parent of all our butterfly eggs, and the changes to the model will be reflected in all of them.

{
  "parent": "butterflies:item/template_butterfly_egg",
  "textures": {
    "layer0": "butterflies:item/butterfly_egg/swallowtail_egg"
  }
}

After making this change to all our egg items, they now look smaller in game!

They’re still not realistically sized, but you can see that sense of smallness I’m going for. Especially if you compare them to a normal-sized chicken egg.

Redesigning the Buckeye


The buckeye butterfly’s design kind of bugged me. I did it fairly quickly, and I was going for that sense of grey-brown with the large false eyes that give it its name. But it just kind of came out as a brown-purple sludge. I’d see it when I was playing the game, and I started to hate it.

So I decided it was finally time to fix it. I did a bit of research and I found that some buckeyes have a bit more blue and red on their wings. I took that as inspiration, as well as taking a bit of creative liberty, and came up with a new look for the butterfly. It’s now more brightly coloured, but you can still see the “buckeyes” on the wings.

The new buckeye texture

I also tweaked the design of a couple of other butterflies. I gave both the cabbage and forester butterflies a darker edge and a bit more detail on their wings so that their style fit in with the rest of the textures.

After all this work, I launched the game and spawned the new butterflies to see what they looked like. And it made me happy.

Coming Soon


I’ve finally started looking at data driving the butterflies. I’ve already come up with a basic JSON format, but I now need to write the code that actually loads and uses these files.

This is something I’ve done before, so I’m using an old article I wrote to help me with this. Unfortunately, some things have changed in 1.20, so I still have to figure out how to get the code working properly in the latest version of Forge. Hopefully by next week I’ll have this all figured out.

Hopefully.