Interface InteractableVolume

    • Method Detail

      • hitBlock

        default boolean hitBlock​(Vector3i position,
                                 Direction side,
                                 GameProfile profile)
        Simulates hitting a block as if a player had done so.

        The difference between this and digBlock(org.spongepowered.math.vector.Vector3i, org.spongepowered.api.profile.GameProfile) is that this will only do a single instantaneous "click" whereas digBlock will simulate holding the primary mouse button until the block breaks.

        Parameters:
        position - The position of the block
        side - The side of the block to interact with
        profile - The game profile of the player this is imitating
        Returns:
        True if the interact succeeded
      • hitBlock

        boolean hitBlock​(int x,
                         int y,
                         int z,
                         Direction side,
                         GameProfile profile)
        Simulates hitting a block as if a player had done so.

        The difference between this and digBlock(org.spongepowered.math.vector.Vector3i, org.spongepowered.api.profile.GameProfile) is that this will only do a single instantaneous "click" whereas digBlock will simulate holding the primary mouse button until the block breaks.

        Parameters:
        x - The X position
        y - The Y position
        z - The Z position
        side - The side of the block to interact with
        profile - The game profile of the player this is imitating
        Returns:
        True if the interact succeeded
      • interactBlock

        default boolean interactBlock​(Vector3i position,
                                      Direction side,
                                      GameProfile profile)
        Simulates the interaction the block as if a player had done so.
        Parameters:
        position - The position of the block
        side - The side of the block to interact with
        profile - The game profile of the player this is imitating
        Returns:
        True if the interact succeeded
      • interactBlock

        boolean interactBlock​(int x,
                              int y,
                              int z,
                              Direction side,
                              GameProfile profile)
        Simulates the interaction the block as if a player had done so.
        Parameters:
        x - The X position
        y - The Y position
        z - The Z position
        side - The side of the block to interact with
        profile - The game profile of the player this is imitating
        Returns:
        True if the interact succeeded
      • interactBlockWith

        default boolean interactBlockWith​(Vector3i position,
                                          ItemStack itemStack,
                                          Direction side,
                                          GameProfile profile)
        Simulates the interaction the block using the given item as if the player had done so.
        Parameters:
        position - The position of the block
        itemStack - The item
        side - The side of the block to interact with
        profile - The game profile of the player this is imitating
        Returns:
        True if the interact succeeded
      • interactBlockWith

        boolean interactBlockWith​(int x,
                                  int y,
                                  int z,
                                  ItemStack itemStack,
                                  Direction side,
                                  GameProfile profile)
        Simulates the interaction the block using the given item as if the player had done so.
        Parameters:
        x - The X position
        y - The Y position
        z - The Z position
        itemStack - The item
        side - The side of the block to interact with
        profile - The game profile of the player this is imitating
        Returns:
        True if the interact succeeded
      • placeBlock

        default boolean placeBlock​(Vector3i position,
                                   BlockState block,
                                   Direction side,
                                   GameProfile profile)
        Simulates the placement of a block at the given location as if a player had done so.
        Parameters:
        position - The position of the block
        block - The block state to be set to
        side - The face of the block to place on
        profile - The game profile of the player this is imitating
        Returns:
        Whether the block was successfully set
      • placeBlock

        boolean placeBlock​(int x,
                           int y,
                           int z,
                           BlockState block,
                           Direction side,
                           GameProfile profile)
        Simulates the placement of a block at the given location as if a player had done so.
        Parameters:
        x - The X position
        y - The Y position
        z - The Z position
        block - The block state to be set to
        side - The face of the block to place on
        profile - The game profile of the player this is imitating
        Returns:
        Whether the block was successfully set
      • digBlock

        default boolean digBlock​(Vector3i position,
                                 GameProfile profile)
        Simulate the digging of the block as if a player had done so.
        Parameters:
        position - The position of the block
        profile - The game profile of the player this is imitating
        Returns:
        Whether the block was destroyed
      • digBlock

        boolean digBlock​(int x,
                         int y,
                         int z,
                         GameProfile profile)
        Simulate the digging of the block as if a player had done so.
        Parameters:
        x - The X position
        y - The Y position
        z - The Z position
        profile - The game profile of the player this is imitating
        Returns:
        Whether the block was destroyed
      • digBlockWith

        default boolean digBlockWith​(Vector3i position,
                                     ItemStack itemStack,
                                     GameProfile profile)
        Simulate the digging of the block with the given tool as if a player had done so.
        Parameters:
        position - The position of the block
        itemStack - The tool
        profile - The game profile of the player this is imitating
        Returns:
        Whether the block was destroyed
      • digBlockWith

        boolean digBlockWith​(int x,
                             int y,
                             int z,
                             ItemStack itemStack,
                             GameProfile profile)
        Simulate the digging of the block with the given tool as if a player had done so.
        Parameters:
        x - The X position
        y - The Y position
        z - The Z position
        itemStack - The tool
        profile - The game profile of the player this is imitating
        Returns:
        Whether the block was destroyed
      • blockDigTimeWith

        default Duration blockDigTimeWith​(Vector3i position,
                                          ItemStack itemStack,
                                          GameProfile profile)
        Gets the Duration it takes to dig this block with the specified item.
        Parameters:
        position - The position of the block
        itemStack - The item to pretend-dig with
        profile - The game profile of the player this is imitating
        Returns:
        The duration it takes to dig the block
      • blockDigTimeWith

        Duration blockDigTimeWith​(int x,
                                  int y,
                                  int z,
                                  ItemStack itemStack,
                                  GameProfile profile)
        Gets the Duration it takes to dig this block with the specified item.
        Parameters:
        x - The X position
        y - The Y position
        z - The Z position
        itemStack - The item to pretend-dig with
        profile - The game profile of the player this is imitating
        Returns:
        The duration it takes to dig the block