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.
|
Modifier and Type | Field and Description |
---|---|
private static java.util.List<IEntitySelectorFactory> |
entitySelectorFactories |
private static java.util.List<IFuelHandler> |
fuelHandlers |
private static java.util.List<IWorldGenerator> |
sortedGeneratorList |
private static java.util.Map<IWorldGenerator,java.lang.Integer> |
worldGeneratorIndex |
private static java.util.Set<IWorldGenerator> |
worldGenerators |
Constructor and Description |
---|
GameRegistry() |
Modifier and Type | Method and Description |
---|---|
static void |
addShapedRecipe(ResourceLocation name,
ResourceLocation group,
ItemStack output,
java.lang.Object... params) |
static void |
addShapelessRecipe(ResourceLocation name,
ResourceLocation group,
ItemStack output,
Ingredient... 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) |
private static void |
computeSortedGeneratorList() |
static java.util.List<com.google.common.base.Predicate<Entity>> |
createEntitySelectors(java.util.Map<java.lang.String,java.lang.String> arguments,
java.lang.String mainSelector,
ICommandSender sender,
Vec3d position)
Creates a list of entity selectors using the registered factories.
|
static <K extends IForgeRegistryEntry<K>> |
findRegistry(java.lang.Class<K> registryType)
Retrieves the registry associated with this super class type.
|
static void |
generateWorld(int chunkX,
int chunkZ,
World world,
IChunkGenerator 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)
Deprecated.
|
static int |
getFuelValueLegacy(ItemStack itemStack)
Deprecated.
|
static ItemStack |
makeItemStack(java.lang.String itemName,
int meta,
int stackSize,
java.lang.String nbtString)
|
private static <K extends IForgeRegistryEntry<K>> |
register(K object)
This is now private, you should use either ForgeRegistries constants.
|
static void |
registerEntitySelector(IEntitySelectorFactory factory,
java.lang.String... arguments)
Registers a entity selector factory which is used to create predicates whenever a command containing selectors is executed
Any non vanilla arguments that you expect has to be registered.
|
static void |
registerFuelHandler(IFuelHandler handler)
Deprecated.
set your item's
Item.getItemBurnTime(ItemStack) or subscribe to FurnaceFuelBurnTimeEvent instead. |
static void |
registerTileEntity(java.lang.Class<? extends TileEntity> tileEntityClass,
ResourceLocation key) |
static void |
registerTileEntity(java.lang.Class<? extends TileEntity> tileEntityClass,
java.lang.String key)
Deprecated.
|
static void |
registerWorldGenerator(IWorldGenerator generator,
int modGenerationWeight)
Register a world generator - something that inserts new block types into the world
|
private static java.util.Set<IWorldGenerator> worldGenerators
private static java.util.Map<IWorldGenerator,java.lang.Integer> worldGeneratorIndex
private static java.util.List<IFuelHandler> fuelHandlers
private static java.util.List<IWorldGenerator> sortedGeneratorList
private static java.util.List<IEntitySelectorFactory> entitySelectorFactories
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 registerEntitySelector(IEntitySelectorFactory factory, java.lang.String... arguments)
arguments
- Expected string arguments in commandspublic static java.util.List<com.google.common.base.Predicate<Entity>> createEntitySelectors(java.util.Map<java.lang.String,java.lang.String> arguments, java.lang.String mainSelector, ICommandSender sender, Vec3d position)
public static void generateWorld(int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider)
chunkX
- Chunk X coordinatechunkZ
- Chunk Z coordinateworld
- World we're generating intochunkGenerator
- The chunk generatorchunkProvider
- The chunk providerprivate static void computeSortedGeneratorList()
private static <K extends IForgeRegistryEntry<K>> K register(K object)
public static <K extends IForgeRegistryEntry<K>> IForgeRegistry<K> findRegistry(java.lang.Class<K> registryType)
registryType
- The base class of items in this registry.public static void addShapedRecipe(ResourceLocation name, ResourceLocation group, @Nonnull ItemStack output, java.lang.Object... params)
public static void addShapelessRecipe(ResourceLocation name, ResourceLocation group, @Nonnull ItemStack output, Ingredient... params)
public static void addSmelting(@Nonnull ItemStack input, @Nonnull ItemStack output, float xp)
@Deprecated public static void registerTileEntity(java.lang.Class<? extends TileEntity> tileEntityClass, java.lang.String key)
public static void registerTileEntity(java.lang.Class<? extends TileEntity> tileEntityClass, ResourceLocation key)
@Deprecated public static void registerFuelHandler(IFuelHandler handler)
Item.getItemBurnTime(ItemStack)
or subscribe to FurnaceFuelBurnTimeEvent
instead.@Deprecated public static int getFuelValue(@Nonnull ItemStack itemStack)
ForgeEventFactory.getItemBurnTime(ItemStack)
@Deprecated public static int getFuelValueLegacy(@Nonnull ItemStack itemStack)
ForgeEventFactory.getItemBurnTime(ItemStack)
@Nonnull public 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