11

I'm making an Adventure map (it has loads of command blocks), but I got stuck:
How can I make a Player to be able to go only backwards, that is, only when pressing the 'backwards' key, and to be able to change directions only with their mouse?
Any Redstone and Command Block circuit will do, It's not space limited. I don't want to install any mods, and I have Minecraft 1.9. Nothing moves the Player except the Player himself.

Is it possible to detect where a Player is looking and putting Barrier blocks on 3 sides from him?

4
  • Do you want them to walk straight backwards or be able to turn wile walking backwards?
    – Jason_
    Apr 5, 2016 at 21:56
  • so they can only press backwards key ? why not just turn off forward, left and right key ? Apr 6, 2016 at 8:42
  • 1
    possible partial solution: gaming.stackexchange.com/questions/189170/…
    – Cole Busby
    Apr 6, 2016 at 17:57
  • A possible solution is to use the collision that was readded in 1.9 to limit a players movement
    – Moddl
    Apr 12, 2016 at 1:03

2 Answers 2

15

Ok, after some (5-10hrs) work I got a solution:

The Super RS Stuff Thing

Now, what the numbered parts are:

  1. Button switch - one button press is like a lever switch
  2. Fast Redstone clock (minimal repeater delay)
  3. Piston that turns the system on; the repeater is essential, otherwise the piston will go on-off-on on button press
  4. 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

  1. 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:

The Super Ultimate RS

  • 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 best RS thing ever

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.

9
  • 2
    FYI, you should not be using impulse command blocks like this in 1.9. There is not a guaranteed activation order by relying on physical redstone. Use Chain command blocks to both reduce the amount of processing of redstone required and to guarantee activation order.
    – Skylinerw
    Apr 13, 2016 at 22:08
  • Why use "minecraftstaines_glass 4" - could they break it + barrier blocks are the default to blocking players from going somewhere Apr 13, 2016 at 22:40
  • @Skylinerw This system was made to work on 1.7, 1.8 AND 1.9
    – user143228
    Apr 14, 2016 at 12:07
  • @KingsleyZhong If you break the glass, it reapears instantly! No need to put Barriers... Just if you want the player to not see it.
    – user143228
    Apr 14, 2016 at 12:08
  • 1
    I've reverted your edit. Please do not mock people or tell people what they can or cannot comment on your answer.
    – Skylinerw
    Apr 25, 2016 at 0:04
8
+50

Without mods or client consent to play fair I think this is NOT possible.

What would work:

You would need to override behaviour of keyboard input for directions you don't want to let clients use. That can be done by some mod, however you stated that you don't want to do so. And probably it would be kinda hard after all.

The second method is to define it as a map rule (so player goes to Option and disables said keys) and expect that they will do so , same as you expect they won't turn on cheats or break blocks.


The problem is that no command can compare player's look angle and his movement nor detect key presses. We can detect the final states of actions (change in XYZ, etc), but not HOW it was done (was the player pushed, or walked on his own?), because all that client sends in packets is the change of position, not the method how it was done.

5
  • I'm not a modder nor have I looked into this extensively. Can't you detect if the player moved from x to x+1 or y to y+1 or z to z+1? if that is the case, then whatever world you're building, use a commandblock to detect if player position moved in a positive direction, if so, move (teleport) them to x-2. else do nothing. Then just re-assign the command block to the user as an inventory item or something. It doesn't sound too difficult so long as you have control over the world. EDIT :I just read the question Commandblocks to detect player movement in direction is what you want.
    – Cole Busby
    Apr 6, 2016 at 17:54
  • The main problem is that you cannot track player's XYZ by scoreboard (well, you can, but it is kinda big thing - you need to use entity teleportation on whole world to get positions - so many commandblocks) or distinguish "wanted" and "unwanted" moves. That would be kinda player-nonfriendly system I guess. Apr 8, 2016 at 2:08
  • @RudolfLibal I found this video, that might help you with "where he is looking", but still you will not be able to distinguish how he moved. youtu.be/rYxxb9i7Bxs For barriers, you for sure can use /execute command, so that might work somehow. Apr 8, 2016 at 2:11
  • @RudolfLibal Ok, will try it to make it this week. Apr 12, 2016 at 10:22
  • @RudolfLibal Ok tedy :) Apr 12, 2016 at 13:21

You must log in to answer this question.

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