用户:MashKJo/1.12.2模组开发笔记/IRecipe接口详解:修订间差异

== 注册IRecipe ==
是的,IRecipe需要注册——而且走的是Forge的注册表系统。因此:
public class MyCustomRecipe implements IRecipe
{
private ResourceLocation regName;
...
@Override
public IRecipe setRegistryName(ResourceLocation name)
{
this.regName = name;
return this;
}
@Override
public ResourceLocation getRegistryName()
{
return this.regName;
}
...
}
 
 
@Mod.EventBusSubscriber(modid = [Your MODID])
public class RecipeLoader
public void register(RegistryEvent.Register<IRecipe> event)
{
event.getRegistry().register([Your IRecipe Instance].setRegistryName(new ResourceLocation(...)));
}
}
行政员、​优秀编辑者、​界面管理员、​监督员、​管理员、​小部件编辑者
3,258

个编辑