Class GeneralUtilities
java.lang.Object
tech.anonymoushacker1279.immersiveweapons.util.GeneralUtilities
A collection of random utility methods for general use.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic net.minecraft.resources.ResourceLocationblockRegistryPath(net.minecraft.world.level.block.Block block) Returns the path of the registry name for the given block.static StringconvertToRoman(int number) Convert an integer to a Roman numeral.static doublegetRandomNumber(double min, double max) Get a random number between a minimum and maximum.static floatgetRandomNumber(float min, float max) Get a random number between a minimum and maximum.static intgetRandomNumber(int min, int max) Get a random number between a minimum and maximum.static net.minecraft.resources.ResourceLocationitemRegistryPath(net.minecraft.world.item.Item item) Returns the path of the registry name for the given item.static booleanCheck if the specified UUID is not Jonny's.
-
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
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
-
notJonny
Check if the specified UUID is not Jonny's. Used as a dev bonus for the Jonny's Curse item, where all effects are inverted for Jonny himself.- Parameters:
uuid- the UUID to check- Returns:
- true if the UUID is not Jonny's, false otherwise
-