Replies: 3 comments 7 replies
-
As per scarpet#179, a knockback direction could be added in the form of a vector. |
Beta Was this translation helpful? Give feedback.
-
Definitely necessary for making custom hitscan weapons. I'm actually surprised scarpet doesn't have this yet. |
Beta Was this translation helpful? Give feedback.
-
When revisiting this recently I had a second suggestion for an argument to add (I was the one to suggest knockback vect): |
Beta Was this translation helpful? Give feedback.
-
Moved from #251 in order to stimulate feedback on the topic
Even as of Carpet mod 1.4.20 for Minecraft 1.16.4, we still don't have a way to deal an arbitrary amount of any damage type to any entity, on behalf of any entity. I suggest that there be a function to do exactly this:
modify(e, 'damage', amount, source, source_entity)
Deals
amount
damage of typesource
to the target entity on behalf ofsource_entity
and calls the appropriate__on_damaged
(or__on_player_takes_damage
) event if available. All vanilla damage types are supported (with corresponding effects and death messages), as well as custom damage types.source_entity
is optional and defaults tonull
(to denote no source entity).If the damage is nullified because the entity has already taken damage, the event is cancelled and no callbacks are made.
Example use cases:
You take constant fire damage while in the Nether:
modify(player, 'damage', 1, 'fire', null)
ormodify(player, 'damage', 1, 'fire')
Kill yourself and destroy all your equipped armor:
modify(player, 'damage', 9999, 'mob', player)
Instantly die once your hunger hits 0:
modify(player, 'damage', player~'health', 'starve', null)
ormodify(player, 'damage', player~'health', 'starve')
Reflect all damage you take back onto the attacker...:
...and vice versa:
Villagers attack you whenever you trade with them:
A custom damage type example based on the above example
As you can see, by having custom damage events, there are a lot more possibilities for challenge apps and datapacks that can damage the player and/or entities in a whole manner of different ways. Any thoughts on this?
Beta Was this translation helpful? Give feedback.
All reactions