public class GameRegistry
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
GameRegistry.ItemStackHolder
ItemStackHolder can be used to automatically populate public static final fields with
ItemStack instances, referring a specific item, potentially configured with NBT. |
static interface |
GameRegistry.ObjectHolder
ObjectHolder can be used to automatically populate public static final fields with entries
from the registry.
|
static class |
GameRegistry.Type |
static class |
GameRegistry.UniqueIdentifier
Deprecated.
|
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 GameRegistry.UniqueIdentifier |
findUniqueIdentifierFor(Block block)
Deprecated.
|
static GameRegistry.UniqueIdentifier |
findUniqueIdentifierFor(Item item)
Deprecated.
|
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)
Register a block with the name that Block.getRegistryName returns.
|
static Block |
registerBlock(Block block,
java.lang.Class<? extends ItemBlock> itemclass)
Register a block with the world, with the specified item class using Block.getRegistryName's name
|
static Block |
registerBlock(Block block,
java.lang.Class<? extends ItemBlock> itemclass,
java.lang.Object... itemCtorArgs)
Register a block with the world, with the specified item class using Block.getRegistryName's name
|
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.String name)
Register a block with the specified mod specific name
|
static void |
registerFuelHandler(IFuelHandler handler) |
static void |
registerItem(Item item)
Register an item with the item registry with a the name specified in Item.getRegistryName()
|
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)
Deprecated.
|
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
- Chunk X coordinatechunkZ
- Chunk Z coordinateworld
- World we're generating intochunkGenerator
- The chunk generatorchunkProvider
- The chunk providerpublic static void registerItem(Item item)
item
- The item to registerpublic static void registerItem(Item item, java.lang.String name)
item
- The item to registername
- The mod-unique name of the item@Deprecated public 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, unusedpublic 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)
block
- The block to registerpublic 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)
block
- The block to registeritemclass
- The item type to register with it : null registers a block without associated item.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.public static Block registerBlock(Block block, java.lang.Class<? extends ItemBlock> itemclass, java.lang.Object... itemCtorArgs)
block
- The block to registeritemclass
- The item type to register with it : null registers a block without associated item.itemCtorArgs
- Arguments to pass (after the required Block
parameter) to the ItemBlock constructor (optional).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 itself@Deprecated public static GameRegistry.UniqueIdentifier findUniqueIdentifierFor(Block block)
block
- to lookupGameRegistry.UniqueIdentifier
for the block or null@Deprecated public static GameRegistry.UniqueIdentifier findUniqueIdentifierFor(Item item)
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