Interface InteractionCondition

All Known Implementing Classes:
AlwaysFalseInteractionCondition, AlwaysTrueInteractionCondition, BlockIsOneOfInteractionCondition, BuildableInteractionCondition, CanBattleInteractionCondition, ContainsItemInteractionCondition, CooldownInteractionCondition, EqualInteractionCondition, GreaterThanInteractionCondition, GreaterThanOrEqualInteractionCondition, ImmutableInteractionCondition, InRangeExclusiveInteractionCondition, InRangeInclusiveInteractionCondition, ItemIsOneOfInteractionCondition, ItemsEqualInteractionCondition, ItemsTagsMatchInteractionCondition, LessThanInteractionCondition, LessThanOrEqualInteractionCondition, LogicalANDInteractionCondition, LogicalNANDInteractionCondition, LogicalNORInteractionCondition, LogicalNOTInteractionCondition, LogicalORInteractionCondition, LogicalXNORInteractionCondition, LogicalXORInteractionCondition, MonthIsInteractionCondition, MutableInteractionCondition, NotEqualInteractionCondition, NumberListContainsInteractionCondition, RandomChanceInteractionCondition, RecipeMatchesInteractionCondition, SpecMatchesEntityInteractionCondition, SpecMatchesInteractionCondition, StringCompareCaseInsensitiveInteractionCondition, StringCompareInteractionCondition, StringContainsInteractionCondition, StringListContainsInteractionCondition, StructureIsOneOfInteractionCondition

public interface InteractionCondition
This checks that the event fired, with the given context, is relevant to the interaction that the logic is flowing through.
  • Field Details

  • Method Details

    • codec

      com.mojang.serialization.Codec<? extends InteractionCondition> codec()
      Codec for decoding data about the interaction condition
      Returns:
      The codec
    • fits

      boolean fits(InteractionContext context)
      Method to check if the given context is correct for the condition
      Parameters:
      context - The context
      Returns:
      True if the logic can proceed with the given context
    • inputTypes

      default List<InputType<?>> inputTypes()
      Returns the input types for the condition
      Returns:
      The input types
    • fill

      @Internal default InteractionCondition fill(ConditionData data)
      Fills the condition with the given data
      Parameters:
      data - The data
      Returns:
      The filled condition
    • toData

      default ConditionData toData()
      Returns the sanitized data for the condition
      Returns:
      The data
    • from

      @Internal static InteractionCondition from(ConditionData data)
      Converts the network data into an interaction condition
      Parameters:
      data - The network data
      Returns:
      The interaction condition
    • always

      static InteractionCondition always()
      Returns an interaction condition that always returns true
      Returns:
      The interaction condition
    • never

      static InteractionCondition never()
      Returns an interaction condition that always returns false
      Returns:
      The interaction condition
    • builder

      Creates a builder for an interaction condition
      Returns:
      The builder