Spawn an entity in front of player

Started by JustDorkyy on

Topic category: Help with Minecraft modding (Java Edition)

Joined Feb 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Spawn an entity in front of player

Alright so i'm trying to make a entity spawn in front of the player when i right click on an item, i dont want to look at the ground to do it i just want to spawn an entity exactly in front of the player (no codding please)

Joined Nov 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You can't do it without…
Fri, 02/19/2021 - 08:51

You can't do it without coding.

Joined Jan 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Make the trigger "If player…
Tue, 05/04/2021 - 10:30

Make the trigger "If player right clicks air with item" and spawn entity depending on player direction, that will spawn "x+1", "y", "z" or "x-1", "y", "z", or "x", "y", "z+1";   "x", "y", "z-1"

Joined Sep 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Use New Procedures Plus+…
Sat, 08/10/2024 - 14:42

Use New Procedures Plus+ plugin, it can execute procedures in front of the player

Joined Jan 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
all of the replies making it…
Tue, 10/29/2024 - 20:41

all of the replies making it complicated or saying you cant are tripping. just make a procedure with a global trigger of "when player right clicks", do an if statement checking if the item is in the players hands, then use "spawn entity at" block, replacing xyz with the raytrace xyz blocks, set the distance of those to how far you want the mob spawned

 

if you want it to simply spawn if front of the player no matter the direction your looking its still not hard just slightly more work. you need an if statement with 3 else if statements. for each if statement check the direction the  player is looking(ex: if direction of event/target entity = north), then summon the entity relative to that (ex: if the player is facing north summon it at x y (z-1)(or replace 1 with distance you want the entity to spawn from you)

 

for each direction you change with coordinate you modify, North=-Z, South=+Z, East=+X, West=-X