ldtteam / minecolonies-features

This is a repo only to discuss minecolonies features (requested and planned)
10 stars 3 forks source link

Enchanter cant produce Research-enabled enchantments #747

Closed sweg4552 closed 1 year ago

sweg4552 commented 1 year ago

Prerequisites

Context

Is your feature request related to a problem?

I am making a datapack and trying to get the Enchanter to produce Swift sneak enchanted books after a deep dark themed research is completed, the loot table therefore uses the minecolonies:research_unlocked predicate, however, the enchanter cant pass the predicate. If I use the exact same loot table on the fisherman, he passes the predicate and fishes these enchantments (the code was checked on the discord)

Enhancement or Change description

After reading through the code, from what I understand, I found that the KILLER_ENTITY parameter is used to check the predicate, which ofc the enchanter is not, and isnt included in the enchanters loot context: https://github.com/ldtteam/minecolonies/blob/91cfa629367c9d7135696320708aab5165f4bc8e/src/api/java/com/minecolonies/api/loot/ResearchUnlocked.java#L41

Enchanter loot table call through the recipe with getLootContext() which doesn't include a KILLER_ENTITY when empty https://github.com/ldtteam/minecolonies/blob/01fdfaf3925c2ddf24fa3dea130a8a925b506918/src/main/java/com/minecolonies/coremod/entity/ai/citizen/enchanter/EntityAIWorkEnchanter.java#L260

It would be nice if this predicate was made to work for all non-killing colonists


Viewers