Class DataHelper

java.lang.Object
team.lodestar.lodestone.helpers.DataHelper

public class DataHelper extends Object
A collection of helper methods for data manipulation
  • Constructor Details

    • DataHelper

      public DataHelper()
  • Method Details

    • reverseOrder

      public static <T, K extends Collection<T>> K reverseOrder(K reversed, Collection<T> items)
      Reverses the order of any K collection of T entries
    • toTitleCase

      public static String toTitleCase(String givenString, String regex)
      Capitalizes the first character in each word and replaces [regex] with space
    • nextInts

      public static int[] nextInts(int count, int range)
      returns an integer array of random ints
      Parameters:
      count - the amount of integers
      range - the range the random function uses
    • hasDuplicate

      public static <T> boolean hasDuplicate(T[] things)
      returns whether an array of items has any duplicates
    • take

      public static <T> T take(Collection<? extends T> src, T item)
      removes an entry from a collection and returns it if removed
    • takeAll

      @SafeVarargs public static <T> Collection<T> takeAll(Collection<? extends T> src, T... items)
      removes all entry from a collection and returns all items removed in a new collection
    • takeAll

      public static <T> Collection<T> takeAll(Collection<T> src, Predicate<T> pred)
      removes all entry from a collection based off of a predicate and returns all items removed in a new collection
    • getAll

      @SafeVarargs public static <T> Collection<T> getAll(Collection<? extends T> src, T... items)
      create a copy of all items in a list that match from another list of items
    • getAll

      public static <T> Collection<T> getAll(Collection<T> src, Predicate<T> pred)
      create a copy of all items in a list that match from a predicate
    • blockOutlinePositions

      public static ArrayList<net.minecraft.world.phys.Vec3> blockOutlinePositions(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos)
    • distSqr

      public static float distSqr(float... a)
    • distance

      public static float distance(float... a)