Java Code Examples for codechicken.nei.NEIClientUtils

The following examples show how to use codechicken.nei.NEIClientUtils. These examples are extracted from open source projects. 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
@Override
public void loadUsageRecipes(ItemStack ingredient){
    for(int i = 0; i < ItemAssemblyProgram.PROGRAMS_AMOUNT; i++) {
        AssemblyProgram program = ItemAssemblyProgram.getProgramFromItem(i);
        boolean[] addedRecipe = new boolean[program.getRecipeList().size()];
        for(int j = 0; j < program.getRecipeList().size(); j++) {
            if(NEIClientUtils.areStacksSameTypeCrafting(program.getRecipeList().get(j).getInput(), ingredient)) {
                arecipes.add(getShape(i, j));
                addedRecipe[j] = true;
            }
        }
        if(ingredient.getItem() == Itemss.assemblyProgram && ingredient.getItemDamage() == i) {
            for(int j = 0; j < program.getRecipeList().size(); j++)
                if(!addedRecipe[j]) arecipes.add(getShape(i, j));
        } else {
            for(ItemStack machine : getMachinesFromEnum(program.getRequiredMachines())) {
                if(NEIClientUtils.areStacksSameTypeCrafting(machine, ingredient)) {
                    for(int j = 0; j < program.getRecipeList().size(); j++)
                        if(!addedRecipe[j]) arecipes.add(getShape(i, j));
                    break;
                }
            }
        }
    }
}
 
Example 2
Source Project: NotEnoughItems   Source File: RecipeItemInputHandler.java    License: MIT License 5 votes vote down vote up
@Override
public boolean lastKeyTyped(GuiContainer gui, char keyChar, int keyCode)
{
    ItemStack stackover = GuiContainerManager.getStackMouseOver(gui);
    if(stackover == null)
        return false;
            
    if(keyCode == NEIClientConfig.getKeyBinding("gui.usage") || (keyCode == NEIClientConfig.getKeyBinding("gui.recipe") && NEIClientUtils.shiftKey()))
        return GuiUsageRecipe.openRecipeGui("item", stackover.copy());
    
    if(keyCode == NEIClientConfig.getKeyBinding("gui.recipe"))
        return GuiCraftingRecipe.openRecipeGui("item", stackover.copy());
    
    return false;
}
 
Example 3
Source Project: NotEnoughItems   Source File: FireworkRecipeHandler.java    License: MIT License 5 votes vote down vote up
@Override
public void onUpdate() {
    if (!NEIClientUtils.shiftKey()) {
        cycleticks++;
        if (cycleticks % 20 == 0)
            for (CachedRecipe crecipe : arecipes)
                ((CachedFireworkRecipe) crecipe).cycle();
    }
}
 
Example 4
Source Project: NotEnoughItems   Source File: FireworkRecipeHandler.java    License: MIT License 5 votes vote down vote up
@Override
public List<String> handleTooltip(GuiRecipe gui, List<String> currenttip, int recipe) {
    currenttip = super.handleTooltip(gui, currenttip, recipe);
    Point mousepos = GuiDraw.getMousePosition();
    Point relMouse = new Point(mousepos.x - gui.guiLeft, mousepos.y - gui.guiTop);
    Point recipepos = gui.getRecipePosition(recipe);
    if (currenttip.isEmpty() && GuiContainerManager.getStackMouseOver(gui) == null &&
            new Rectangle(recipepos.x, recipepos.y, 166, 55).contains(relMouse))
        currenttip.add(NEIClientUtils.translate(
                "recipe.firework.tooltip" + ((CachedFireworkRecipe) arecipes.get(recipe)).recipeType));
    return currenttip;
}
 
Example 5
Source Project: NotEnoughItems   Source File: DataDumper.java    License: MIT License 5 votes vote down vote up
public void dumpFile() {
    try {
        File file = new File(CommonUtils.getMinecraftDir(), "dumps/" + getFileName(name.replaceFirst(".+\\.", "")));
        if (!file.getParentFile().exists())
            file.getParentFile().mkdirs();
        if (!file.exists())
            file.createNewFile();

        dumpTo(file);

        NEIClientUtils.printChatMessage(dumpMessage(file));
    } catch (Exception e) {
        NEIClientConfig.logger.error("Error dumping " + renderName() + " mode: " + getMode(), e);
    }
}
 
Example 6
Source Project: NotEnoughItems   Source File: DataDumper.java    License: MIT License 5 votes vote down vote up
@Override
public void mouseClicked(int mousex, int mousey, int button) {
    if (modeCount() > 1 && modeButtonSize().contains(mousex, mousey)) {
        NEIClientUtils.playClickSound();
        getTag().setIntValue((getMode() + 1) % modeCount());
    } else if (dumpButtonSize().contains(mousex, mousey)) {
        NEIClientUtils.playClickSound();
        dumpFile();
    }
}
 
Example 7
Source Project: NotEnoughItems   Source File: ItemPanelDumper.java    License: MIT License 5 votes vote down vote up
@Override
public void mouseClicked(int mousex, int mousey, int button) {
    if(getMode() == 3 && resButtonSize().contains(mousex, mousey)) {
        NEIClientUtils.playClickSound();
        getTag(name+".res").setIntValue((renderTag(name+".res").getIntValue(0) + 1) % resolutions.length);
    }
    else
        super.mouseClicked(mousex, mousey, button);
}
 
Example 8
@Override
public void loadCraftingRecipes(ItemStack result){
    for(int i = 0; i < ItemAssemblyProgram.PROGRAMS_AMOUNT; i++) {
        AssemblyProgram program = ItemAssemblyProgram.getProgramFromItem(i);
        for(int j = 0; j < program.getRecipeList().size(); j++) {
            if(NEIClientUtils.areStacksSameTypeCrafting(program.getRecipeList().get(j).getOutput(), result)) {
                arecipes.add(getShape(i, j));
                break;
            }
        }
    }
}
 
Example 9
@Override
public void loadCraftingRecipes(ItemStack output){
    for(MultipleInputOutputRecipe recipe : getAllRecipes()) {
        for(PositionedStack stack : recipe.output) {
            for(ItemStack itemStack : stack.items) {
                if(NEIClientUtils.areStacksSameTypeCrafting(itemStack, output)) {
                    arecipes.add(recipe);
                }
            }
        }
    }
}
 
Example 10
/**
 * Simplified wrapper, implement this and fill the empty recipe array with recipes
 *
 * @param ingredient The ingredient the recipes must contain.
 */
@Override
public void loadUsageRecipes(ItemStack ingredient){
    for(MultipleInputOutputRecipe recipe : getAllRecipes()) {
        for(PositionedStack stack : recipe.input) {
            for(ItemStack itemStack : stack.items) {
                if(NEIClientUtils.areStacksSameTypeCrafting(itemStack, ingredient)) {
                    arecipes.add(recipe);
                }
            }
        }
    }
}
 
Example 11
Source Project: NotEnoughItems   Source File: TemplateRecipeHandler.java    License: MIT License 4 votes vote down vote up
public void onUpdate() {
    if (!NEIClientUtils.shiftKey())
        cycleticks++;
}
 
Example 12
Source Project: NotEnoughItems   Source File: FuelRecipeHandler.java    License: MIT License 4 votes vote down vote up
public String getRecipeName() {
    return NEIClientUtils.translate("recipe.fuel");
}
 
Example 13
Source Project: NotEnoughItems   Source File: ProfilerRecipeHandler.java    License: MIT License 4 votes vote down vote up
@Override
public String getRecipeName()
{
    return NEIClientUtils.translate("recipe.profiler."+(crafting ? "crafting" : "usage"));
}
 
Example 14
Source Project: NotEnoughItems   Source File: BrewingRecipeHandler.java    License: MIT License 4 votes vote down vote up
@Override
public String getRecipeName() {
    return NEIClientUtils.translate("recipe.brewing");
}
 
Example 15
Source Project: NotEnoughItems   Source File: ShapelessRecipeHandler.java    License: MIT License 4 votes vote down vote up
public String getRecipeName() {
    return NEIClientUtils.translate("recipe.shapeless");
}
 
Example 16
Source Project: NotEnoughItems   Source File: FireworkRecipeHandler.java    License: MIT License 4 votes vote down vote up
@Override
public String getRecipeName() {
    return NEIClientUtils.translate("recipe.firework");
}
 
Example 17
Source Project: NotEnoughItems   Source File: FurnaceRecipeHandler.java    License: MIT License 4 votes vote down vote up
@Override
public String getRecipeName() {
    return NEIClientUtils.translate("recipe.furnace");
}
 
Example 18
Source Project: NotEnoughItems   Source File: ShapedRecipeHandler.java    License: MIT License 4 votes vote down vote up
@Override
public String getRecipeName() {
    return NEIClientUtils.translate("recipe.shaped");
}
 
Example 19
Source Project: NotEnoughItems   Source File: DataDumper.java    License: MIT License 4 votes vote down vote up
public String dumpButtonText() {
    return NEIClientUtils.lang.translate("options.tools.dump.dump");
}
 
Example 20
Source Project: NotEnoughItems   Source File: DataDumper.java    License: MIT License 4 votes vote down vote up
public String modeButtonText() {
    return NEIClientUtils.lang.translate("options.tools.dump.mode." + getMode());
}
 
Example 21
Source Project: NotEnoughItems   Source File: GuiItemIconDumper.java    License: MIT License 4 votes vote down vote up
private void returnScreen(IChatComponent msg) {
    Minecraft.getMinecraft().displayGuiScreen(opt.slot.getGui());
    NEIClientUtils.printChatMessage(msg);
}
 
Example 22
Source Project: NotEnoughItems   Source File: GuiHighlightTips.java    License: MIT License 4 votes vote down vote up
private void updateNames() {
    toggleButton.text = NEIClientUtils.translate("options." + name + "." + (show() ? "show" : "hide"));
}
 
Example 23
Source Project: GardenCollection   Source File: BloomeryFurnaceRecipeHandler.java    License: MIT License 4 votes vote down vote up
@Override
public String getRecipeName () {
    return NEIClientUtils.translate("recipe.gardenstuff.bloomeryFurnace", new Object[0]);
}