#Multiblock structure not working

1 messages · Page 1 of 1 (latest)

lone mulchBOT
rich radishBOT
#

Hello, I have been trying to make a multi block structure work, like in modded playthroughs, and the detections is working, but when I try to remove the test blocks the detection still dose not work?!

For more information here is the github repositiory:
https://github.com/TheTeleporter9/Techwars---Ore-generator/tree/main/data/tw/functions/extractor/placementz

Can somebody please help

execute as @s at @s if block ~ ~3 ~ air unless entity @e[type=block_display,tag=tw_extr,distance=..3] run \
place template minecraft:extractor_n ~-1 ~3 ~-1

execute if entity @e[type=item] positioned ~-1 ~3 ~-1 \
if blocks ~ ~ ~ ~3 ~3 ~3 ~ ~-6 ~ masked run \
function tw:extractor/placement/placement

execute if entity @e[type=item] positioned ~-1 ~3 ~-1 \
unless blocks ~ ~ ~ ~3 ~3 ~3 ~ ~-6 ~ masked run \
function tw:extractor/placement/remove
lone mulchBOT
granite lichen
mossy pike
#

I don't understand

granite lichen
#

so when I activate the execute if blocks command, it works, but when I have the unless command active at the same time it ovverrides the first command

mossy pike
#

Is your if blocks changing those blocks when it succeeds?

rich radishBOT
#

no, it summons a display enity, and removes the checking blocks/structure:

execute align xyz positioned ~-0.05 ~ ~-0.05 \
unless entity @e[type=block_display,tag=tw_extr,distance=..3,limit=1] run \
summon block_display ~1 ~-3 ~1 \
{Tags:["tw","tw_extr"],transformation:\
{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],\
translation:[-1f,-3f,-1f],scale:[3.1f,3.1f,3.1f]},\
block_state:{Name:"create:fluid_tank"}}

execute as @e[type=block_display,tag=tw_extr] run scoreboard players add @s data 0

execute as @s at @s unless block ~ ~3 ~ air if entity @e[type=block_display,tag=tw_extr,distance=..3] run \
place template minecraft:extractor_empty ~-1 ~3 ~-1
mossy pike
#

That sounds like it does change those blocks, no?

#

What are the blocks initially, and what happens to them after the success?

granite lichen
#

the way I check, is I place a structure 3 blocks above the middle of the structure below, where the wrench is thrown, and then I run the execute if check, then in the placement function I remove the same structure that was placed

mossy pike
#

I see, so the blocks that are getting checked themselves do not change?

granite lichen
#

yes, if I did not make a mistake...

mossy pike
#

So if the structure you're checking against is gone, how are you checking the unless blocks?

granite lichen
#

oh, good point, I don't, but could I not check if that blockdisplay is nearby?

mossy pike
#

You could

#

But for clarity, ignoring what you're currently doing, what do you actually want to happen? You want the wrench to detect if the 27 blocks below it are a specific set of blocks, and if they are, do a thing to them, and then check if they got broken to undo that thing?

granite lichen
#

yes

mossy pike
#

Pkay, then I would recommend making a predicate to check the blocks instead

#

It's gonna be long and a little tedious to write, but you only have to do it once

granite lichen
#

ok

#

haven't thought of that

mossy pike
#

Then you can have the wrench check that predicate for the successful placement, and have the block display check the predicate to see if it's been broken

granite lichen
#

so then I don't need the execute blocks then

mossy pike
#

Of course, make sure to check that there isn't already a multiblock structure there so the wrench doesn't place multiple in the same spot

mossy pike
#

or unless

granite lichen
#

ok, and what prediacte type would I need to do this

mossy pike
#

An all_of predicate of 27 location predicates

granite lichen
#

can I use relative cordinates, srry I have not worked fully with predicates

mossy pike
#

You can set an offset from the origin, which will be wherever the command is being executed from

granite lichen
#

does this look somewhat correct?

#
{
  "condition": "minecraft:all_of",
  "terms": [
    {
      "condition": "minecraft:location_check",
      "offsetX": 0,
      "offsetY": 0,
      "offsetZ": 0,
      "predicate": {
        "block": {
          "blocks": [
            "do-i-use-this-too"
          ],
          "tag": "minecraft:stone_bricks"
        }
      }
    }
  ]
}
mossy pike
#

If you're using the tag you probably don't need the list of blocks, as long as all the blocks you're checking are in that tag

granite lichen
#

wdym?

#

oh, I seee

#

will the blocks list check if the blocks are in order, or do I have to make one term per block in the structure

mossy pike
#

One term per block

#

Each with different offsets

granite lichen
#

thank you!