Skip to content

Datapack Structure

CheaterCodes edited this page Jan 30, 2023 · 1 revision

Datapack Structure

You can modify the items obtainable with fluid sieves using a datapack. Just place loottables in the correct folder. The file name and location depends on the block you want to use as a net. For example, if you want the Fluid Sieve to extract resources from a block called my_namespace:my_block, you put your loot table into loot_tables/fluid_sieve/my_namespace/my_block.json.

Example

Let's say you want to have a chance to obtain seeds from putting farmland above a fluid_sieve. The path of the file could be:

data/seed_drops/loot_tables/fluid_sieve/minecraft/farmland.json

In side of the loot_table you might want to add something like the following:

{
  "type": "minecraft:generic",
  "pools": [
    {
      "conditions": [
        {
          "condition": "random_chance",
          "chance": 0.01
        }
      ],
      "rolls": 1,
      "entries": [
        {
          "type": "minecraft:item",
          "name": "minecraft:seeds"
        }
      ]
    }
  ]
}

This loot_table gets evaluated for each tick if there's a block of farmland above the Fluid Sieve. In order to make drops less common, the random_chance condition is used to reduce the drop chance to 1%, so an average of 5 seconds between seeds.

Drop Chance Predicate

In order to prevent coding the drop chances for water over and over again for each block, Fluid Sieve defines a predicate for that. In order to use it instead of a random chance, replace the random_chance condition from above with a reference condition:

{
  "condition": "reference",
  "name": "fluid_sieve:drop_chance"
}

This works for any waterlogged block as well as normal water. It's also compatible with water levels in fluid logged blocks made with Towelette by Virtuoel.

If you replace the file data/fluid_sieve/predicates/drop_chance.json with your own file, you can change the drop chances to your liking. Check the file in git for reference: drop_chance.json

Clone this wiki locally