Class GeneralUtilities

java.lang.Object
tech.anonymoushacker1279.immersiveweapons.util.GeneralUtilities

public class GeneralUtilities extends Object
A collection of random utility methods for general use.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static net.minecraft.resources.ResourceLocation
    blockRegistryPath(net.minecraft.world.level.block.Block block)
    Returns the path of the registry name for the given block.
    static String
    convertToRoman(int number)
    Convert an integer to a Roman numeral.
    static double
    getRandomNumber(double min, double max)
    Get a random number between a minimum and maximum.
    static float
    getRandomNumber(float min, float max)
    Get a random number between a minimum and maximum.
    static int
    getRandomNumber(int min, int max)
    Get a random number between a minimum and maximum.
    static net.minecraft.resources.ResourceLocation
    itemRegistryPath(net.minecraft.world.item.Item item)
    Returns the path of the registry name for the given item.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • GeneralUtilities

      public GeneralUtilities()
  • Method Details

    • getRandomNumber

      public static float getRandomNumber(float min, float max)
      Get a random number between a minimum and maximum.
      Parameters:
      min - minimum number (inclusive)
      max - maximum number (not inclusive)
      Returns:
      float
    • getRandomNumber

      public static double getRandomNumber(double min, double max)
      Get a random number between a minimum and maximum.
      Parameters:
      min - minimum number (inclusive)
      max - maximum number (not inclusive)
      Returns:
      double
    • getRandomNumber

      public static int getRandomNumber(int min, int max)
      Get a random number between a minimum and maximum.
      Parameters:
      min - minimum number (inclusive)
      max - maximum number (not inclusive)
      Returns:
      int
    • convertToRoman

      public static String convertToRoman(int number)
      Convert an integer to a Roman numeral.
      Parameters:
      number - the integer to convert
      Returns:
      the Roman numeral
    • blockRegistryPath

      public static net.minecraft.resources.ResourceLocation blockRegistryPath(net.minecraft.world.level.block.Block block)
      Returns the path of the registry name for the given block. This is a convenience method which checks if the registry name of the entry exists, to avoid linting warnings about the nullability of the entry's registry name.
      Parameters:
      block - the registry entry
      Returns:
      the path of the registry name of the given entry
      Throws:
      NullPointerException - if the entry does not have a registry name
    • itemRegistryPath

      public static net.minecraft.resources.ResourceLocation itemRegistryPath(net.minecraft.world.item.Item item)
      Returns the path of the registry name for the given item. This is a convenience method which checks if the registry name of the entry exists, to avoid linting warnings about the nullability of the entry's registry name.
      Parameters:
      item - the registry entry
      Returns:
      the path of the registry name of the given entry
      Throws:
      NullPointerException - if the entry does not have a registry name