2

So I would like to have phantoms drop extra membranes the larger they are, except it seems like the min/max is ignored? When I kill regular phantoms with looting 3 for example I usually get 4 membranes?

Here it is:

{
  "type": "minecraft:entity",
  "pools": [
    {
      "rolls": 1,
      "bonus_rolls": 0,
      "entries": [
        {
          "type": "minecraft:item",
          "name": "minecraft:phantom_membrane",
          "functions": [
            {
              "function": "minecraft:set_count",
              "count": {
                "type": "minecraft:uniform",
                "min": 0,
                "max": 1.0
              },
              "add": false
            },
            {
              "function": "minecraft:looting_enchant",
              "count": {
                "type": "minecraft:uniform",
                "min": 0,
                "max": 1.0
              }
            }
          ]
        }
      ],
      "conditions": [
        {
          "condition": "minecraft:killed_by_player",
          "inverse": true
        }
      ]
    },
    {
      "rolls": 1,
      "entries": [
        {
          "type": "minecraft:item",
          "name": "minecraft:phantom_membrane",
          "functions": [
            {
              "function": "minecraft:set_count",
              "count": 2.0,
              "add": true,
              "conditions": [
                {
                  "condition": "minecraft:entity_properties",
                  "entity": "this",
                  "predicate": {
                    "nbt": "{Size:3}"
                  }
                }
              ]
            }
          ],
          "conditions": [
            {
              "condition": "minecraft:killed_by_player",
              "inverse": true
            }
          ]
        }
      ]
    },
    {
      "rolls": 1,
      "entries": [
        {
          "type": "minecraft:item",
          "name": "minecraft:phantom_membrane",
          "functions": [
            {
              "function": "minecraft:set_count",
              "count": 4.0,
              "add": true,
              "conditions": [
                {
                  "condition": "minecraft:entity_properties",
                  "entity": "this",
                  "predicate": {
                    "nbt": "{Size:5}"
                  }
                }
              ]
            }
          ],
          "conditions": [
            {
              "condition": "minecraft:killed_by_player",
              "inverse": true
            }
          ]
        }
      ]
    },
    {
      "rolls": 1,
      "entries": [
        {
          "type": "minecraft:item",
          "name": "minecraft:phantom_membrane",
          "functions": [
            {
              "function": "minecraft:set_count",
              "count": 6.0,
              "add": true,
              "conditions": [
                {
                  "condition": "minecraft:entity_properties",
                  "entity": "this",
                  "predicate": {
                    "nbt": "{Size:7}"
                  }
                }
              ]
            }
          ],
          "conditions": [
            {
              "condition": "minecraft:killed_by_player",
              "inverse": true
            }
          ]
        }
      ]
    },
    {
      "rolls": 1,
      "entries": [
        {
          "type": "minecraft:item",
          "name": "minecraft:phantom_membrane",
          "functions": [
            {
              "function": "minecraft:set_count",
              "count": 10.0,
              "add": true,
              "conditions": [
                {
                  "condition": "minecraft:entity_properties",
                  "entity": "this",
                  "predicate": {
                    "nbt": "{Size:20}"
                  }
                }
              ]
            }
          ]
        }
      ],
      "conditions": [
        {
          "condition": "minecraft:killed_by_player",
          "inverse": true
        }
      ]
    }
  ]
}

2 Answers 2

2

Edit, I was just being stupid. As you can see, the final "killed by player check" is outside the final pool's "function" brackets.

The final and working loot table is successfully able to drop specific loot based on nbt data just as I had hoped and is listed below:

{
  "type": "minecraft:entity",
  "pools": [
    {
      "rolls": 1,
      "bonus_rolls": 0,
      "entries": [
        {
          "type": "minecraft:item",
          "name": "minecraft:phantom_membrane",
          "functions": [
            {
              "function": "minecraft:set_count",
              "count": {
                "type": "minecraft:uniform",
                "min": 0,
                "max": 1
              },
              "add": false
            },
            {
              "function": "minecraft:looting_enchant",
              "count": {
                "type": "minecraft:uniform",
                "min": 0,
                "max": 1
              }
            }
          ]
        }
      ],
      "conditions": [
        {
          "condition": "minecraft:killed_by_player"
        }
      ]
    },
    {
      "rolls": 1,
      "entries": [
        {
          "type": "minecraft:item",
          "name": "minecraft:phantom_membrane",
          "functions": [
            {
              "function": "minecraft:set_count",
              "count": 0,
              "add": false,
              "conditions": [
                {
                  "condition": "minecraft:entity_properties",
                  "entity": "this",
                  "predicate": {
                    "nbt": "{Size:0}"
                  }
                }
              ]
            },
            {
              "function": "minecraft:set_count",
              "count": 2,
              "add": false,
              "conditions": [
                {
                  "condition": "minecraft:entity_properties",
                  "entity": "this",
                  "predicate": {
                    "nbt": "{Size:3}"
                  }
                }
              ]
            },
            {
              "function": "minecraft:set_count",
              "count": 4,
              "add": false,
              "conditions": [
                {
                  "condition": "minecraft:entity_properties",
                  "entity": "this",
                  "predicate": {
                    "nbt": "{Size:5}"
                  }
                }
              ]
            },
            {
              "function": "minecraft:set_count",
              "count": 6,
              "add": false,
              "conditions": [
                {
                  "condition": "minecraft:entity_properties",
                  "entity": "this",
                  "predicate": {
                    "nbt": "{Size:7}"
                  }
                }
              ]
            },
            {
              "function": "minecraft:set_count",
              "count": 10,
              "add": false,
              "conditions": [
                {
                  "condition": "minecraft:entity_properties",
                  "entity": "this",
                  "predicate": {
                    "nbt": "{Size:20}"
                  }
                }
              ]
            }
          ],
          "conditions": [
            {
              "condition": "minecraft:killed_by_player"
            }
          ]
        }
      ]
    }
  ]
}

0

I would consolidate all four entries that do the size-based count into one single entry:

{
      "rolls": 1,
      "entries": [
        {
          "type": "minecraft:item",
          "name": "minecraft:phantom_membrane",
          "functions": [
            {
              "function": "minecraft:set_count",
              "count": 2,
              "conditions": [
                {
                  "condition": "minecraft:entity_properties",
                  "entity": "this",
                  "predicate": {
                    "nbt": "{Size: 3}"
                  }
                }
              ]
            },
            {
              "function": "minecraft:set_count",
              "count": 4,
              "conditions": [
                {
                  "condition": "minecraft:entity_properties",
                  "entity": "this",
                  "predicate": {
                    "nbt": "{Size: 5}"
                  }
                }
              ]
            },
            {
              "function": "minecraft:set_count",
              "count": 6,
              "conditions": [
                {
                  "condition": "minecraft:entity_properties",
                  "entity": "this",
                  "predicate": {
                    "nbt": "{Size: 7}"
                  }
                }
              ]
            },
            {
              "function": "minecraft:set_count",
              "count": 10,
              "conditions": [
                {
                  "condition": "minecraft:entity_properties",
                  "entity": "this",
                  "predicate": {
                    "nbt": "{Size: 20}"
                  }
                }
              ]
            }
          ]
        }
      ]
    }

This consolidates all the functions and conditions into one pool.

1
  • Smart. Thanks Ill try that.
    – Aceplante
    Feb 16 at 13:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .