Started by
Grinp
on
Topic category: Help with Minecraft modding (Java Edition)
Im trying to make an item that is given to a player when they swim 5000 blocks, and when they right click it, it gives them perma dolphins grace and conduit power. and no other player can get it once 1 player has, but also, when they right click it, it goes to a special slot. how do i make the extra slot(which should only be able to hold the custom item) and the item itself
Edited by Grinp on Mon, 01/29/2024 - 18:21
have a global world variable that is false, when the player right clicks this item it checks if the variable is false and gives the effects, and makes the global variable true, as for the swim 5k blocks, that is not something I'm aware of how to do. the slot one you might not need, unless you want the player to be able to take it off, there you could just use a gui with inventory, 1 input slot and have it save to the player so it saves items there, and just make a keybind to open it.
could you please show an image?
It appears that we can only insert images via URLs.
To use a swimming variable, check if the player's current position is in water every tick, then if so, use the Pythagorean theorem on the x and z delta player data to find the total distance travelled in that tick (excluding vertical motion) and set the variable to its previous value plus the calculation.
Hopefully, someone can explain this in less technical terms.