Skip to content

Commit 2f71066

Browse files
authored
Merge pull request #24 from Nyveon/v1.7
1.7
2 parents ee941fa + 6112627 commit 2f71066

14 files changed

+427
-203
lines changed

README.md

Lines changed: 61 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,65 @@
11
# MCStructureCleaner
22

3-
Missing Structure Fix - Modded structure cleaner for minecraft. Removes all references to non-existent structures to allow for clean error logs and chunk saving. The program goes through every chunk, in every region file of the world, removing the relevant `structure reference` and `structure start` tags.
3+
Minecraft utility designed to repair worlds affected by the [[MC-194811] Missing structures will destroy saved worlds](https://bugs.mojang.com/browse/MC-194811) bug. This bug, resulting from uninstalling mods that generate custom structures, can cause **world instability** and **corrupt saves**. MCStructureCleaner meticulously scans and cleans every chunk in every region file of the world, removing orphaned `structure reference` and `structure start` tags. This process ensures clean error logs, efficient chunk saving and a more stable Minecraft experience.
44

5-
Designed to fix worlds suffering from the [[MC-194811] Missing structures will destroy saved worlds](https://bugs.mojang.com/browse/MC-194811) bug, where uninstalling a mod which generated custom structures causes the world to become unstable.
5+
## Key features
66

7-
Fixes errors such as `Unknown structure start: <missing structure>`, `Failed to save chunk`
7+
- Cleans up references to non-existent structures
8+
- Fixes `Unknown structure start: <missing structure>` error.
9+
- Fixes `Failed to save chunk` error.
10+
- Fixes `Found reference to unknown structure` console spam.
11+
- Should work on all Minecraft versions over 1.12
812

913
## Installation
1014

11-
⚠ This does not work on 1.18.x worlds. ⚠
15+
**⚠ Important:** Always back up your world before using MCStructureCleaner's results
1216

13-
1. Install [Python 3.x](https://www.python.org/) Currently not compatible with Python versions past 3.10
14-
2. Install the requirements [Matcool's Anvil Parser](https://github.com/matcool/anvil-parser) and [Gooey](https://github.com/chriskiehl/Gooey). This can be done with the following commands:
17+
1. **Install [Python 3.x](https://www.python.org/)**. *Python 3.12.x recommended*.
18+
2. **Install Dependencies:** Use the following commands in the command line to install required libraries:
1519

1620
```bash
17-
pip install anvil-parser
21+
pip install git+https://github.com/Nyveon/anvil-parser
1822
pip install Gooey
1923
```
20-
21-
3. Download the latest release (*MCStructureCleaner_v16.zip*) from the [releases page](https://github.com/Nyveon/MCStructureCleaner/releases) and extract it.
2224

23-
## How to Use (Instructions)
25+
3. **Download MCStructureCleaner:** Grab the latest release (_MCStructureCleaner_v17.zip_) from the [releases page](https://github.com/Nyveon/MCStructureCleaner/releases) and extract the contents.
2426

25-
1. Find the names of the structure tags you want to remove. I recommend using [NBTExplorer](https://github.com/jaquadro/NBTExplorer).
26-
2. **Install MCStructureCleaner** then double click on `main.py` to run the program.
27-
3. You should see an interface like this.
27+
## Usage
28+
29+
1. **Find the Structure Tags**: I recommend using something like [NBTExplorer](https://github.com/jaquadro/NBTExplorer) to identify the tags you wish to remove.
30+
2. **Launch MCStructureCleaner**: Run `main.py` by double-clicking the file. You will be greeted with a user-friendly interface.
2831

2932
![MC Structure Cleaner GUI](images/screenshot1.png)
3033

31-
4. Now, you can fill out each section:
32-
1. `tag`: The exact name of the structure tag you want to remove. This is case sensitive. You can input many tags at once, separated by spaces. If the names have spaces in them, you can surround them with quotes. For example, `"my structure" "another structure"`. Leave this field blank if you want to delete **ALL NON-VANILLA STRUCTURE TAGS**.
33-
2. `jobs`: The number of threads you want to run it on. Default: 2 x CPU logical processors. In my experience, the default works well enough.
34-
3. `path`: The path to the world folder. (The whole folder, not just the `region` folder)
35-
4. `output`: The path to the output folder. This is where the cleaned `new_region` will be saved. If you leave this blank, the cleaned world will be saved in the same folder as MCStructureCleaner.
36-
5. `region`: The dimension you want to clean. If you leave this **blank** it will clean the overworld. `DIM-1` is the nether, `DIM1` is the end.
37-
5. *For example, this input will delete all occurances of "Better Mineshaft" and of "Better Stronghold" in the world "MyWorld", in the Nether (DIM-1), using 8 threads. The world folder is located in the user's minecraft saves, and the output will be saved to the desktop.*
34+
3. **Configure options**:
35+
- `tag`: Here you have two options,
36+
1. Leave the field blank if you want to delete all non-vanilla structure tags.
37+
2. Write a space-separated list of exact tags or tag prefixes you want removed.
38+
- You can use a _wildcard_ (*) to match prefixes. For example if you want to remove all structures from additional structures you would add `additionalstructures:*` to the list.
39+
- Note: Tag names are case sensitive.
40+
- Note: If the tag name has spaces, surround it with quotes. For example, `"my structure" "another structure"`
41+
- `jobs`: The number of threads you want to run it on. The default it optimal in most cases.
42+
- `path`: The path to the world folder. (The whole folder, not just the `region` folder)
43+
- `output`: The path to the output folder. This is where the cleaned `new_region` will be saved. If you leave this blank, the cleaned world will be saved in the same folder as MCStructureCleaner.
44+
- `region`: The dimension you want to clean. If you leave this **blank** it will clean the overworld. `DIM-1` is the nether, `DIM1` is the end.
45+
4. **Example**: this input will delete all occurances of "Better Mineshaft" and better_stronghold, as well as all structures from the mod "watching" in the world "New World", in the Nether (DIM-1), using 8 threads. The world folder is located in the user's minecraft saves, and the output will be saved to the desktop.
3846

3947
![MC Structure Cleaner GUI](images/screenshot2.png)
4048

41-
6. Once you have filled out all the sections, click `Start` to begin the process. This may take a while, especially if you have a larger world.
42-
7. If there is an error, it will be displayed in the `Output` section. If there is no error, the program will say `Done!` and you can close the program.
43-
8. Now you may rename the output folder (called `new_region`) to `region` and **replace** the old `region` folder in your world. **Don't forget to backup your world first!**
44-
9. Enjoy your now working world 😊
49+
5. **Start Cleaning:** Once configured, click `Start` to begin the process. This may take a while, especially if you have a larger world.
50+
6. **Toubleshooting:** If there is an error, it will be displayed in the `Output` section. If there is no error, the program will say `Done!` and you can close the program.
51+
7. **New files:** Now you may rename the output folder (called `new_region`) to `region` and **replace** the old `region` folder in your world. **Don't forget to backup your world first!**
52+
8. Enjoy your now working world 😊
4553

4654
### Command Line
4755

4856
<details>
4957
<summary>Only recommended if the GUI does not work on your device</summary>
5058

5159
1. Run main.py with any of the following parameters. I recommend using [NBTExplorer](https://github.com/jaquadro/NBTExplorer) to find the name, or just letting the program fix all non-vanilla names by not inputting any tag.
60+
5261
- `-h` For help on command line arguments.
53-
- `-t` For the tag you want removed, in quotes. Leave empty if you wish to remove ALL NON-VANILLA TAGS.
62+
- `-t` For the tag(s) you want removed, in quotes. Space-separated if multiple. Leave empty if you wish to remove ALL NON-VANILLA TAGS. Use * as a wildcard after a prefix.
5463
- `-j` For the number of threads you want to run it on. Default: 2 x CPU logical processors.
5564
- `-w` For the name of the world you want to process. Default: "world".
5665
- `-p` For the path to the world you want to process. Default: current directory.
@@ -69,6 +78,7 @@ pip install Gooey
6978
```
7079

7180
If you are on windows, I recommend using PowerShell.
81+
7282
2. Let it run. This may take a while, depending on the power of your computer and the size of your world.
7383
3. Replace the contents of your region folder with the contents of new_region.
7484
4. Enjoy your now working world 😊
@@ -78,31 +88,41 @@ pip install Gooey
7888
## Warnings
7989

8090
1. Always back up your worlds before making any changes to them.
81-
2. Structure specific effects that remained after uninstalling the mod will no longer work for the removed structures (This includes locating structures and custom loot tables).
82-
3. If you have corrupted region files (With the wrong data format, or a size of 0b) the script may crash.
91+
2. Structure specific effects that remained after uninstalling the mod will no longer work for the removed structures. This includes locating structures and chests being populated by custom loot tables.
92+
3. If you have corrupted region files the script may crash.
8393

8494
## Developers
8595

8696
### Installation & Testing
8797

88-
#### Installation
98+
#### Getting Started
8999

90100
Clone the repository, then install requirements:
91101

92102
```bash
103+
git clone https://github.com/Nyveon/MCStructureCleaner
104+
cd MCStructureCleaner
93105
pip install -r requirements.txt
94106
pip install -r tests/requirements.txt
95107
```
96108

97109
#### Linting and style
98110

99-
Most standard linters are fine as long as the code is readable, the project files are currently linted with [flake8](https://flake8.pycqa.org/en/latest/).
111+
The project files are currently formatted with [Black](https://github.com/psf/black). If you send a pull request formatted with Black, most likely no style changes will be made to your code, but feel free to send anything as long as the code is readable and organized.
100112

101113
#### Running tests
102114

103115
- **VSCode**: the testing environment is already configured, simply press the `Run Tests` button added by the [official Python Extension](https://code.visualstudio.com/docs/python/testing).
104116
- **Command Line**:
105117

118+
Without coverageL
119+
120+
```bash
121+
pytest -v tests/
122+
```
123+
124+
With coverage:
125+
106126
```bash
107127
pytest -v --cov=. tests/ --cov-report xml:cov.xml
108128
```
@@ -122,20 +142,24 @@ Contributions are always welcome! See the [issues page](https://github.com/Nyveo
122142

123143
## Notes
124144

125-
- Feel free to message me on discord (Nyveon#9999) or twitter (Nyveon) if you need help using it.
145+
- Feel free to message me on discord (@Nyveon) or twitter (Nyveon) if you need help using it.
126146
- **Why did we make this?** To save our own SMP world after uninstalling some mods and getting the MC-194811 error. We had spent a lot of time on it, and didn't want anyone else to have to lose their world to the same bug.
127-
- Thanks to @DemonInTheCloset for contributing to multiprocessing and command line arugments.
147+
- Thanks to @DemonInTheCloset for contributing to multiprocessing and command line arguments.
128148
- Thanks to @lleheny0 for contributing to file validation.
129149

130150
### Versions tested
131151

132-
- Pre 1.12: The bug does not apply to these versions.
152+
- 1.12 and earlier: The bug does not apply to these versions.
133153
- 1.13.x: 🟡 Manually
134-
- 1.14.x: 🟠 Untested, but should work
135-
- 1.15.x: 🟢 Automatically
136-
- 1.16.x: 🟡 Manually
154+
- 1.14.x: 🟠 Untested, but should work.
155+
- 1.15.x: 🟢 Automatically tested by the code.
156+
- 1.16.x: 🟡 Manually tested.
137157
- 1.17.x: 🟠 Untested, but should work
138-
- 1.18.x: 🔴 Not working. anvil-parser is not compatible with 1.18.x yet.
139-
- 1.19.x: ❔ The bug might be fixed in this version. If anyone has information, please let me know c:
158+
- 1.18.x: 🟡 Manually tested.
159+
- 1.19.x: 🟠 Untested, but should work
160+
- 1.20.x: 🟡 Manually tested.
161+
- Later versions: 🟠 Untested.
162+
163+
If you use this for any version, please let me know that it worked so this section can be updated! You can contact me on discord or leave an [issue](https://github.com/Nyveon/MCStructureCleaner/issues).
140164

141165
![MC Structure Cleaner](images/mc-structure-cleaner.png)

images/screenshot1.png

5.51 KB
Loading

images/screenshot2.png

5.56 KB
Loading

0 commit comments

Comments
 (0)