Interface EnergyNode

All Known Subinterfaces:
EnergyConductor
All Known Implementing Classes:
AbstractEnergyConductor, AbstractEnergyNode

public interface EnergyNode
Represents a node within the energy network capable of storing, receiving, and providing energy.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Codec<EnergyNode>
    Polymorphic codec for all energy node types.
  • Method Summary

    Modifier and Type
    Method
    Description
    default boolean
    canProvide(@Nullable org.bukkit.block.BlockFace side)
     
    default boolean
    canReceive(@Nullable org.bukkit.block.BlockFace side)
     
    default void
    connect(@Nullable org.bukkit.block.BlockFace side, EnergyNode other, @Nullable org.bukkit.block.BlockFace otherSide)
    Connects this node to another node.
    default void
    disconnect(@Nullable org.bukkit.block.BlockFace side, EnergyNode other, @Nullable org.bukkit.block.BlockFace otherSide)
    Disconnects this node from another node.
    double
    extract(@Nullable org.bukkit.block.BlockFace side, double amount, Action action)
    Extracts energy from this node.
    double
     
    Map<org.bukkit.block.BlockFace, EnergyNode>
     
    double
     
    @Nullable org.bukkit.Location
     
    double
     
    double
     
     
     
    double
    insert(@Nullable org.bukkit.block.BlockFace side, double amount, Action action)
    Inserts energy into this node.
  • Field Details

    • CODEC

      static final Codec<EnergyNode> CODEC
      Polymorphic codec for all energy node types.
  • Method Details

    • getEnergy

      double getEnergy()
      Returns:
      current stored energy
    • getCapacity

      double getCapacity()
      Returns:
      maximum energy capacity
    • getMaxInsert

      double getMaxInsert()
      Returns:
      max energy accepted per tick
    • getMaxExtract

      double getMaxExtract()
      Returns:
      max energy extracted per tick
    • getUnit

      EnergyUnit getUnit()
      Returns:
      unit used by this node
    • getType

      EnergyNodeType<?> getType()
      Returns:
      node type for serialization
    • getLocation

      @Nullable @Nullable org.bukkit.Location getLocation()
      Returns:
      physical location, or null if not bound to the world
    • insert

      double insert(@Nullable @Nullable org.bukkit.block.BlockFace side, double amount, Action action)
      Inserts energy into this node.
      Parameters:
      side - input side (nullable)
      amount - requested amount
      action - execution mode
      Returns:
      amount accepted
    • extract

      double extract(@Nullable @Nullable org.bukkit.block.BlockFace side, double amount, Action action)
      Extracts energy from this node.
      Parameters:
      side - output side (nullable)
      amount - requested amount
      action - execution mode
      Returns:
      amount extracted
    • getConnections

      Map<org.bukkit.block.BlockFace, EnergyNode> getConnections()
      Returns:
      map of connected nodes by face
    • connect

      default void connect(@Nullable @Nullable org.bukkit.block.BlockFace side, EnergyNode other, @Nullable @Nullable org.bukkit.block.BlockFace otherSide)
      Connects this node to another node.
    • disconnect

      default void disconnect(@Nullable @Nullable org.bukkit.block.BlockFace side, EnergyNode other, @Nullable @Nullable org.bukkit.block.BlockFace otherSide)
      Disconnects this node from another node.
    • canReceive

      default boolean canReceive(@Nullable @Nullable org.bukkit.block.BlockFace side)
      Returns:
      whether this node can receive energy
    • canProvide

      default boolean canProvide(@Nullable @Nullable org.bukkit.block.BlockFace side)
      Returns:
      whether this node can provide energy