First create a clock with the following commands:
execute @e[name=TPSlimeBack] ~ ~ ~ tp @e[type=Slime,name=SlimeKnock,rm=1,r=2] @e[type=ArmorStand,c=1,name=TPSlimeBack,r=2]
And:
execute @e[name=TPSlimeBack] ~ ~ ~ /effect @a[r=2] minecraft:resistance 1 100
Then summon an invisible ArmorStand
and an invisible Slime
with a size of 1
on the block where you want it to knock the player back by doing:
/summon ArmorStand ~ ~ ~ {CustomName:TPSlimeBack}
And then on the same position:
/summon Slime ~ ~ ~ {CustomName:SlimeKnock,Size:1}
This will make a Slime that knocks the players back, but that can't move out of the block's radius because it teleports back to the armour stand all the time. The player also get's a resistance effect to make sure no one loses their lives.
Edit
A much easier way to do this is just to summon a Slime on the block with the Size
of 2
and NoAI
added. Do this by running the following command:
/summon Slime ~ ~ ~ {CustomName:SlimeKnock,Size:2,NoAI:1}
(Note: The custom name isn't really needed, just to kill the slime when you want to remove it.)
Ok, after some (5-10hrs) work I got a solution:
Now, what the numbered parts are:
- Button switch - one button press is like a lever switch
- Fast Redstone clock (minimal repeater delay)
- Piston that turns the system on; the repeater is essential, otherwise the piston will go on-off-on on button press
- Command blocks, each part has these four commands:
/execute @a[ry=112,rym=-112] ~ ~ ~ fill ~ ~ ~+1 ~ ~+1 ~+1 minecraft:barrier 0 replace minecraft:air
/execute @a[ry=22,rym=157] ~ ~ ~ fill ~+1 ~ ~ ~+1 ~+1 ~ minecraft:barrier 0 replace minecraft:air
/execute @a[ry=-67,rym=68] ~ ~ ~ fill ~ ~ ~-1 ~ ~+1 ~-1 minecraft:barrier 0 replace minecraft:air
/execute @a[ry=-158,rym=-22] ~ ~ ~ fill ~-1 ~ ~ ~-1 ~+1 ~ minecraft:barrier 0 replace minecraft:air
- Finally, this last Command Block resets the whole cycle:
/execute @a ~ ~ ~ fill ~-5 ~-2 ~-5 ~+5 ~+2 ~+5 minecraft:air 0 replace minecraft:barrier 0
Notes:
- all repeaters must be set to minimum delay
- the lower #4 command blocks are not connected with a repeater, the upper ones are.
- all the Pistons are Sticky Pistons
- the system will not delete the remaining Barrier blocks when turned off; It's better to use this:
- I recommend to use "minecraft:stained_glass 4" instead of "minecraft:barrier 0", if the player breaks it, a new glass block appears almost instantly.
- It's convertable to use the 1.9 chain command block feature, but I don't recommend it because of different repeat frequency.
- The system is reliable - you can't move forwards whatever you try.
- Even if you are falling/flying upwards/sprinting/potion sped up, the barrier block(s) farther from you will be deleted.
- You can try it yourself and use/test/edit it! - let's say, it could look like this:
The Command block next to the Button has this inside:
/clone XYZLeftChest XYZLeftChest XYZWool
The other two new Command blocks reset the cycle:
/setblock XYZChestUnderHopper minecraft:chest
/setblock XYZWool minecraft:air
Inside the left Chest place some items for signal length.
Best Answer
To answer your question, you can't summon sideways falling sand, but you can create an illusion of movement by rapidly summoning and destroying a falling sand block with a slight change in horizontal direction. Just set up a clock to a line of command blocks and it should do the trick.