Class Consume

java.lang.Object
mindustry.world.consumers.Consume
Direct Known Subclasses:
ConsumeItemDynamic, ConsumeItemFilter, ConsumeItems, ConsumeLiquidBase, ConsumeLiquids, ConsumeLiquidsDynamic, ConsumePayloadDynamic, ConsumePayloadFilter, ConsumePayloads, ConsumePower

public abstract class Consume extends Object
An abstract class that defines a type of resource that a block can consume.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    boolean
    If true, this consumer will be displayed as a boost input.
    Floatf<mindustry.gen.Building>
    Multiplier for costs.
    boolean
    If true, this consumer will not influence consumer validity.
    boolean
    If false, this consumer will still be checked, but it will need to updated manually.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    apply(Block block)
    Apply extra filters to a block.
     
    void
    build(mindustry.gen.Building build, Table table)
     
    void
    display(Stats stats)
     
    float
    efficiency(mindustry.gen.Building build)
     
    float
    efficiencyMultiplier(mindustry.gen.Building build)
     
    boolean
     
    optional(boolean optional, boolean boost)
     
    void
    trigger(mindustry.gen.Building build)
    Called when a consumption is triggered manually.
    update(boolean update)
     
    void
    update(mindustry.gen.Building build)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • optional

      public boolean optional
      If true, this consumer will not influence consumer validity.
    • booster

      public boolean booster
      If true, this consumer will be displayed as a boost input.
    • update

      public boolean update
      If false, this consumer will still be checked, but it will need to updated manually.
    • multiplier

      public Floatf<mindustry.gen.Building> multiplier
      Multiplier for costs. Does not work for power consumers.
  • Constructor Details

    • Consume

      public Consume()
  • Method Details

    • apply

      public void apply(Block block)
      Apply extra filters to a block.
    • optional

      public Consume optional(boolean optional, boolean boost)
    • boost

      public Consume boost()
    • update

      public Consume update(boolean update)
    • ignore

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

      public void build(mindustry.gen.Building build, Table table)
    • trigger

      public void trigger(mindustry.gen.Building build)
      Called when a consumption is triggered manually.
    • update

      public void update(mindustry.gen.Building build)
    • efficiency

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

      public float efficiencyMultiplier(mindustry.gen.Building build)
      Returns:
      multiplier for efficiency - this can be above 1. Will not influence a building's base efficiency value.
    • display

      public void display(Stats stats)