Package de.Keyle.MyPet.api.gui
Record Class ValueBarSection
java.lang.Object
java.lang.Record
de.Keyle.MyPet.api.gui.ValueBarSection
- Record Components:
id- this section's id within its menutype- the registered type handle this section was decoded ascol- left-hand column of the barrow- the bar's rowwidth- bar length in slots, from 1 to 9lowItem- appearance of cells above the fill positionhighItem- appearance of cells at or below the fill positionsoundOnClick- played when a cell is clicked
- All Implemented Interfaces:
Section
public record ValueBarSection(String id, SectionType<ValueBarSection> type, int col, int row, int width, ItemAppearance lowItem, ItemAppearance highItem, SoundSpec soundOnClick)
extends Record
implements Section
One-row horizontal slider. Cells
[0..position] render with
highItem, cells (position..width-1] with lowItem.
The handler supplies the fill position via MenuHandler.valueBarPosition(C, java.lang.String).
Each cell exposes a <percent> placeholder.-
Constructor Summary
ConstructorsConstructorDescriptionValueBarSection(String id, SectionType<ValueBarSection> type, int col, int row, int width, ItemAppearance lowItem, ItemAppearance highItem, SoundSpec soundOnClick) Rejects an out-of-range width or absent cell appearance, and substitutes silence for an absent sound. -
Method Summary
Modifier and TypeMethodDescriptionintcol()Returns the value of thecolrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.highItem()Returns the value of thehighItemrecord component.id()Returns the value of theidrecord component.lowItem()Returns the value of thelowItemrecord component.intpercentAt(int index) Returns the percentage a given cell of the bar represents, for the<percent>placeholder.introw()Returns the value of therowrecord component.Returns the value of thesoundOnClickrecord component.final StringtoString()Returns a string representation of this record class.type()Returns the value of thetyperecord component.intwidth()Returns the value of thewidthrecord component.
-
Constructor Details
-
ValueBarSection
public ValueBarSection(String id, SectionType<ValueBarSection> type, int col, int row, int width, ItemAppearance lowItem, ItemAppearance highItem, SoundSpec soundOnClick) Rejects an out-of-range width or absent cell appearance, and substitutes silence for an absent sound.
-
-
Method Details
-
percentAt
public int percentAt(int index) Returns the percentage a given cell of the bar represents, for the<percent>placeholder.- Parameters:
index- 0-indexed cell position within the bar- Returns:
- the percentage from 0 to 100; always 100 for a one-cell bar
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
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 '=='. -
id
Returns the value of theidrecord component. -
type
Returns the value of thetyperecord component. -
col
public int col()Returns the value of thecolrecord component.- Returns:
- the value of the
colrecord component
-
row
public int row()Returns the value of therowrecord component.- Returns:
- the value of the
rowrecord component
-
width
public int width()Returns the value of thewidthrecord component.- Returns:
- the value of the
widthrecord component
-
lowItem
Returns the value of thelowItemrecord component.- Returns:
- the value of the
lowItemrecord component
-
highItem
Returns the value of thehighItemrecord component.- Returns:
- the value of the
highItemrecord component
-
soundOnClick
Returns the value of thesoundOnClickrecord component.- Returns:
- the value of the
soundOnClickrecord component
-