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

give_initial_stuff: cannot add items with metadata containing commas via the setting #2999

Open
fluxionary opened this issue Nov 11, 2022 · 2 comments

Comments

@fluxionary
Copy link
Contributor

e.g. an item w/ an itemstring like

waypoint_compass:compass 1 0 "\u0001color\u0002#FFFFFF\u0003description\u0002Waypoint compass to \"Public Farm\"\u0003waypoint_compass:label\u0002Public Farm\u0003waypoint_compass:position\u0002(2035,14,1303)\u0003waypoint_compass:color\u000216777215\u0003waypoint_compass:owner\u0002flux\u0003"

this is because item delimiting is done by simply splitting the value of the initial_stuff setting on commas.

there is an API which can be used as a work-around, but having an option that doesn't require coding would be preferable.

one solution would be to escape the commas somehow. another would be to add another setting to configure the delimiter (e.g. being able to set it to a newline would be useful).

@sfan5 sfan5 added the Bug label Nov 12, 2022
@Wuzzy2
Copy link
Contributor

Wuzzy2 commented Jan 30, 2023

Sounds more like a missing feature than a bug. Recommendation: Update documentation instead, that metadata is not allowed.

@appgurueu
Copy link
Contributor

Ugh, this is ugly. I agree that this can be seen as a missing feature. The underlying issue is that the Settings file format is too primitive (basically only a string k/v) to properly represent lists, so the wheel has to be reinvented each time and we're left with a variety of different delimiters across mods. The proper solution would be conf files allowing a proper object notation (might be something like YAML if it's supposed to be user friendly).

there is an API which can be used as a work-around, but having an option that doesn't require coding would be preferable.

I think using the API ("codefiguration") is the cleaner solution here actually. The configuration line in your example is hardly human-readable and -editable (it was probably generated using code), which is the whole point of configuration (which strives to be even more accessible than code). Proper "codefiguration" would be more readable here and wouldn't have to rely on the engine-interal, undocumented ItemString metadata encoding format; you could just use the ItemStack class to construct your initial items there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants