Interface ConfigValueList
- All Superinterfaces:
ConfigTag
- All Known Implementing Classes:
ConfigValueListImpl
-
Method Summary
Modifier and TypeMethodDescriptionit.unimi.dsi.fastutil.booleans.BooleanListGets theBooleanListvalues stored in this tag.it.unimi.dsi.fastutil.booleans.BooleanListGets the defaultBooleanListvalues stored in this tag.it.unimi.dsi.fastutil.doubles.DoubleListGets the defaultDoubleListvalues stored in this tag.it.unimi.dsi.fastutil.ints.IntListGets the defaultIntListvalues represented as Hex strings stored in this tag.it.unimi.dsi.fastutil.ints.IntListGets the defaultIntListvalues stored in this tag.it.unimi.dsi.fastutil.longs.LongListGets the defaultLongListvalues stored in this tag.it.unimi.dsi.fastutil.doubles.DoubleListGets theDoubleListvalues stored in this tag.it.unimi.dsi.fastutil.ints.IntListgetHexs()Gets theIntListvalues stored as a Hex strings stored in this tag.it.unimi.dsi.fastutil.ints.IntListgetInts()Gets theIntListvalues stored in this tag.it.unimi.dsi.fastutil.longs.LongListgetLongs()Gets theLongListvalue stored in this tag.@Nullable ListRestrictionGets theRestrictionpredicate for this tag.getType()Gets the type of theConfigValueList.onSync(ConfigCallback<ConfigValueList> callback) Called when this tag, or any children, are modified.setBooleans(List<Boolean> values) setComment(String comment) Sets the comment for this tag.
Will be split on\n.setComment(String... comment) Sets the comment for this tag.setComment(List<String> comment) Sets the comment for this tag.setDefaultBooleans(List<Boolean> values) setDefaultDoubles(List<Double> values) setDefaultHexs(List<Integer> values) setDefaultInts(List<Integer> values) setDefaultLongs(List<Long> values) setDefaultStrings(List<String> values) setDoubles(List<Double> values) setRestriction(ListRestriction restriction) // TODO Improve wording for lists.setStrings(List<String> values) Sets this tag as requiring syncing to the client.Methods inherited from interface codechicken.lib.config.ConfigTag
copy, delete, forceSync, getComment, getDesc, getName, getParent, isDirty, isNetworkTag, read, requiresClientSync, reset, resetFromNetwork, runSync, save, write
-
Method Details
-
getType
ValueType getType()Gets the type of theConfigValueList.- Returns:
- The
ValueTypeof this tag.
-
getBooleans
it.unimi.dsi.fastutil.booleans.BooleanList getBooleans()Gets theBooleanListvalues stored in this tag.No attempt to convert between tag types is made, this must be called on a tag which has a non
ValueType.UNKNOWNtype.- Returns:
- The boolean value or the default.
- Throws:
IllegalStateException- If thegetType()is notValueType.BOOLEAN, or in the event of a missing value, no default is set.
-
getStrings
Gets theListofStringvalues stored in this tag.No attempt to convert between tag types is made, this must be called on a tag which has a non
ValueType.UNKNOWNtype.- Returns:
- The String value or the default.
- Throws:
IllegalStateException- If thegetType()is notValueType.STRING, or in the event of a missing value, no default is set.
-
getInts
it.unimi.dsi.fastutil.ints.IntList getInts()Gets theIntListvalues stored in this tag.No attempt to convert between tag types is made, this must be called on a tag which has a non
ValueType.UNKNOWNtype.- Returns:
- The int value or the default.
- Throws:
IllegalStateException- If thegetType()is notValueType.INT, or in the event of a missing value, no default is set.
-
getLongs
it.unimi.dsi.fastutil.longs.LongList getLongs()Gets theLongListvalue stored in this tag.No attempt to convert between tag types is made, this must be called on a tag which has a non
ValueType.UNKNOWNtype.- Returns:
- The long value or the default.
- Throws:
IllegalStateException- If thegetType()is notValueType.LONG, or in the event of a missing value, no default is set.
-
getHexs
it.unimi.dsi.fastutil.ints.IntList getHexs()Gets theIntListvalues stored as a Hex strings stored in this tag.No attempt to convert between tag types is made, this must be called on a tag which has a non
ValueType.UNKNOWNtype.- Returns:
- The int value or the default.
- Throws:
IllegalStateException- If thegetType()is notValueType.HEX, or in the event of a missing value, no default is set.
-
getDoubles
it.unimi.dsi.fastutil.doubles.DoubleList getDoubles()Gets theDoubleListvalues stored in this tag.No attempt to convert between tag types is made, this must be called on a tag which has a non
ValueType.UNKNOWNtype.- Returns:
- The double value or the default.
- Throws:
IllegalStateException- If thegetType()is notValueType.DOUBLE, or in the event of a missing value, no default is set.
-
setBooleans
Sets theListofBooleanvalues stored in this tag.If the tag has an
ValueType.UNKNOWNvalue type, this function will set it appropriately.- Parameters:
values- TheListofBooleanvalues.- Returns:
- The same
ConfigValueList. - Throws:
IllegalStateException- If thegetType()is notValueType.UNKNOWNorValueType.BOOLEAN.
-
setStrings
Sets theListofStringvalues stored in this tag.If the tag has an
ValueType.UNKNOWNvalue type, this function will set it appropriately.- Parameters:
values- TheListofStringvalues.- Returns:
- The same
ConfigValueList. - Throws:
IllegalStateException- If thegetType()is notValueType.UNKNOWNorValueType.STRING.
-
setInts
Sets theListofIntegervalues stored in this tag.If the tag has an
ValueType.UNKNOWNvalue type, this function will set it appropriately.- Parameters:
values- TheListofIntegervalues.- Returns:
- The same
ConfigValueList. - Throws:
IllegalStateException- If thegetType()is notValueType.UNKNOWNorValueType.INT.
-
setLongs
Sets theListofLongvalues stored in this tag.If the tag has an
ValueType.UNKNOWNvalue type, this function will set it appropriately.- Parameters:
values- TheListofLongvalues.- Returns:
- The same
ConfigValueList. - Throws:
IllegalStateException- If thegetType()is notValueType.UNKNOWNorValueType.LONG.
-
setHexs
Sets theListofIntegervalues represented as hex Strings stored in this tag.If the tag has an
ValueType.UNKNOWNvalue type, this function will set it appropriately.- Parameters:
values- TheListofIntegervalues.- Returns:
- The same
ConfigValueList. - Throws:
IllegalStateException- If thegetType()is notValueType.UNKNOWNorValueType.HEX.
-
setDoubles
Sets theListofDoublevalues stored in this tag.If the tag has an
ValueType.UNKNOWNvalue type, this function will set it appropriately.- Parameters:
values- TheListofDoublevalues.- Returns:
- The same
ConfigValueList. - Throws:
IllegalStateException- If thegetType()is notValueType.UNKNOWNorValueType.DOUBLE.
-
getDefaultBooleans
it.unimi.dsi.fastutil.booleans.BooleanList getDefaultBooleans()Gets the defaultBooleanListvalues stored in this tag.No attempt to convert between tag types is made, this must be called on a tag which has a non
ValueType.UNKNOWNtype.- Returns:
- The default
BooleanListvalues. - Throws:
IllegalStateException- If thegetType()is notValueType.BOOLEAN, or when no default is set.
-
getDefaultStrings
Gets the defaultListofStringvalues stored in this tag.No attempt to convert between tag types is made, this must be called on a tag which has a non
ValueType.UNKNOWNtype.- Returns:
- The default
ListofStringvalues. - Throws:
IllegalStateException- If thegetType()is notValueType.STRING, or when no default is set.
-
getDefaultInts
it.unimi.dsi.fastutil.ints.IntList getDefaultInts()Gets the defaultIntListvalues stored in this tag.No attempt to convert between tag types is made, this must be called on a tag which has a non
ValueType.UNKNOWNtype.- Returns:
- The default
LongListvalues. - Throws:
IllegalStateException- If thegetType()is notValueType.INT, or when no default is set.
-
getDefaultLongs
it.unimi.dsi.fastutil.longs.LongList getDefaultLongs()Gets the defaultLongListvalues stored in this tag.No attempt to convert between tag types is made, this must be called on a tag which has a non
ValueType.UNKNOWNtype.- Returns:
- The default
LongListvalues. - Throws:
IllegalStateException- If thegetType()is notValueType.LONG, or when no default is set.
-
getDefaultHexs
it.unimi.dsi.fastutil.ints.IntList getDefaultHexs()Gets the defaultIntListvalues represented as Hex strings stored in this tag.No attempt to convert between tag types is made, this must be called on a tag which has a non
ValueType.UNKNOWNtype.- Returns:
- The default
IntListvalues. - Throws:
IllegalStateException- If thegetType()is notValueType.HEX, or when no default is set.
-
getDefaultDoubles
it.unimi.dsi.fastutil.doubles.DoubleList getDefaultDoubles()Gets the defaultDoubleListvalues stored in this tag.No attempt to convert between tag types is made, this must be called on a tag which has a non
ValueType.UNKNOWNtype.- Returns:
- The default
DoubleListvalues. - Throws:
IllegalStateException- If thegetType()is notValueType.DOUBLE, or when no default is set.
-
setDefaultBooleans
Sets the defaultListofBooleanvalues stored in this tag.If the tag has an
ValueType.UNKNOWNvalue type, this function will set it appropriately.- Parameters:
values- TheListofBooleanvalues.- Returns:
- The same
ConfigValueList. - Throws:
IllegalStateException- If thegetType()is notValueType.UNKNOWNorValueType.BOOLEAN.
-
setDefaultStrings
Sets the defaultListofStringvalues stored in this tag.If the tag has an
ValueType.UNKNOWNvalue type, this function will set it appropriately.- Parameters:
values- TheListofStringvalues.- Returns:
- The same
ConfigValueList. - Throws:
IllegalStateException- If thegetType()is notValueType.UNKNOWNorValueType.STRING.
-
setDefaultInts
Sets the defaultListofIntegervalues stored in this tag.If the tag has an
ValueType.UNKNOWNvalue type, this function will set it appropriately.- Parameters:
values- TheListofIntegervalues.- Returns:
- The same
ConfigValueList. - Throws:
IllegalStateException- If thegetType()is notValueType.UNKNOWNorValueType.INT.
-
setDefaultLongs
Sets the defaultListofLongvalues stored in this tag.If the tag has an
ValueType.UNKNOWNvalue type, this function will set it appropriately.- Parameters:
values- TheListofLongvalues.- Returns:
- The same
ConfigValueList. - Throws:
IllegalStateException- If thegetType()is notValueType.UNKNOWNorValueType.LONG.
-
setDefaultHexs
Sets the defaultListofIntegervalues represented as hex Strings stored in this tag.If the tag has an
ValueType.UNKNOWNvalue type, this function will set it appropriately.- Parameters:
values- TheListofIntegervalues.- Returns:
- The same
ConfigValueList. - Throws:
IllegalStateException- If thegetType()is notValueType.UNKNOWNorValueType.HEX.
-
setDefaultDoubles
Sets the defaultListofDoublevalues stored in this tag.If the tag has an
ValueType.UNKNOWNvalue type, this function will set it appropriately.- Parameters:
values- TheListofDoublevalues.- Returns:
- The same
ConfigValueList. - Throws:
IllegalStateException- If thegetType()is notValueType.UNKNOWNorValueType.DOUBLE.
-
setRestriction
// TODO Improve wording for lists. Set theRestrictionfor thisConfigValueList.A restriction is just a
Predicate, and can be used for anything, but is most commonly used for int/float value ranges on tags.If the restriction is violated, either by the tag being loaded from disk, or via a set method, it will be reset to default.
TODO, in the future, provide a function to choose what to do when a value is invalid, allow the value to be altered (clamped), removed, or reset entirely to default.
It is invalid for the restriction to not accept the tag's default value, if the restriction does not, it will throw an
IllegalArgumentExceptioneither when the restriction is set, or the default is set, whichever comes last.See
Restrictionfor more information.- Parameters:
restriction- The restriction to set.- Returns:
- The same
ConfigValueList. - See Also:
-
getRestriction
Gets theRestrictionpredicate for this tag.- Returns:
- The
Restriction
-
syncTagToClient
ConfigValueList syncTagToClient()Sets this tag as requiring syncing to the client.Register your root tag via
ConfigSyncManager.registerSync(ResourceLocation, ConfigTag).- Specified by:
syncTagToClientin interfaceConfigTag
-
onSync
Called when this tag, or any children, are modified.This is commonly used for when tags are synced to the client and inversely, reverted when disconnecting.
Additionally, one can manually fire all sync callbacks using
ConfigTag.forceSync()See
ConfigCallbackfor more info.- Parameters:
callback- TheConfigCallback.- Returns:
- The same
ConfigValueList. - See Also:
-
setComment
Sets the comment for this tag.
Will be split on\n.- Specified by:
setCommentin interfaceConfigTag- Parameters:
comment- The comment line.- Returns:
- The same config tag.
-
setComment
Sets the comment for this tag.- Specified by:
setCommentin interfaceConfigTag- Parameters:
comment- The comment lines.- Returns:
- The same config tag.
-
setComment
Sets the comment for this tag.- Specified by:
setCommentin interfaceConfigTag- Parameters:
comment- The comment lines.- Returns:
- The same config tag.
-