Darkhax-Minecraft / Bookshelf

A library mod which adds additional code support beyond what is provided by Forge.
GNU Lesser General Public License v2.1
142 stars 39 forks source link

[Suggestion] Block and Item tag loot condition #194

Open farinc opened 2 years ago

farinc commented 2 years ago

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.

Darkhax commented 2 years ago

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.

ehx-v1 commented 1 year ago

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.