API for custom default values during parsing.
Description
Adds an api for declaring custom default values during parsing. Does not apply to runtime defaults like arithmetic. The goal of this is to provide a slightly easier method for section to provide section-specific defaults without having to create an entire custom event and change the context.
I think this implementation might be a little rough and would welcome critiques.
Example:
// Add custom default value
data.addDefaultValue(Number.class, new SimpleLiteral((Number) 7, true));
// parse section with custom value
loadCode(sectionNode);
// remove custom value
data.removeDefaultValue(Number.class);
Target Minecraft Versions: any Requirements: none Related Issues: none
Just realized this needs to support multiple layers of default values. Will fix Friday.
default value A:
default B:
# default is B
# default should be A
I would like some thoughts on how/whether to handle cases where context completely changes. Perhaps a clearDefaults() and restoreDefaults() method? Maybe defaults should be tied to event/a context generic? not sure, would like suggestions