2020-09-09 16:49:01 +02:00
|
|
|
package de.ellpeck.actuallyadditions.common.jei.coffee;
|
2016-01-17 12:17:24 +01:00
|
|
|
|
2018-06-24 02:44:47 +02:00
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import com.google.common.base.Strings;
|
|
|
|
|
2016-05-14 13:51:18 +02:00
|
|
|
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
2016-11-10 19:50:01 +01:00
|
|
|
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
|
2020-09-09 16:49:01 +02:00
|
|
|
import de.ellpeck.actuallyadditions.common.ActuallyAdditions;
|
|
|
|
import de.ellpeck.actuallyadditions.common.blocks.InitBlocks;
|
2020-09-09 16:48:43 +02:00
|
|
|
import de.ellpeck.actuallyadditions.booklet.misc.BookletUtils;
|
2020-09-09 16:49:01 +02:00
|
|
|
import de.ellpeck.actuallyadditions.common.items.InitItems;
|
|
|
|
import de.ellpeck.actuallyadditions.common.items.metalists.TheMiscItems;
|
|
|
|
import de.ellpeck.actuallyadditions.common.jei.RecipeWrapperWithButton;
|
|
|
|
import de.ellpeck.actuallyadditions.common.tile.TileEntityCoffeeMachine;
|
|
|
|
import de.ellpeck.actuallyadditions.common.util.StringUtil;
|
2016-10-29 10:47:33 +02:00
|
|
|
import mezz.jei.api.ingredients.IIngredients;
|
2018-12-11 07:18:31 +01:00
|
|
|
import mezz.jei.api.ingredients.VanillaTypes;
|
2016-01-17 12:17:24 +01:00
|
|
|
import net.minecraft.client.Minecraft;
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
|
2018-06-24 02:44:47 +02:00
|
|
|
public class CoffeeMachineRecipeWrapper extends RecipeWrapperWithButton {
|
2016-01-17 12:17:24 +01:00
|
|
|
|
2018-06-24 02:44:47 +02:00
|
|
|
public final CoffeeIngredient ingredient;
|
2016-05-19 20:05:12 +02:00
|
|
|
public final ItemStack theOutput;
|
|
|
|
public final ItemStack cup = new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CUP.ordinal());
|
2016-01-17 12:17:24 +01:00
|
|
|
|
2018-06-24 02:44:47 +02:00
|
|
|
public CoffeeMachineRecipeWrapper(CoffeeIngredient ingredient) {
|
|
|
|
this.ingredient = ingredient;
|
2016-01-17 12:17:24 +01:00
|
|
|
|
|
|
|
this.theOutput = new ItemStack(InitItems.itemCoffee);
|
2018-06-24 02:44:47 +02:00
|
|
|
ActuallyAdditionsAPI.methodHandler.addEffectToStack(this.theOutput, this.ingredient);
|
2016-01-17 12:17:24 +01:00
|
|
|
}
|
|
|
|
|
2016-10-29 10:47:33 +02:00
|
|
|
@Override
|
2018-06-24 02:44:47 +02:00
|
|
|
public void getIngredients(IIngredients ingredients) {
|
|
|
|
List<ItemStack> list = new ArrayList<>();
|
2019-02-27 19:53:05 +01:00
|
|
|
for (ItemStack s : this.ingredient.getInput().getMatchingStacks())
|
2018-12-11 07:18:31 +01:00
|
|
|
list.add(s);
|
2016-01-17 12:17:24 +01:00
|
|
|
list.add(this.cup);
|
2019-05-02 09:10:29 +02:00
|
|
|
for (ItemStack s : TileEntityCoffeeMachine.COFFEE.getMatchingStacks())
|
|
|
|
list.add(s);
|
2018-12-11 07:18:31 +01:00
|
|
|
ingredients.setInputs(VanillaTypes.ITEM, list);
|
|
|
|
|
|
|
|
ingredients.setOutput(VanillaTypes.ITEM, this.theOutput);
|
2016-01-17 12:17:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2018-06-24 02:44:47 +02:00
|
|
|
public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
|
|
|
|
if (!Strings.isNullOrEmpty(this.ingredient.getExtraText())) {
|
|
|
|
minecraft.fontRenderer.drawString(StringUtil.localize("container.nei." + ActuallyAdditions.MODID + ".coffee.special") + ":", 2, 4, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false);
|
|
|
|
minecraft.fontRenderer.drawString(this.ingredient.getExtraText(), 2, 16, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false);
|
2016-01-17 15:09:59 +01:00
|
|
|
}
|
|
|
|
|
2018-06-24 02:44:47 +02:00
|
|
|
if (this.ingredient.getMaxAmplifier() > 0) {
|
|
|
|
minecraft.fontRenderer.drawString(StringUtil.localize("container.nei." + ActuallyAdditions.MODID + ".coffee.maxAmount") + ": " + this.ingredient.getMaxAmplifier(), 2, 28, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false);
|
2016-01-17 15:09:59 +01:00
|
|
|
}
|
2016-01-17 12:17:24 +01:00
|
|
|
|
2016-10-31 20:19:55 +01:00
|
|
|
super.drawInfo(minecraft, recipeWidth, recipeHeight, mouseX, mouseY);
|
2016-01-17 12:17:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2018-06-24 02:44:47 +02:00
|
|
|
public int getButtonX() {
|
2016-01-17 12:17:24 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2018-06-24 02:44:47 +02:00
|
|
|
public int getButtonY() {
|
2016-10-31 20:19:55 +01:00
|
|
|
return 68;
|
2016-01-17 12:17:24 +01:00
|
|
|
}
|
2016-02-01 17:49:55 +01:00
|
|
|
|
|
|
|
@Override
|
2018-06-24 02:44:47 +02:00
|
|
|
public IBookletPage getPage() {
|
2016-11-10 19:50:01 +01:00
|
|
|
return BookletUtils.findFirstPageForStack(new ItemStack(InitBlocks.blockCoffeeMachine));
|
2016-02-01 17:49:55 +01:00
|
|
|
}
|
2016-01-17 12:17:24 +01:00
|
|
|
}
|