codechicken.nei.api.API Java Examples

The following examples show how to use codechicken.nei.api.API. 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: JEIProxy.java    From NotEnoughItems with MIT License 6 votes vote down vote up
public JEIProxy() {
    MinecraftForge.EVENT_BUS.register(new EventHandler());
    API.registerNEIGuiHandler(new INEIGuiHandler() {
        @Override
        public boolean hideItemPanelSlot(GuiContainer gui, int x, int y, int w, int h) {
            if (extraAreasCache == null) {
                extraAreasCache = getExtraAreas(gui);
            }
            for (Rectangle rectangle : extraAreasCache) {
                if (rectangle.intersects(x, y, w, h)) {
                    return true;
                }
            }
            return false;
        }
    });
}
 
Example #2
Source File: NEI_BW_Config.java    From bartworks with MIT License 5 votes vote down vote up
public void loadConfig() {
    API.hideItem(new ItemStack(ItemRegistry.TAB));
    API.hideItem(new ItemStack(FluidLoader.bioFluidBlock));
    API.hideItem(new ItemStack(ItemRegistry.bw_fake_glasses));
    NEI_BW_Config.sIsAdded = false;
    new BW_NEI_OreHandler();
    new BW_NEI_BioVatHandler(BWRecipes.instance.getMappingsFor(BWRecipes.BACTERIALVATBYTE));
    new BW_NEI_BioLabHandler(BWRecipes.instance.getMappingsFor(BWRecipes.BIOLABBYTE));
    NEI_BW_Config.sIsAdded = true;
}
 
Example #3
Source File: NEIChiselConfig.java    From Chisel-2 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void loadConfig() {
	API.hideItem(new ItemStack(GameRegistry.findBlock("chisel", "limestone_slab_top")));
	API.hideItem(new ItemStack(GameRegistry.findBlock("chisel", "marble_slab_top")));
	API.hideItem(new ItemStack(GameRegistry.findBlock("chisel", "marble_pillar_slab_top")));

	RecipeHandlerChisel handler = new RecipeHandlerChisel();
	API.registerRecipeHandler(handler);
	API.registerUsageHandler(handler);
	API.setGuiOffset(GuiChisel.class, -50, 40);
}
 
Example #4
Source File: MCForgeDumpers.java    From NEI-Integration with MIT License 5 votes vote down vote up
public static void loadConfig() {
    API.addOption(new LoadedModDumper());
    API.addOption(new ChestLootDumper());
    API.addOption(new DimensionDumper());
    API.addOption(new EntityDumper());
    API.addOption(new TileEntityDumper());
    
    API.addOption(new OreDictionaryDumper());
    API.addOption(new FluidDumper());
    API.addOption(new FluidContainerDumper());
    API.addOption(new RecipeHandlerDumper());
    
    API.addOption(new InventoryDumper());
}
 
Example #5
Source File: RecipeHandlerPresserOld.java    From NEI-Integration with MIT License 5 votes vote down vote up
@Override
public void prepare() {
    API.setGuiOffset(GuiPamPresser.class, 7, -18);
    
    try {
        Method smelting = PresserRecipes.class.getMethod("smelting");
        getSmeltingList = PresserRecipes.class.getMethod("getSmeltingList");
        presserRecipesInstance = (PresserRecipes) smelting.invoke(null);
    } catch (Exception e) {
    }
}
 
Example #6
Source File: RecipeInfo.java    From NotEnoughItems with MIT License 5 votes vote down vote up
public static void load()
{
    API.registerRecipeHandler(new ShapedRecipeHandler());
    API.registerUsageHandler(new ShapedRecipeHandler());
    API.registerRecipeHandler(new ShapelessRecipeHandler());
    API.registerUsageHandler(new ShapelessRecipeHandler());
    API.registerRecipeHandler(new FireworkRecipeHandler());
    API.registerUsageHandler(new FireworkRecipeHandler());
    API.registerRecipeHandler(new FurnaceRecipeHandler());
    API.registerUsageHandler(new FurnaceRecipeHandler());
    API.registerRecipeHandler(new BrewingRecipeHandler());
    API.registerUsageHandler(new BrewingRecipeHandler());
    API.registerRecipeHandler(new FuelRecipeHandler());
    API.registerUsageHandler(new FuelRecipeHandler());

    API.registerGuiOverlay(GuiCrafting.class, "crafting");
    API.registerGuiOverlay(GuiInventory.class, "crafting2x2", 63, 20);
    API.registerGuiOverlay(GuiFurnace.class, "smelting");
    API.registerGuiOverlay(GuiFurnace.class, "fuel");
    API.registerGuiOverlay(GuiBrewingStand.class, "brewing");

    API.registerGuiOverlayHandler(GuiCrafting.class, new DefaultOverlayHandler(), "crafting");
    API.registerGuiOverlayHandler(GuiInventory.class, new DefaultOverlayHandler(63, 20), "crafting2x2");
    API.registerGuiOverlayHandler(GuiBrewingStand.class, new BrewingOverlayHandler(), "brewing");
    
    API.registerRecipeHandler(new ProfilerRecipeHandler(true));
    API.registerUsageHandler(new ProfilerRecipeHandler(false));
}
 
Example #7
Source File: ClientHandler.java    From NotEnoughItems with MIT License 5 votes vote down vote up
public static void init() {
    instance = new ClientHandler();

    GuiModListScroll.register("NotEnoughItems");
    PacketCustom.assignHandler(NEICPH.channel, new NEICPH());
    FMLCommonHandler.instance().bus().register(instance);
    MinecraftForge.EVENT_BUS.register(instance);

    ItemInfo.init();
    API.registerHighlightHandler(new DefaultHighlightHandler(), ItemInfo.Layout.HEADER);
    HUDRenderer.load();
    WorldOverlayRenderer.load();
}
 
Example #8
Source File: NEIEtFuturumConfig.java    From Et-Futurum with The Unlicense 5 votes vote down vote up
@Override
public void loadConfig() {
	if (EtFuturum.enableBanners) {
		API.registerRecipeHandler(new BannerPatternHandler());
		API.registerUsageHandler(new BannerPatternHandler());
	}

	if (EtFuturum.enableBeetroot)
		API.hideItem(new ItemStack(ModBlocks.beetroot));
}
 
Example #9
Source File: NEIGTNewHorizonsConfig.java    From NewHorizonsCoreMod with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void loadConfig()
{
    API.hideItem(new ItemStack(QuantumBread.Instance()));
    // Hide metaID 0, as this is the generic item for trash bags
    MainRegistry.Logger.info("Added NEI Config");
}
 
Example #10
Source File: LayoutManager.java    From NotEnoughItems with MIT License 5 votes vote down vote up
public static void load() {
    API.addLayoutStyle(0, new LayoutStyleMinecraft());
    API.addLayoutStyle(1, new LayoutStyleTMIOld());

    instance = new LayoutManager();
    KeyManager.trackers.add(instance);
    NEIClientEventHandler.addInputHandler(instance);
    NEIClientEventHandler.addTooltipHandler(instance);
    NEIClientEventHandler.addDrawHandler(instance);
    NEIClientEventHandler.addObjectHandler(instance);
    init();
}
 
Example #11
Source File: NEIInitialization.java    From NotEnoughItems with MIT License 5 votes vote down vote up
private static void loadModSubsets() {
    ProgressBar bar = ProgressManager.push("Mod Subsets", ForgeRegistries.ITEMS.getKeys().size());
    HashMap<String, ItemStackSet> modSubsets = new HashMap<>();

    for (Item item : ForgeRegistries.ITEMS) {
        try {
            ResourceLocation ident = item.getRegistryName();
            bar.step(ident.toString());
            if (ident == null) {
                LogHelper.error("Failed to find identifier for: " + item);
                continue;
            }
            String modId = ident.getResourceDomain();
            ItemInfo.itemOwners.put(item, modId);
            ItemStackSet itemset = modSubsets.computeIfAbsent(modId, k -> new ItemStackSet());
            itemset.with(item);
        } catch (Throwable t) {
            LogHelper.errorError("Failed to process mod subset item %s %s", t, String.valueOf(item), String.valueOf(item.getRegistryName()));
        }
    }
    ProgressManager.pop(bar);

    API.addSubset("Mod.Minecraft", modSubsets.remove("minecraft"));
    for (Entry<String, ItemStackSet> entry : modSubsets.entrySet()) {
        ModContainer mc = FMLCommonHandler.instance().findContainerFor(entry.getKey());
        if (mc == null) {
            LogHelper.error("Missing container for " + entry.getKey());
        } else {
            API.addSubset("Mod." + mc.getName(), entry.getValue());
        }
    }
}
 
Example #12
Source File: NEIInitialization.java    From NotEnoughItems with MIT License 5 votes vote down vote up
public static void loadPotionSubsets() {
    ArrayList<ItemStack> allPotions = new ArrayList<>();
    for (IPotionRecipe recipe : PotionRecipeHelper.getRecipes()) {
        allPotions.add(recipe.getRecipeOutput());
    }

    ItemStackSet positiveEffects = new ItemStackSet();
    ItemStackSet negativeEffects = new ItemStackSet();
    ItemStackSet neutralEffects = new ItemStackSet();
    for (ItemStack potionStack : allPotions) {
        PotionType potionType = PotionRecipeHelper.getPotionTypeFromStack(potionStack);
        if (potionType == null) {
            continue;
        }
        List<PotionEffect> stackEffects = potionType.getEffects();
        if (stackEffects.isEmpty()) {
            neutralEffects.add(potionStack);
            continue;
        }
        for (PotionEffect effect : stackEffects) {
            //If for some reason a vanilla potion has positive and negative effects, make sure we don't add it to the list more than once.
            if (effect.getPotion().isBadEffect()) {
                if (!negativeEffects.contains(potionStack)) {
                    negativeEffects.add(potionStack);
                }
            } else {
                if (!positiveEffects.contains(potionStack)) {
                    positiveEffects.add(potionStack);
                }
            }
        }
    }

    API.addSubset("Items.Potions", new ItemStackSet().with(Items.POTIONITEM).with(Items.SPLASH_POTION).with(Items.LINGERING_POTION));
    API.addSubset("Items.Potions.Splash", new ItemStackSet().with(Items.SPLASH_POTION));
    API.addSubset("Items.Potions.Lingering", new ItemStackSet().with(Items.LINGERING_POTION));
    API.addSubset("Items.Potions.Positive", positiveEffects);
    API.addSubset("Items.Potions.Negative", negativeEffects);
    API.addSubset("Items.Potions.Neutral", neutralEffects);
}
 
Example #13
Source File: NEIbartworksConfig.java    From bartworks with MIT License 5 votes vote down vote up
@Optional.Method(modid = "NotEnoughItems")
    @Override
    public void loadConfig() {
        API.hideItem(new ItemStack(ItemRegistry.TAB));
        API.hideItem(new ItemStack(FluidLoader.bioFluidBlock));
        API.hideItem(new ItemStack(ItemRegistry.bw_fake_glasses));
        ItemStack[] prefixesToHide = {
                WerkstoffLoader.getCorrespondingItemStack(OrePrefixes.dustTiny, WerkstoffLoader.Bismutite).copy(),
                WerkstoffLoader.getCorrespondingItemStack(OrePrefixes.dustSmall, WerkstoffLoader.Bismutite).copy(),
                WerkstoffLoader.getCorrespondingItemStack(OrePrefixes.crushed, WerkstoffLoader.Bismutite).copy(),
                WerkstoffLoader.getCorrespondingItemStack(OrePrefixes.crushedPurified, WerkstoffLoader.Bismutite).copy(),
                WerkstoffLoader.getCorrespondingItemStack(OrePrefixes.crushedCentrifuged, WerkstoffLoader.Bismutite).copy(),
                WerkstoffLoader.getCorrespondingItemStack(OrePrefixes.nugget, WerkstoffLoader.Bismutite).copy(),
                WerkstoffLoader.getCorrespondingItemStack(OrePrefixes.gemChipped, WerkstoffLoader.Bismutite).copy(),
                WerkstoffLoader.getCorrespondingItemStack(OrePrefixes.gemFlawed, WerkstoffLoader.Bismutite).copy(),
                WerkstoffLoader.getCorrespondingItemStack(OrePrefixes.gemFlawless, WerkstoffLoader.Bismutite).copy(),
                WerkstoffLoader.getCorrespondingItemStack(OrePrefixes.gemExquisite, WerkstoffLoader.Bismutite).copy(),
                WerkstoffLoader.getCorrespondingItemStack(OrePrefixes.dustImpure, WerkstoffLoader.Bismutite).copy(),
                WerkstoffLoader.getCorrespondingItemStack(OrePrefixes.dustPure, WerkstoffLoader.Bismutite).copy(),
        };
        for (ItemStack stack : prefixesToHide) {
            stack.setItemDamage(Short.MAX_VALUE);
            API.hideItem(stack);
        }
//        for (int i = 0; i < Short.MAX_VALUE; i++) {
//            API.addItemListEntry(new ItemStack(WerkstoffLoader.BWOres,1,i));
//        }
    }
 
Example #14
Source File: NEIPluginConfig.java    From GTNEIOrePlugin with MIT License 5 votes vote down vote up
@Override
public void loadConfig() {
    if (GTNEIOrePlugin.GTVersion.equals("GT5")) {
        PluginGT5VeinStat pluginVeinStat = new PluginGT5VeinStat();
        PluginGT5AsteroidStat pluginAsteriodStat = new PluginGT5AsteroidStat();
        PluginGT5SmallOreStat pluginSmallOreStat = new PluginGT5SmallOreStat();
        API.registerRecipeHandler(pluginVeinStat);
        API.registerUsageHandler(pluginVeinStat);
        API.registerRecipeHandler(pluginAsteriodStat);
        API.registerUsageHandler(pluginAsteriodStat);
        API.registerRecipeHandler(pluginSmallOreStat);
        API.registerUsageHandler(pluginSmallOreStat);
        if (GT5OreLayerHelper.immersiveEngineeringSupport) {
            PluginGT5IEVeinStat pluginIEVeinStat = new PluginGT5IEVeinStat();
            API.registerRecipeHandler(pluginIEVeinStat);
            API.registerUsageHandler(pluginIEVeinStat);
        }
    }
    else {
        PluginGT6VeinStat pluginGT6VeinStat = new PluginGT6VeinStat();
        PluginGT6SmallOreStat pluginGT6SmallOreStat = new PluginGT6SmallOreStat();
        PluginGT6BedrockOreStat pluginGT6BedrockOreStat = new PluginGT6BedrockOreStat();
        API.registerRecipeHandler(pluginGT6VeinStat);
        API.registerUsageHandler(pluginGT6VeinStat);
        API.registerRecipeHandler(pluginGT6SmallOreStat);
        API.registerUsageHandler(pluginGT6SmallOreStat);
        API.registerRecipeHandler(pluginGT6BedrockOreStat);
        API.registerUsageHandler(pluginGT6BedrockOreStat);
    } 
}
 
Example #15
Source File: NEIController.java    From NotEnoughItems with MIT License 5 votes vote down vote up
public static void load(GuiContainer gui) {
    deleteMode = false;
    GuiInfo.clearGuiHandlers();
    fastTransferManager = null;
    if (!NEIClientConfig.isEnabled()) {
        return;
    }

    fastTransferManager = new FastTransferManager();
    if (gui instanceof INEIGuiHandler) {
        API.registerNEIGuiHandler((INEIGuiHandler) gui);
    }
}
 
Example #16
Source File: NEIColossalChestsConfig.java    From NotEnoughItems with MIT License 5 votes vote down vote up
@Override
public void loadConfig() {
    try {
        Class<?> clazz = null;
        try {
            clazz = ReflectionManager.findClass("org.cyclops.colossalchests.client.gui.container.GuiColossalChest");
        } catch (Exception ignored) {
        }
        if (clazz != null) {
            API.addFastTransferExemptContainer((Class<? extends GuiContainer>) clazz);
        }
    } catch (Exception e) {
        LogHelper.fatalError("Something went wring trying to enable ColossalChests ingegration.", e);
    }
}
 
Example #17
Source File: RecipeHandlerPresser.java    From NEI-Integration with MIT License 4 votes vote down vote up
@Override
public void prepare() {
    API.setGuiOffset(GuiPamPresser.class, 7, -18);
}
 
Example #18
Source File: NEIPluginInitConfig.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
public void registerHandler(TemplateRecipeHandler handler){
    API.registerRecipeHandler(handler);
    API.registerUsageHandler(handler);
}
 
Example #19
Source File: NEIPluginInitConfig.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void loadConfig(){

    Log.info("Initializing " + getName() + "...");

    registerHandler(new NEIPressureChamberRecipeManager());
    registerHandler(new NEIAssemblyControllerRecipeManager());
    registerHandler(new NEIThermopneumaticProcessingPlantManager());
    registerHandler(new NEIRefineryManager());
    registerHandler(new NEIEtchingAcidManager());
    registerHandler(new NEIUVLightBoxManager());
    registerHandler(new NEIAmadronTradeManager());
    registerHandler(new NEIPlasticMixerManager());

    GuiContainerManager.addDrawHandler(new ItemDrawHandler());

    //handle drop down windows
    /* MultiItemRange tubes = new MultiItemRange();
     tubes.add(Blockss.pressureTube, 0, BlockPressureTube.PRESSURE_TUBES_AMOUNT);
     tubes.add(Blockss.advancedPressureTube, 0, BlockPressureTube.PRESSURE_TUBES_AMOUNT);
     API.addSetRange("Mod.PneumaticCraft.Pressure Tubes", tubes);

     MultiItemRange upgrades = new MultiItemRange();
     upgrades.add(Itemss.machineUpgrade, 0, ItemMachineUpgrade.UPGRADES_AMOUNT);
     API.addSetRange("Mod.PneumaticCraft.Machine Upgrades", upgrades);*/

    API.hideItem(new ItemStack(Blockss.burstPlant));
    API.hideItem(new ItemStack(Blockss.chopperPlant));
    API.hideItem(new ItemStack(Blockss.creeperPlant));
    API.hideItem(new ItemStack(Blockss.enderPlant));
    API.hideItem(new ItemStack(Blockss.fireFlower));
    API.hideItem(new ItemStack(Blockss.flyingFlower));
    API.hideItem(new ItemStack(Blockss.heliumPlant));
    API.hideItem(new ItemStack(Blockss.lightningPlant));
    API.hideItem(new ItemStack(Blockss.potionPlant));
    API.hideItem(new ItemStack(Blockss.propulsionPlant));
    API.hideItem(new ItemStack(Blockss.rainPlant));
    API.hideItem(new ItemStack(Blockss.repulsionPlant));
    API.hideItem(new ItemStack(Blockss.slimePlant));
    API.hideItem(new ItemStack(Blockss.squidPlant));
    API.hideItem(new ItemStack(Blockss.droneRedstoneEmitter));
}
 
Example #20
Source File: NEIHelper.java    From GardenCollection with MIT License 4 votes vote down vote up
public static void registerNEI () {
    API.registerRecipeHandler(new BloomeryFurnaceRecipeHandler());
    API.registerUsageHandler(new BloomeryFurnaceRecipeHandler());
    API.registerGuiOverlay(GuiBloomeryFurnace.class, "bloomerySmelting");
}
 
Example #21
Source File: TranslocatorProxy.java    From Translocators with MIT License 4 votes vote down vote up
public void init() {
    blockTranslocator = new BlockTranslocator();
    blockTranslocator.setBlockName("translocator").setCreativeTab(CreativeTabs.tabRedstone);
    blockCraftingGrid = new BlockCraftingGrid();
    blockCraftingGrid.setBlockName("craftingGrid");
    blockCraftingGrid.setBlockTextureName("planks_oak");

    itemDiamondNugget = new Item()
            .setUnlocalizedName("translocator:diamondNugget").setTextureName("translocator:diamondNugget")
            .setCreativeTab(CreativeTabs.tabMaterials);
    GameRegistry.registerItem(itemDiamondNugget, "diamondNugget");
    OreDictionary.registerOre("nuggetDiamond", itemDiamondNugget);

    GameRegistry.registerBlock(blockTranslocator, ItemTranslocator.class, "translocator");
    GameRegistry.registerBlock(blockCraftingGrid, "craftingGrid");
    MinecraftForge.EVENT_BUS.register(blockTranslocator);
    MinecraftForge.EVENT_BUS.register(blockCraftingGrid);

    GameRegistry.registerTileEntity(TileItemTranslocator.class, "itemTranslocator");
    GameRegistry.registerTileEntity(TileLiquidTranslocator.class, "liquidTranslocator");
    GameRegistry.registerTileEntity(TileCraftingGrid.class, "craftingGrid");

    PacketCustom.assignHandler(TranslocatorSPH.channel, new TranslocatorSPH());

    GameRegistry.addRecipe(new ItemStack(blockTranslocator, 2, 0),
            "rer",
            "ipi",
            "rgr",
            'r', Items.redstone,
            'e', Items.ender_pearl,
            'i', Items.iron_ingot,
            'g', Items.gold_ingot,
            'p', Blocks.piston);
    GameRegistry.addRecipe(new ItemStack(blockTranslocator, 2, 1),
            "rer",
            "ipi",
            "rlr",
            'r', Items.redstone,
            'e', Items.ender_pearl,
            'i', Items.iron_ingot,
            'l', new ItemStack(Items.dye, 1, 4),
            'p', Blocks.piston);
    API.hideItem(new ItemStack(blockCraftingGrid));

    GameRegistry.addShapelessRecipe(new ItemStack(Items.diamond),
            itemDiamondNugget, itemDiamondNugget, itemDiamondNugget,
            itemDiamondNugget, itemDiamondNugget, itemDiamondNugget,
            itemDiamondNugget, itemDiamondNugget, itemDiamondNugget);

    GameRegistry.addShapelessRecipe(new ItemStack(itemDiamondNugget, 9), Items.diamond);
}
 
Example #22
Source File: RecipeHandlerCarpenter.java    From NEI-Integration with MIT License 4 votes vote down vote up
@Override
public void prepare() {
    guiClass = Utils.getClass("forestry.factory.gui.GuiCarpenter");
    API.setGuiOffset(guiClass, 5, 14);
}
 
Example #23
Source File: RecipeHandlerFermenter.java    From NEI-Integration with MIT License 4 votes vote down vote up
@Override
public void prepare() {
    guiClass = Utils.getClass("forestry.factory.gui.GuiFermenter");
    API.setGuiOffset(guiClass, 5, 15);
}
 
Example #24
Source File: RecipeHandlerRockCrusher.java    From NEI-Integration with MIT License 4 votes vote down vote up
@Override
public void prepare() {
    guiClass = Utils.getClass("mods.railcraft.client.gui.GuiRockCrusher");
    API.setGuiOffset(guiClass, -3, 11);
}
 
Example #25
Source File: RecipeHandlerCokeOven.java    From NEI-Integration with MIT License 4 votes vote down vote up
@Override
public void prepare() {
    guiClass = Utils.getClass("mods.railcraft.client.gui.GuiCokeOven");
    API.setGuiOffset(guiClass, -6, 11);
}
 
Example #26
Source File: RecipeHandlerCyaniteReprocessor.java    From NEI-Integration with MIT License 4 votes vote down vote up
@Override
public void prepare() {
    solidToReactant = ReflectionHelper.getPrivateValue(Reactants.class, null, "_solidToReactant");
    API.setGuiOffset(GuiCyaniteReprocessor.class, 8, 17);
}
 
Example #27
Source File: RecipeHandlerQuern.java    From NEI-Integration with MIT License 4 votes vote down vote up
@Override
public void prepare() {
    API.setGuiOffset(GuiQuern.class, 11, 13);
}
 
Example #28
Source File: RecipeHandlerChurn.java    From NEI-Integration with MIT License 4 votes vote down vote up
@Override
public void prepare() {
    API.setGuiOffset(GuiChurn.class, 11, 13);
}
 
Example #29
Source File: RecipeHandlerOven.java    From NEI-Integration with MIT License 4 votes vote down vote up
@Override
public void prepare() {
    API.setGuiOffset(GuiOven.class, 11, 13);
}
 
Example #30
Source File: IntegrationBase.java    From NEI-Integration with MIT License 4 votes vote down vote up
protected void registerHandler(IRecipeHandler handler) {
    handler.prepare();
    API.registerRecipeHandler(handler);
    API.registerUsageHandler(handler);
}