2

I have a slime riding a falling sand block that is flying through the air. I need the falling sand block to disappear when it hits the ground so that only the slime remains. Is there a way to do this?

4 Answers 4

3

If you place a torch beneath the falling sand, the sand block will "break" and become a sand block item that can be picked up or ignored until it despawns.

4
  • Unfortunately, I don't know where the falling sand will land. Good idea though. Commented Dec 24, 2014 at 2:04
  • Ah, I see. I tried. I'll leave my answer for other people who don't know the sand-mining trick (it works on gravel, too, but the gravel doesn't roll its chance to give flint, it always gives gravel instead this way). Commented Dec 24, 2014 at 2:08
  • @gatherer818 That is more useful than you'd think... I love using gravel for paths, so when I get flint it annoys me haha
    – Ben
    Commented Dec 24, 2014 at 2:28
  • @ben I play mod packs that add machines a lot, they typically have a grinder for ores. One of the side effects is the grinder can usually turn gravel into flint anyway, so I prefer pure gravel myself for inventory management, when I want flint I'll make it ^_^ Commented Dec 25, 2014 at 13:27
3

Create a scoreboard objective named onGround

/scoreboard objectives add onGround dummy

Set all entity's onGround scores whose OnGround tag equals 1 to 1; kill all FallingSand entity's with onGround score of 1

/scoreboard players set @e onGround 1 {OnGround:1b}
/kill @e[type=FallingSand,score_onGround_min=1]

Put the last two commands on a 20Hz clock


If the ground is only made op of a certain material, for example, stone

You can use an execute with detect and test for the block below the FallingSand

/execute @e[type=FallingSand] ~ ~ ~ detect ~ ~-1 ~ stone 0 kill @e[type=FallingStand,r=0]

the r=0 at the end is to make sure that the fallingsand only targets itself.

3
  • onGround is never being changed. Commented Dec 24, 2014 at 15:09
  • could be that the FallingSand becomes a block before it can be detected that it has hit the ground, in that case you should use the second method Commented Dec 24, 2014 at 16:25
  • I don't know what the ground will be like, though. Commented Dec 24, 2014 at 16:33
1

I already have a slime riding my block, but if you just have a block, you can make an invisible mob ride it and this will still work.

NOTE: All commands here, unless specified, should be run on a 20hz clock.

The solution I found was to let the falling sand become a block, then use the slime to destroy the block. First you need to detect slimes that have only just touched the ground, so they don't destroy other blocks. A scoreboard can be used to track this. First, create the scoreboard objective manually:

/scoreboard objectives add onGroundTicks dummy

Then add to the score for slimes on the ground:

/scoreboard players add @e[type=Slime] onGroundTicks 1 {OnGround:1b}

Any slime that has only just touched the ground for the first time will have a score of 1. Slimes that have never touched the ground have a score of 0. Slimes that have touched the ground before have a score that is greater than 1.

Next, you need to remove the extra blocks around the slimes with a score of 1. I am using barriers, but whatever block you are using, you must replace minecraft:barrier with that block. Only the barrier blocks in this example are destroyed.

/execute @e[type=Slime,score_onGroundTicks=1] ~ ~ ~ /fill ~1 ~ ~1 ~-1 ~ ~-1 minecraft:air 0 replace minecraft:barrier 0

You may or may not want to kill the slimes after that:

/kill @e[type=Slime,score_onGroundTicks_min=2]
-1

If you had a fast redstone clock hooked up to a command block with the following command in it: /setblock <x> <y> <z> air

Then when the sand falls down the /setblock will change the sand to air ans the slime block will still remain.

You must log in to answer this question.

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