public final class Utilities
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String[] |
rainbowChars
An array of formatting codes used to create rainbow text.
|
static java.lang.String[] |
vanillaLootChests
An array of all keys used in ChestGenHooks for the vanilla chests.
|
| Constructor and Description |
|---|
Utilities() |
| Modifier and Type | Method and Description |
|---|---|
static void |
checkDuplicatePotions()
Checks the list of duplicate potion IDs, and recommends suggestions to the user based on
what IDs are available.
|
static boolean |
compareClasses(java.lang.Class class1,
java.lang.Class class2)
A basic check to see if two classes are the same.
|
static boolean |
compareObjectToClass(java.lang.Object obj,
java.lang.Class clazz)
Compares the class of an Object with another class.
|
static java.util.List<net.minecraft.enchantment.Enchantment> |
getAvailableEnchantments()
Provides a list of all enchantments that are currently available.
|
static java.lang.Class |
getClassFromString(java.lang.String name)
Provides a safe way to get a class by its name.
|
static net.minecraft.item.ItemStack |
getCustomHorseArmor(net.minecraft.entity.passive.EntityHorse horse)
Retrieves the ItemStack placed in an EntityHorse's custom armor inventory slot.
|
static net.minecraft.enchantment.Enchantment |
getEnchantment(int id)
A safe way to grab an enchantment by its numeric ID.
|
static java.lang.String |
getModName(net.minecraft.block.Block block)
Retrieves the name of the mod that added the block to the game.
|
static java.lang.String |
getModName(net.minecraft.item.Item item)
Retrieves the name of the mod that added the item to the game.
|
static net.minecraft.potion.Potion |
getPotion(int id)
A safe way to grab a Potion by its numeric ID.
|
static net.minecraft.creativetab.CreativeTabs |
getTabFromLabel(java.lang.String label)
Searches through the array of CreativeTabs and finds the first tab with the same label
as the one passed.
|
static java.lang.Object |
getThingByName(java.lang.String name)
A blend between the itemRegistry.getObject and bockRegistry.getObject methods.
|
static java.lang.String |
getVillagerName(int id)
Retrieves a unique string related to the texture name of a villager.
|
static boolean |
isFluid(net.minecraft.block.Block block)
Checks if a block is a fluid or not.
|
static boolean |
isWearingFullSet(net.minecraft.entity.EntityLivingBase living,
java.lang.Class armorClass)
A check to see if an entity is wearing a full suit of the armor.
|
static java.lang.String |
makeUpperCased(java.lang.String text)
Makes the first character of a string upper case.
|
static <T extends AbstractMessage<T> & cpw.mods.fml.common.network.simpleimpl.IMessageHandler<T,cpw.mods.fml.common.network.simpleimpl.IMessage>> |
registerMessage(cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper network,
java.lang.Class<T> clazz,
int id,
cpw.mods.fml.relauncher.Side side)
Registers an AbstractMessage to your SimpleNetworkWrapper.
|
static void |
setCustomHorseArmor(net.minecraft.entity.passive.EntityHorse horse,
net.minecraft.item.ItemStack stack)
Allows for a custom ItemStack to be set to an EntityHorse's custom armor inventory slot.
|
static void |
spawnParticleRing(net.minecraft.world.World world,
java.lang.String name,
double x,
double y,
double z,
double velocityX,
double velocityY,
double velocityZ,
double step)
Spawns a particle into the world, in a basic ring pattern.
|
static void |
spawnParticleRing(net.minecraft.world.World world,
java.lang.String name,
float percentage,
double x,
double y,
double z,
double velocityX,
double velocityY,
double velocityZ,
double step)
Spawns a particle into the world, in a basic ring pattern.
|
static void |
updateAvailableEnchantments()
Updates the available enchantment array to contain all current enchantments.
|
static java.util.List<java.lang.String> |
wrapStringToList(java.lang.String string,
int lnLength,
boolean wrapLongWords,
java.util.List<java.lang.String> list)
This method will take a string and break it down into multiple lines based on a provided
line length.
|
static java.util.List<java.lang.String> |
wrapStringToListWithFormat(java.lang.String string,
int lnLength,
boolean wrapLongWords,
java.util.List<java.lang.String> list,
net.minecraft.util.EnumChatFormatting format)
This method will take a string and break it down into multiple lines based on a provided
line length.
|
public static java.lang.String[] vanillaLootChests
public static java.lang.String[] rainbowChars
public static java.util.List<java.lang.String> wrapStringToList(java.lang.String string,
int lnLength,
boolean wrapLongWords,
java.util.List<java.lang.String> list)
string: - The string being split into multiple lines. It's recommended to use
StatCollector.translateToLocal() for this so multiple languages will be
supported.lnLength: - The ideal size for each line of text.wrapLongWords: - If true the ideal size will be exact, potentially splitting words
on the end of each line.list: - A list to add each line of text to. An good example of such list would be
the list of tooltips on an item.public static java.util.List<java.lang.String> wrapStringToListWithFormat(java.lang.String string,
int lnLength,
boolean wrapLongWords,
java.util.List<java.lang.String> list,
net.minecraft.util.EnumChatFormatting format)
string: - The string being split into multiple lines. It's recommended to use
StatCollector.translateToLocal() for this so multiple languages will be
supported.lnLength: - The ideal size for each line of text.wrapLongWords: - If true the ideal size will be exact, potentially splitting words
on the end of each line.format: - A list to add each line of text to. An good example of such list would be
the list of tooltips on an item.color: - An EnumChatFormatting to apply to all lines added to the list.public static boolean isFluid(net.minecraft.block.Block block)
block: - An instance of the block being checked.public static java.lang.Object getThingByName(java.lang.String name)
name: - The ID of the thing you're looking for. Domains are often preferred.public static boolean compareClasses(java.lang.Class class1,
java.lang.Class class2)
class1: - The first class to compare.class2: - The second class to compare.public static boolean compareObjectToClass(java.lang.Object obj,
java.lang.Class clazz)
obj: - The Object to compare.clazz: - The class to compare the Object to.public static java.lang.String makeUpperCased(java.lang.String text)
text: - The text to convert.public static java.lang.Class getClassFromString(java.lang.String name)
name: - The name of the class you are trying to get. Example: java.lang.Stringpublic static boolean isWearingFullSet(net.minecraft.entity.EntityLivingBase living,
java.lang.Class armorClass)
living: - The living entity to check the armor of.armorClass: - The class of the armor to check against.public static net.minecraft.item.ItemStack getCustomHorseArmor(net.minecraft.entity.passive.EntityHorse horse)
horse: - An instance of the EntityHorse to grab the armor ItemStack from.public static void setCustomHorseArmor(net.minecraft.entity.passive.EntityHorse horse,
net.minecraft.item.ItemStack stack)
horse: - An instance of the EntityHorse to set the ItemStack to.stack: - An ItemStack you want to set to an EntityHorse's custom armor inventory
slot.public static java.lang.String getModName(net.minecraft.item.Item item)
item: - The Item to get the mod name from.public static java.lang.String getModName(net.minecraft.block.Block block)
block: - The Block to get the mod name from.public static net.minecraft.enchantment.Enchantment getEnchantment(int id)
id: - The ID of the enchantment you wish to grab.public static net.minecraft.potion.Potion getPotion(int id)
id: - The ID of the Potion you wish to grab.public static void updateAvailableEnchantments()
public static java.util.List<net.minecraft.enchantment.Enchantment> getAvailableEnchantments()
public static <T extends AbstractMessage<T> & cpw.mods.fml.common.network.simpleimpl.IMessageHandler<T,cpw.mods.fml.common.network.simpleimpl.IMessage>> void registerMessage(cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper network, java.lang.Class<T> clazz, int id, cpw.mods.fml.relauncher.Side side)
network: - The SimpleNetworkWrapper to register to.clazz: - The class of your AbstractMessage.id: - And ID for your AbstractMessage.side: - The side to send these messages towards.public static void spawnParticleRing(net.minecraft.world.World world,
java.lang.String name,
double x,
double y,
double z,
double velocityX,
double velocityY,
double velocityZ,
double step)
world: - The world to spawn the particles in.name: - The name of the particle to spawn. VanillaParticle has a list of these.x: - The x position to spawn the particle around.y: - The y position to spawn the particle around.z: - The z position to spawn the particle around.velocityX: - The velocity of the particle, in the x direction.velocityY: - The velocity of the particle, in the y direction.velocityZ: - The velocity of the particle, in the z direction.step: - The distance in degrees, between each particle. The maximum is 2 * PI,
which will create 1 particle per ring. 0.15 is a nice value.public static void spawnParticleRing(net.minecraft.world.World world,
java.lang.String name,
float percentage,
double x,
double y,
double z,
double velocityX,
double velocityY,
double velocityZ,
double step)
world: - The world to spawn the particles in.name: - The name of the particle to spawn. VanillaParticle has a list of these.percent: - The percentage of the ring to render.x: - The x position to spawn the particle around.y: - The y position to spawn the particle around.z: - The z position to spawn the particle around.velocityX: - The velocity of the particle, in the x direction.velocityY: - The velocity of the particle, in the y direction.velocityZ: - The velocity of the particle, in the z direction.step: - The distance in degrees, between each particle. The maximum is 2 * PI,
which will create 1 particle per ring. 0.15 is a nice value.public static java.lang.String getVillagerName(int id)
id - : The ID of the villager being looked up.public static net.minecraft.creativetab.CreativeTabs getTabFromLabel(java.lang.String label)
label: - The label of the tab you are looking for.public static void checkDuplicatePotions()