#copy block from one structure to another

1 messages · Page 1 of 1 (latest)

cursive hull
#

I've got a structure saved with a few blocks. Now I want to take the blocks from this structure and paste them into another structure.

snippet:

let structure: Structure = world.StructureManager.get("tr:preset");
let blockPerm: BlockPermutation = structure.getBlockPermutation({x: 0, y: 0, z: 0});

let newStructure: Structure = world.StructureManager.createEmpty("tr:test", {x: 1, y: 1, z: 1}, StructureSaveMode.World);
newStructure.setBlockPermutation({0, 0, 0}, blockPerm);

This works, except it's loosing all block data, like chest inventories. Any ideas?

dense helm
#

Block Permutations only keep data like facing direction or if a sign is hanging. More complicated data is likely a component. Can't pull block components from inside a structure like this AFAIK

#

Could try placing the structure, getting what you need, then removing it. This is a bit hacky though lol

cursive hull
#

...especially since I don't have a structure.setBlock(), right? That means I'd still loose the data even if I pasted it into the world first?

cursive hull
#

bump

flat otter
#

Looks to be this way. Not only are you unable to set a Block within a structure, you cannot pull out a Block either.

dense helm
#

You can set a block in the structure using the setBlockPermutation function from structure. Can change it to be whatever

#

100% runtime usage of the structure so if you do it once, it will still have the change the second time pasting. I don't believe it saves to disk though

flat otter
#

(I am making the semantic distinction between a Block and a Permutation)

dense helm
#

Is there a difference really?

flat otter
#

Well as you said earlier, yes.

#

Permutation only contains ID, states, and tags; while a Block contains location and components*, right?

dense helm
#

setBlock function only takes the id too?

#

Either way you cannot get block components from structures, but you can set them with the permutation command

#

you can change the type and all

flat otter
dense helm
#

setBlock isn't on structure class afaik. I meant like in dimension class and anywhere else (if anywhere else)

flat otter
#

Ah

dense helm
#

I didn't want OP to be confused and assume they can't get or set blocks from a structure. I believe they want inventory component which they can't get for sure

flat otter
#

Plag's been doing this kinda thing for a while 😄 he probably knows the semantics

dense helm
#

Was going through it with other blocks like jigsaw. Was crossing my fingers that some data like text fields would be stored there. I knew better lol

#

Getting the components would be nice, it's all right there in the NBT.

flat otter
#

Aye, it makes me wish Bedrock had some kinda standardized way to access that data directly, like Java Edition has. I get why the developers have made the choice to not expose that at runtime, but it does make stuff like this more frustrating than it needs to be

#

Especially since they know we're going to just edit it anyway—or at least, I will lol. My Swift Sneak 5 leggings will come in handy