Started by
MattiDragon835
on
Topic category: Help with modding (Java Edition)
As the tittle says i want to add a magnet to my mod. There are a lot of mods out there which do the same (or similar) thing so it should be possible.
There doesn't seem to be a way to interact with entities nearby so even if I learn how to move the properly it would still be impossible.
It's okay if it includes coding. I haven't coded in Java but i have used a few other languages.
here is a example of a magnet item you hold that moves items to you from 8 blocks around you
under when item in hand tick
tp @e[type=minecraft:item,distance=..8] @s
you can change this to a tool's on block break for example
Yes it works but i would idealy like it to slowly move them to the player.
I think its possible with math but the problem is commands are the only way to target entities in a area.
This is procedure you must use in 2 triggers: ,,When item in an inventory,, and ,,When item in a hand,, for everything to work correctly!!!
This may help you.
Attempt to override motion vector of {target]
To Vx: X position of [target] - x / 100 * -1
To Yx: Y velocity of [target]
To Zx: Z position of [target] - z / 100 * -1
how do u have it track certain items?