Magnet block that pulls in items

Started by swelkinn_n on

Topic category: Help with modding (Java Edition)

Last seen on 22:53, 29. Dec 2023
Joined Oct 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Magnet block that pulls in items

I'm trying to make a block that pulls in dropped items, which I know at least was possible, which leads me to assume it still is, but I'm not sure how.

The reason I know it was, was because of this video at the timestamp this link sends you to, as the person stated in a comment that this is all procedures, and no custom code. I'm not sure of what they did, but I would love to know if anyone has a method, especially with all the newer procedure blocks in the program now

Last seen on 00:55, 28. Mar 2024
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Ironically, I spent a fair…
Mon, 11/21/2022 - 00:04

Ironically, I spent a fair bit of time trying to make a block that launches everything away from it. Presumably, doing the reverse should work to make it a magnet:

  • Make a procedure that runs an entity iterator in your desired radius around the block every tick.
  • Make some custom variables for x, y, and z offset. (I'll call them Sx, Sy, and Sz)
  • If the entity iterator's x coordinate is less than the block's x coordinate, set Sx to something positive. If it's more than the block's x coordinate, set Sx to something negative. The amount you set it to will determine how rapidly the magnet pulls stuff in. (Anything greater than 1 will launch stuff pretty forcefully, enough to deal fall damage to entities.) You might also want to check that the entity iterator isn't too close, otherwise the magnet will continue to pull stuff even if it's right next to it.
  • Do the same thing for the z and y coordinates.
  • Attempt to override the entity iterator's velocity. If you want the magnet to pull stuff at consistent speeds, just set the x y and z values of the override block to the custom variables you made earlier- this will make anything in the radius immediately move at a consistent speed towards the magnet. If you want stuff to gradually accelerate, you can instead set x y and z to the current velocities of the entity iterator, plus your custom variables. This will make anything in the radius adjust its velocity towards the magnet based on how powerful the magnet is and how long they're nearby it.
Last seen on 09:50, 28. Mar 2024
Joined Jan 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
@Mindthemoods Thanks a lot…
Sat, 01/27/2024 - 10:55

@Mindthemoods Thanks a lot for your work !