java.lang.Object
org.cyclops.integrateddynamics.core.helper.Helpers

public final class Helpers extends Object
Helper methods.
  • Field Details

    • SELECTOR_IS_PLAYER

      public static final com.google.common.base.Predicate<net.minecraft.world.entity.Entity> SELECTOR_IS_PLAYER
  • Constructor Details

    • Helpers

      public Helpers()
  • Method Details

    • getFluidStack

      public static net.minecraftforge.fluids.FluidStack getFluidStack(net.minecraft.world.item.ItemStack itemStack)
      Get the fluidstack from the given itemstack.
      Parameters:
      itemStack - The itemstack.
      Returns:
      The fluidstack or null.
    • getFluidStackCapacity

      public static int getFluidStackCapacity(net.minecraft.world.item.ItemStack itemStack)
      Get the fluidstack capacity from the given itemstack.
      Parameters:
      itemStack - The itemstack.
      Returns:
      The capacity
    • getTagValues

      public static Stream<net.minecraft.world.item.ItemStack> getTagValues(String name) throws net.minecraft.ResourceLocationException
      Retrieves a Stream of items that are registered to this tag name.
      Parameters:
      name - The tag name, directly calls OreDictionary.getOres
      Returns:
      A Stream containing ItemStacks registered for this ore
      Throws:
      net.minecraft.ResourceLocationException
    • joinList

      public static <T> List<T> joinList(List<T> list, T newElement)
      Add the given element to a copy of the given list/
      Type Parameters:
      T - The type.
      Parameters:
      list - The list.
      newElement - The element.
      Returns:
      The new joined list.
    • createPatternOfLength

      public static String createPatternOfLength(int length)
      Create a string of 'length' times '%s' seperated by ','.
      Parameters:
      length - The length for the series of '%s'.
      Returns:
      The string.
    • getInterface

      public static <C> Optional<C> getInterface(org.cyclops.cyclopscore.datastructure.DimPos dimPos, Class<C> clazz, boolean forceLoad)
      Check for the given interface at the given position.
      Type Parameters:
      C - The class type.
      Parameters:
      dimPos - The dimensional position.
      clazz - The class to find.
      forceLoad - If the world should be loaded if it was not loaded yet.
      Returns:
      The optional instance.
    • getLocalizedEnergyLevel

      public static net.minecraft.network.chat.Component getLocalizedEnergyLevel(int stored, int capacity)
      Get a localized string showing the ratio of stored energy vs the capacity.
      Parameters:
      stored - The stored amount of energy.
      capacity - The capacity of the energy container.
      Returns:
      The localized string.
    • calculateTps

      public static double calculateTps(long[] times)
    • mean

      public static long mean(long[] values)
    • addInterfaceRetriever

      public static void addInterfaceRetriever(Helpers.IInterfaceRetriever interfaceRetriever)
    • capitalizeString

      public static String capitalizeString(String value)
      Return a string with the first character capitalized.
      Parameters:
      value - A string.
      Returns:
      A capitalized string.
    • sneakyThrow

      public static <T extends Exception, R> R sneakyThrow(Exception t) throws T
      Throws:
      T extends Exception