net.minecraftforge.oredict.ShapedOreRecipe Java Examples

The following examples show how to use net.minecraftforge.oredict.ShapedOreRecipe. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ShapedRecipeHandler.java    From NotEnoughItems with MIT License 6 votes vote down vote up
@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);
        }
    }
}
 
Example #2
Source File: ShapedRecipeHandler.java    From NotEnoughItems with MIT License 6 votes vote down vote up
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());
}
 
Example #3
Source File: ShapedRecipeHandler.java    From NotEnoughItems with MIT License 6 votes vote down vote up
@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);
        }
    }
}
 
Example #4
Source File: ShapedRecipeHandler.java    From NotEnoughItems with MIT License 6 votes vote down vote up
@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);
        }
    }
}
 
Example #5
Source File: ShapedRecipeHandler.java    From NotEnoughItems with MIT License 6 votes vote down vote up
@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);
    }
}
 
Example #6
Source File: RecipeHandlerRollingMachineShaped.java    From NEI-Integration with MIT License 6 votes vote down vote up
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);
}
 
Example #7
Source File: ShapedRecipeHandler.java    From NotEnoughItems with MIT License 6 votes vote down vote up
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());
}
 
Example #8
Source File: ShapedRecipeHandler.java    From NotEnoughItems with MIT License 6 votes vote down vote up
@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);
        }
    }
}
 
Example #9
Source File: ShapedRecipeHandler.java    From NotEnoughItems with MIT License 6 votes vote down vote up
@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);
    }
}
 
Example #10
Source File: ModRecipes.java    From GardenCollection with MIT License 6 votes vote down vote up
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);
}
 
Example #11
Source File: DamageableShapedOreRecipeTest.java    From customstuff4 with GNU General Public License v3.0 6 votes vote down vote up
@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());
}
 
Example #12
Source File: CircuitImprintLoader.java    From bartworks with MIT License 6 votes vote down vote up
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);
}
 
Example #13
Source File: CoFHCore.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
@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);
}
 
Example #14
Source File: CraftingRegistrator.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
private static void scanForFluids(ShapedOreRecipe recipe){
    for(int i = 0; i < recipe.getRecipeSize(); i++) {
        Object o = recipe.getInput()[i];
        if(o instanceof ItemStack) {
            ItemStack stack = (ItemStack)o;
            FluidStack fluid = FluidContainerRegistry.getFluidForFilledItem(stack);
            if(fluid != null) {
                GameRegistry.addRecipe(new RecipeFluid(recipe, i));
            }
        }
    }
}
 
Example #15
Source File: ComputerCraft.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void init(){
    if(Loader.isModLoaded(ModIds.OPEN_COMPUTERS)) super.init();
    Block modem = GameRegistry.findBlock(ModIds.COMPUTERCRAFT, "CC-Peripheral");
    if(modem != null) {
        GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(droneInterface), true, " u ", "mp ", "iii", 'u', new ItemStack(Itemss.machineUpgrade, 1, ItemMachineUpgrade.UPGRADE_RANGE), 'm', new ItemStack(modem, 1, 1), 'p', Itemss.printedCircuitBoard, 'i', Names.INGOT_IRON_COMPRESSED));
    } else {
        Log.error("Wireless Modem block not found! Using the backup recipe");
        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));
    }
}
 
Example #16
Source File: Recipes.java    From BaseMetals with GNU Lesser General Public License v2.1 5 votes vote down vote up
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));
}
 
Example #17
Source File: WRLogicProxy.java    From WirelessRedstone with MIT License 5 votes vote down vote up
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);
}
 
Example #18
Source File: Registries.java    From Ex-Aliquo with MIT License 5 votes vote down vote up
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);
	}
}
 
Example #19
Source File: ItemNugget.java    From AgriCraft with MIT License 5 votes vote down vote up
@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);
        }
    }
}
 
Example #20
Source File: CustomWoodShapedRecipe.java    From AgriCraft with MIT License 5 votes vote down vote up
@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);
}
 
Example #21
Source File: OpenComputers.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@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();
    }
}
 
Example #22
Source File: RecipeHandlerRollingMachineShaped.java    From NEI-Integration with MIT License 5 votes vote down vote up
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;
}
 
Example #23
Source File: BuildCraft.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@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);
}
 
Example #24
Source File: Hydraulicraft.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
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));
}
 
Example #25
Source File: ReflectionUtil.java    From NOVA-Core with GNU Lesser General Public License v3.0 5 votes vote down vote up
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;
	}
}
 
Example #26
Source File: ReflectionUtil.java    From NOVA-Core with GNU Lesser General Public License v3.0 5 votes vote down vote up
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;
	}
}
 
Example #27
Source File: ReflectionUtil.java    From NOVA-Core with GNU Lesser General Public License v3.0 5 votes vote down vote up
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;
	}
}
 
Example #28
Source File: Recipes.java    From ExNihiloAdscensio with MIT License 5 votes vote down vote up
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"}));
}
 
Example #29
Source File: RecipeFluid.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
public RecipeFluid(ShapedOreRecipe recipe, int fluidIndex){
    this.recipe = recipe;
    originalStack = (ItemStack)recipe.getInput()[fluidIndex];
    fluidStack = FluidContainerRegistry.getFluidForFilledItem(originalStack);
    if(fluidStack == null) throw new IllegalArgumentException("Recipe doesn't have fluid item at index " + fluidIndex + ". Item: " + originalStack);
    this.fluidIndex = fluidIndex;
}
 
Example #30
Source File: DamageableShapedOreRecipeTest.java    From customstuff4 with GNU General Public License v3.0 5 votes vote down vote up
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());
    }
}