Interface ConnectionPredicate

All Known Subinterfaces:
SensitiveConnectionPredicate
All Known Implementing Classes:
AndConnectionPredicate, IsFaceVisibleConnectionPredicate, IsSameBlockConnectionPredicate, IsSameStateConnectionPredicate, MatchBlockConnectionPredicate, MatchStateConnectionPredicate, NotConnectionPredicate, OrConnectionPredicate

public interface ConnectionPredicate
A predicate used to determine whether a model should connect to with another block.

Created 27/04/2023 by SuperMartijn642

  • Method Summary

    Modifier and Type
    Method
    Description
    and(ConnectionPredicate... predicates)
    Adds a requirement to this predicate.
     
    default boolean
    Determines whether this connection predicate depends on the level and should always be reevaluated.
    Negates the output of this resource condition.
    or(ConnectionPredicate... predicates)
    Adds an alternative to this predicate.
    boolean
    shouldConnect(net.minecraft.core.Direction side, @Nullable net.minecraft.world.level.block.state.BlockState ownState, net.minecraft.world.level.block.state.BlockState otherState, net.minecraft.world.level.block.state.BlockState blockInFront, ConnectionDirection direction)
    Determines whether the model should connect to the given direction.
    default boolean
    shouldConnect(net.minecraft.world.level.BlockGetter level, net.minecraft.core.BlockPos pos, net.minecraft.core.Direction side, @Nullable net.minecraft.world.level.block.state.BlockState ownState, net.minecraft.world.level.block.state.BlockState otherState, net.minecraft.world.level.block.state.BlockState blockInFront, ConnectionDirection direction)
    Determines whether the model should connect to the given direction.
  • Method Details

    • shouldConnect

      boolean shouldConnect(net.minecraft.core.Direction side, @Nullable @Nullable net.minecraft.world.level.block.state.BlockState ownState, net.minecraft.world.level.block.state.BlockState otherState, net.minecraft.world.level.block.state.BlockState blockInFront, ConnectionDirection direction)
      Determines whether the model should connect to the given direction.
      Parameters:
      side - side of the block which the relevant texture is on
      ownState - state of the block itself
      otherState - state of the block in the connection direction
      blockInFront - state in front of otherstate
      direction - direction to check
      Returns:
      true if the texture should connect in the given direction
      Throws:
      IllegalStateException - when the predicate is sensitive, i.e. isSensitive() returns true
    • shouldConnect

      default boolean shouldConnect(net.minecraft.world.level.BlockGetter level, net.minecraft.core.BlockPos pos, net.minecraft.core.Direction side, @Nullable @Nullable net.minecraft.world.level.block.state.BlockState ownState, net.minecraft.world.level.block.state.BlockState otherState, net.minecraft.world.level.block.state.BlockState blockInFront, ConnectionDirection direction)
      Determines whether the model should connect to the given direction. Sensitive version of shouldConnect(Direction, BlockState, BlockState, BlockState, ConnectionDirection). If this method should be used, isSensitive() must return true.
      Parameters:
      side - side of the block which the relevant texture is on
      ownState - state of the block itself
      otherState - state of the block in the connection direction
      blockInFront - state in front of otherstate
      direction - direction to check
      Returns:
      true if the texture should connect in the given direction
    • isSensitive

      default boolean isSensitive()
      Determines whether this connection predicate depends on the level and should always be reevaluated. If true is returned shouldConnect(Direction, BlockState, BlockState, BlockState, ConnectionDirection) may throw an IllegalStateException. If false is returned, it is assumed that the connection predicate may be cached for the values supplied in shouldConnect(Direction, BlockState, BlockState, BlockState, ConnectionDirection).
      See Also:
    • getSerializer

      Serializer<? extends ConnectionPredicate> getSerializer()
      Returns:
      the serializer for this predicate
    • and

      default ConnectionPredicate and(ConnectionPredicate... predicates)
      Adds a requirement to this predicate.
    • or

      default ConnectionPredicate or(ConnectionPredicate... predicates)
      Adds an alternative to this predicate.
    • negate

      default ConnectionPredicate negate()
      Negates the output of this resource condition.