ActuallyAdditions/src/main/java/de/ellpeck/actuallyadditions/booklet/chapter/BookletChapterCoffee.java

37 lines
1.4 KiB
Java
Raw Normal View History

package de.ellpeck.actuallyadditions.common.booklet.chapter;
2016-11-10 21:07:15 +01:00
2019-05-02 09:10:29 +02:00
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
2016-11-12 00:29:01 +01:00
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
2016-11-10 21:07:15 +01:00
import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry;
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
2016-11-12 00:29:01 +01:00
import de.ellpeck.actuallyadditions.api.recipe.CoffeeIngredient;
import de.ellpeck.actuallyadditions.common.booklet.page.BookletPage;
import de.ellpeck.actuallyadditions.common.booklet.page.PageCoffeeMachine;
import de.ellpeck.actuallyadditions.common.items.ItemCoffee;
2016-11-10 21:07:15 +01:00
import net.minecraft.item.ItemStack;
2019-05-02 09:10:29 +02:00
public class BookletChapterCoffee extends BookletChapter {
2016-11-10 21:07:15 +01:00
2019-05-02 09:10:29 +02:00
public BookletChapterCoffee(String identifier, IBookletEntry entry, ItemStack displayStack, IBookletPage... pages) {
2016-11-12 00:29:01 +01:00
super(identifier, entry, displayStack, getPages(pages));
}
2019-05-02 09:10:29 +02:00
private static IBookletPage[] getPages(IBookletPage... pages) {
2019-02-27 19:53:05 +01:00
List<IBookletPage> allPages = new ArrayList<>();
2016-11-12 00:29:01 +01:00
allPages.addAll(Arrays.asList(pages));
2019-05-02 09:10:29 +02:00
for (CoffeeIngredient ingredient : ActuallyAdditionsAPI.COFFEE_MACHINE_INGREDIENTS) {
BookletPage page = new PageCoffeeMachine(allPages.size() + 1, ingredient);
if (!(ingredient instanceof ItemCoffee.MilkIngredient)) {
2016-11-12 00:29:01 +01:00
page.setNoText();
}
allPages.add(page);
}
return allPages.toArray(new IBookletPage[allPages.size()]);
2016-11-10 21:07:15 +01:00
}
}