Record Class Palette
java.lang.Object
java.lang.Record
dev.despical.mazeengine.config.Palette
public record Palette(List<Palette.Entry> entries, Palette.Pattern pattern, int sectionSize)
extends Record
Stores validated block-state entries and their deterministic selection policy.
Entries pair portable block-state strings with positive finite weights. Parsing resolves Bukkit block data and applies solid, gravity, and decoration constraints appropriate to the palette's use. The entry list is copied and limited so a preset cannot publish an empty or unbounded palette.
Random selection consumes a supplied coordinate hash rather than a mutable random generator. Section patterns instead choose entries from X/Z sections. Both policies can reproduce the same block plan during creation, rebuilding, and repair when the saved preset and seed are retained.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordPairs a portable block-state string with its selection weight.static enumSelects how palette entries are applied to block coordinates. -
Constructor Summary
ConstructorsConstructorDescriptionPalette(List<Palette.Entry> entries) Palette(List<Palette.Entry> entries, Palette.Pattern pattern, int sectionSize) Creates an instance of aPaletterecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic Palettechoose(long hash) choose(long hash, int x, int z) entries()Returns the value of theentriesrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.static Palettepattern()Returns the value of thepatternrecord component.patterned(Palette.Pattern pattern, int size) intReturns the value of thesectionSizerecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Palette
-
Palette
Creates an instance of aPaletterecord class.- Parameters:
entries- the value for theentriesrecord componentpattern- the value for thepatternrecord componentsectionSize- the value for thesectionSizerecord component
-
-
Method Details
-
parse
-
choose
-
patterned
-
choose
-
caps
-
serialize
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
entries
Returns the value of theentriesrecord component.- Returns:
- the value of the
entriesrecord component
-
pattern
Returns the value of thepatternrecord component.- Returns:
- the value of the
patternrecord component
-
sectionSize
public int sectionSize()Returns the value of thesectionSizerecord component.- Returns:
- the value of the
sectionSizerecord component
-