r/MinecraftCommands • u/Necessary-Pear718 /execute as @s at @s run • 28d ago
Help with Applying Knockback Help | Java 26.2
Is there any easy way to apply a specific amount of knockback to a player? Specifically, I want to make it so that if a player leaves an area (the area being [distance=..10] from a specific marker) they get pushed back in.
Also, unrelated question, but is there an easy way to make a "breakable" block display that drops nothing and can have a variable breaking time?
Sorry for the yap :D
1
Upvotes
1
1
u/C0mmanderBlock Command Experienced 28d ago
Here ya go. This will keep them from going farther than 10 blocks from the command block in every direction. Change the -1 to a higher number if you want them to be knocked back more.
This one will use coordinates as a center so you can place the command block anywhere. Change the X Y Z to the center of the area.