Topic category: Help with Minecraft modding (Java Edition)
I'm trying to create a procedure that reduces the fall distance when a player falls. There is a procedure block for "Overwrite fall distance for <x>" but I can't find any useful way to implement it. I can make it trigger on various triggers, except for the one that makes sense, "Entity Falls".
I wrote a simple procedure triggering on "Entity Falls" that displays player health, fall distance, sets fall distance to 0, waits 1 tick and then displays the player health and fall distance again. Walking off a 5 block cliff shows my starting 20 health followed by 18 after I take the fall damage. Fall distance remained a constant 4.82. I can completely negate damage by either cancelling the event or disabling player damage and then re-enabling after the wait delay, but that is not what I'm looking for. Why doesn't Overwrite Fall Distance work here? If it doesn't work when falling, what good is it?
The developers made it very simple -
1. A standalone procedure >> On Player Tick Update
2. Add >> Overwrite Fall Distance of entity with 0 blocks for the next tick
No matter the height, the player (or entity) will not be damaged for the next tick. Simple procedure, and yet very op. Better set it as conditional for wearing custom boots or holding item.
^^ only do so if the player has a certain amount of downwards motion else youll permenantly take 0 damage a tick
Is a Player Update Tick the only way to get this to work? I was trying to avoid calling my procedure 20 times a second since there will be several checks and calculations involved to figure out how much fall reduction is warranted, multiplied x4 armor slots.
It seems fall reduction is already locked in when using Entity Falls, even though the trigger clearly occurs prior to damage being dealt. I guess this all happens in the same tick and Override Fall Distance won't take effect until the next one. Is there any way around this?
I'm currently trying to get something working under a "Before Entity is Hurt" trigger. Is there any way to check if the entity is Falling or if the damage source if from a Fall?
Also, is there a way to edit a post to amend to the old one rather than double posting?
It took some workarounds, but I managed to get things working.
To track falling, I used a "Entity Falls" trigger to set a global player variable to the Fall Distance. I used a Wait command to reset the variable to 0 on the next tick.
To reduce the fall damage I used a "Before Entity is Hurt" trigger that checks for a non zero value in the above global player variable. Since I couldn't figure out how to adjust the damage "Amount" I used a custom code snippet to add Absorption health equal to the amount of damage that I want to negate, 1 per level of the relevant enchantment. A few checks for existing Absorption health and capping it to the damage inflicted and I was in business.
Nice, you just turned your own question into a tutorial. Great job!
If anyone is interested in the custom code snippet, it uses a local number variable to set the Absorption level (gold hearts).
Set Absorption health level to <vCount>
haven't anyone thought to make a potion effect that disables fall damage and is given to player every time player gets off a plane?
About disabling fall damage, if you are okay in using snapshot for making mod, 1st snapshot of mcreator 2023.3 added damage source to some triggers like for "Before entity is hurt". You can check what's the source of damage and and if its caused by fall and entity has potion effect u you want, cancel event.