codechicken.nei.PositionedStack Java Examples

The following examples show how to use codechicken.nei.PositionedStack. 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: RecipeHandlerShapedCustom.java    From NEI-Integration with MIT License 6 votes vote down vote up
public void setIngredients(int width, int height, Object[] items) {
    for (int x = 0; x < width; x++) {
        for (int y = 0; y < height; y++) {
            int index = y * width + x;
            if (index >= items.length) {
                continue;
            }
            
            Object item = items[index];
            
            if (item == null) {
                continue;
            } else if (item instanceof ItemStack[] && ((ItemStack[]) item).length == 0) {
                continue;
            } else if (item instanceof List && ((List) item).size() == 0) {
                continue;
            }
            
            PositionedStack stack = new PositionedStack(item, 25 + x * 18, 6 + y * 18);
            stack.setMaxSize(1);
            this.inputs.add(stack);
        }
    }
}
 
Example #2
Source File: RecipeHandlerFabricator.java    From NEI-Integration with MIT License 6 votes vote down vote up
public void setIngredients(int width, int height, Object[] items) {
    for (int x = 0; x < width; x++) {
        for (int y = 0; y < height; y++) {
            int index = y * width + x;
            if (index >= items.length) {
                continue;
            }
            
            Object item = items[index];
            
            if (item == null) {
                continue;
            } else if (item instanceof ItemStack[] && ((ItemStack[]) item).length == 0) {
                continue;
            } else if (item instanceof List && ((List) item).size() == 0) {
                continue;
            }
            
            PositionedStack stack = new PositionedStack(item, 62 + x * 18, 6 + y * 18, false);
            stack.setMaxSize(1);
            this.inputs.add(stack);
        }
    }
}
 
Example #3
Source File: FireworkRecipeHandler.java    From NotEnoughItems with MIT License 6 votes vote down vote up
public void cycle() {
    itemList.clear();
    for (Object obj : baseIngredients)
        itemList.add(obj);
    int extras = (cycleticks / 40) % (10 - itemList.size());
    for (int i = 0; i < extras; i++)
        itemList.add(extraIngred);
    setIngredients(itemList);

    List<PositionedStack> ingreds = getIngredients();
    for (int i = 0; i < 9; i++)
        inventoryCrafting.setInventorySlotContents(i, i < ingreds.size() ? ingreds.get(i).item : null);

    if (!recipeFireworks.matches(inventoryCrafting, null))
        throw new RuntimeException("Invalid Recipe?");
    setResult(recipeFireworks.getCraftingResult(null));
}
 
Example #4
Source File: RecipeHandlerRollingMachineShaped.java    From NEI-Integration with MIT License 6 votes vote down vote up
public void setIngredients(int width, int height, Object[] items) {
    for (int x = 0; x < width; x++) {
        for (int y = 0; y < height; y++) {
            int index = y * width + x;
            if (index >= items.length) {
                continue;
            }
            
            Object item = items[index];
            
            if (item == null) {
                continue;
            } else if (item instanceof ItemStack[] && ((ItemStack[]) item).length == 0) {
                continue;
            } else if (item instanceof List && ((List) item).size() == 0) {
                continue;
            }
            
            PositionedStack stack = new PositionedStack(item, 25 + x * 18, 8 + y * 18, false);
            stack.setMaxSize(1);
            this.inputs.add(stack);
        }
    }
}
 
Example #5
Source File: DefaultOverlayHandler.java    From NotEnoughItems with MIT License 6 votes vote down vote up
@SuppressWarnings("unchecked")
public Slot[][] mapIngredSlots(GuiContainer gui, List<PositionedStack> ingredients)
{
    Slot[][] recipeSlotList = new Slot[ingredients.size()][];
    for(int i = 0; i < ingredients.size(); i++)//identify slots
    {
        LinkedList<Slot> recipeSlots = new LinkedList<Slot>();
        PositionedStack pstack = ingredients.get(i);
        for(Slot slot : (List<Slot>)gui.inventorySlots.inventorySlots)
        {
            if(slot.xDisplayPosition == pstack.relx+offsetx && slot.yDisplayPosition == pstack.rely+offsety)
            {
                recipeSlots.add(slot);
                break;
            }
        }
        recipeSlotList[i] = recipeSlots.toArray(new Slot[0]);
    }
    return recipeSlotList;
}
 
Example #6
Source File: BannerPatternHandler.java    From Et-Futurum with The Unlicense 5 votes vote down vote up
@Override
public List<PositionedStack> getIngredients() {
	if (randomPermutations)
		return getCycledIngredients(cycleticks / 20, ingredients);

	for (PositionedStack stack : ingredients)
		if (stack.items.length > 1)
			stack.setPermutationToRender(cycleticks / 20 % stack.items.length);
	return ingredients;
}
 
Example #7
Source File: PluginGT5AsteroidStat.java    From GTNEIOrePlugin with MIT License 5 votes vote down vote up
@Override
public List<PositionedStack> getIngredients() {
    List<PositionedStack> ingredientsList = new ArrayList<PositionedStack>();
    ingredientsList.add(positionedStackPrimary);
    ingredientsList.add(positionedStackSecondary);
    ingredientsList.add(positionedStackBetween);
    ingredientsList.add(positionedStackSporadic);
    return ingredientsList;
}
 
Example #8
Source File: RecipeHandlerBlastFurnace.java    From NEI-Integration with MIT License 5 votes vote down vote up
public CachedBlastFurnaceRecipe(IBlastFurnaceRecipe recipe) {
    if (recipe.getInput() != null) {
        this.input = new PositionedStack(recipe.getInput(), 51, 6);
    }
    if (recipe.getOutput() != null) {
        this.output = new PositionedStack(recipe.getOutput(), 111, 24);
    }
    this.cookTime = recipe.getCookTime();
}
 
Example #9
Source File: PluginGT5VeinStat.java    From GTNEIOrePlugin with MIT License 5 votes vote down vote up
public CachedVeinStatRecipe(String veinName, List<ItemStack> stackListPrimary, List<ItemStack> stackListSecondary,
        List<ItemStack> stackListBetween, List<ItemStack> stackListSporadic) {
    this.veinName = veinName;
    positionedStackPrimary = new PositionedStack(stackListPrimary, 2, 0);
    positionedStackSecondary = new PositionedStack(stackListSecondary, 22, 0);
    positionedStackBetween = new PositionedStack(stackListBetween, 42, 0);
    positionedStackSporadic = new PositionedStack(stackListSporadic, 62, 0);
}
 
Example #10
Source File: PluginGT6VeinStat.java    From GTNEIOrePlugin with MIT License 5 votes vote down vote up
@Override
public List<PositionedStack> getIngredients() {
    List<PositionedStack> ingredientsList = new ArrayList<PositionedStack>();
    positionedStackPrimary.setPermutationToRender((cycleticks / 20) % positionedStackPrimary.items.length);;
    positionedStackSecondary.setPermutationToRender((cycleticks / 20) % positionedStackPrimary.items.length);;
    positionedStackBetween.setPermutationToRender((cycleticks / 20) % positionedStackPrimary.items.length);;
    positionedStackSporadic.setPermutationToRender((cycleticks / 20) % positionedStackPrimary.items.length);;
    ingredientsList.add(positionedStackPrimary);
    ingredientsList.add(positionedStackSecondary);
    ingredientsList.add(positionedStackBetween);
    ingredientsList.add(positionedStackSporadic);
    return ingredientsList;
}
 
Example #11
Source File: PluginGT5AsteroidStat.java    From GTNEIOrePlugin with MIT License 5 votes vote down vote up
public CachedAsteroidStatRecipe(String veinName, ItemStack stackListPrimary, ItemStack stackListSecondary,
        ItemStack stackListBetween, ItemStack stackListSporadic) {
    this.veinName = veinName;
    positionedStackPrimary = new PositionedStack(stackListPrimary, 2, 0);
    positionedStackSecondary = new PositionedStack(stackListSecondary, 22, 0);
    positionedStackBetween = new PositionedStack(stackListBetween, 42, 0);
    positionedStackSporadic = new PositionedStack(stackListSporadic, 62, 0);
}
 
Example #12
Source File: PluginGT6SmallOreStat.java    From GTNEIOrePlugin with MIT License 5 votes vote down vote up
public CachedOreSmallRecipe(String oreGenName, List<ItemStack> stackList, List<ItemStack> materialDustStackList, List<ItemStack> dropStackList) {
    this.oreGenName = oreGenName;
    this.positionedStackOreSmall = new PositionedStack(stackList, 2, 0);
    this.positionedStackMaterialDust = new PositionedStack(materialDustStackList, 43, 67);
    List<PositionedStack> positionedDropStackList = new ArrayList<PositionedStack>();
    int i = 1;
    for (ItemStack stackDrop: dropStackList)
        positionedDropStackList.add(new PositionedStack(stackDrop, 43+20*(i%5), 67+17*((i++)/5)));
    this.positionedDropStackList = positionedDropStackList;
}
 
Example #13
Source File: RecipeHandlerSqueezer.java    From NEI-Integration with MIT License 5 votes vote down vote up
public void setIngredients(ItemStack[] inputs) {
    int i = 0;
    for (ItemStack stack : inputs) {
        if (i >= INPUTS.length) {
            return;
        }
        this.inputs.add(new PositionedStack(stack, 14 + INPUTS[i][0] * 18, 7 + INPUTS[i][1] * 18, false));
        i++;
    }
}
 
Example #14
Source File: PluginGT6BedrockOreStat.java    From GTNEIOrePlugin with MIT License 5 votes vote down vote up
public CachedBedrockOreStatRecipe(String oreName, ItemStack stackOreBedrock, ItemStack stackOreSmallBedrock,
        List<ItemStack> stackListOre, List<ItemStack> stackListOreSmall) {
    this.oreName = oreName;
    positionedStackOreBedrock = new PositionedStack(stackOreBedrock, 2, 0);
    positionedStackOreSmallBedrock = new PositionedStack(stackOreSmallBedrock, 22, 0);
    positionedStackOre = new PositionedStack(stackListOre, 42, 0);
    positionedStackOreSmall = new PositionedStack(stackListOreSmall, 62, 0);
}
 
Example #15
Source File: RecipeHandlerBottler.java    From NEI-Integration with MIT License 5 votes vote down vote up
public CachedBottlerRecipe(MachineBottler.Recipe recipe) {
    if (recipe.input != null) {
        this.fluid = new PositionedFluidTank(recipe.input, 10000, new Rectangle(48, 6, 16, 58), RecipeHandlerBottler.this.getGuiTexture(), new Point(176, 0));
    }
    if (recipe.can != null) {
        this.input = new PositionedStack(recipe.can, 111, 8);
    }
    if (recipe.bottled != null) {
        this.output = new PositionedStack(recipe.bottled, 111, 44);
    }
}
 
Example #16
Source File: PluginGT5SmallOreStat.java    From GTNEIOrePlugin with MIT License 5 votes vote down vote up
public CachedOreSmallRecipe(String oreGenName, List<ItemStack> stackList, List<ItemStack> materialDustStackList, List<ItemStack> dropStackList) {
    this.oreGenName = oreGenName;
    this.positionedStackOreSmall = new PositionedStack(stackList, 2, 0);
    this.positionedStackMaterialDust = new PositionedStack(materialDustStackList, 43, 79+getRestrictBiomeOffset());
    List<PositionedStack> positionedDropStackList = new ArrayList<PositionedStack>();
    int i = 1;
    for (ItemStack stackDrop: dropStackList)
        positionedDropStackList.add(new PositionedStack(stackDrop, 43+20*(i%4), 79+16*((i++)/4)+getRestrictBiomeOffset()));
    this.positionedDropStackList = positionedDropStackList;
}
 
Example #17
Source File: PluginGT6SmallOreStat.java    From GTNEIOrePlugin with MIT License 5 votes vote down vote up
@Override
public List<PositionedStack> getIngredients() {
    positionedStackOreSmall.setPermutationToRender((cycleticks / 20) % positionedStackOreSmall.items.length);
    positionedStackMaterialDust.setPermutationToRender((cycleticks / 20) % positionedStackMaterialDust.items.length);
    positionedDropStackList.add(positionedStackOreSmall);
    positionedDropStackList.add(positionedStackMaterialDust);
    return positionedDropStackList;
    
}
 
Example #18
Source File: RecipeHandlerCentrifuge.java    From NEI-Integration with MIT License 5 votes vote down vote up
public CachedCentrifugeRecipe(ICentrifugeRecipe recipe, boolean genPerms) {
    if (recipe.getInput() != null) {
        this.inputs = new PositionedStack(recipe.getInput(), 29, 26);
    }
    if (recipe.getAllProducts() != null) {
        this.setResults(recipe.getAllProducts());
    }
}
 
Example #19
Source File: RecipeHandlerHCBase.java    From NEI-Integration with MIT License 5 votes vote down vote up
public CachedHCRecipe(ItemStack input, ItemStack output, ItemStack fuel) {
    Point inputStackPos = RecipeHandlerHCBase.this.getInputStackPos();
    Point outputStackPos = RecipeHandlerHCBase.this.getOutputStackPos();
    Point fuelStackPos = RecipeHandlerHCBase.this.getFuelStackPos();
    
    this.input = new PositionedStack(input, inputStackPos.x, inputStackPos.y);
    this.output = new PositionedStack(output, outputStackPos.x, outputStackPos.y);
    if (fuel != null) {
        this.fuel = new PositionedStack(fuel, fuelStackPos.x, fuelStackPos.y);
    }
}
 
Example #20
Source File: TemplateRecipeHandler.java    From NotEnoughItems with MIT License 5 votes vote down vote up
/**
 * Return extra items that are not directly involved in the ingredient->result relationship. Eg fuels.
 * Use this if you have more than one other stack
 *
 * @return A list of positioned items.
 */
public List<PositionedStack> getOtherStacks() {
    ArrayList<PositionedStack> stacks = new ArrayList<PositionedStack>();
    PositionedStack stack = getOtherStack();
    if (stack != null)
        stacks.add(stack);
    return stacks;
}
 
Example #21
Source File: RecipeHandlerApiary.java    From NEI-Integration with MIT License 5 votes vote down vote up
public CachedApiaryRecipe() {
    this.input = new PositionedStack(new ItemStack(ItemRegistry.queenbeeItem), 21, 24);
    
    int i = 0;
    for (Entry<Item, Float> e : BEE_PRODUCTS.entrySet()) {
        this.outputs.add(new PositionedStackAdv(new ItemStack(e.getKey()), 57 + 18 * i, 6).setChance(e.getValue()));
        i++;
    }
}
 
Example #22
Source File: TemplateRecipeHandler.java    From NotEnoughItems with MIT License 5 votes vote down vote up
/**
 * This will perform default cycling of ingredients, mulitItem capable
 *
 * @return
 */
public List<PositionedStack> getCycledIngredients(int cycle, List<PositionedStack> ingredients) {
    for (int itemIndex = 0; itemIndex < ingredients.size(); itemIndex++)
        randomRenderPermutation(ingredients.get(itemIndex), cycle + itemIndex);

    return ingredients;
}
 
Example #23
Source File: RecipeHandlerFluidRegistry.java    From NEI-Integration with MIT License 5 votes vote down vote up
public CachedFluidRegistryRecipe(Fluid fluid) {
    this.fluid = new PositionedFluidTank(new FluidStack(fluid, 1000), 1000, new Rectangle(32, 5, 96, 32));
    this.fluid.showAmount = false;
    
    if (fluid.getBlock() != null) {
        this.block = new PositionedStack(new ItemStack(fluid.getBlock()), 32, 43);
    }
    
    this.setContainerItems(fluid);
}
 
Example #24
Source File: NEIEtchingAcidManager.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected List<MultipleInputOutputRecipe> getAllRecipes(){
    List<MultipleInputOutputRecipe> recipes = new ArrayList<MultipleInputOutputRecipe>();
    MultipleInputOutputRecipe recipe = new MultipleInputOutputRecipe();
    recipe.addIngredient(new PositionedStack(new ItemStack(Itemss.emptyPCB), 41, 80));
    recipe.addIngredient(new PositionedStack(new ItemStack(Fluids.getBucket(Fluids.etchingAcid)), 73, 80));
    recipe.addOutput(new PositionedStack(new ItemStack(Itemss.unassembledPCB), 105, 80));
    recipes.add(recipe);
    return recipes;
}
 
Example #25
Source File: DefaultOverlayHandler.java    From NotEnoughItems with MIT License 5 votes vote down vote up
private List<DistributedIngred> getPermutationIngredients(List<PositionedStack> ingredients)
{
    ArrayList<DistributedIngred> ingredStacks = new ArrayList<DistributedIngred>();
    for(PositionedStack posstack : ingredients)//work out what we need
    {
        for(ItemStack pstack : posstack.items)
        {
            DistributedIngred istack = findIngred(ingredStacks, pstack);
            if(istack == null)
                ingredStacks.add(istack = new DistributedIngred(pstack));
            istack.recipeAmount+=pstack.stackSize;
        }
    }
    return ingredStacks;
}
 
Example #26
Source File: RecipeHandlerRollingMachineShaped.java    From NEI-Integration with MIT License 5 votes vote down vote up
public CachedRollingMachineShapedRecipe(int width, int height, Object[] items, ItemStack output, boolean genPerms) {
    this.setIngredients(width, height, items);
    this.output = new PositionedStack(output, 88, 18);
    
    if (genPerms) {
        this.generatePermutations();
    }
}
 
Example #27
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 #28
Source File: ShapelessRecipeHandler.java    From NotEnoughItems with MIT License 5 votes vote down vote up
public void setIngredients(List<?> items) {
    ingredients.clear();
    for (int ingred = 0; ingred < items.size(); ingred++) {
        PositionedStack stack = new PositionedStack(items.get(ingred), 25 + stackorder[ingred][0] * 18, 6 + stackorder[ingred][1] * 18);
        stack.setMaxSize(1);
        ingredients.add(stack);
    }
}
 
Example #29
Source File: ContainerRecipe.java    From NotEnoughItems with MIT License 5 votes vote down vote up
public void addSlot(PositionedStack stack, int recipex, int recipey)
{
    int slot = inventorySlots.size();
    addSlotToContainer(new Slot(recipeInventory, slot, recipex+stack.relx, recipey+stack.rely)
    {
        @Override
        public boolean isItemValid(ItemStack par1ItemStack)
        {
            return false;
        }
    });
    recipeInventory.setInventorySlotContents(slot, stack.item);
}
 
Example #30
Source File: RecipeHandlerRockCrusher.java    From NEI-Integration with MIT License 5 votes vote down vote up
public CachedRockCrusherRecipe(IRockCrusherRecipe recipe) {
    if (recipe.getInput() != null) {
        this.input = new PositionedStack(recipe.getInput(), 12, 10);
    }
    if (recipe.getOutputs() != null) {
        this.setResults(recipe.getOutputs());
    }
}