下面列出了net.minecraft.util.WeightedRandomChestContent#net.minecraftforge.oredict.ShapedOreRecipe 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
private static void makeAndAddCraftingRecipes(NBTTagCompound tag) {
ItemStack circuit = BW_Meta_Items.getNEWCIRCUITS().getStackWithNBT(tag,0,1);
Object[] imprintRecipe = {
" X ",
"GPG",
" X ",
'P', BW_Meta_Items.getNEWCIRCUITS().getStackWithNBT(tag,1,1),
'G', WerkstoffLoader.Prasiolite.get(OrePrefixes.gemExquisite,1),
'X', BW_Meta_Items.getNEWCIRCUITS().getStack(3)
};
IRecipe bwrecipe = new BWRecipes.BWNBTDependantCraftingRecipe(circuit,imprintRecipe);
ShapedOreRecipe gtrecipe = BW_Util.createGTCraftingRecipe(circuit, GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | GT_ModHandler.RecipeBits.KEEPNBT | GT_ModHandler.RecipeBits.BUFFERED, imprintRecipe);
//Adds the actual recipe
recipeWorldCache.add(bwrecipe);
GameRegistry.addRecipe(bwrecipe);
//Adds the NEI visual recipe
recipeWorldCache.add(gtrecipe);
GameRegistry.addRecipe(gtrecipe);
}
@Test
public void test_useUpItem()
{
ShapedOreRecipe recipe = new DamageableShapedOreRecipe(new ResourceLocation("group"),
new int[] {60}, new ItemStack(Blocks.DIRT),
"A",
'A', new ItemStack(Items.WOODEN_SWORD));
InventoryCrafting inv = new InventoryCrafting(new Container()
{
@Override
public boolean canInteractWith(EntityPlayer playerIn)
{
return false;
}
}, 3, 3);
inv.setInventorySlotContents(0, new ItemStack(Items.WOODEN_SWORD));
assertTrue(recipe.matches(inv, null));
NonNullList<ItemStack> remaining = recipe.getRemainingItems(inv);
assertTrue(remaining.get(0).isEmpty());
}
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
if (outputId.equals("crafting") && getClass() == ShapedRecipeHandler.class) {
for (IRecipe irecipe : CraftingManager.getInstance().getRecipeList()) {
CachedShapedRecipe recipe = null;
if (irecipe instanceof ShapedRecipes) {
recipe = new CachedShapedRecipe((ShapedRecipes) irecipe);
} else if (irecipe instanceof ShapedOreRecipe) {
recipe = forgeShapedRecipe((ShapedOreRecipe) irecipe);
}
if (recipe == null) {
continue;
}
recipe.computeVisuals();
arecipes.add(recipe);
}
} else {
super.loadCraftingRecipes(outputId, results);
}
}
@Override
public void loadCraftingRecipes(ItemStack result) {
for (IRecipe irecipe : CraftingManager.getInstance().getRecipeList()) {
if (NEIServerUtils.areStacksSameTypeCrafting(irecipe.getRecipeOutput(), result)) {
CachedShapedRecipe recipe = null;
if (irecipe instanceof ShapedRecipes) {
recipe = new CachedShapedRecipe((ShapedRecipes) irecipe);
} else if (irecipe instanceof ShapedOreRecipe) {
recipe = forgeShapedRecipe((ShapedOreRecipe) irecipe);
}
if (recipe == null) {
continue;
}
recipe.computeVisuals();
arecipes.add(recipe);
}
}
}
@Override
public void loadUsageRecipes(ItemStack ingredient) {
for (IRecipe irecipe : CraftingManager.getInstance().getRecipeList()) {
CachedShapedRecipe recipe = null;
if (irecipe instanceof ShapedRecipes) {
recipe = new CachedShapedRecipe((ShapedRecipes) irecipe);
} else if (irecipe instanceof ShapedOreRecipe) {
recipe = forgeShapedRecipe((ShapedOreRecipe) irecipe);
}
if (recipe == null || !recipe.contains(recipe.ingredients, ingredient.getItem())) {
continue;
}
recipe.computeVisuals();
if (recipe.contains(recipe.ingredients, ingredient)) {
recipe.setIngredientPermutation(recipe.ingredients, ingredient);
arecipes.add(recipe);
}
}
}
public CachedShapedRecipe forgeShapedRecipe(ShapedOreRecipe recipe) {
int width;
int height;
try {
width = ReflectionManager.getField(ShapedOreRecipe.class, Integer.class, recipe, 4);
height = ReflectionManager.getField(ShapedOreRecipe.class, Integer.class, recipe, 5);
} catch (Exception e) {
LogHelper.errorError("Error loading recipe", e);
return null;
}
Object[] items = recipe.getInput();
for (Object item : items) {
if (item instanceof List && ((List<?>) item).isEmpty())//ore handler, no ores
{
return null;
}
}
return new CachedShapedRecipe(width, height, items, recipe.getRecipeOutput());
}
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
if (outputId.equals("crafting") && getClass() == ShapedRecipeHandler.class) {
for (IRecipe irecipe : (List<IRecipe>) CraftingManager.getInstance().getRecipeList()) {
CachedShapedRecipe recipe = null;
if (irecipe instanceof ShapedRecipes)
recipe = new CachedShapedRecipe((ShapedRecipes) irecipe);
else if (irecipe instanceof ShapedOreRecipe)
recipe = forgeShapedRecipe((ShapedOreRecipe) irecipe);
if (recipe == null)
continue;
recipe.computeVisuals();
arecipes.add(recipe);
}
} else {
super.loadCraftingRecipes(outputId, results);
}
}
@Override
public void loadCraftingRecipes(ItemStack result) {
for (IRecipe irecipe : (List<IRecipe>) CraftingManager.getInstance().getRecipeList()) {
if (NEIServerUtils.areStacksSameTypeCrafting(irecipe.getRecipeOutput(), result)) {
CachedShapedRecipe recipe = null;
if (irecipe instanceof ShapedRecipes)
recipe = new CachedShapedRecipe((ShapedRecipes) irecipe);
else if (irecipe instanceof ShapedOreRecipe)
recipe = forgeShapedRecipe((ShapedOreRecipe) irecipe);
if (recipe == null)
continue;
recipe.computeVisuals();
arecipes.add(recipe);
}
}
}
@Override
public void loadUsageRecipes(ItemStack ingredient) {
for (IRecipe irecipe : (List<IRecipe>) CraftingManager.getInstance().getRecipeList()) {
CachedShapedRecipe recipe = null;
if (irecipe instanceof ShapedRecipes)
recipe = new CachedShapedRecipe((ShapedRecipes) irecipe);
else if (irecipe instanceof ShapedOreRecipe)
recipe = forgeShapedRecipe((ShapedOreRecipe) irecipe);
if (recipe == null || !recipe.contains(recipe.ingredients, ingredient.getItem()))
continue;
recipe.computeVisuals();
if (recipe.contains(recipe.ingredients, ingredient)) {
recipe.setIngredientPermutation(recipe.ingredients, ingredient);
arecipes.add(recipe);
}
}
}
public CachedShapedRecipe forgeShapedRecipe(ShapedOreRecipe recipe) {
int width;
int height;
try {
width = ReflectionManager.getField(ShapedOreRecipe.class, Integer.class, recipe, 4);
height = ReflectionManager.getField(ShapedOreRecipe.class, Integer.class, recipe, 5);
} catch (Exception e) {
NEIClientConfig.logger.error("Error loading recipe", e);
return null;
}
Object[] items = recipe.getInput();
for (Object item : items)
if (item instanceof List && ((List<?>) item).isEmpty())//ore handler, no ores
return null;
return new CachedShapedRecipe(width, height, items, recipe.getRecipeOutput());
}
private CachedRollingMachineShapedRecipe getCachedOreRecipe(ShapedOreRecipe recipe, boolean genPerms) {
int width;
int height;
try {
width = ReflectionManager.getField(ShapedOreRecipe.class, Integer.class, recipe, 4);
height = ReflectionManager.getField(ShapedOreRecipe.class, Integer.class, recipe, 5);
} catch (Exception e) {
return null;
}
Object[] items = recipe.getInput();
for (Object item : items) {
if (item instanceof List && ((List<?>) item).isEmpty()) {
return null;
}
}
return new CachedRollingMachineShapedRecipe(width, height, items, recipe.getRecipeOutput(), genPerms);
}
public void init () {
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.compostBin), "xxx", "xxx", "yyy",
'x', "stickWood", 'y', "slabWood"));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.soilTestKit), "xy", "zz",
'x', "dyeRed", 'y', "dyeGreen", 'z', Items.glass_bottle));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.soilTestKit), "yx", "zz",
'x', "dyeRed", 'y', "dyeGreen", 'z', Items.glass_bottle));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.gardenTrowel), " z", " y ", "x ",
'x', "stickWood", 'y', "ingotIron", 'z', ModItems.compostPile));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.gardenTrowel), " x", " y ", "z ",
'x', "stickWood", 'y', "ingotIron", 'z', ModItems.compostPile));
GameRegistry.addShapelessRecipe(new ItemStack(ModBlocks.gardenSoil), Blocks.dirt, ModItems.compostPile);
}
@Override
public void preInit(){
pneumaticDynamo = new BlockPneumaticDynamo(Material.iron).setHardness(3.0F).setResistance(10.0F).setBlockName("pneumaticDynamo");
fluxCompressor = new BlockFluxCompressor(Material.iron).setHardness(3.0F).setResistance(10.0F).setBlockName("fluxCompressor");
Blockss.registerBlock(pneumaticDynamo);
Blockss.registerBlock(fluxCompressor);
GameRegistry.registerTileEntity(TileEntityPneumaticDynamo.class, "PneumaticCraft_pneumaticDynamo");
GameRegistry.registerTileEntity(TileEntityFluxCompressor.class, "PneumaticCraft_fluxCompressor");
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Itemss.compressedIronGear), " i ", "isi", " i ", 'i', Names.INGOT_IRON_COMPRESSED, 's', Items.iron_ingot));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(pneumaticDynamo), " t ", "gig", "ipi", 'i', Names.INGOT_IRON_COMPRESSED, 'g', Itemss.compressedIronGear, 't', Blockss.advancedPressureTube, 'p', Itemss.printedCircuitBoard));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(fluxCompressor), "gcp", "frt", "gqp", 'p', Itemss.printedCircuitBoard, 'c', Itemss.compressedIronGear, 'g', Items.redstone, 't', new ItemStack(Blockss.advancedPressureTube, 1, 0), 'r', Itemss.turbineRotor, 'f', Blocks.redstone_block, 'q', Blocks.furnace));
PneumaticRegistry.getInstance().registerBlockTrackEntry(new BlockTrackEntryRF());
PneumaticRegistry.getInstance().registerCustomBlockInteractor(new DroneInteractRFExport());
PneumaticRegistry.getInstance().registerCustomBlockInteractor(new DroneInteractRFImport());
WidgetRegistrator.register(new ProgWidgetRFCondition());
WidgetRegistrator.register(new ProgWidgetDroneConditionRF());
MinecraftForge.EVENT_BUS.register(this);
}
@SubscribeEvent
public void InitRecipes(PostInitEvent event) {
SlashBlade.addRecipe("slashblade.tofucraft.ishikatana",
new ShapedOreRecipe(new ResourceLocation("flammpfeil.slashblade","slashblade.tofucraft.ishikatana"),
SlashBlade.getCustomBlade("slashblade.tofucraft.ishikatana"), new Object[]{
" CS",
"CS ",
"GP ",
Character.valueOf('P'), "string",
Character.valueOf('G'), "stickWood",
Character.valueOf('S'), BlockLoader.ISHITOFU ,
'C',BlockLoader.ISHITOFU
}));
SlashBlade.addRecipe("slashblade.tofucraft.metalkatana",
new ShapedOreRecipe(new ResourceLocation("flammpfeil.slashblade","slashblade.tofucraft.metalkatana"),
SlashBlade.getCustomBlade("slashblade.tofucraft.metalkatana"), new Object[]{
" CS",
"CS ",
"GP ",
Character.valueOf('P'), "string",
Character.valueOf('G'), "stickWood",
Character.valueOf('S'), BlockLoader.METALTOFU ,
'C',BlockLoader.ISHITOFU
}));
SlashBlade.addRecipe("slashblade.tofucraft.diamondkatana",
new ShapedOreRecipe(new ResourceLocation("flammpfeil.slashblade","slashblade.tofucraft.diamondkatana"),
SlashBlade.getCustomBlade("slashblade.tofucraft.diamondkatana"), new Object[]{
" CS",
"CS ",
"GP ",
Character.valueOf('P'), "string",
Character.valueOf('G'), "stickWood",
Character.valueOf('S'), BlockLoader.TOFUDIAMOND ,
'C',BlockLoader.ISHITOFU
}));
}
private boolean matchesInput(IRecipe recipe)
{
if (recipe instanceof ShapedRecipes)
{
return matchesInput((ShapedRecipes) recipe);
} else if (recipe instanceof ShapedOreRecipe)
{
return matchesInput((ShapedOreRecipe) recipe);
}
return false;
}
private boolean matchesInput(ShapedOreRecipe recipe)
{
if (recipe.getWidth() != getRecipeWidth())
return false;
if (recipe.getHeight() != getRecipeHeight())
return false;
return isSameInputs(recipe.getIngredients());
}
private void doTest(boolean mirror, boolean enoughDamage)
{
ShapedOreRecipe recipe = new DamageableShapedOreRecipe(new ResourceLocation("group"),
new int[] {0, 0, enoughDamage ? 5 : 5000, 0}, new ItemStack(Blocks.DIRT),
"AA", "BA",
'A', new ItemStack(Blocks.DIRT),
'B', new ItemStack(Items.WOODEN_SWORD))
.setMirrored(mirror);
InventoryCrafting inv = new InventoryCrafting(new Container()
{
@Override
public boolean canInteractWith(EntityPlayer playerIn)
{
return false;
}
}, 3, 3);
inv.setInventorySlotContents(4, new ItemStack(Blocks.DIRT));
inv.setInventorySlotContents(5, new ItemStack(Blocks.DIRT));
inv.setInventorySlotContents(mirror ? 8 : 7, new ItemStack(Items.WOODEN_SWORD));
inv.setInventorySlotContents(mirror ? 7 : 8, new ItemStack(Blocks.DIRT));
assertSame(enoughDamage, recipe.matches(inv, null));
if (enoughDamage)
{
NonNullList<ItemStack> remaining = recipe.getRemainingItems(inv);
assertSame(Items.WOODEN_SWORD, remaining.get(mirror ? 8 : 7).getItem());
assertEquals(5, remaining.get(mirror ? 8 : 7).getItemDamage());
}
}
public static void init()
{
GameRegistry.addRecipe(new ShapedOreRecipe(ENItems.hammerWood, new Object[] { " x ", " yx", "y ", 'x', "plankWood", 'y', "stickWood"}));
GameRegistry.addRecipe(new ShapedOreRecipe(ENItems.hammerStone, new Object[] { " x ", " yx", "y ", 'x', "cobblestone", 'y', "stickWood"}));
GameRegistry.addRecipe(new ShapedOreRecipe(ENItems.hammerIron, new Object[] { " x ", " yx", "y ", 'x', "ingotIron", 'y', "stickWood"}));
GameRegistry.addRecipe(new ShapedOreRecipe(ENItems.hammerGold, new Object[] { " x ", " yx", "y ", 'x', "ingotGold", 'y', "stickWood"}));
GameRegistry.addRecipe(new ShapedOreRecipe(ENItems.hammerDiamond, new Object[] { " x ", " yx", "y ", 'x', "gemDiamond", 'y', "stickWood"}));
GameRegistry.addRecipe(new ShapedOreRecipe(ENItems.crookWood, new Object[] { "xx"," x"," x", 'x', "stickWood"}));
GameRegistry.addRecipe(new ShapedOreRecipe(ENItems.crookBone, new Object[] { "xx"," x"," x", 'x', Items.BONE}));
if (Config.enableBarrels)
{
GameRegistry.addRecipe(new ShapedOreRecipe(ENBlocks.barrelWood, new Object[] {"x x","x x", "xyx", 'x', "plankWood", 'y', "slabWood"}));
GameRegistry.addRecipe(new ShapedOreRecipe(ENBlocks.barrelStone, new Object[] {"x x","x x", "xyx", 'x', new ItemStack(Blocks.STONE), 'y', new ItemStack(Blocks.STONE_SLAB)}));
}
if (Config.enableCrucible) {
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ENBlocks.crucible, 1, 0), new Object[] {"x x","x x","xxx", 'x', "clayPorcelain"}));
FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(ENBlocks.crucible, 1, 0), new ItemStack(ENBlocks.crucible, 1, 1), 0.7f);
}
GameRegistry.addRecipe(new ShapedOreRecipe(Blocks.COBBLESTONE, new Object[] {"xx","xx", 'x', ItemPebble.getPebbleStack("stone")}));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Blocks.STONE, 1, BlockStone.EnumType.GRANITE.ordinal()), new Object[] {"xx","xx", 'x', ItemPebble.getPebbleStack("granite")}));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Blocks.STONE, 1, BlockStone.EnumType.DIORITE.ordinal()), new Object[] {"xx","xx", 'x', ItemPebble.getPebbleStack("diorite")}));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Blocks.STONE, 1, BlockStone.EnumType.ANDESITE.ordinal()), new Object[] {"xx","xx", 'x', ItemPebble.getPebbleStack("andesite")}));
GameRegistry.addShapelessRecipe(ItemResource.getResourceStack("porcelain_clay"), new ItemStack(Items.CLAY_BALL), new ItemStack(Items.DYE, 1, 15));
GameRegistry.addRecipe(new ShapedOreRecipe(ENBlocks.sieve, new Object[] {"x x","xyx","z z", 'z', "plankWood", 'y', "slabWood", 'z', "stickWood"}));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ENItems.mesh, 1, 1), new Object[] {"xxx","xxx","xxx", 'x', Items.STRING}));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ENItems.mesh, 1, 2), new Object[] {"x x","xyx","x x", 'x', Items.FLINT, 'y', new ItemStack(ENItems.mesh, 1, 1)}));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ENItems.mesh, 1, 3), new Object[] {"x x","xyx","x x", 'x', Items.IRON_INGOT, 'y', new ItemStack(ENItems.mesh, 1, 2)}));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ENItems.mesh, 1, 4), new Object[] {"x x","xyx","x x", 'x', Items.DIAMOND, 'y', new ItemStack(ENItems.mesh, 1, 3)}));
FurnaceRecipes.instance().addSmeltingRecipe(ItemResource.getResourceStack("silkworm"), new ItemStack(ENItems.cookedSilkworm), 0.7f);
GameRegistry.addRecipe(new ShapedOreRecipe(ItemResource.getResourceStack("doll", 4), new Object[] {"xyx"," x ", "x x", 'x', "clayPorcelain", 'y', "gemDiamond"}));
GameRegistry.addRecipe(new ShapedOreRecipe(ItemResource.getResourceStack("doll", 6), new Object[] {"xyx"," x ", "x x", 'x', "clayPorcelain", 'y', "gemEmerald"}));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ENItems.dolls, 1, 0), new Object[] {"xyx", "zwz", "xvx", 'x', Items.BLAZE_POWDER, 'v', Items.NETHER_WART, 'w', ItemResource.getResourceStack("doll"), 'y', "dustRedstone", 'z', "dustGlowstone"}));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ENItems.dolls, 1, 1), new Object[] {"xyx", "zwz", "xvx", 'v', Items.NETHER_WART, 'x', "dyeBlack", 'w', ItemResource.getResourceStack("doll"), 'y', "dustRedstone", 'z', "dustGlowstone"}));
}
public static int getShapedOreRecipeWidth(ShapedOreRecipe recipe) {
try {
return SHAPEDORERECIPE_WIDTH.getInt(recipe);
} catch (IllegalAccessException ex) {
Game.logger().error("could not load shaped ore recipe width!");
return 3;
}
}
public static int getShapedOreRecipeWidth(ShapedOreRecipe recipe) {
try {
return SHAPEDORERECIPE_WIDTH.getInt(recipe);
} catch (IllegalAccessException ex) {
Game.logger().error("could not load shaped ore recipe width!");
return 3;
}
}
public static int getShapedOreRecipeWidth(ShapedOreRecipe recipe) {
try {
return SHAPEDORERECIPE_WIDTH.getInt(recipe);
} catch (IllegalAccessException ex) {
Game.logger().error("could not load shaped ore recipe width!");
return 3;
}
}
private static void initVanillaRecipes(){
OreDictionary.registerOre("barsIron", Blocks.IRON_BARS);
OreDictionary.registerOre("bars", Blocks.IRON_BARS);
OreDictionary.registerOre("doorIron", Items.IRON_DOOR);
OreDictionary.registerOre("door", Items.IRON_DOOR);
OreDictionary.registerOre("doorWood", Items.OAK_DOOR);
OreDictionary.registerOre("doorWood", Items.JUNGLE_DOOR);
OreDictionary.registerOre("doorWood", Items.SPRUCE_DOOR);
OreDictionary.registerOre("doorWood", Items.DARK_OAK_DOOR);
OreDictionary.registerOre("doorWood", Items.BIRCH_DOOR);
OreDictionary.registerOre("doorWood", Items.ACACIA_DOOR);
OreDictionary.registerOre("door", Items.OAK_DOOR);
OreDictionary.registerOre("door", Items.JUNGLE_DOOR);
OreDictionary.registerOre("door", Items.SPRUCE_DOOR);
OreDictionary.registerOre("door", Items.DARK_OAK_DOOR);
OreDictionary.registerOre("door", Items.BIRCH_DOOR);
OreDictionary.registerOre("door", Items.ACACIA_DOOR);
CrusherRecipeRegistry.addNewCrusherRecipe("oreIron", new ItemStack(cyano.basemetals.init.Items.iron_powder,2));
CrusherRecipeRegistry.addNewCrusherRecipe("blockIron", new ItemStack(cyano.basemetals.init.Items.iron_powder,9));
CrusherRecipeRegistry.addNewCrusherRecipe("ingotIron", new ItemStack(cyano.basemetals.init.Items.iron_powder,1));
CrusherRecipeRegistry.addNewCrusherRecipe("oreGold", new ItemStack(cyano.basemetals.init.Items.gold_powder,2));
CrusherRecipeRegistry.addNewCrusherRecipe("blockGold", new ItemStack(cyano.basemetals.init.Items.gold_powder,9));
CrusherRecipeRegistry.addNewCrusherRecipe("ingotGold", new ItemStack(cyano.basemetals.init.Items.gold_powder,1));
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(cyano.basemetals.init.Items.iron_nugget,9), new ItemStack(Items.IRON_INGOT)));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Items.IRON_INGOT), "xxx","xxx","xxx",'x',cyano.basemetals.init.Items.iron_nugget));
GameRegistry.addSmelting(cyano.basemetals.init.Items.iron_powder, new ItemStack(Items.IRON_INGOT), 0f);
GameRegistry.addSmelting(cyano.basemetals.init.Items.gold_powder, new ItemStack(Items.GOLD_INGOT), 0f);
CrusherRecipeRegistry.addNewCrusherRecipe("oreCoal", new ItemStack(cyano.basemetals.init.Items.carbon_powder,2));
CrusherRecipeRegistry.addNewCrusherRecipe("blockCoal", new ItemStack(cyano.basemetals.init.Items.carbon_powder,9));
CrusherRecipeRegistry.addNewCrusherRecipe(new ItemStack(Items.COAL,1,0), new ItemStack(cyano.basemetals.init.Items.carbon_powder,1));
CrusherRecipeRegistry.addNewCrusherRecipe(new ItemStack(Items.COAL,1,1), new ItemStack(cyano.basemetals.init.Items.carbon_powder,1));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Blocks.COAL_BLOCK), "xxx","xxx","xxx",'x',cyano.basemetals.init.Items.carbon_powder));
}
private CachedRollingMachineShapedRecipe getCachedRecipe(IRecipe irecipe, boolean genPerms) {
CachedRollingMachineShapedRecipe recipe = null;
if (irecipe instanceof ShapedRecipes) {
recipe = new CachedRollingMachineShapedRecipe((ShapedRecipes) irecipe, genPerms);
} else if (irecipe instanceof ShapedOreRecipe) {
recipe = this.getCachedOreRecipe((ShapedOreRecipe) irecipe, genPerms);
}
return recipe;
}
@Override
public IRecipe parse(JsonContext context, JsonObject json) {
ShapedOreRecipe fake = ShapedOreRecipe.factory(context, json);
CraftingHelper.ShapedPrimer primer = new CraftingHelper.ShapedPrimer();
primer.width = fake.getRecipeWidth();
primer.height = fake.getRecipeHeight();
primer.input = fake.getIngredients();
primer.mirrored = JsonUtils.getBoolean(json, "mirrored", true); // Hack
return new CustomWoodShapedRecipe(fake.getRegistryName(), fake.getRecipeOutput(), primer);
}
@Override
public void registerRecipes(IForgeRegistry<IRecipe> registry) {
for (AgriNuggetType type : AgriNuggetType.values()) {
// 1) Ore Dictionary registration.
AgriCore.getLogger("agricraft").info("Registering in Ore Dictionary: {0}", type.nugget);
ItemStack oneNugget = new ItemStack(this, 1, type.ordinal());
OreDictionary.registerOre(type.nugget, oneNugget);
// 2) Conditional recipes. Only if the ingot exists, because AgriCraft doesn't add its own.
ItemStack ingot = OreDictUtil.getFirstOre(type.ingot).orElse(ItemStack.EMPTY);
if (!ingot.isEmpty()) {
AgriCore.getLogger("agricraft").info("Adding a recipe to convert nine {0} into one {1}", type.nugget, type.ingot);
final ResourceLocation group = new ResourceLocation(AgriCraft.instance.getModId(), "combine_nugget");
final ResourceLocation name = new ResourceLocation(AgriCraft.instance.getModId(), "combine_nugget_" + type.name().toLowerCase());
final ShapedOreRecipe recipe = new ShapedOreRecipe(
group,
ingot,
"nnn",
"nnn",
"nnn",
'n', type.nugget
);
recipe.setRegistryName(name);
AgriCore.getLogger("agricraft").info("Registering nugget recipe: {0}!", recipe.getRegistryName());
registry.register(recipe);
}
}
}
public static void postInitHammers() {
for (AliquoHammer hammer : AliquoHammer.registeredHammers()) {
AliquoMaterial am = AliquoMaterial.get(hammer.material);
EnumToolMaterial toolEnum = am.getToolEnumFromRecipe();
if (toolEnum == null)
{
toolEnum = am.getFallbackToolEnum();
}
GameRegistry.addRecipe(new ShapedOreRecipe(hammer, hammershape, 's', "stickWood", 'i', hammer.getIngotName()));
hammer.setToolMaterial(toolEnum);
}
}
private static void addRecipies()
{
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemwireless, 1, 0),
"t ",
"srr",
"fff",
't', WirelessRedstoneCore.wirelessTransceiver,
's', "obsidianRod",
'f', new ItemStack(Blocks.stone_slab, 1, 0),
'r', Items.redstone));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemwireless, 1, 1),
"d ",
"srr",
"fff",
'd', WirelessRedstoneCore.recieverDish,
's', "obsidianRod",
'f', new ItemStack(Blocks.stone_slab, 1, 0),
'r', Items.redstone));
GameRegistry.addRecipe(new ItemStack(itemwireless, 1, 2),
"p ",
"srr",
"fff",
'p', WirelessRedstoneCore.blazeTransceiver,
's', Items.blaze_rod,
'f', new ItemStack(Blocks.stone_slab, 1, 0),
'r', Items.redstone);
}
@Override
public void init(){
ItemStack stoneGear = PneumaticCraftUtils.getBuildcraftItemStack(EnumBuildcraftModule.CORE, "stoneGearItem");
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Itemss.compressedIronGear), " i ", "isi", " i ", 'i', Names.INGOT_IRON_COMPRESSED, 's', stoneGear));
//PneumaticRegistry.getInstance().registerFuel(FluidRegistry.getFluid("fuel"), 1500000);
}
public static void registrarHandling(IHydraulicraftRegistrar registrar){
registrar.registerTrolley(new TrolleyPlasticPlants());
ItemStack cropsTrolly = registrar.getTrolleyItem("plasticPlants");
cropsTrolly.stackSize = 4;
Block pressureCore = GameData.getBlockRegistry().getObject(ModIds.HC + ":LPBlockCore");
Block pressureWall = GameData.getBlockRegistry().getObject(ModIds.HC + ":hydraulicPressureWall");
Block hydraulicPiston = GameData.getBlockRegistry().getObject(ModIds.HC + ":hydraulicPiston");
GameRegistry.addRecipe(new ShapedOreRecipe(cropsTrolly, true, "-P-", "WCW", "-H-", 'C', new ItemStack(pressureCore, 1, 1), 'W', pressureWall, 'H', Itemss.turbineRotor, 'P', hydraulicPiston));
}
@Override
public void init(){
if(!Loader.isModLoaded(ModIds.COMPUTERCRAFT)) {
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(droneInterface), true, " u ", "mp ", "iii", 'u', new ItemStack(Itemss.machineUpgrade, 1, ItemMachineUpgrade.UPGRADE_RANGE), 'm', Items.ender_pearl, 'p', Itemss.printedCircuitBoard, 'i', Names.INGOT_IRON_COMPRESSED));
}
if(Loader.isModLoaded(ModIds.OPEN_COMPUTERS)) {
initializeDrivers();
}
}