How do I place a block where the player is looking?

Started by ThorPDough on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jun 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How do I place a block where the player is looking?

I would like to place a block at the location the player is looking if the current keybinding is pressed,

 

how do I do it?

You have raytrace entity…
Fri, 11/15/2019 - 17:19

You have raytrace entity look position for x y and z coordinates procedure blocks. This is pretty basic procedures.

I suggest you check our tutorials collection playlist on our YouTube channel which contains many examples and tutorials that can help you get started with MCreator: https://www.youtube.com/playlist?list=PLAeL-oIFIEngE6jRgFYeFMfuj8WQsO3Ei

Joined Apr 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
how do you do that?
Tue, 04/21/2020 - 14:05

how do you do that?

Joined Jul 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Just make a procedure and…
Fri, 08/14/2020 - 04:17

Just make a procedure and set it to have any trigger, make sure it has an entity in the trigger (make sure the trigger is todo with the player otherwise it won't work).

 

inside the procedure just make a Place block procedure block at the start (this procedure block can be found in the block section in the side bar).

Then instead of X,Y,Z replace those with "look raytrace x position of Event/Target Entity for 100 blocks" (this procedure block can be found under the entity side bar) then do the same in the other X,Y,Z slots of the place block procedure block changing the X to either Y or Z for their apropriate slot in the "place block" procedure block.

Now in the place block procedure block set the block to be placed to whatever you want and then try it.

 

If you want to change the block being placed whilst the game is running change the block part of the Place block procedure block to be the procedure block "convert [item] to block or air if conversion fails" (found in the block tab) and set the item to be the item in the off hand of the entity (this procedure block is found under the entity tab).

Joined Oct 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Is there a way to make it so…
Fri, 10/21/2022 - 12:51

Is there a way to make it so the player can look at a mob and for example,  spawn a shulker bullet at the mob's location?

Joined Jun 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Here is a tutorial I made:…
Fri, 07/07/2023 - 19:07

Here is a tutorial I made: link