Interface IPlacementHandler

All Known Implementing Classes:
BlockTagSubstitutionPlacementHandler, DoBlockPlacementHandler, DoDoorBlockPlacementHandler, PlacementHandlers.AirPlacementHandler, PlacementHandlers.BannerPlacementHandler, PlacementHandlers.BedPlacementHandler, PlacementHandlers.BlackListedBlockPlacementHandler, PlacementHandlers.BlockGrassPathPlacementHandler, PlacementHandlers.ContainerPlacementHandler, PlacementHandlers.DoorPlacementHandler, PlacementHandlers.DoublePlantPlacementHandler, PlacementHandlers.DripStoneBlockPlacementHandler, PlacementHandlers.FallingBlockPlacementHandler, PlacementHandlers.FirePlacementHandler, PlacementHandlers.FlowerPotPlacementHandler, PlacementHandlers.FluidSubstitutionPlacementHandler, PlacementHandlers.GeneralBlockPlacementHandler, PlacementHandlers.GrassPlacementHandler, PlacementHandlers.HopperClientLagPlacementHandler, PlacementHandlers.SolidSubstitutionPlacementHandler, PlacementHandlers.SpecialBlockPlacementAttemptHandler, PlacementHandlers.SubstitutionPlacementHandler

public interface IPlacementHandler
Handler for all kinds of placements.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static enum 
    Possible result of an IPlacementHandler call.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    canHandle(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState blockState)
    Check if a placement handler can handle a certain block.
    static boolean
    doesWorldStateMatchBlueprintState(@NotNull BlockInfo blockInfo, @NotNull net.minecraft.core.BlockPos worldPos, @NotNull IStructureHandler structureHandler)
     
    boolean
    doesWorldStateMatchBlueprintState(net.minecraft.world.level.block.state.BlockState worldState, net.minecraft.world.level.block.state.BlockState blueprintState, @Nullable net.minecraft.util.Tuple<net.minecraft.world.level.block.entity.BlockEntity,net.minecraft.nbt.CompoundTag> blockEntityData, @NotNull IPlacementContext placementContext)
    Method used to compare blueprint state with world state to detect if changes are necessary.
    List<net.minecraft.world.item.ItemStack>
    getRequiredItems(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState blockState, @Nullable net.minecraft.nbt.CompoundTag tileEntityData, @NotNull IPlacementContext placementContext)
    Method used to get the required items to place a block.
    handle(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos worldPos, net.minecraft.world.level.block.state.BlockState blockState, @Nullable net.minecraft.nbt.CompoundTag tileEntityData, @NotNull IPlacementContext placementContext)
    Method used to handle the processing of a Placement of a block.
    default void
    handleRemoval(IStructureHandler handler, net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos)
    Handles the removal of the existing block in the world
    default void
    handleRemoval(IStructureHandler handler, net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos, net.minecraft.nbt.CompoundTag tileEntityData)
    Handles the removal of the existing block in the world
  • Method Details

    • doesWorldStateMatchBlueprintState

      static boolean doesWorldStateMatchBlueprintState(@NotNull @NotNull BlockInfo blockInfo, @NotNull @NotNull net.minecraft.core.BlockPos worldPos, @NotNull @NotNull IStructureHandler structureHandler)
    • canHandle

      boolean canHandle(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState blockState)
      Check if a placement handler can handle a certain block.
      Parameters:
      world - the world.
      pos - the position.
      blockState - the blockState.
      Returns:
      true if so.
    • handle

      IPlacementHandler.ActionProcessingResult handle(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos worldPos, net.minecraft.world.level.block.state.BlockState blockState, @Nullable @Nullable net.minecraft.nbt.CompoundTag tileEntityData, @NotNull @NotNull IPlacementContext placementContext)
      Method used to handle the processing of a Placement of a block.
      Parameters:
      world - receives the world.
      worldPos - the position.
      blockState - the blockState.
      tileEntityData - the placer of the block.
      placementContext - extended placement context.
      Returns:
      ACCEPT, DENY or IGNORE.
    • handleRemoval

      default void handleRemoval(IStructureHandler handler, net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos, net.minecraft.nbt.CompoundTag tileEntityData)
      Handles the removal of the existing block in the world
      Parameters:
      handler - the actor removing the block
      world - the world this block belongs to
      pos - the position of the block
      tileEntityData - any tile entity data in the blueprint
    • handleRemoval

      default void handleRemoval(IStructureHandler handler, net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos)
      Handles the removal of the existing block in the world
      Parameters:
      handler - the actor removing the block
      world - the world this block belongs to
      pos - the position of the block
    • getRequiredItems

      List<net.minecraft.world.item.ItemStack> getRequiredItems(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState blockState, @Nullable @Nullable net.minecraft.nbt.CompoundTag tileEntityData, @NotNull @NotNull IPlacementContext placementContext)
      Method used to get the required items to place a block.
      Parameters:
      world - receives the world.
      pos - the position.
      blockState - the blockState.
      tileEntityData - the placer of the block.
      placementContext - the placement context.
      Returns:
      the list of items.
    • doesWorldStateMatchBlueprintState

      boolean doesWorldStateMatchBlueprintState(net.minecraft.world.level.block.state.BlockState worldState, net.minecraft.world.level.block.state.BlockState blueprintState, @Nullable @Nullable net.minecraft.util.Tuple<net.minecraft.world.level.block.entity.BlockEntity,net.minecraft.nbt.CompoundTag> blockEntityData, @NotNull @NotNull IPlacementContext placementContext)
      Method used to compare blueprint state with world state to detect if changes are necessary.
      Returns:
      true if world state matches blueprint state.