2016-01-17 15:09:59 +01:00
|
|
|
/*
|
2016-05-16 22:52:27 +02:00
|
|
|
* This file ("CrusherRecipeWrapper.java") is part of the Actually Additions mod for Minecraft.
|
2016-01-17 15:09:59 +01:00
|
|
|
* It is created and owned by Ellpeck and distributed
|
|
|
|
* under the Actually Additions License to be found at
|
2016-05-16 22:52:27 +02:00
|
|
|
* http://ellpeck.de/actaddlicense
|
2016-01-17 15:09:59 +01:00
|
|
|
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
|
|
*
|
2017-01-01 16:23:26 +01:00
|
|
|
* © 2015-2017 Ellpeck
|
2016-01-17 15:09:59 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
package de.ellpeck.actuallyadditions.mod.jei.crusher;
|
|
|
|
|
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;
|
2016-01-17 15:09:59 +01:00
|
|
|
import de.ellpeck.actuallyadditions.api.recipe.CrusherRecipe;
|
|
|
|
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
2016-11-10 19:50:01 +01:00
|
|
|
import de.ellpeck.actuallyadditions.mod.booklet.misc.BookletUtils;
|
2016-01-17 15:09:59 +01:00
|
|
|
import de.ellpeck.actuallyadditions.mod.jei.RecipeWrapperWithButton;
|
2016-11-16 20:31:16 +01:00
|
|
|
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
2016-01-17 15:09:59 +01:00
|
|
|
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
2016-10-29 10:47:33 +02:00
|
|
|
import mezz.jei.api.ingredients.IIngredients;
|
2016-01-17 15:09:59 +01:00
|
|
|
import net.minecraft.client.Minecraft;
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
|
2016-10-31 20:19:55 +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
|
|
|
|
|
|
|
public CrusherRecipeWrapper(CrusherRecipe recipe){
|
|
|
|
this.theRecipe = recipe;
|
|
|
|
}
|
|
|
|
|
2016-10-29 10:47:33 +02:00
|
|
|
@Override
|
|
|
|
public void getIngredients(IIngredients ingredients){
|
2018-06-23 01:39:30 +02:00
|
|
|
ingredients.setInputs(ItemStack.class, Arrays.asList(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());
|
|
|
|
if(StackUtil.isValid(this.theRecipe.getOutputTwo())){
|
|
|
|
list.add(this.theRecipe.getOutputTwo());
|
2016-01-17 15:09:59 +01:00
|
|
|
}
|
2016-11-08 23:35:11 +01:00
|
|
|
ingredients.setOutputs(ItemStack.class, list);
|
2016-01-17 15:09:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2016-05-29 23:49:35 +02:00
|
|
|
public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY){
|
2018-06-23 01:39:30 +02:00
|
|
|
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
|
|
|
|
public int getButtonX(){
|
|
|
|
return -5;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int getButtonY(){
|
|
|
|
return 26;
|
|
|
|
}
|
2016-02-01 17:49:55 +01:00
|
|
|
|
|
|
|
@Override
|
2016-11-10 19:50:01 +01:00
|
|
|
public IBookletPage getPage(){
|
|
|
|
return BookletUtils.findFirstPageForStack(new ItemStack(InitBlocks.blockGrinder));
|
2016-02-01 17:49:55 +01:00
|
|
|
}
|
2016-01-17 15:09:59 +01:00
|
|
|
}
|