Class DataHelper

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

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

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static double
    approach(double a, double b, double amount)
     
    static float
    approach(float a, float b, float amount)
     
    static int
    approach(int value, int limit, int stepSize)
     
    static ArrayList<net.minecraft.world.phys.Vec3>
    blockOutlinePositions(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos)
     
    static float
    distance(float... a)
     
    static float
    distSqr(float... a)
     
    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
    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
    static <T> boolean
    hasDuplicate(T[] things)
    returns whether an array of items has any duplicates
    static int[]
    nextInts(int count, int range)
    returns an integer array of random ints
    static <T, K extends Collection<T>>
    K
    reverseOrder(K reversed, Collection<T> items)
    Reverses the order of any K collection of T entries
    static <T> T
    take(Collection<? extends T> src, T item)
    removes an entry from a collection and returns it if removed
    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
    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
    static String
    toTitleCase(String givenString, String regex)
    Capitalizes the first character in each word and replaces [regex] with space

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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)
    • approach

      public static int approach(int value, int limit, int stepSize)
    • approach

      public static float approach(float a, float b, float amount)
    • approach

      public static double approach(double a, double b, double amount)
    • distSqr

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

      public static float distance(float... a)