I created a Command class that extends CommandBase and I want it to spawn a block that I created and called "zero" at the position where the player is looking. Here is the code that I wrote, but it doesn't do anything. I hope someone can help, and thank you in advance.Command execution code
event handler code
Thank you in advance :)
If you just want to set the block then why are you adding a new world gen? Just use world.setBlock (or setBlockState in newer versions). The player lookvec is not at the block you are looking at, but exactly 1 block in front of your face. So if you are looking at an angle it will be spawned in the same space as your head (potentially suffocating you).
When running the command, you could always check the players hitVec. Get the coords of the block being looked at, and ask the world to set the block using the coordinates gathered.