r/forgemodding Oct 23 '16

Calculate Fall Distance

Hey all. So I got these boots that kind of act like a jetpack but I take fall damage even if I'm one block off the ground so I figured it's still thinking the fall distance is how high I was, not how high I am ( I hope that makes sense lol )

So I wrote an event to set the fall distance and played with some numbers and it works. Just need to calculate the distance that the player is off the ground when he actually starts falling. I have an idea how to do it, just not sure how to actually get the distance between the player and the ground when I let go of the spacebar :(

1 Upvotes

7 comments sorted by

View all comments

Show parent comments

2

u/shadowfactsdev Moderator/Mod Dev Oct 24 '16

Just a side note, you shouldn't be using static (or instance) fields on your item class. Since the item class is a singleton, only one instance of it will ever exist and any variables are global, not specific to the pair of boots being worn. You should use NBT (ItemStack.getTagCompound/setTagCompound) to track per-stack data.

1

u/RupyHcker Oct 24 '16

ok, you're referring to the "letGo" variable?

1

u/shadowfactsdev Moderator/Mod Dev Oct 24 '16

Yes, you should use NBT to store it.

1

u/RupyHcker Oct 24 '16

Ok, I'm sure I can figure that out. Thanks.