2020-09-09 16:49:01 +02:00
|
|
|
package de.ellpeck.actuallyadditions.common.jei.crusher;
|
2016-01-17 15:09:59 +01:00
|
|
|
|
2018-06-23 01:39:30 +02:00
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.Arrays;
|
|
|
|
import java.util.List;
|
|
|
|
|
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.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.jei.RecipeWrapperWithButton;
|
|
|
|
import de.ellpeck.actuallyadditions.common.util.StackUtil;
|
|
|
|
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 15:09:59 +01:00
|
|
|
import net.minecraft.client.Minecraft;
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
|
2018-12-11 07:18:31 +01:00
|
|
|
public class CrusherRecipeWrapper extends RecipeWrapperWithButton {
|
2016-01-17 15:09:59 +01:00
|
|
|
|
2016-05-19 20:05:12 +02:00
|
|
|
public final CrusherRecipe theRecipe;
|
2016-01-17 15:09:59 +01:00
|
|
|
|
2018-12-11 07:18:31 +01:00
|
|
|
public CrusherRecipeWrapper(CrusherRecipe recipe) {
|
2016-01-17 15:09:59 +01:00
|
|
|
this.theRecipe = recipe;
|
|
|
|
}
|
|
|
|
|
2016-10-29 10:47:33 +02:00
|
|
|
@Override
|
2018-12-11 07:18:31 +01:00
|
|
|
public void getIngredients(IIngredients ingredients) {
|
2019-02-27 19:53:05 +01:00
|
|
|
ingredients.setInputs(VanillaTypes.ITEM, Arrays.asList(this.theRecipe.getInput().getMatchingStacks()));
|
2016-10-29 10:47:33 +02:00
|
|
|
|
2018-06-23 01:39:30 +02:00
|
|
|
List<ItemStack> list = new ArrayList<>();
|
|
|
|
list.add(this.theRecipe.getOutputOne());
|
2018-12-11 07:18:31 +01:00
|
|
|
if (StackUtil.isValid(this.theRecipe.getOutputTwo())) {
|
2018-06-23 01:39:30 +02:00
|
|
|
list.add(this.theRecipe.getOutputTwo());
|
2016-01-17 15:09:59 +01:00
|
|
|
}
|
2018-12-11 07:18:31 +01:00
|
|
|
ingredients.setOutputs(VanillaTypes.ITEM, list);
|
2016-01-17 15:09:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2018-12-11 07:18:31 +01:00
|
|
|
public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
|
|
|
|
if (StackUtil.isValid(this.theRecipe.getOutputTwo())) {
|
|
|
|
minecraft.fontRenderer.drawString(this.theRecipe.getSecondChance() + "%", 60, 60, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false);
|
2016-01-17 15:09:59 +01:00
|
|
|
}
|
|
|
|
|
2016-10-31 20:19:55 +01:00
|
|
|
super.drawInfo(minecraft, recipeWidth, recipeHeight, mouseX, mouseY);
|
2016-01-17 15:09:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2018-12-11 07:18:31 +01:00
|
|
|
public int getButtonX() {
|
2016-01-17 15:09:59 +01:00
|
|
|
return -5;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2018-12-11 07:18:31 +01:00
|
|
|
public int getButtonY() {
|
2016-01-17 15:09:59 +01:00
|
|
|
return 26;
|
|
|
|
}
|
2016-02-01 17:49:55 +01:00
|
|
|
|
|
|
|
@Override
|
2018-12-11 07:18:31 +01:00
|
|
|
public IBookletPage getPage() {
|
2016-11-10 19:50:01 +01:00
|
|
|
return BookletUtils.findFirstPageForStack(new ItemStack(InitBlocks.blockGrinder));
|
2016-02-01 17:49:55 +01:00
|
|
|
}
|
2016-01-17 15:09:59 +01:00
|
|
|
}
|