Bookshelf

Bookshelf

230M Downloads

[Suggestion] Block and Item tag loot condition

farinc opened this issue ยท 3 comments

commented

So I am still new when it comes to datapack conditions, but here we go:

One loot condition that would be quite useful is a condition to test if the block generating the loot (aka, the block from LootContextParams.BLOCK_STATE) is contained in a provided tag.

Something similar for the case that we can test if an item on the player is contained in a specific tag(s). Additional settings provide "where" this item must be on the player; for example such as main hand, off hand, head, etc.

A few examples:
Block tag condition

{
    "condition": "bookshelf:has_block_tag",
    "tags": [
         "minecraft:logs_that_burn"
    ]
}

Item tag condition. Values for slot includes any, mainhand, offhand, head, feet, chest, legs

{
    "condition": "bookshelf:has_item_tag",
    "tags": [
         "minecraft:wool"
    ],
    "slot": "head"
}

Right now I am attempting to implement this in my mod, but I thought the idea was worth putting forward for a core mod like this.

commented

Thanks for the suggestion. I will consider adding this when I get around to adding loot conditions again. Older versions are only receiving bug fixes and newer versions don't have any new loot condition types.

commented

These would be shorthands for existing loot conditions/predicates (which are mostly the same thing in Vanilla; block_state_property/location_check and match_tool/entity_properties, respectively), but so are a lot of the existing custom predicates, so it would fit the mod's spirit.

commented

Since this seems to be possible in vanilla already I am going to close this for now. I am working on a new project that will specifically cater to data packs in the future and if a shorthand for this would still be useful we can look into adding it there.