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 String
    convertToRoman(int number)
    Convert an integer to a Roman numeral.
    static void
    enchantGear(net.minecraft.world.entity.Mob mob, boolean doWeapons, boolean doArmor)
    Enchant the gear of a given entity.
    static void
    enchantSpawnedArmor(net.minecraft.world.entity.Mob mob, net.minecraft.util.RandomSource random, float chanceMultiplier)
    Enchant the armor of a spawned entity.
    static void
    enchantSpawnedWeapon(net.minecraft.world.entity.Mob mob, net.minecraft.util.RandomSource random, float chanceMultiplier)
    Enchant the weapon of a spawned entity.
    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.
    static boolean
    notJonny(UUID uuid)
    Check if the specified UUID is not Jonny's.
    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.

    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

    • convertToRoman

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

      public static boolean notJonny(UUID uuid)
      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 registry
      itemStack - 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 facing
      to - the direction the shape should be facing
      shape - 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 entity
      doWeapons - whether to enchant weapons
      doArmor - 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 entity
      random - the random source
      chanceMultiplier - 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 entity
      random - the random source
      chanceMultiplier - the chance multiplier