Skip to content

Instantly share code, notes, and snippets.

@codetaylor
Last active July 25, 2019 16:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codetaylor/b373cd14bc0956debea715aaf9e682b0 to your computer and use it in GitHub Desktop.
Save codetaylor/b373cd14bc0956debea715aaf9e682b0 to your computer and use it in GitHub Desktop.

just looking through the leaf drops, is it possible to make it a chance to drop sticks would i just add "quantity": { "min": 0, "max": 2} ? will it still drop 1 sometimes? using json

There are a number of ways you could achieve that depending on how much control you want.

I've modified the leaf example from the docs in different ways below.

Example #1

{
  "rules": [
    {
      "match": {
        "blocks": {
          "blocks": [
            "minecraft:leaves:*"
          ]
        }
      },
      "replaceStrategy": "ADD",
      "drops": [
        {
          "item": {
            "items": [
              "minecraft:stick"
            ],
            "selector": {
              "weight": 75
            }
          }
        },
        {
          "item": {
            "selector": {
              "weight": 25
            }
          }
        }
      ]
    }
  ]
}

In example #1, item selectors are used to determine drop chance. The first item is the stick and has a weight of 75 and the second item is empty with a weight of 25. This would drop sticks 75% of the time.

Note: Weights don't have to add up to 100. For more info on weights, see https://dropt.readthedocs.io/en/latest/gettingstarted#selecting-drops

Example #2

{
  "rules": [
    {
      "match": {
        "blocks": {
          "blocks": [
            "minecraft:leaves:*"
          ]
        }
      },
      "replaceStrategy": "ADD",
      "dropCount": {
        "min": 0,
        "max": 2
      },
      "drops": [
        {
          "item": {
            "items": [
              "minecraft:stick"
            ]
          }
        }
      ]
    }
  ]
}

Example #2 uses the dropCount object to define how many items should be dropped. This will drop no sticks, one stick, or two sticks. The drop chance for each quantity of sticks is equal.

Example #3

{
  "rules": [
    {
      "match": {
        "blocks": {
          "blocks": [
            "minecraft:leaves:*"
          ]
        }
      },
      "replaceStrategy": "ADD",
      "drops": [
        {
          "item": {
            "items": [
              "minecraft:stick"
            ],
            "quantity": {
              "min": 0,
              "max": 2
            }
          }
        }
      ]
    }
  ]
}

Example #3 uses the item's quantity object to define how many items should be dropped. Like the previous example, this will drop no sticks, one stick, or two sticks and the drop chance for each quantity of sticks is equal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment