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);
}
Aggregations