LootTweaker

LootTweaker

17M Downloads

[Request] LootFunction conditions

Dabombber opened this issue ยท 1 comments

commented

As it is, I'm not sure if the smelt function is particularly useful. People may expect it to implement its vanilla usage, adding a condition of the entity being on fire.

The following are currently equivalent

Functions.smelt()
Functions.parse({"function": "minecraft:furnace_smelt"})

While vanilla uses it as

Functions.parse({"function": "minecraft:furnace_smelt", "conditions": [{"properties": {"minecraft:on_fire": true}, "entity": "this", "condition": "minecraft:entity_properties"}]})

I guess you could implement this with something like smelt(true), but that's a bit ugly. It'd make more sense to add a method for smelt(ZenLootConditionWrapper[] conditions). Then it'd be possible to write it as

Functions.smelt([Conditions.parse({"properties": {"minecraft:on_fire": true}, "entity": "this", "condition": "minecraft:entity_properties"})])

Which is ummm, yea not really a lot better I guess. While minecraft:entity_properties is complicated, the on_fire part of it isn't too bad as it only has true/false and the entity (this/killer/killer_player). If that was also added you'd be able to write it as

Functions.smelt([Conditions.onFire(true, "this")])

Or even shorter if onFires arguments had default values. I think it's almost possible to do in pure zenscript, but I'm not sure how to turn a LootCondition back into something useful.

commented

I'm not sure how to turn a LootCondition back into something useful

LootConditions and LootFunctions have no ZenScript methods, their only use is to be passed to LootTweaker.