2017-06-22 05:10:40 +00:00
|
|
|
package net.minecraftforge.debug;
|
|
|
|
|
|
|
|
import net.minecraft.init.Blocks;
|
|
|
|
import net.minecraft.item.ItemStack;
|
2017-06-23 04:38:36 +00:00
|
|
|
import net.minecraft.item.crafting.IRecipe;
|
2017-06-22 05:10:40 +00:00
|
|
|
import net.minecraft.item.crafting.ShapedRecipes;
|
|
|
|
import net.minecraft.util.ResourceLocation;
|
2017-06-23 04:38:36 +00:00
|
|
|
import net.minecraftforge.common.MinecraftForge;
|
2017-06-22 05:10:40 +00:00
|
|
|
import net.minecraftforge.common.crafting.CraftingHelper;
|
2017-06-23 04:38:36 +00:00
|
|
|
import net.minecraftforge.event.RegistryEvent;
|
2017-06-22 05:10:40 +00:00
|
|
|
import net.minecraftforge.fml.common.Mod;
|
|
|
|
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
2017-06-23 04:38:36 +00:00
|
|
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
2017-08-15 12:10:07 +00:00
|
|
|
import net.minecraftforge.fml.relauncher.FMLLaunchHandler;
|
|
|
|
import net.minecraftforge.fml.relauncher.Side;
|
2017-06-22 05:10:40 +00:00
|
|
|
import net.minecraftforge.oredict.ShapedOreRecipe;
|
|
|
|
|
2017-10-21 05:28:26 +00:00
|
|
|
@Mod(modid = "recipetest", name = "Recipe test mod", version = "1.0", acceptableRemoteVersions = "*")
|
2017-06-22 05:10:40 +00:00
|
|
|
public class RecipeTestMod
|
|
|
|
{
|
|
|
|
@Mod.EventHandler
|
|
|
|
public void preinit(FMLPreInitializationEvent event)
|
2017-06-23 04:38:36 +00:00
|
|
|
{
|
|
|
|
MinecraftForge.EVENT_BUS.register(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
@SubscribeEvent
|
|
|
|
public void registerRecipes(RegistryEvent.Register<IRecipe> event)
|
2017-06-22 05:10:40 +00:00
|
|
|
{
|
|
|
|
ResourceLocation location1 = new ResourceLocation("recipetest", "dirt");
|
|
|
|
ShapedOreRecipe recipe1 = new ShapedOreRecipe(location1, new ItemStack(Blocks.DIAMOND_BLOCK), "DDD", 'D', new ItemStack(Blocks.DIRT));
|
|
|
|
recipe1.setRegistryName(location1);
|
2017-06-23 04:38:36 +00:00
|
|
|
event.getRegistry().register(recipe1);
|
2017-06-22 05:10:40 +00:00
|
|
|
|
2017-08-15 12:10:07 +00:00
|
|
|
if (FMLLaunchHandler.side() == Side.SERVER)
|
|
|
|
{
|
|
|
|
ResourceLocation location2 = new ResourceLocation("recipetest", "stone");
|
|
|
|
CraftingHelper.ShapedPrimer primer1 = CraftingHelper.parseShaped("SSS", 'S', new ItemStack(Blocks.IRON_BLOCK));
|
|
|
|
ShapedRecipes recipe2 = new ShapedRecipes(location2.getResourcePath(), primer1.width, primer1.height, primer1.input, new ItemStack(Blocks.GOLD_BLOCK));
|
|
|
|
recipe2.setRegistryName(location2);
|
|
|
|
event.getRegistry().register(recipe2);
|
|
|
|
}
|
2017-06-22 05:10:40 +00:00
|
|
|
}
|
|
|
|
}
|