Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for nbt.NBTFile instance in interface.placeStructure #85

Conversation

Niels-NTG
Copy link
Contributor

Inspired by a support request on the GDMC Discord, I've enhanced the interface.placeStructure method to work with the following use case:

nbt = parseNbtFile(path)
interface.placeStructure(nbt, position=(X, Y, Z))

This isn't possible without the changes in this PR, since interface.placeStructure is designed to work with NBT data that is represented as the bytes data type, meaning that the user can only use an existing file or has to find out a way to convert their programatically constructed NBT into bytes themselves. The code in this PR takes care of the latter task, allowing the user to use an instance of nbt.NBTFile as an alternative to bytes.

@avdstaaij
Copy link
Owner

Hmm, I'd prefer if interface.placeStructure remained as simple and possible, and "high-level" features like this one moved to the not-yet-implemented Editor methods. I do see the value in having this available now though, so I'll merge it, but it's quite likely that I will remove this again when the Editor methods are there.

@avdstaaij avdstaaij merged commit fc73172 into avdstaaij:dev Apr 20, 2023
@Niels-NTG Niels-NTG deleted the nbt.NBTFile-support-place-structure-interface branch April 22, 2023 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants