Interface GenericPeripheral

All Superinterfaces:
GenericSource

public interface GenericPeripheral extends GenericSource
A GenericSource which provides methods for a peripheral.

Unlike a GenericSource, all methods should target the same type, for instance a block entity subclass. This is not currently enforced.

  • Method Summary

    Modifier and Type
    Method
    Description
    Get the type of the exposed peripheral.

    Methods inherited from interface dan200.computercraft.api.lua.GenericSource

    id
  • Method Details

    • getType

      default PeripheralType getType()
      Get the type of the exposed peripheral.

      Unlike normal IPeripherals, GenericPeripheral do not have to have a type. By default, the resulting peripheral uses the resource name of the wrapped block entity (for instance minecraft:chest).

      However, in some cases it may be more appropriate to specify a more readable name. Overriding this method allows you to do so.

      When multiple GenericPeripherals return a non-empty peripheral type for a single tile entity, the lexicographically smallest will be chosen. In order to avoid this conflict, this method should only be implemented when your peripheral targets a single tile entity AND it's likely that you're the only mod to do so. Similarly this should NOT be implemented when your methods target a capability or other interface (such as Forge's IItemHandler).

      Returns:
      The type of this peripheral or PeripheralType.untyped().
      See Also: