Class ConsumePower

java.lang.Object
mindustry.world.consumers.Consume
mindustry.world.consumers.ConsumePower
Direct Known Subclasses:
ConsumePowerCondition, ConsumePowerDynamic

public class ConsumePower extends Consume
Consumer class for blocks which consume power while being connected to a power graph.
  • Field Details

    • usage

      public float usage
      The maximum amount of power which can be processed per tick. This might influence efficiency or load a buffer.
    • capacity

      public float capacity
      The maximum power capacity in power units.
    • buffered

      public boolean buffered
      True if the module can store power.
  • Constructor Details

    • ConsumePower

      public ConsumePower(float usage, float capacity, boolean buffered)
    • ConsumePower

      protected ConsumePower()
  • Method Details

    • apply

      public void apply(Block block)
      Description copied from class: Consume
      Apply extra filters to a block.
      Overrides:
      apply in class Consume
    • ignore

      public boolean ignore()
      Overrides:
      ignore in class Consume
      Returns:
      if true, this consumer will be ignored in the consumer list (no updates or valid() checks)
    • efficiency

      public float efficiency(mindustry.gen.Building build)
      Overrides:
      efficiency in class Consume
      Returns:
      [0, 1] efficiency multiplier based on input. Returns 0 if not valid in subclasses. Should return fraction if needs are partially met.
    • display

      public void display(Stats stats)
      Overrides:
      display in class Consume
    • requestedPower

      public float requestedPower(mindustry.gen.Building entity)
      Retrieves the amount of power which is requested for the given block and entity.
      Parameters:
      entity - The entity which contains the power module.
      Returns:
      The amount of power which is requested per tick.