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 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 net.minecraft.world.phys.Vec3
    radialOffset(net.minecraft.world.phys.Vec3 pos, float distance, float current, float total)
     
    static <T, K extends Collection<T>>
    K
    reverseOrder(K reversed, Collection<T> items)
    Reverses the order of any K collection of T entries
    static net.minecraft.world.phys.Vec3
    rotatingRadialOffset(net.minecraft.world.phys.Vec3 pos, float distanceX, float distanceZ, float current, float total, long gameTime, float time)
     
    static net.minecraft.world.phys.Vec3
    rotatingRadialOffset(net.minecraft.world.phys.Vec3 pos, float distance, float current, float total, long gameTime, float time)
     
    static ArrayList<net.minecraft.world.phys.Vec3>
    rotatingRadialOffsets(net.minecraft.world.phys.Vec3 pos, float distanceX, float distanceZ, float total, long gameTime, float time)
     
    static ArrayList<net.minecraft.world.phys.Vec3>
    rotatingRadialOffsets(net.minecraft.world.phys.Vec3 pos, float distance, float total, long gameTime, float time)
     
    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
    • radialOffset

      public static net.minecraft.world.phys.Vec3 radialOffset(net.minecraft.world.phys.Vec3 pos, float distance, float current, float total)
    • rotatingRadialOffsets

      public static ArrayList<net.minecraft.world.phys.Vec3> rotatingRadialOffsets(net.minecraft.world.phys.Vec3 pos, float distance, float total, long gameTime, float time)
    • rotatingRadialOffsets

      public static ArrayList<net.minecraft.world.phys.Vec3> rotatingRadialOffsets(net.minecraft.world.phys.Vec3 pos, float distanceX, float distanceZ, float total, long gameTime, float time)
    • rotatingRadialOffset

      public static net.minecraft.world.phys.Vec3 rotatingRadialOffset(net.minecraft.world.phys.Vec3 pos, float distance, float current, float total, long gameTime, float time)
    • rotatingRadialOffset

      public static net.minecraft.world.phys.Vec3 rotatingRadialOffset(net.minecraft.world.phys.Vec3 pos, float distanceX, float distanceZ, float current, float total, long gameTime, float time)
    • 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)