Package me.desht.pneumaticcraft.api.misc
Interface IPlayerMatcher
- All Superinterfaces:
Predicate<net.minecraft.world.entity.player.Player>
- All Known Implementing Classes:
BiomeMatcher,DimensionMatcher,GamestagesMatcher
A player matcher predicate with potential multiple uses - currently used by the Amadron tablet to check if a
particular offer is usable by a player.
This matcher should be able to run on both client and server.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceIPlayerMatcher.MatcherFactory<T extends IPlayerMatcher>Implement this and register it viaIMiscHelpers.registerPlayerMatcher(ResourceLocation, MatcherFactory). -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDescription(net.minecraft.world.entity.player.Player player, List<net.minecraft.network.chat.Component> tooltip) Add this matcher's information to a tooltip.default voidstandardTooltip(net.minecraft.world.entity.player.Player player, List<net.minecraft.network.chat.Component> tooltip, net.minecraft.network.chat.Component header, List<net.minecraft.network.chat.Component> itemList) Utility method to add a standardised tooltip for a matcher.voidtoBytes(net.minecraft.network.FriendlyByteBuf buffer) Serialize this matcher object to a packet buffer, for sync'ing to clientscom.google.gson.JsonElementtoJson()Serialize this matcher object to JSON, for data generation.
-
Method Details
-
toBytes
void toBytes(net.minecraft.network.FriendlyByteBuf buffer) Serialize this matcher object to a packet buffer, for sync'ing to clients- Parameters:
buffer- a packet buffer
-
toJson
com.google.gson.JsonElement toJson()Serialize this matcher object to JSON, for data generation.- Returns:
- a JSON element
-
addDescription
void addDescription(net.minecraft.world.entity.player.Player player, List<net.minecraft.network.chat.Component> tooltip) Add this matcher's information to a tooltip. This is used for example by the Amadron Tablet GUI to show information about this matcher.- Parameters:
player- the relevant playertooltip- a tooltip list
-
standardTooltip
default void standardTooltip(net.minecraft.world.entity.player.Player player, List<net.minecraft.network.chat.Component> tooltip, net.minecraft.network.chat.Component header, List<net.minecraft.network.chat.Component> itemList) Utility method to add a standardised tooltip for a matcher. Don't override this - it is strongly recommended to call it fromaddDescription(Player, List)for a consistent tooltip for all matchers.- Parameters:
player- the player, as received byaddDescription(Player, List)tooltip- tooltip to add to, as received byaddDescription(Player, List)header- the header text lineitemList- a list of items that this matcher matches against
-