All Known Subinterfaces:
IFlammableBehavior, IInteractionBehavior, IInteractionWithNeighborBlockUpdate, IInteractionWithNeighborBlockUpdateBehavior
All Known Implementing Classes:
FlammableBehavior

@ParametersAreNonnullByDefault public interface IInteraction

Api for creating behavior interface that have interactions between entity, block, fluid, or item

I split this from IInteractionBehavior just because to separate the abstract interactions and functionality implementation, usually you will neven need this class

Usually you will never need this, just use IInteractionBehavior

Since:
2.0
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    interactWithBlock(net.minecraft.world.level.LevelAccessor level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState interactant)
    Interact with a block
    default void
    interactWithBlockDestroyed(net.minecraft.world.level.LevelAccessor level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState interactant)
    Interact with a block *when* the fluid destroyed the block
    default void
    interactWithEntity(net.minecraft.core.BlockPos pos, net.minecraft.world.entity.Entity interactant)
    Interact with an entity
    default void
    interactWithFluid(net.minecraft.world.level.LevelAccessor level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.material.Fluid interactant)
    Interact with a fluid
    default void
    interactWithItem(net.minecraft.world.level.LevelAccessor level, net.minecraft.core.BlockPos pos, net.minecraft.world.item.ItemStack interactant)
    Interact with an item
  • Method Details

    • interactWithEntity

      default void interactWithEntity(net.minecraft.core.BlockPos pos, net.minecraft.world.entity.Entity interactant)

      Interact with an entity

      This will default call interactWithItem(LevelAccessor, BlockPos, ItemStack)

      when it's a ItemEntity
      Parameters:
      pos - The position of the block
      interactant - The entity that is interacting with the fluid
      Since:
      2.0
    • interactWithBlock

      default void interactWithBlock(net.minecraft.world.level.LevelAccessor level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState interactant)

      Interact with a block

      This will default call interactWithFluid(LevelAccessor, BlockPos, Fluid) when the block has a fluid state

      Parameters:
      level - The level
      pos - The position of the block
      interactant - The block that is interacting with the fluid
      Since:
      2.0
    • interactWithBlockDestroyed

      default void interactWithBlockDestroyed(net.minecraft.world.level.LevelAccessor level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState interactant)

      Interact with a block *when* the fluid destroyed the block

      This will default redirect to interactWithBlock(LevelAccessor, BlockPos, BlockState)

      Parameters:
      level - The level
      pos - The position of the block
      interactant - The block that is interacting with the fluid
      Since:
      2.0
    • interactWithFluid

      default void interactWithFluid(net.minecraft.world.level.LevelAccessor level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.material.Fluid interactant)

      Interact with a fluid

      Parameters:
      level - The level
      pos - The position of the block
      interactant - The fluid that is interacting with the fluid
      Since:
      2.0
    • interactWithItem

      default void interactWithItem(net.minecraft.world.level.LevelAccessor level, net.minecraft.core.BlockPos pos, net.minecraft.world.item.ItemStack interactant)

      Interact with an item

      Parameters:
      level - The level
      pos - The position of the block
      interactant - The item that is interacting with the fluid
      Since:
      2.0