I would like to push back mobs without causing them damage. Kind of like throwing an egg to them from the front. And I would like thqt to work in peaceful mode too. So summoning an invisible fused creeper is probably not an option.
I've tried the following command in MC14.4, but it does not take into account the entity's orientation (ie, the target is always pushed toward the positive X direction, regardless the direction the entity is facing):
There is a selector argument called "y_rotation" which can be used to detect the rotation of a player along the Y-axis (jaw). Once you have the rotation, apply the motion based to the rotation angle.
Here are all the directions a player can face in and all the angles:
South - 0
Southwest +45
West +90
Northwest +135
North +180
Northeast -135
East -90
Southeast -45
Source:
the video is outdated (1.8) but the concept is still the same.
I've seen the "How to give players knockback?" thread, but I'm not quite sure this is exactly the same use case as mine.
I would like to push back mobs without causing them damage. Kind of like throwing an egg to them from the front. And I would like thqt to work in peaceful mode too. So summoning an invisible fused creeper is probably not an option.
I've tried the following command in MC14.4, but it does not take into account the entity's orientation (ie, the target is always pushed toward the positive X direction, regardless the direction the entity is facing):
Any idea or suggestion to achieve what I want?
Please, support the sledgehammer tool!
I ♥ Linux. Thanks Mojang for providing a game that runs natively on that OS!
Hi, little bit late but here my sugestion ;-) take a snowball or edit command
repeating comandblock always active:
execute at @e[type=snowball] rotated as @p run tp @e[type=!minecraft:player,type=!minecraft:snowball,distance=..2.5] ^ ^0.3 ^5
There is a selector argument called "y_rotation" which can be used to detect the rotation of a player along the Y-axis (jaw). Once you have the rotation, apply the motion based to the rotation angle.
Here are all the directions a player can face in and all the angles:
Source:
the video is outdated (1.8) but the concept is still the same.
Command block engineer // Developer // #TeamTrees