Started by
Norb
on
Topic category: Help with Minecraft modding (Java Edition)
I have a custom block I made, and I want to check that if the player fall distance is over 128 blocks and falls on the block, they get an advancement.
I work on 2023.2.24119 version and modding for 1.19.2, I tried using the "Entity falls" global trigger but that somehow works on every other entity except the player. I can't even check if entity is subtype of Player, because the trigger doesn't fire when the player falls.
I've been thinking of using a "On Player update tick" trigger and check if the player is falling by checking the Y velocity, but I have no idea how to then check the fall distance.
Thanks in advance.
Make 2 new Attributes called "YCoordinate" and "LastKnownY" or whatever else you want, set both of their attribute ranges to from minimum of -100 to a maximum of 400, check "Add to players"
Make a new procedure, put "On player tick update"
put---------------------------------------------------------------------------------------------
if ["YCoordinate" ≤ "LastKnownY" - 120] AND [IS BLOCK AT [y -1] IS THE SAME BLOCK AS YOUR BLOCK] |
|do| Add advancement
then--------------------------------------------------------------------------------------------
| if [Y DELTA MOVEMENT OF [EVENT/TARGET ENTITY] ≥ 0] |
|do| {SET THE BASE VALUE OF ATTRIBUTE "LastKnownY" to [GET THE VALUE (WITH MODIFIERS) OF ATTRIBUTE "Y Coordinate" FROM ENTITY [EVENT/TARGET ENTITY]] for entity [EVENT/TARGET ENTITY]
finally------------------------------------------------------------------------------------------
{SET THE BASE VALUE OF ATTRIBUTE "Y Coordinate" to [y] for entity [EVENT/TARGET ENTITY]}
you could also put all of this in an if statement to stop if the player has completed the advancement
Thank you so much, blue kitty :3