Butterfly Checklist

These are the steps you need to follow if you want to add a butterfly to Bok’s Banging Butterflies. At the time of writing you need to build from the source code, so this can’t be done from the client-side alone.

Checklist


  1. Add the Butterfly Data
  2. Generate Data Files
  3. Add Localisation String
  4. Create the Textures
    • Butterfly Entity
    • Bottled Butterfly Item
    • Scroll Gui
    • Scroll Item
    • Chrysalis Entity
    • Caterpillar Entity
    • Caterpillar Item
    • Bottled Caterpillar Item
    • Egg Entity/Item
  5. Implement Custom Behaviour

Butterfly Data


The first step to adding any new butterfly is to create a butterfly data file under /resources/data/butterflies/butterfly_data/. The name of the file will be the name of the species. Avoid using underscores in the JSON file name or the entityId. An example of a completed butterfly data looks something like this:

{
  "breedTarget": "none",
  "diurnality": "diurnal",
  "eggMultiplier": "double",
  "entityId": "commongrassyellow",
  "extraLandingBlocks": "none",
  "habitat": "plains",
  "index": 24,
  "lifespan": {
    "butterfly": "medium",
    "caterpillar": "medium",
    "chrysalis": "short",
    "egg": "short"
  },
  "plantEffect": "pollinate",
  "preferredFlower": "azure_bluet",
  "rarity": "common",
  "size": "small",
  "speed": "moderate",
  "type": "butterfly"
}

The attributes are as follows:

  • breedTarget: The entityId of the target this butterfly will try to breed with. By default butterflies will target their own species.
  • diurnality: Can be diurnal (active in the daytime), nocturnal (active in the night), crepuscular (active during twilight), or cathemeral (always active).
  • eggMultiplier: Can be none, normal, or double.
  • entityId: The ID of this butterfly, used for many things including ResourceLocations.
  • habitat: Where the butterfly spawns. Can be one of forests, forests_and_plains, forests_and_wetlands, forest_plains_wetlands, hills_and_plateaus, ice, jungles, nether, plains, plains_and_savannas, plains_and_wetlands, or wetlands.
  • index: Used in code to access the correct data. This will be generated so you can put anything here for now.
  • lifespan: The length of each of the butterfly’s lifecycle. Can be short, medium, long, or immortal.
  • plantEffect: The effect the butterfly has on plants. Can be none, pollinate, or consume.
  • preferredFlower: The ID of the flower this butterfly prefers.
  • rarity: This affects spawn rates. Can be common, uncommon, or rare.
  • size: This can be small, medium, large, or huge.
  • speed: Either moderate or fast.
  • type: One of butterfly, moth, or special.

Generate Data Files


Just run generate_butterfly_files.py. This will generate all the data you need to add the butterfly to the game.

Localisation


The butterfly’s name strings will have been generated for you, but you may need to modify them if you want the butterfly’s name to be something different. There will be a placeholder under gui.butterflies.fact.* That you will need to update if you want an interesting fact to appear for the butterfly in the butterfly book.

Textures


You will need to design the textures yourself. For each new butterfly you will need a total of 9 textures:

  • Butterfly Entity
  • Bottled Butterfly Item
  • Scroll Gui
  • Scroll Item
  • Chrysalis Entity
  • Caterpillar Entity
  • Caterpillar Item
  • Bottled Caterpillar Item
  • Egg Entity/Item

Custom Behaviour


Butterflies are very customisable, but if you want any unique behaviour you will have to code it yourself. What code is needed will vary depending on what you want the new butterfly to do, so this part is left as an exercise for the reader.