Change how blocks/items are registered (desc)

tterrag is a meany face and yelled at me for using class.getSimpleName(). So here's an API-friendly re-work of the registration system. This allows all our Items/Blocks to be obtained via the API. Just add a new enum.
This commit is contained in:
Nick 2016-01-18 22:34:12 -08:00
parent 2a028414b1
commit fdfcb5c5b7
69 changed files with 260 additions and 15 deletions

View file

@ -35,8 +35,9 @@ public class BloodMagicAPI
private static Fluid lifeEssence;
/**
* Used to obtain Items from BloodMagic. Use the constants above for common
* items in case internal names change.
* Used to obtain Items from BloodMagic. Use
* {@link WayofTime.bloodmagic.api.Constants.BloodMagicItem} to get
* the registered name.
*
* @param name
* - The registered name of the item. Usually the same as the class
@ -48,6 +49,43 @@ public class BloodMagicAPI
return GameRegistry.findItem(Constants.Mod.MODID, name);
}
/**
* @see #getItem(String)
*
* @param bloodMagicItem
* - The {@link WayofTime.bloodmagic.api.Constants.BloodMagicItem} to get.
* @return - The requested Item
*/
public static Item getItem(Constants.BloodMagicItem bloodMagicItem) {
return getItem(bloodMagicItem.getRegName());
}
/**
* Used to obtain Blocks from BloodMagic. Use
* {@link WayofTime.bloodmagic.api.Constants.BloodMagicBlock} to get
* the registered name.
*
* @param name
* - The registered name of the block. Usually the same as the class
* name.
* @return - The requested Block
*/
public static Block getBlock(String name)
{
return GameRegistry.findBlock(Constants.Mod.MODID, name);
}
/**
* @see #getBlock(String)
*
* @param bloodMagicBlock
* - The {@link WayofTime.bloodmagic.api.Constants.BloodMagicBlock} to get.
* @return - The requested Block
*/
public static Block getBlock(Constants.BloodMagicBlock bloodMagicBlock) {
return getBlock(bloodMagicBlock.getRegName());
}
/**
* Used to add a {@link BlockStack} to the Teleposer blacklist that cannot
* be changed via Configuration files.