Search in sources :

Example 1 with ItemShears

use of net.minecraft.item.ItemShears in project BetterStorage by copygirl.

the class PresentRemoveNametagRecipe method checkMatch.

@Override
public StationCrafting checkMatch(ItemStack[] input, RecipeBounds bounds) {
    StationCrafting match = super.checkMatch(input, bounds);
    if (match == null)
        return null;
    ItemStack[] output = new ItemStack[input.length];
    int shearsIndex = -1;
    String nameTag = null;
    for (int i = 0; i < input.length; i++) {
        ItemStack stack = input[i];
        if (stack == null)
            continue;
        if (stack.getItem() == Item.getItemFromBlock(BetterStorageTiles.present)) {
            nameTag = StackUtils.get(stack, null, TileEntityPresent.TAG_NAMETAG);
            StackUtils.remove((output[i] = stack.copy()), TileEntityPresent.TAG_NAMETAG);
        } else if (stack.getItem() instanceof ItemShears)
            shearsIndex = i;
    }
    (output[shearsIndex] = new ItemStack(Items.name_tag)).setStackDisplayName(nameTag);
    return new StationCrafting(output, match.getCraftRequirements(), 8);
}
Also used : StationCrafting(net.mcft.copy.betterstorage.api.crafting.StationCrafting) ItemShears(net.minecraft.item.ItemShears) ItemStack(net.minecraft.item.ItemStack) RecipeInputItemStack(net.mcft.copy.betterstorage.api.crafting.RecipeInputItemStack)

Aggregations

RecipeInputItemStack (net.mcft.copy.betterstorage.api.crafting.RecipeInputItemStack)1 StationCrafting (net.mcft.copy.betterstorage.api.crafting.StationCrafting)1 ItemShears (net.minecraft.item.ItemShears)1 ItemStack (net.minecraft.item.ItemStack)1