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
FieldsModifier and TypeFieldDescriptionstatic final Codec<EnergyNode> Polymorphic codec for all energy node types. -
Method Summary
Modifier and TypeMethodDescriptiondefault booleancanProvide(@Nullable org.bukkit.block.BlockFace side) default booleancanReceive(@Nullable org.bukkit.block.BlockFace side) default voidconnect(@Nullable org.bukkit.block.BlockFace side, EnergyNode other, @Nullable org.bukkit.block.BlockFace otherSide) Connects this node to another node.default voiddisconnect(@Nullable org.bukkit.block.BlockFace side, EnergyNode other, @Nullable org.bukkit.block.BlockFace otherSide) Disconnects this node from another node.doubleExtracts energy from this node.doubleMap<org.bukkit.block.BlockFace, EnergyNode> double@Nullable org.bukkit.LocationdoubledoublegetType()getUnit()doubleInserts energy into this node.
-
Field Details
-
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
Inserts energy into this node.- Parameters:
side- input side (nullable)amount- requested amountaction- execution mode- Returns:
- amount accepted
-
extract
Extracts energy from this node.- Parameters:
side- output side (nullable)amount- requested amountaction- 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
-