Summon an entity with an item

Started by lawpash on

Topic category: Help with Minecraft modding (Java Edition)

Joined May 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Summon an entity with an item
Sun, 05/21/2023 - 04:42 (edited)

How would I go about making an item that summons an entity by right-clicking, then when right clicking the item again the entity goes “back into the item”(despawns until the item is right-clicked again)?

 

Edit: For context, like how you summon a pet in Terraria.

Edited by lawpash on Sun, 05/21/2023 - 04:42
Joined Feb 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
When right-click on block…
Sun, 05/21/2023 - 06:00

When right-click on block position (trigger)

 

spawn entity *your entity* at x y z 

set item in main hand of event/target Entity to *result of using*

 

 

for the entity to item

when right click (on entity)

 

despawn event/target entity

spawn gem/item *your item* at x y z pickup delay *your value* despawn *you decide*

 

 

the ** is for values you need to specify yourself. This code is not tested but the blocks exist in MCreator