Right clicking on entity with specific item procedure

Started by Razvii on

Topic category: Help with modding (Java Edition)

Last seen on 10:02, 15. May 2020
Joined Apr 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Right clicking on entity with specific item procedure

How can i make a procedure that gives the player an item when they right click an entity with a specific item in hand?

Last seen on 13:50, 6. Apr 2024
Joined Jun 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Use the procedure trigger …
Fri, 05/01/2020 - 18:51

Use the procedure trigger "on right click on entity" and then checks the item in main hand of the player.

Last seen on 10:02, 15. May 2020
Joined Apr 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thanks for replying, that is…
Fri, 05/01/2020 - 19:54

Thanks for replying, that is what i've been doing, but i don't know how to check the player's main hand, whatever ive been doing so far ends up checking the entity's main hand

Last seen on 01:13, 25. Apr 2024
Joined Apr 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Go under the entity…
Sat, 07/04/2020 - 02:08

Go under the entity procedures, grab the red "item in main-hand of - Event/target entity". Then go to minecraft components and grab a item slot. Then go to logic operations and grab the red one, place the item in main hand first, and the item slot in second. Place this in a if statement. Then add what you want to happen in "do".

 

Last seen on 05:39, 24. Apr 2024
Joined Jan 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
this checks the entity's…
Sat, 08/01/2020 - 03:45

this checks the entity's hand though 

Last seen on 03:17, 31. Jan 2021
Joined Jul 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Try dragging the Event…
Sat, 08/01/2020 - 04:08

Try dragging the Event/Target entity part away and into a trash can. Replace it with Source entity (you) in the tab of minecraft components.

So it would say Item in main-hand of source entity = [item] instead of item in main-hand of event/target entity = [item] which is checking the inventory of the creature you are interacting with. 

(Currently in the new 2020.4 snapshot so "source entity" may be in another tab on previous versions)

I have seen in a previous version item in entity's main hand = [item] which may also work.

Last seen on 05:39, 24. Apr 2024
Joined Jan 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
thanks! :( i feel bad i saw…
Wed, 08/12/2020 - 01:34

thanks! :( i feel bad i saw this so late but thank you so much! 

Last seen on 19:18, 21. Dec 2021
Joined Dec 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
@AngelWolfhaven Your Red…
Wed, 12/30/2020 - 02:02

@AngelWolfhaven Your Red Piece Doesn't fit in the IF Statement. Can I Have Help?

Last seen on 03:17, 31. Jan 2021
Joined Jul 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Your structure should look…
Wed, 12/30/2020 - 02:27

Your structure should look like this:

If/do block. What attaches to the if part is a red piece that has two blank spots with an "=" sign inbetween. You find this under Logic. It has what looks to be two small blocks in white and two small diamond shapes. This is likely due to you being able to put blocks or items into those slots. So now you have:

If [ ] = [ ]

Next you take "item in main hand of" which would be also red and under Entity procedures. By default, it has "event/target entity" attached. Detach and get rid of the event/target entity. Keep the "item in main hand of" part. We then dig into the Minecraft components section and look for "source entity" which will be blue. Attach that in the place of what we just removed. It should now say "item in main hand of source entity". You take that piece, together, into the first slot of the piece that has two open spots. So now you have:

 

If [item in main hand of source entity] = [ ]

 

Finally, you pull the red box from Minecraft components. It should have the matching cube and diamond icon as described earlier. You put that box into the second slot and click on it to choose your item that you would like.

Your final result will look like

 

If [item in main hand of source entity] = [item]

Do []

 

This process still works on my end so if you are experiencing problems still, I'm not sure as to why.