Inserting A Block That Is Next To Another Block Into A Slot

Started by Lefturd on

Topic category: Help with modding (Java Edition)

Last seen on 11:49, 19. Jul 2023
Joined Nov 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Inserting A Block That Is Next To Another Block Into A Slot

I've been looking for a way to check for a block at a relative position to another and copy it into an inventory. It's for a drill-like block that breaks the block next to it and puts it inside a slot in the drill. I'm having trouble figuring out a way to do this without having to check for every specific block, like "If block at y+1 = stone, insert stone in slot 0". That would be inefficient and tedious. What I want is something like "if block at y+1 is solid, set get block at y+1 in slot 0 of inventory". After watching a few tutorial videos and searching topics on the forum, I haven't found an answer yet. If anyone knows if this is possible and/or how to do it please let me know. I really appreciate it, and if I figure it out on my own, I will make sure to post the solution either on this thread or another forum section. Thank you!

Last seen on 13:55, 27. Mar 2024
Joined Jun 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
https://imgur.com/a/LeeEBln…
Sat, 06/03/2023 - 14:52

https://imgur.com/a/LeeEBln
Example of storing blocks in inventory

How about the above?

This may be what you are looking for.

Last seen on 11:49, 19. Jul 2023
Joined Nov 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
@Belselk_ That's exactly…
Mon, 06/05/2023 - 02:56

@Belselk_ That's exactly what I'm looking for! Thank you so much, I was close but that's way better. I opted to breaking the block in front of it, and then using the "convert Get nearest entity of item type to itemstack" function. Didn't think I could use it to get block, I wonder what else it can do.