Schnittstelle EntityBlockProvider

Alle Superschnittstellen:
net.minecraft.world.level.block.EntityBlock
Alle bekannten Implementierungsklassen:
UEntityBlock

public interface EntityBlockProvider extends net.minecraft.world.level.block.EntityBlock
Provides a convenience way to implement block entities for blocks.
  • Methodenübersicht

    Modifizierer und Typ
    Methode
    Beschreibung
    net.minecraft.world.level.block.entity.BlockEntityType<?>
    blockEntityType(net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state)
    Returns the BlockEntityType that is used for creating the BlockEntity when newBlockEntity(BlockPos, BlockState) is invoked.
    default <T extends net.minecraft.world.level.block.entity.BlockEntity>
    Optional<T>
    getBlockEntity(net.minecraft.world.level.BlockGetter level, net.minecraft.core.BlockPos pos)
    Returns a optional with can contain the BlockEntity at that give position if the BlockEntityType is correct.
    default net.minecraft.world.level.block.entity.BlockEntity
    newBlockEntity(net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state)
    Returns a new BlockEntity for the give BlockPos and BlockState.
    default net.minecraft.world.InteractionResult
    openMenu(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.world.entity.player.Player player)
    Opens the menu that is specified in the block entity with MenuConstructor.
    default net.minecraft.world.InteractionResult
    openMenu(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.world.entity.player.Player player, boolean canOpenWhenSecondaryUse)
    Opens the menu that is specified in the block entity with MenuConstructor.

    Von Schnittstelle geerbte Methoden net.minecraft.world.level.block.EntityBlock

    getListener, getTicker
  • Methodendetails

    • blockEntityType

      net.minecraft.world.level.block.entity.BlockEntityType<?> blockEntityType(net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state)
      Returns the BlockEntityType that is used for creating the BlockEntity when newBlockEntity(BlockPos, BlockState) is invoked. Can return null if for the current state or position no block entity should be created.
      Parameter:
      pos - Position of the block
      state - Block state
    • newBlockEntity

      default net.minecraft.world.level.block.entity.BlockEntity newBlockEntity(net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state)
      Returns a new BlockEntity for the give BlockPos and BlockState.
      The default implementation creates a new BlockEntity by using the blockEntityType(BlockPos, BlockState) method and invoke BlockEntityType.create(BlockPos, BlockState) Can return null if no block entity should be created for that position or state.
      Angegeben von:
      newBlockEntity in Schnittstelle net.minecraft.world.level.block.EntityBlock
      Parameter:
      pos - Position of the block
      state - Block state
    • getBlockEntity

      default <T extends net.minecraft.world.level.block.entity.BlockEntity> Optional<T> getBlockEntity(net.minecraft.world.level.BlockGetter level, net.minecraft.core.BlockPos pos)
      Returns a optional with can contain the BlockEntity at that give position if the BlockEntityType is correct. Otherwise returns an empty optional.
      Typparameter:
      T - Block entity
      Parameter:
      level - Level
      pos - Position of the block
      Gibt zurück:
      Optional with the block entity
    • openMenu

      default net.minecraft.world.InteractionResult openMenu(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.world.entity.player.Player player)
      Opens the menu that is specified in the block entity with MenuConstructor. If the block entity implements MenuSyncedBlockEntity then the MenuSyncedBlockEntity.sendInitialMenuDataToClient(FriendlyByteBuf) is called and the data will be send to the client. The container cannot be opened when secondary use is active.
      Parameter:
      level - Level
      pos - The block entities position
      player - The player that opens the block entity
      Gibt zurück:
      InteractionResult if the container could be opened
    • openMenu

      default net.minecraft.world.InteractionResult openMenu(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.world.entity.player.Player player, boolean canOpenWhenSecondaryUse)
      Opens the menu that is specified in the block entity with MenuConstructor. If the block entity implements MenuSyncedBlockEntity then the MenuSyncedBlockEntity.sendInitialMenuDataToClient(FriendlyByteBuf) is called and the data will be send to the client.
      Parameter:
      level - Level
      pos - The block entities position
      player - The player that opens the block entity
      canOpenWhenSecondaryUse - If the container can be opened when secondary use is active
      Gibt zurück:
      InteractionResult if the container could be opened