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 --delete flag to aid trimming worlds #99

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

jkunkee
Copy link

@jkunkee jkunkee commented Jun 29, 2020

When a new version of the game comes along, it is useful to be able to delete chunks based on some criteria, like InhabitedTime being 0.

This change adds a --delete flag to NBTUtil that deletes the node or nodes specified by --path. It also restructures how the nodes were iterated over to allow them to be deleted.

NBTUtil can then be wrapped in a script that reads the data from each chunk and calls NBTUtil --delete on the chunk if the criteria are met.

This change splits CanProcess into a separate loop from Process so that
Process can perform actions like deletion that cause NbtPathEnumerator
to throw an exception. It also caches targetNode.Root before Process
because Process can cause targetNode to be invalid.
@jkunkee
Copy link
Author

jkunkee commented Jun 29, 2020

I wrote a script to leverage this feature, but it's really slow (something like 1s/chunk):
https://gist.github.com/jkunkee/71847e1565e2152cf4c1e42b6aa6cd9e

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.

1 participant