Class EnergyData

java.lang.Object
mcp.mobius.waila.api.data.EnergyData
All Implemented Interfaces:
IData

@NonExtendable public abstract class EnergyData extends Object implements IData
Adds an energy information to an object.
  • Field Details

    • ID

      public static final ResourceLocation ID
    • TYPE

      public static final IData.Type<EnergyData> TYPE
    • DEFAULT_NAME

      public static final Component DEFAULT_NAME
      The default energy name translation key.
    • DEFAULT_COLOR

      public static final int DEFAULT_COLOR
      The default energy bar color.
      See Also:
    • DEFAULT_UNIT

      public static final String DEFAULT_UNIT
      The default unit of energy that will be shown, depending on the platform.

      E will be used on Fabric/Quilt and FE on Forge.

    • INFINITE

      public static final EnergyData INFINITE
      An infinite energy data.
      See Also:
  • Constructor Details

    • EnergyData

      public EnergyData()
  • Method Details

    • newInfiniteProvider

      public static <T> IDataProvider<T> newInfiniteProvider()
      Creates a data provider that always returns infinite energy data.

      Should probably be used with a higher (lower number) priority than the default.

      Along with this method, Waila also provides waila:extra/infinite_energy tag that can be used for marking blocks, block entity types, or entity types to contain infinite energy.

      See Also:
    • describe

      @ClientOnly public static EnergyData.Description describe(String namespace)
      Sets the default values that will be applied for objects from the specified namespace.
    • of

      public static EnergyData of(double stored, double capacity)
      Creates a energy data.
      Parameters:
      stored - the stored energy, from 0.0 to infinity
      capacity - the energy storage capacity, from 1.0 to infinity