#Block Replacement Filter

1 messages · Page 1 of 1 (latest)

modest linden
#

Using the "minecraft:placement_filter" component, how do I allow my block to be placed on any other block and break if the block below it is broken? This is similar to what happens with lanterns.

paper crag
modest linden
#

This is what I'm using, but I don't get what I want, the block isn't even placed.

#

It's not work

paper crag
#

This allows the block to only be placed on the top face of other blocks, you cannot place it on the bottom or sides of blocks.

#

Send the block code, is there any content log error?

modest linden
#

In fact, the way you put it in the code actually allows the block to be placed only on the top face, but it does not break the block if the block below it is broken

#

There are no errors in the log

paper crag
#

It breaks automatically, placement filter defines where the block can be

modest linden
#

It doesn't break, I believe the air block also has a top

paper crag
#

Maybe you did something wrong as I'm sure it breaks.

modest linden
#

II´l try again

paper crag
#

Wait, I think I made a mistake, it breaks if you specify a block. sorry

#

You can use q.any_tag('wood','stone','metal')

modest linden
#

I was doing this, it turned out to be a lot of work because I only want it to break if the bottom block is air.

#

I'm having to manually place several blocks, there are some that the tags don't reach, like the walls

#

And fences

#

´-´

paper crag
#

Another solution is to detect if the bottom block is air using "minecraft:queued_ticking", but multiple blocks with this cause lag

modest linden
#

How do I it?

#

I wanted a way to allow it to be placed on any block, but if you break the one below, the block is broken

paper crag
#

This is experimental and needs Holiday Creator Features to work

"minecraft:queued_ticking": {
  "on_tick": {
    "event": "detect_air"
  },
  "range": [
    5,
    5
  ],
  "looping": true
}
"events": {
  "detect_air": {
    "run_command": {
      "command": [
        "execute if block ~~-1~ air run setblock ~~~ air destroy"
      ]
    }
  }
}
modest linden
#

I didn't want to have to use experiments on my map :/

#

But it seems like an interesting solution

paper crag
#

This will be no longer experimental soon with new custom components, but they haven't been added yet

jaunty cedar
#

You can replace minecraft:queued_ticking with an entity, but that’d be 1 entity per block

#

Or you can make a grid check from the player to run commands using a grid formula

modest linden
#

As I intend to use the block to build, I think one entity per block would cause lag

jaunty cedar
#

It will, not as much but yeah