Skip to content

Adding Crystal Apothecary Harvestables

Electro_593 edited this page Jul 22, 2023 · 7 revisions

The Crystal Apothecary is a functional block that automatically harvests blocks in it's vicinity. Making blocks harvestable is as simple as adding them to the spectrum:crystal_apothecary_harvestable block tag. There is another functionality to the Crystal Apothecary, though: It can simulate block growth in unloaded chunks (mainly intended, but not limited to for gemstone cluster type blocks). Whenever a Crystal Apothecary get's loaded it checks how long it was unloaded, checks it's surroundings and tries to estimate, for example, how much Amethyst would have been grown in a geode, based on the amount of budding blocks & blocks next to them that match certain criteria (where Amethyst Clusters could grow).

You can specify additional simulations, or edit existing ones, by placing json files in the directory <data_pack_or_mod_name>/crystal_apothecary_simulations/.

Properties:

  • (Identifier) budding_block: The id of a block that should be searched around of
  • (Identifier[]) valid_neighbor_blocks: List of blocks that should be counted next to each budding_block
  • (int) ticks_for_compensation_loot_per_valid_neighbor: The amount of ticks per found valid block it takes to generate compensation loot. Adjusted to match the randomTickSpeed gamerule. Vanilla amethyst roughly grows a finished Cluster every ~10.000 ticks with default randomTickSpeed of 3
  • {} compensated_loot:
    • (Identifier) item: The item to give
    • (int) count: The number of items to give
    • (String) nbt: An nbt string for the result

Growth Estimates (ticks_for_compensation_loot_per_valid_neighbor)

For Vanilla's amethyst:

  • There are /gamerule randomTickSpeed random ticks in each 161616 cube per game tick (default: 3)
  • When a budding block it ticked, there is a 20% chance to choose a random direction and check if a bud can grow/advance at that pos
  • Vanilla's and Spectrum's Buds all have 4 growth stages to get fully grown

This results in

  • (random_tick_speed / (16*16*16)) * empty_blocks_next_to_budding_blocks * grow_chance * (1 / growth_stage_count) average grown clusters per tick.
  • => ~5.000 ticks per budding block, with all faces exposed

Example: Allowing the Crystal Apothecary to harvest Topaz

{
  "budding_block": "minecraft:budding_amethyst",
  "valid_neighbor_blocks": [
    "minecraft:small_amethyst_bud",
    "minecraft:medium_amethyst_bud",
    "minecraft:large_amethyst_bud",
    "minecraft:amethyst_cluster",
    "minecraft:air",
    "minecraft:cave_air",
    "minecraft:water"
  ],
  "ticks_for_compensation_loot_per_valid_neighbor": 10000,
  "compensated_loot": {
    "item": "minecraft:amethyst_shard",
    "count": 2
  }
}
Clone this wiki locally