6

Or is there actually any way to do that?

Basically I do a /setblock ~ ~ ~ snow_layer at the player but if it's above something that snow layer can't be on (eg. slab,sign,grass) it just looks buggy. :/ I could avoid it with causing a block update right after creating it.

Any idea is helpful even if you're not sure if it works or not! (best would be a one command block method)

As you can see on the picture looking for {OnGround:true} doesn't solve it all the time: enter image description here

UPDATE: I could do a /setblock above it, but that may remove other block, so I'm looking for a safer idea.

UPDATE 2: Changed title to represent the problem more clearly.

3
  • I would suggest rewriting your question a bit to better reflect the actual problem: how do I use setblock at a player's location, but only when they're standing on a full block? Don't presume the solution, it only serves to narrow the answers you'll get.
    – MBraedley
    Commented Jan 16, 2015 at 19:29
  • Thank you, I just thought that detecting a full block is nearly impossible or only with a million command blocks containing each full-block. Causing a block update would do the dirty work :P
    – Skeukry
    Commented Jan 16, 2015 at 19:33
  • I was just searching for the same thing, I want a command to make it add snow layers on top of full blocks when it's snowing. Commented Jul 23, 2019 at 15:46

3 Answers 3

2

Simple method

Run the following 2 commands sequentially in 1 tick:

/execute @p ~ ~ ~ setblock ~ ~ ~ snow_layer 0 keep
/execute @p ~ ~ ~ detect ~ ~ ~ snow_layer 0 clone ~ ~1 ~ ~ ~1 ~ ~ ~1 ~ replace force

First command places snow layer at player's position, and second command will update the snow layer and remove improper ones. Using this method will constantly update adjacent blocks around the block that the player's head is in, if you don't want that use advanced method instead.


Advanced method

  1. First you need to allocate 2 blocks(at <x> <y> <z> and <x> <y+1> <z>) on your world to this command block system. Which should be independant and kept away from any other blocks or entities.
  2. Following commands will run sequentially in 1 tick when done (works best with 20Hz fill/clone clock):

    /execute @p ~ ~.999999999999999 ~ clone ~ ~-1 ~ ~ ~ ~ <x> <y> <z> replace
    /setblock <x> <y+1> <z> snow_layer 0 keep
    /clone <x> <y> <z> <x> <y> <z> <x> <y> <z> replace force
    /execute @p ~ ~.999999999999999 ~ detect <x> <y+1> <z> snow_layer 0 setblock ~ ~ ~ snow_layer

  3. Replace <x> <y> <z>, <x> <y+1> <z> with allocated blocks' coordinates from above
4
  • This one is just brilliant! With mine you see snow_layer glitching while standing on top of stairs or chests, but your way is just absolutly what i was looking for!
    – Skeukry
    Commented Jan 20, 2015 at 19:29
  • @Feca1997 Updated my answer to fix adjacent blocks constantly updating, also simulated onGround:true with fine-tuned coordinates.
    – Q20
    Commented Feb 7, 2015 at 5:28
  • Thanks, but I use your old solution, because I wanted to use minimum number of commandblocks and I also liked that it was more flexible without allocating blocks.
    – Skeukry
    Commented Feb 10, 2015 at 19:10
  • The simple method won't work on world border, though it's usually not a big matter
    – l4m2
    Commented May 12, 2018 at 13:35
9
+50

After trying many things, I finally came up with a solution that works all the time (I hope) and doesn't change any block:

Instead of creating the snow layer with:

/setblock ~ ~ ~ snow_layer

I use the command:

/summon FallingSand ~ ~ ~ {Block:"minecraft:snow_layer",Time:1,DropItem:false}

wich does the job quite well, and because of DropItem:false it doesn't even drop the snow if placing it fails. :)

NOTE:

Summoning falling sand at the same block where there's an existing one will cause it to be deleted, so only summon the sand if there's air! In my example:

Summon FallingSand that become a snow_layer AT every player:

/execute @a ~ ~ ~ detect ~ ~ ~ air 0 /summon FallingSand ~ ~ ~ {...}

1
  • 1
    And I thought fallingsand summons were pretty much dead when setblock existed. Very, very nice.
    – Unionhawk
    Commented Jan 17, 2015 at 16:26
0

I could do a /setblock above it, but that may remove other block, so I'm looking for a safer idea.

The /setblockcommand allows for an old block handing mode of "keep", which means that it will only replace air. Because of this, we can safely use a block that will immediately turn back to air (like a snow_layer) to cause a block update. Running a command like this at the same time as your current one should fix things:

/setblock ~ ~1 ~ snow_layer 0 keep
1
  • I tried it, but unfortunately it doesn't update the snow layer if it doesn't change the block. Thank you anyways. ^^
    – Skeukry
    Commented Jan 16, 2015 at 20:26

You must log in to answer this question.

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