public class GameRegistry
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
GameRegistry.ItemStackHolder |
static interface |
GameRegistry.ObjectHolder
This will cause runtime injection of public static final fields to occur at various points
where mod blocks and items could be subject to change.
|
static class |
GameRegistry.Type |
static class |
GameRegistry.UniqueIdentifier |
Constructor and Description |
---|
GameRegistry() |
Modifier and Type | Method and Description |
---|---|
static void |
addRecipe(IRecipe recipe) |
static void |
addRecipe(ItemStack output,
java.lang.Object... params) |
static IRecipe |
addShapedRecipe(ItemStack output,
java.lang.Object... params) |
static void |
addShapelessRecipe(ItemStack output,
java.lang.Object... params) |
static void |
addSmelting(Block input,
ItemStack output,
float xp) |
static void |
addSmelting(Item input,
ItemStack output,
float xp) |
static void |
addSmelting(ItemStack input,
ItemStack output,
float xp) |
static void |
addSubstitutionAlias(java.lang.String nameToSubstitute,
GameRegistry.Type type,
java.lang.Object object)
Add a forced persistent substitution alias for the block or item to another block or item.
|
static Block |
findBlock(java.lang.String modId,
java.lang.String name)
Look up a mod block in the global "named item list"
|
static Item |
findItem(java.lang.String modId,
java.lang.String name)
Look up a mod item in the global "named item list"
|
static ItemStack |
findItemStack(java.lang.String modId,
java.lang.String name,
int stackSize)
Lookup an itemstack based on mod and name.
|
static GameRegistry.UniqueIdentifier |
findUniqueIdentifierFor(Block block)
Look up the mod identifier data for a block.
|
static GameRegistry.UniqueIdentifier |
findUniqueIdentifierFor(Item item)
Look up the mod identifier data for an item.
|
static void |
generateWorld(int chunkX,
int chunkZ,
World world,
IChunkProvider chunkGenerator,
IChunkProvider chunkProvider)
Callback hook for world gen - if your mod wishes to add extra mod related generation to the world
call this
|
static int |
getFuelValue(ItemStack itemStack) |
static ItemStack |
makeItemStack(java.lang.String itemName,
int meta,
int stackSize,
java.lang.String nbtString)
|
static Block |
registerBlock(Block block,
java.lang.Class<? extends ItemBlock> itemclass,
java.lang.String name)
Register a block with the world, with the specified item class and block name
|
static Block |
registerBlock(Block block,
java.lang.Class<? extends ItemBlock> itemclass,
java.lang.String name,
java.lang.Object... itemCtorArgs)
Register a block with the world, with the specified item class, block name and owning modId
|
static Block |
registerBlock(Block block,
java.lang.Class<? extends ItemBlock> itemclass,
java.lang.String name,
java.lang.String modId,
java.lang.Object... itemCtorArgs)
Deprecated.
Use the registerBlock version without the modId parameter instead.
|
static Block |
registerBlock(Block block,
java.lang.String name)
Register a block with the specified mod specific name
|
static void |
registerCustomItemStack(java.lang.String name,
ItemStack itemStack)
Manually register a custom item stack with FML for later tracking.
|
static void |
registerFuelHandler(IFuelHandler handler) |
static void |
registerItem(Item item,
java.lang.String name)
Register an item with the item registry with a custom name : this allows for easier server->client resolution
|
static Item |
registerItem(Item item,
java.lang.String name,
java.lang.String modId)
Register the specified Item with a mod specific name : overrides the standard type based name
|
static void |
registerTileEntity(java.lang.Class<? extends TileEntity> tileEntityClass,
java.lang.String id) |
static void |
registerTileEntityWithAlternatives(java.lang.Class<? extends TileEntity> tileEntityClass,
java.lang.String id,
java.lang.String... alternatives)
Register a tile entity, with alternative TileEntity identifiers.
|
static void |
registerWorldGenerator(IWorldGenerator generator,
int modGenerationWeight)
Register a world generator - something that inserts new block types into the world
|
public static void registerWorldGenerator(IWorldGenerator generator, int modGenerationWeight)
generator
- the generatormodGenerationWeight
- a weight to assign to this generator. Heavy weights tend to sink to the bottom of
list of world generators (i.e. they run later)public static void generateWorld(int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
chunkX
- chunkZ
- world
- chunkGenerator
- chunkProvider
- public static void registerItem(Item item, java.lang.String name)
item
- The item to registername
- The mod-unique name of the itempublic static Item registerItem(Item item, java.lang.String name, java.lang.String modId)
item
- The item to registername
- The mod-unique name to register it as - null will remove a custom namemodId
- deprecated, unused
where one mod should "own" all the blocks of all the mods, null defaults to the active modpublic static void addSubstitutionAlias(java.lang.String nameToSubstitute, GameRegistry.Type type, java.lang.Object object) throws ExistingSubstitutionException
nameToSubstitute
- The name to link to (this is the NEW block or item)type
- The type (Block or Item)object
- a NEW instance that is type compatible with the existing instanceExistingSubstitutionException
- if someone else has already registered an alias either from or to one of the namesIncompatibleSubstitutionException
- if the substitution is incompatiblepublic static Block registerBlock(Block block, java.lang.String name)
block
- The block to registername
- The mod-unique name to register it as, will get prefixed by your modid.public static Block registerBlock(Block block, java.lang.Class<? extends ItemBlock> itemclass, java.lang.String name)
block
- The block to registeritemclass
- The item type to register with it : null registers a block without associated item.name
- The mod-unique name to register it as, will get prefixed by your modid.@Deprecated public static Block registerBlock(Block block, java.lang.Class<? extends ItemBlock> itemclass, java.lang.String name, java.lang.String modId, java.lang.Object... itemCtorArgs)
public static Block registerBlock(Block block, java.lang.Class<? extends ItemBlock> itemclass, java.lang.String name, java.lang.Object... itemCtorArgs)
block
- The block to registeritemclass
- The item type to register with it : null registers a block without associated item.name
- The mod-unique name to register it as, will get prefixed by your modid.itemCtorArgs
- Arguments to pass (after the required Block
parameter) to the ItemBlock constructor (optional).public static void addRecipe(ItemStack output, java.lang.Object... params)
public static void addShapelessRecipe(ItemStack output, java.lang.Object... params)
public static void addRecipe(IRecipe recipe)
public static void registerTileEntity(java.lang.Class<? extends TileEntity> tileEntityClass, java.lang.String id)
public static void registerTileEntityWithAlternatives(java.lang.Class<? extends TileEntity> tileEntityClass, java.lang.String id, java.lang.String... alternatives)
tileEntityClass
- The tileEntity class to registerid
- The primary ID, this will be the ID that the tileentity saves asalternatives
- A list of alternative IDs that will also map to this class. These will never save, but they will loadpublic static void registerFuelHandler(IFuelHandler handler)
public static int getFuelValue(ItemStack itemStack)
public static Block findBlock(java.lang.String modId, java.lang.String name)
modId
- The modid owning the blockname
- The name of the block itselfpublic static Item findItem(java.lang.String modId, java.lang.String name)
modId
- The modid owning the itemname
- The name of the item itselfpublic static void registerCustomItemStack(java.lang.String name, ItemStack itemStack)
name
- The name to register it underitemStack
- The itemstack to registerpublic static ItemStack findItemStack(java.lang.String modId, java.lang.String name, int stackSize)
modId
- The modid of the stack ownername
- The name of the stackstackSize
- The size of the stack returnedpublic static GameRegistry.UniqueIdentifier findUniqueIdentifierFor(Block block)
registerCustomItemStack(java.lang.String, net.minecraft.item.ItemStack)
Note: uniqueness and persistence is only guaranteed by mods using the game registry
correctly.block
- to lookupGameRegistry.UniqueIdentifier
for the block or nullpublic static GameRegistry.UniqueIdentifier findUniqueIdentifierFor(Item item)
registerCustomItemStack(java.lang.String, net.minecraft.item.ItemStack)
Note: uniqueness and persistence is only guaranteed by mods using the game registry
correctly.item
- to lookupGameRegistry.UniqueIdentifier
for the item or nullpublic static ItemStack makeItemStack(java.lang.String itemName, int meta, int stackSize, java.lang.String nbtString)
ItemStack
based on the itemName reference, with supplied meta, stackSize and nbt, if possible
Will return null if the item doesn't exist (because it's not from a loaded mod for example)
Will throw a RuntimeException
if the nbtString is invalid for use in an ItemStack
itemName
- a registry name referencemeta
- the metastackSize
- the stack sizenbtString
- an nbt stack as a string, will be processed by JsonToNBT