EngineHub / CommandHelper

Rapid scripting and command aliases for Minecraft owners
https://methodscript.com
Other
118 stars 71 forks source link

[Feature request] Structure handling functions. #1284

Open JasonTable opened 3 years ago

JasonTable commented 3 years ago

Some way to load and maybe save NBT structures to the same place that structure blocks save and load them from. Or load the NBT files from any file location that its allowed to access.

Maybe a function like structure_load(structureName, locationArray, [rotation], [mirror]) to load a saved structure into the world.

So if I use a command block to save a structure named "minecraft:test", i could load it with CommandHelper using structure_load("minecraft:test", ploc("Steve")) to place it at Steve's location for example

PseudoKnight commented 3 years ago

It's worth mentioning that most servers use schematics instead, and there's already support for that through the SKCompat extension and WorldEdit.

In regards to structures, there's no way to directly load/place one. However, Structure Blocks do have an API that can be used indirectly for this. We could add a function to set structure block data.

https://hub.spigotmc.org/javadocs/spigot/org/bukkit/block/Structure.html

It'd look something more like this:

set_block(@location, 'STRUCTURE_BLOCK');
set_structure_data(@location, array(structure: 'minecraft:test', mode: 'LOAD', position: @position);
set_block(location_shift(@location, 'up'), 'REDSTONE_BLOCK');
set_block(@location, 'AIR');
set_block(location_shift(@location, 'up'), 'AIR');
JasonTable commented 2 years ago

Thanks for telling me about the SKCompat extension. I am gonna try it out.

A set_structure_data function would be a good alternative. Right now I have a custom proc that makes CommandHelper run a vanilla minecraft command as console to set the structure block with its data and set the redstone block.