MattDahEpic / MattDahEpic/AutoOreDictConvert

AutoOreDictConv in-game commands lose comments when writing to .cfg file

Open
#21 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
7
Forks
5
PR merge metrics
No merged PRs in 30d

Description

With autooredictconv-1.16.4-16.1.6.jar (autooredictconv-1.16.4-16.1.5.jar also had this issue, but just noticed the headers gone today) for Minecraft 1.16.5 and Forge 31.0.14, when I run `/odc add` in-game, it re-writes the **autooredictconv-conversions.cfg** file, but without the helpful headers anymore.

Initial version:
```
# Format for tag conversion (all items in tag `namespace:tag/name` will be converted to destination item `modid:item`):
# namespace:tag/name=modid:item
# Format for direct item conversion (the item `modid:sourceitem` will be converted to `modid:destitem`):
# modid:sourceitem>modid:destitem

# Default conversions config
forge:ores/iron=minecraft:iron_ore
forge:ores/gold=minecraft:gold_ore
forge:ores/lapis=minecraft:lapis_ore
forge:ores/diamond=minecraft:diamond_ore
forge:ores/emerald=minecraft:emerald_ore
```

After adding some entries via `/odc add`, I saw the comments above gone, so re-edited ( while the server was off) **autooredictconv-conversions.cfg** (adding back the comments) and sorted the file to look like this:
```
# Format for tag conversion (all items in tag `namespace:tag/name` will be converted to destination item `modid:item`):
# namespace:tag/name=modid:item
# Format for direct item conversion (the item `modid:sourceitem` will be converted to `modid:destitem`):
# modid:sourceitem>modid:destitem

# Default conversions config
forge:ingots/aluminium=janoeo:aluminium_ingot
forge:ingots/bismuth=silents_mechanisms:bismuth_ingot
forge:ingots/copper=janoeo:copper_ingot
forge:ingots/lead=janoeo:lead_ingot
forge:ingots/tin=janoeo:tin_ingot
forge:ingots/zinc=janoeo:zinc_ingot
forge:ores/copper=janoeo:copper_ore
forge:ores/diamond=minecraft:diamond_ore
forge:ores/emerald=minecraft:emerald_ore
forge:ores/gold=minecraft:gold_ore
forge:ores/iron=minecraft:iron_ore
forge:ores/lapis=minecraft:lapis_ore
forge:ores/lead=janoeo:lead_ore
forge:ores/silver=janoeo:silver_ore
forge:ores/uranium=janoeo:uranium_ore
forge:ores/zinc=janoeo:zinc_ore
```

The comments remained there after the server was started up. To see if the comments got removed again, I added `janoeo:uranium_ingot`, `mekanism:ingot_osmium`, and `mekanism:osmium_ore` via `/odc add` and the file **autooredictconv-conversions.cfg** is now missing the descriptive comments at the top telling me what format to put the entries in:
```
forge:ingots/uranium=janoeo:uranium_ingot
forge:ingots/bismuth=silents_mechanisms:bismuth_ingot
forge:ores/silver=janoeo:silver_ore
forge:ingots/zinc=janoeo:zinc_ingot
forge:ingots/copper=janoeo:copper_ingot
forge:ores/lapis=minecraft:lapis_ore
forge:ores/uranium=janoeo:uranium_ore
forge:ingots/aluminium=janoeo:aluminium_ingot
forge:ores/zinc=janoeo:zinc_ore
forge:ores/iron=minecraft:iron_ore
forge:ores/osmium=mekanism:osmium_ore
forge:ingots/lead=janoeo:lead_ingot
forge:ores/emerald=minecraft:emerald_ore
forge:ores/copper=janoeo:copper_ore
forge:ingots/osmium=mekanism:ingot_osmium
forge:ores/diamond=minecraft:diamond_ore
forge:ores/gold=minecraft:gold_ore
forge:ingots/tin=janoeo:tin_ingot
forge:ores/lead=janoeo:lead_ore
```

Might also be nice to have the entries in a lexicographical sort like I did in my manual entries for easier reading later, but I can open a separate ticket if you want that tracked. ;)

Here's my currently manually re-formatted if you like:
```
# Format for tag conversion (all items in tag `namespace:tag/name` will be converted to destination item `modid:item`):
# namespace:tag/name=modid:item
# Format for direct item conversion (the item `modid:sourceitem` will be converted to `modid:destitem`):
# modid:sourceitem>modid:destitem

# Default conversions config
forge:ores/diamond=minecraft:diamond_ore
forge:ores/emerald=minecraft:emerald_ore
forge:ores/gold=minecraft:gold_ore
forge:ores/iron=minecraft:iron_ore
forge:ores/lapis=minecraft:lapis_ore

# Tag conversions
forge:ingots/aluminium=janoeo:aluminium_ingot
forge:ingots/bismuth=silents_mechanisms:bismuth_ingot
forge:ingots/copper=janoeo:copper_ingot
forge:ingots/lead=janoeo:lead_ingot
forge:ingots/osmium=mekanism:ingot_osmium
forge:ingots/tin=janoeo:tin_ingot
forge:ingots/uranium=janoeo:uranium_ingot
forge:ingots/zinc=janoeo:zinc_ingot
forge:ores/copper=janoeo:copper_ore
forge:ores/lead=janoeo:lead_ore
forge:ores/osmium=mekanism:osmium_ore
forge:ores/silver=janoeo:silver_ore
forge:ores/uranium=janoeo:uranium_ore
forge:ores/zinc=janoeo:zinc_ore

# Item conversions
electrodynamics:orecopper>janoeo:copper_ore
electrodynamics:orelead>janoeo:lead_ore
electrodynamics:oresilver>janoeo:silver_ore
electrodynamics:oretin>janoeo:tin_ore
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the code handling the `/odc add` command and writing `autooredictconv-conversions.cfg`. Reproduce the command in Minecraft 1.16.5 with Forge 31.0.14, then verify that the descriptive header comments remain after entries are added and the configuration still loads correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
game-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.