2

I would like to knock players back, whenever they step on a block. I have tried making a fill clock doing the following commands

execute @a[x=-124,y=67,z=1307,r=0] ~ ~ ~ /summon Zombie ~ ~ ~
execute @a[x=-124,y=67,z=1307,r=0] ~ ~ ~ /kill @e[type=Zombie,r=0,c=-1]

This is supposed to summon a zombie that must hit the player backwards, but it kills the zombie too fast. I have also tried to summon a snowball, but it doesn't seem to knock the player backwards.

1
  • Could you just tp the player back a few blocks? If you want to make the zombie idea work, put some repeaters between the two blocks. The more repeaters you have (and the higher they're set), the longer it will wait to kill the zombie.
    – Nick B.
    Jul 8, 2015 at 2:13

1 Answer 1

2

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.)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .