How to make a replaced block face a player

Started by weird_wayne_ya… on

Topic category: Help with Minecraft modding (Java Edition)

Joined Aug 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to make a replaced block face a player

Hello! I'm making a feature of my mod in which when you right-click on sand with a bucket, it turns into a sand castle! The only problem I'm having right now is that the sand castle does not face the player (it is a directional block). I know you can set block directions but there's no "face the player" option. Any ideas?

Here's my current code, I thought that checking the "Keep state" box would keep the sand castle blocks orientation but it keeps the sand blocks orientation (which doesn't really have one)

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
There should be a procedure…
Thu, 07/27/2023 - 05:28

There should be a procedure block to get the direction of an entity. (This will aproximate the direction the player is looking to one of the four cardinal directions.) You can then place the sand castle with the same direction, or the opposite direction depending on how you designed the model. (There's a code block to manually change block directions, and another to specify a direction for a block being placed.)

Joined Aug 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
@mindthemoods thank you so…
Thu, 07/27/2023 - 13:33

@mindthemoods thank you so much I got it to work! Don't know how I missed that procedure block lol sometimes i'm blind