Skip to content

Tree Packs: Fruits and Pods

supermassimo edited this page Apr 11, 2023 · 4 revisions

What are they

Fruits are defined in the fruits folder, and each one creates a different fruit block for a tree species to use that grow from the leaves. These are not tied to any species so multiple species can use the same fruit, but for most fruits there's one species for each.

Pods are defined in the pods folder, and similarly to fruits they are a fruity resource for species to use. Unlike fruits, pods grow on the side of branches instead of hanging from the leaves.

Properties

The following properties MUST be included:

  • "item_stack": The item the fruit/pod represents. It will select this item when middle-clicked.

The following properties can be included:

  • "type": Allows for custom behavior beyond these properties. There are no options by default, but more can be added by addons.
  • "max_age": The maximum age value for the block. (Default for fruits: 3, Default for pods: 2)
  • "block_shapes": A list of the shapes for the hitbox of each stage of growth. For more info go to this section.
  • "can_bone_meal": Whether the fruit or pod will grow when bone-mealed. (Default for fruits: false, Default for pods: true)
  • "growth_chance": Chance each tick for the fruit/pod to grow to the next stage.
  • "season_offset": [When a season mod is installed] The offset from summer that the fruit/pod is on season. (Min: 0.0, Max: 4.0, Default: 0.0)
  • "flower_hold_period_length": [When a season mod is installed] The length of time in seasons that the fruit/pod won't grow past the flower stage (stage 0) right before the period when its on season to harvest. (Min: 0.0, Max: 3.0, Default: 0.5)
  • "min_production_factor": [When a season mod is installed] The minimum production factor value that the fruit can survive at. If the factor dips below this threshold the fruit/pod will wither away and disappear. This happens on the opposite season of its harvest season. A lower value means it lasts longer. (Min: 0.0, Max: 1.0, Default: 0.3)
  • "mature_action": A custom action that the block can perform when maturing. This requires code as none are defined by default.

Block Shapes

This parameter can be an array of elements, a string (for predefined shapes), or an element (for changing shapes with properties).

Fruits are usually defined as an array of elements, one for each valid stage of growth (age), while pods may use an element with each facing direction defining its array of shapes.

Defining the shape:

The element contain two objects, a function and a parameter.

  • "function": the function used to build the shape. The options are {fruit, pod}. More can be added by addons.
  • "parameters": the parameters the function needs.
    • For fruits, the available parameters are the following:
      • [optional] fraction: How many units per block are used to define the next parameters. (Default: 20. Vanilla voxels: 16)
      • radius: The radius of the fruit box
      • height: The height of the fruit box
      • stem_length: the distance from the bottom of the block on top to the top of the box
    • For pods, the available parameters are the following:
      • [optional] fraction: How many units per block are used to define the next parameters. (Default: 20. Vanilla voxels: 16)
      • radius: The radius of the fruit box
      • height: The height of the fruit box
      • stem_length: the distance from the bottom of the block on top to the top of the box
      • side: the facing direction this shape is defined for
      • side_offset: how offset from the center the shape is, in the direction of side.
Example of a fruit shape from apple.json:
"block_shapes": [
    { "function": "fruit", "parameters": { "radius": 1, "height": 1, "stem_length": 0, "fraction": 16 } },
    { "function": "fruit", "parameters": { "radius": 1, "height": 2, "stem_length": 0, "fraction": 16 } },
    { "function": "fruit", "parameters": { "radius": 2.5, "height": 5, "stem_length": 0 } },
    { "function": "fruit", "parameters": { "radius": 2.5, "height": 5, "stem_length": 1.25 } }
  ]
Example of a pod shape from cocoa.json:
"block_shapes": {
    "east": [
      { "function": "pod", "parameters": { "radius": 2, "height": 5, "stem_length": 4, "side_offset": 5, "side": "east" } },
      { "function": "pod", "parameters": { "radius": 3, "height": 7, "stem_length": 4, "side_offset": 4, "side": "east" } },
      { "function": "pod", "parameters": { "radius": 4, "height": 9, "stem_length": 4, "side_offset": 3, "side": "east" } }
    ],
    "west": [
      { "function": "pod", "parameters": { "radius": 2, "height": 5, "stem_length": 4, "side_offset": 5, "side": "west" } },
      { "function": "pod", "parameters": { "radius": 3, "height": 7, "stem_length": 4, "side_offset": 4, "side": "west" } },
      { "function": "pod", "parameters": { "radius": 4, "height": 9, "stem_length": 4, "side_offset": 3, "side": "west" } }
    ],
    "north": [
      { "function": "pod", "parameters": { "radius": 2, "height": 5, "stem_length": 4, "side_offset": 5, "side": "north" } },
      { "function": "pod", "parameters": { "radius": 3, "height": 7, "stem_length": 4, "side_offset": 4, "side": "north" } },
      { "function": "pod", "parameters": { "radius": 4, "height": 9, "stem_length": 4, "side_offset": 3, "side": "north" } }
    ],
    "south": [
      { "function": "pod", "parameters": { "radius": 2, "height": 5, "stem_length": 4, "side_offset": 5, "side": "south" } },
      { "function": "pod", "parameters": { "radius": 3, "height": 7, "stem_length": 4, "side_offset": 4, "side": "south" } },
      { "function": "pod", "parameters": { "radius": 4, "height": 9, "stem_length": 4, "side_offset": 3, "side": "south" } }
    ]
  }

Loot Tables

Drops from the fruit or pod must be defined through loot tables. When working on an addon the runData task can be setup to generate them automatically, otherwise when working on a treepack they must be defined manually.