How to make an item place a block on right click

Started by CasintheTARDISin221B on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jun 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to make an item place a block on right click

I'm attempting to make a mod that allows obtaining and placement of certain normally unplaceable blocks in the world (in this case specifically end gateways) by way of creating an item that places the block the same way one would place any other vanilla block and then deletes itself from the inventory. 

 

I've worked out how to detect which face of a block a player is looking at, but I can't figure out how to apply that information so that the block appears adjacent to that face, like placing a normal block would do.
 

Joined Dec 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Try Making an Invisible…
Sat, 06/24/2023 - 04:31

Try Making an Invisible Block Texture with an item texture (Make a 1x1 fully transparent pixel for the block texture and the actual item texture for the item renderer), and then add the procedure that immediately replaces to that block that you wanted to place. For clarification, Try Adding a procedure "If block placed" trigger for a more polished result.