All Known Implementing Classes:
CableDefault, CableTile, CableTileMultipartTicking

public interface ICable
Capability for cables that can form networks. Note that this is an UNSIDED capability, so only one should exist per side. This is because cable sides are too dependent of each other.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    canConnect(ICable connector, net.minecraft.core.Direction side)
    Check if this part should connect with the given cable for the given side.
    void
    Called when this cable is removed by a wrench.
    void
    disconnect(net.minecraft.core.Direction side)
    Disconnect the cable connection for a side.
    net.minecraft.world.item.ItemStack
     
    boolean
    isConnected(net.minecraft.core.Direction side)
    Check if this cable is connected to a side.
    void
    reconnect(net.minecraft.core.Direction side)
    Reconnect the cable connection for a side.
    void
    Update the cable connections.
  • Method Details

    • canConnect

      boolean canConnect(ICable connector, net.minecraft.core.Direction side)
      Check if this part should connect with the given cable for the given side. This method MUST NOT call the canConnect(ICable, Direction) method of the connector, this is checked externally, otherwise infinite loops will occur.
      Parameters:
      connector - The connecting block.
      side - The side of the connecting block.
      Returns:
      If it should connect.
    • updateConnections

      void updateConnections()
      Update the cable connections.
    • isConnected

      boolean isConnected(net.minecraft.core.Direction side)
      Check if this cable is connected to a side. This method should not check any neighbours, it should internally store the connection.
      Parameters:
      side - The side to check a connection for.
      Returns:
      If this block is connected with that side.
    • disconnect

      void disconnect(net.minecraft.core.Direction side)
      Disconnect the cable connection for a side.
      Parameters:
      side - The side to block the connection for.
    • reconnect

      void reconnect(net.minecraft.core.Direction side)
      Reconnect the cable connection for a side. Will only do something if the cable was previously disconnected.
      Parameters:
      side - The side to remake the connection for.
    • getItemStack

      net.minecraft.world.item.ItemStack getItemStack()
      Returns:
      The item stack that is dropped when breaking this cable, when using a wrench for example.
    • destroy

      void destroy()
      Called when this cable is removed by a wrench.