codechicken.nei.NEIClientUtils Java Examples

The following examples show how to use codechicken.nei.NEIClientUtils. 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: NEIAssemblyControllerRecipeManager.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
@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 File: DataDumper.java    From NotEnoughItems with 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 #3
Source File: PneumaticCraftPlugins.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 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 #4
Source File: PneumaticCraftPlugins.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@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 #5
Source File: NEIAssemblyControllerRecipeManager.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@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 #6
Source File: ItemPanelDumper.java    From NotEnoughItems with 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 #7
Source File: DataDumper.java    From NotEnoughItems with 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 #8
Source File: FireworkRecipeHandler.java    From NotEnoughItems with 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 #9
Source File: FireworkRecipeHandler.java    From NotEnoughItems with 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 #10
Source File: RecipeItemInputHandler.java    From NotEnoughItems with 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 #11
Source File: FireworkRecipeHandler.java    From NotEnoughItems with MIT License 4 votes vote down vote up
@Override
public String getRecipeName() {
    return NEIClientUtils.translate("recipe.firework");
}
 
Example #12
Source File: FurnaceRecipeHandler.java    From NotEnoughItems with MIT License 4 votes vote down vote up
@Override
public String getRecipeName() {
    return NEIClientUtils.translate("recipe.furnace");
}
 
Example #13
Source File: ShapedRecipeHandler.java    From NotEnoughItems with MIT License 4 votes vote down vote up
@Override
public String getRecipeName() {
    return NEIClientUtils.translate("recipe.shaped");
}
 
Example #14
Source File: TemplateRecipeHandler.java    From NotEnoughItems with MIT License 4 votes vote down vote up
public void onUpdate() {
    if (!NEIClientUtils.shiftKey())
        cycleticks++;
}
 
Example #15
Source File: DataDumper.java    From NotEnoughItems with MIT License 4 votes vote down vote up
public String dumpButtonText() {
    return NEIClientUtils.lang.translate("options.tools.dump.dump");
}
 
Example #16
Source File: DataDumper.java    From NotEnoughItems with MIT License 4 votes vote down vote up
public String modeButtonText() {
    return NEIClientUtils.lang.translate("options.tools.dump.mode." + getMode());
}
 
Example #17
Source File: GuiItemIconDumper.java    From NotEnoughItems with MIT License 4 votes vote down vote up
private void returnScreen(IChatComponent msg) {
    Minecraft.getMinecraft().displayGuiScreen(opt.slot.getGui());
    NEIClientUtils.printChatMessage(msg);
}
 
Example #18
Source File: GuiHighlightTips.java    From NotEnoughItems with MIT License 4 votes vote down vote up
private void updateNames() {
    toggleButton.text = NEIClientUtils.translate("options." + name + "." + (show() ? "show" : "hide"));
}
 
Example #19
Source File: BloomeryFurnaceRecipeHandler.java    From GardenCollection with MIT License 4 votes vote down vote up
@Override
public String getRecipeName () {
    return NEIClientUtils.translate("recipe.gardenstuff.bloomeryFurnace", new Object[0]);
}
 
Example #20
Source File: ShapelessRecipeHandler.java    From NotEnoughItems with MIT License 4 votes vote down vote up
public String getRecipeName() {
    return NEIClientUtils.translate("recipe.shapeless");
}
 
Example #21
Source File: BrewingRecipeHandler.java    From NotEnoughItems with MIT License 4 votes vote down vote up
@Override
public String getRecipeName() {
    return NEIClientUtils.translate("recipe.brewing");
}
 
Example #22
Source File: ProfilerRecipeHandler.java    From NotEnoughItems with MIT License 4 votes vote down vote up
@Override
public String getRecipeName()
{
    return NEIClientUtils.translate("recipe.profiler."+(crafting ? "crafting" : "usage"));
}
 
Example #23
Source File: FuelRecipeHandler.java    From NotEnoughItems with MIT License 4 votes vote down vote up
public String getRecipeName() {
    return NEIClientUtils.translate("recipe.fuel");
}