Class ConditionalRecipe.Serializer<T extends IRecipe<?>>
- java.lang.Object
-
- net.minecraftforge.common.crafting.ConditionalRecipe.Serializer<T>
-
- All Implemented Interfaces:
IRecipeSerializer<T>
,IForgeRegistryEntry<IRecipeSerializer<?>>
- Enclosing class:
- ConditionalRecipe
public static class ConditionalRecipe.Serializer<T extends IRecipe<?>> extends java.lang.Object implements IRecipeSerializer<T>
-
-
Field Summary
Fields Modifier and Type Field Description private ResourceLocation
name
-
Fields inherited from interface net.minecraft.item.crafting.IRecipeSerializer
ARMOR_DYE, BANNER_DUPLICATE, BLASTING_RECIPE, BOOK_CLONING, CAMPFIRE_COOKING_RECIPE, FIREWORK_ROCKET, FIREWORK_STAR, FIREWORK_STAR_FADE, MAP_CLONING, MAP_EXTENDING, REPAIR_ITEM, SHAPED_RECIPE, SHAPELESS_RECIPE, SHIELD_DECORATION, SHULKER_BOX_COLORING, SMELTING_RECIPE, SMITHING, SMOKING_RECIPE, STONECUTTER, SUSPICIOUS_STEW, TIPPED_ARROW
-
-
Constructor Summary
Constructors Constructor Description Serializer()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static <G> java.lang.Class<G>
castClass(java.lang.Class<?> cls)
T
fromJson(ResourceLocation recipeId, com.google.gson.JsonObject json)
T
fromNetwork(ResourceLocation recipeId, PacketBuffer buffer)
ResourceLocation
getRegistryName()
A unique identifier for this entry, if this entry is registered already it will return it's official registry name.java.lang.Class<IRecipeSerializer<?>>
getRegistryType()
Determines the type for this entry, used to look up the correct registry in the global registries list as there can only be one registry per concrete class.IRecipeSerializer<?>
setRegistryName(ResourceLocation name)
Sets a unique name for this Item.void
toNetwork(PacketBuffer buffer, T recipe)
-
-
-
Field Detail
-
name
private ResourceLocation name
-
-
Method Detail
-
setRegistryName
public IRecipeSerializer<?> setRegistryName(ResourceLocation name)
Description copied from interface:IForgeRegistryEntry
Sets a unique name for this Item. This should be used for uniquely identify the instance of the Item. This is the valid replacement for the atrocious 'getUnlocalizedName().substring(6)' stuff that everyone does. Unlocalized names have NOTHING to do with unique identifiers. As demonstrated by vanilla blocks and items. The supplied name will be prefixed with the currently active mod's modId. If the supplied name already has a prefix that is different, it will be used and a warning will be logged. If a name already exists, or this Item is already registered in a registry, then an IllegalStateException is thrown. Returns 'this' to allow for chaining.- Specified by:
setRegistryName
in interfaceIForgeRegistryEntry<T extends IRecipe<?>>
- Parameters:
name
- Unique registry name- Returns:
- This instance
-
getRegistryName
public ResourceLocation getRegistryName()
Description copied from interface:IForgeRegistryEntry
A unique identifier for this entry, if this entry is registered already it will return it's official registry name. Otherwise it will return the name set in setRegistryName(). If neither are valid null is returned.- Specified by:
getRegistryName
in interfaceIForgeRegistryEntry<T extends IRecipe<?>>
- Returns:
- Unique identifier or null.
-
getRegistryType
public java.lang.Class<IRecipeSerializer<?>> getRegistryType()
Description copied from interface:IForgeRegistryEntry
Determines the type for this entry, used to look up the correct registry in the global registries list as there can only be one registry per concrete class.- Specified by:
getRegistryType
in interfaceIForgeRegistryEntry<T extends IRecipe<?>>
- Returns:
- Root registry type.
-
castClass
private static <G> java.lang.Class<G> castClass(java.lang.Class<?> cls)
-
fromJson
public T fromJson(ResourceLocation recipeId, com.google.gson.JsonObject json)
- Specified by:
fromJson
in interfaceIRecipeSerializer<T extends IRecipe<?>>
-
fromNetwork
public T fromNetwork(ResourceLocation recipeId, PacketBuffer buffer)
- Specified by:
fromNetwork
in interfaceIRecipeSerializer<T extends IRecipe<?>>
-
toNetwork
public void toNetwork(PacketBuffer buffer, T recipe)
- Specified by:
toNetwork
in interfaceIRecipeSerializer<T extends IRecipe<?>>
-
-