Shynixn / StructureBlockLib

StructureBlockLib is a bukkit implementation for handling structures on spigot server.
https://shynixn.github.io/StructureBlockLib/apidocs/
MIT License
60 stars 5 forks source link

How can I var all pasted entities? #99

Closed plytki closed 2 years ago

plytki commented 2 years ago

I need to add pasted entities to an ArrayList to handle them. Is there a way to do that with your API?

Shynixn commented 2 years ago

No, currently not. There are ways to add this to the API. Are you interested in that?

plytki commented 2 years ago

Yes, I am very interested.

Could you also tell me if there is a chance to just paste the entities instead if the blocks with entities? Because when I paste the structure it is removing the area nearby. I know that there are air blocks so maybe you can just add option not to paste the blocks?

Shynixn commented 2 years ago

You can already ignore blocks if you return false for every block in onProcessBlock. The following code only loads the entities.

structureBlockLibApi
        .loadStructure(plugin)
        .at(player.getLocation())
        .includeEntities(true)
        .onProcessBlock(e -> {
                 return false;
        })
        .loadFromPath(plugin.getDataFolder().toPath().resolve(args[1]))
        .onResult(e -> player.sendMessage("Placed structure."));
Shynixn commented 2 years ago

Implemented in version 2.7.0. See https://github.com/Shynixn/StructureBlockLib#load-entities-in-memory-and-iterate-them for details.