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

Level wrapper load_root method #258

Open
gentlegiantJGC opened this issue May 21, 2022 · 0 comments
Open

Level wrapper load_root method #258

gentlegiantJGC opened this issue May 21, 2022 · 0 comments

Comments

@gentlegiantJGC
Copy link
Member

gentlegiantJGC commented May 21, 2022

The Problem

I don't particularly like the way data is loaded by the level wrapper classes.
Currently in the __init__ function they load the root data so that it can be queried.
This means that if the level does not exist it tries and fails to load that data.

Feature Description

It would make more sense if the __init__ function simply initialised variables to their default state and did not actually load any data.
There would be a public method (perhaps load_root) that would load this data.
This would mean that the full subclass chain of __init__ can run without worrying if the subclass default attribute has been set.
It also does not having to try and except loading the data.

Once the class has been initialised the calling code can call load_root to make the root data available for inspection or just open which would load the root data and open the database for editing. Alternatively create_and_open could be called to initialise the data and open it.

Edit: load_metadata might be a better name

@gentlegiantJGC gentlegiantJGC transferred this issue from Amulet-Team/Amulet-Map-Editor Sep 16, 2023
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

No branches or pull requests

1 participant