Package com.minecolonies.core.event
Record Class ColonyStoryListener.StoryText
java.lang.Object
java.lang.Record
com.minecolonies.core.event.ColonyStoryListener.StoryText
- Record Components:
biomeFilter- the filter that passes any biome where this story is valid.content- the text content.
- Enclosing class:
ColonyStoryListener
public static record ColonyStoryListener.StoryText(com.minecolonies.core.event.ColonyStoryListener.BiomeFilter biomeFilter, String content)
extends Record
A bit of story text that is filterable by biome.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionallMatches(Collection<ColonyStoryListener.StoryText> stories, net.minecraft.core.Holder<net.minecraft.world.level.biome.Biome> biome) Builds a list of all possible matches from a collection ofColonyStoryListener.StoryText.com.minecolonies.core.event.ColonyStoryListener.BiomeFilterReturns the value of thebiomeFilterrecord component.content()Returns the value of thecontentrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanmatches(net.minecraft.core.Holder<net.minecraft.world.level.biome.Biome> biome) Check if the given biome is valid for this story text.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
StoryText
public StoryText(com.minecolonies.core.event.ColonyStoryListener.BiomeFilter biomeFilter, String content) Creates an instance of aStoryTextrecord class.- Parameters:
biomeFilter- the value for thebiomeFilterrecord componentcontent- the value for thecontentrecord component
-
-
Method Details
-
matches
public boolean matches(net.minecraft.core.Holder<net.minecraft.world.level.biome.Biome> biome) Check if the given biome is valid for this story text.- Parameters:
biome- the biome to check.- Returns:
- true if valid.
-
allMatches
public static List<String> allMatches(Collection<ColonyStoryListener.StoryText> stories, net.minecraft.core.Holder<net.minecraft.world.level.biome.Biome> biome) Builds a list of all possible matches from a collection ofColonyStoryListener.StoryText.- Parameters:
stories- the collection.biome- the biome to match against.- Returns:
- a list of matching content.
-
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. All components in this record class are compared withObjects::equals(Object,Object). -
biomeFilter
public com.minecolonies.core.event.ColonyStoryListener.BiomeFilter biomeFilter()Returns the value of thebiomeFilterrecord component.- Returns:
- the value of the
biomeFilterrecord component
-
content
Returns the value of thecontentrecord component.- Returns:
- the value of the
contentrecord component
-