Class GeneralUtilities
java.lang.Object
tech.anonymoushacker1279.immersiveweapons.util.GeneralUtilities
A collection of random utility methods for general use.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringconvertToRoman(int number) Convert an integer to a Roman numeral.static voidenchantGear(net.minecraft.world.entity.Mob mob, boolean doWeapons, boolean doArmor) Enchant the gear of a given entity.static voidenchantSpawnedArmor(net.minecraft.world.entity.Mob mob, net.minecraft.util.RandomSource random, float chanceMultiplier) Enchant the armor of a spawned entity.static voidenchantSpawnedWeapon(net.minecraft.world.entity.Mob mob, net.minecraft.util.RandomSource random, float chanceMultiplier) Enchant the weapon of a spawned entity.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 intgetTotalEnchantmentLevels(net.minecraft.core.HolderLookup.RegistryLookup<net.minecraft.world.item.enchantment.Enchantment> lookup, net.minecraft.world.item.ItemStack itemStack) Get the total levels of all enchantments on an ItemStack.static booleanCheck if the specified UUID is not Jonny's.static net.minecraft.world.phys.shapes.VoxelShaperotateShape(net.minecraft.core.Direction from, net.minecraft.core.Direction to, net.minecraft.world.phys.shapes.VoxelShape shape) Rotate a VoxelShape to a given horizontal direction.
-
Field Details
-
ATTACK_REACH_MODIFIER
-
-
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
-
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
-
getTotalEnchantmentLevels
public static int getTotalEnchantmentLevels(net.minecraft.core.HolderLookup.RegistryLookup<net.minecraft.world.item.enchantment.Enchantment> lookup, net.minecraft.world.item.ItemStack itemStack) Get the total levels of all enchantments on an ItemStack.- Parameters:
lookup- The enchantment registryitemStack- The ItemStack to check- Returns:
- The total levels of all enchantments
-
rotateShape
public static net.minecraft.world.phys.shapes.VoxelShape rotateShape(net.minecraft.core.Direction from, net.minecraft.core.Direction to, net.minecraft.world.phys.shapes.VoxelShape shape) Rotate a VoxelShape to a given horizontal direction.- Parameters:
from- the direction the shape is currently facingto- the direction the shape should be facingshape- the shape to rotate- Returns:
- the rotated shape
-
enchantGear
public static void enchantGear(net.minecraft.world.entity.Mob mob, boolean doWeapons, boolean doArmor) Enchant the gear of a given entity.- Parameters:
mob- the entitydoWeapons- whether to enchant weaponsdoArmor- whether to enchant armor
-
enchantSpawnedWeapon
public static void enchantSpawnedWeapon(net.minecraft.world.entity.Mob mob, net.minecraft.util.RandomSource random, float chanceMultiplier) Enchant the weapon of a spawned entity.- Parameters:
mob- the entityrandom- the random sourcechanceMultiplier- the chance multiplier
-
enchantSpawnedArmor
public static void enchantSpawnedArmor(net.minecraft.world.entity.Mob mob, net.minecraft.util.RandomSource random, float chanceMultiplier) Enchant the armor of a spawned entity.- Parameters:
mob- the entityrandom- the random sourcechanceMultiplier- the chance multiplier
-