Interface IReplaceableBlock


public interface IReplaceableBlock
Used in IPlacementHelpers if this Block can replace or be replaced by others
  • Method Summary

    Modifier and Type
    Method
    Description
    default boolean
    canBeReplaced(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState existingState, net.minecraft.world.level.block.state.BlockState newState, net.minecraft.world.entity.player.Player player)
     
    net.minecraft.world.level.block.state.BlockState
    getReplacedState(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState existingState, net.minecraft.world.level.block.state.BlockState newState, net.minecraft.world.entity.player.Player player)
    Get the result of "replacing" existingState with newState.
  • Method Details

    • canBeReplaced

      default boolean canBeReplaced(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState existingState, net.minecraft.world.level.block.state.BlockState newState, net.minecraft.world.entity.player.Player player)
    • getReplacedState

      net.minecraft.world.level.block.state.BlockState getReplacedState(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState existingState, net.minecraft.world.level.block.state.BlockState newState, net.minecraft.world.entity.player.Player player)
      Get the result of "replacing" existingState with newState. Essentially, what should happen be the result if both these BlockStates are placed in the same block space. If both the Blocks of the existing BlockState and the one to be placed implement IReplaceableBlock, this should ideally be symmetrical but the already-placed BlockState will take priority.
      Parameters:
      level -
      pos -
      existingState -
      newState -
      player -
      Returns:
      A combined BlockState if the two states can go together, or null if they cannot be combined