Update JEI

This commit is contained in:
Ellpeck 2016-11-08 23:35:11 +01:00
parent 691fabd5ef
commit 57f16ec321
13 changed files with 64 additions and 258 deletions

View file

@ -45,7 +45,7 @@ repositories {
dependencies { dependencies {
compile "net.darkhax.tesla:Tesla:1.10.2-1.2.1.49" compile "net.darkhax.tesla:Tesla:1.10.2-1.2.1.49"
deobfCompile "mezz.jei:jei_1.10.2:3.13.0.335" deobfCompile "mezz.jei:jei_1.10.2:3.13.2.360"
} }
processResources { processResources {

View file

@ -17,14 +17,14 @@ import de.ellpeck.actuallyadditions.mod.booklet.GuiBooklet;
import de.ellpeck.actuallyadditions.mod.booklet.button.TexturedButton; import de.ellpeck.actuallyadditions.mod.booklet.button.TexturedButton;
import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import mezz.jei.api.recipe.IRecipeWrapper; import mezz.jei.api.recipe.BlankRecipeWrapper;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
public abstract class RecipeWrapperWithButton implements IRecipeWrapper{ public abstract class RecipeWrapperWithButton extends BlankRecipeWrapper{
protected final TexturedButton theButton; protected final TexturedButton theButton;

View file

@ -15,13 +15,11 @@ import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.IDrawable; import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeCategory; import mezz.jei.api.recipe.BlankRecipeCategory;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
import java.util.Arrays; import java.util.Arrays;
public class BookletRecipeCategory implements IRecipeCategory{ public class BookletRecipeCategory extends BlankRecipeCategory<BookletRecipeWrapper>{
public static final String NAME = "actuallyadditions.booklet"; public static final String NAME = "actuallyadditions.booklet";
@ -31,7 +29,6 @@ public class BookletRecipeCategory implements IRecipeCategory{
this.background = helper.createBlankDrawable(160, 105); this.background = helper.createBlankDrawable(160, 105);
} }
@Override @Override
public String getUid(){ public String getUid(){
return NAME; return NAME;
@ -50,26 +47,8 @@ public class BookletRecipeCategory implements IRecipeCategory{
} }
@Override @Override
public void drawExtras(Minecraft minecraft){ public void setRecipe(IRecipeLayout recipeLayout, BookletRecipeWrapper wrapper, IIngredients ingredients){
recipeLayout.getItemStacks().init(0, true, 70, -4);
} recipeLayout.getItemStacks().set(0, Arrays.asList(wrapper.thePage.getItemStacksForPage()));
@Override
public void drawAnimations(Minecraft minecraft){
}
@Override
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper){
}
@Override
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients){
if(recipeWrapper instanceof BookletRecipeWrapper){
BookletRecipeWrapper wrapper = (BookletRecipeWrapper)recipeWrapper;
recipeLayout.getItemStacks().init(0, true, 70, -4);
recipeLayout.getItemStacks().set(0, Arrays.asList(wrapper.thePage.getItemStacksForPage()));
}
} }
} }

View file

@ -32,7 +32,6 @@ public class BookletRecipeHandler implements IRecipeHandler<BookletPage>{
return BookletRecipeCategory.NAME; return BookletRecipeCategory.NAME;
} }
@Override @Override
public IRecipeWrapper getRecipeWrapper(BookletPage recipe){ public IRecipeWrapper getRecipeWrapper(BookletPage recipe){
return new BookletRecipeWrapper(recipe); return new BookletRecipeWrapper(recipe);

View file

@ -18,6 +18,7 @@ import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.ingredients.IIngredients;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
@ -34,27 +35,11 @@ public class BookletRecipeWrapper extends RecipeWrapperWithButton{
@Override @Override
public void getIngredients(IIngredients ingredients){ public void getIngredients(IIngredients ingredients){
ingredients.setInputs(ItemStack.class, Arrays.asList(this.thePage.getItemStacksForPage()));
ingredients.setInputs(FluidStack.class, Arrays.asList(this.thePage.getFluidStacksForPage()));
} ingredients.setOutputs(ItemStack.class, Arrays.asList(this.thePage.getItemStacksForPage()));
ingredients.setOutputs(FluidStack.class, Arrays.asList(this.thePage.getFluidStacksForPage()));
@Override
public List getInputs(){
return Arrays.asList(this.thePage.getItemStacksForPage());
}
@Override
public List getOutputs(){
return Arrays.asList(this.thePage.getItemStacksForPage());
}
@Override
public List<FluidStack> getFluidInputs(){
return Arrays.asList(this.thePage.getFluidStacksForPage());
}
@Override
public List<FluidStack> getFluidOutputs(){
return Arrays.asList(this.thePage.getFluidStacksForPage());
} }
@Override @Override

View file

@ -16,11 +16,11 @@ import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.IDrawable; import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeCategory; import mezz.jei.api.recipe.BlankRecipeCategory;
import mezz.jei.api.recipe.IRecipeWrapper; import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
public class CoffeeMachineRecipeCategory implements IRecipeCategory{ public class CoffeeMachineRecipeCategory extends BlankRecipeCategory<CoffeeMachineRecipeWrapper>{
public static final String NAME = "actuallyadditions.coffee"; public static final String NAME = "actuallyadditions.coffee";
@ -30,54 +30,33 @@ public class CoffeeMachineRecipeCategory implements IRecipeCategory{
this.background = helper.createDrawable(AssetUtil.getGuiLocation("guiNEICoffeeMachine"), 0, 0, 126, 92); this.background = helper.createDrawable(AssetUtil.getGuiLocation("guiNEICoffeeMachine"), 0, 0, 126, 92);
} }
@Override @Override
public String getUid(){ public String getUid(){
return NAME; return NAME;
} }
@Override @Override
public String getTitle(){ public String getTitle(){
return StringUtil.localize("container.nei."+NAME+".name"); return StringUtil.localize("container.nei."+NAME+".name");
} }
@Override @Override
public IDrawable getBackground(){ public IDrawable getBackground(){
return this.background; return this.background;
} }
@Override @Override
public void drawExtras(Minecraft minecraft){ public void setRecipe(IRecipeLayout recipeLayout, CoffeeMachineRecipeWrapper wrapper, IIngredients ingredients){
recipeLayout.getItemStacks().init(0, true, 89, 20);
recipeLayout.getItemStacks().set(0, wrapper.theIngredient.ingredient);
} recipeLayout.getItemStacks().init(1, true, 44, 38);
recipeLayout.getItemStacks().set(1, wrapper.cup);
@Override recipeLayout.getItemStacks().init(2, true, 1, 38);
public void drawAnimations(Minecraft minecraft){ recipeLayout.getItemStacks().set(2, wrapper.coffeeBeans);
} recipeLayout.getItemStacks().init(3, false, 44, 69);
recipeLayout.getItemStacks().set(3, wrapper.theOutput);
@Override
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper){
}
@Override
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients){
if(recipeWrapper instanceof CoffeeMachineRecipeWrapper){
CoffeeMachineRecipeWrapper wrapper = (CoffeeMachineRecipeWrapper)recipeWrapper;
recipeLayout.getItemStacks().init(0, true, 89, 20);
recipeLayout.getItemStacks().set(0, wrapper.theIngredient.ingredient);
recipeLayout.getItemStacks().init(1, true, 44, 38);
recipeLayout.getItemStacks().set(1, wrapper.cup);
recipeLayout.getItemStacks().init(2, true, 1, 38);
recipeLayout.getItemStacks().set(2, wrapper.coffeeBeans);
recipeLayout.getItemStacks().init(3, false, 44, 69);
recipeLayout.getItemStacks().set(3, wrapper.theOutput);
}
} }
} }

View file

@ -23,10 +23,8 @@ import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.ingredients.IIngredients;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
public class CoffeeMachineRecipeWrapper extends RecipeWrapperWithButton{ public class CoffeeMachineRecipeWrapper extends RecipeWrapperWithButton{
@ -45,31 +43,13 @@ public class CoffeeMachineRecipeWrapper extends RecipeWrapperWithButton{
@Override @Override
public void getIngredients(IIngredients ingredients){ public void getIngredients(IIngredients ingredients){
}
@Override
public List getInputs(){
List list = new ArrayList(); List list = new ArrayList();
list.add(this.theIngredient.ingredient); list.add(this.theIngredient.ingredient);
list.add(this.cup); list.add(this.cup);
list.add(this.coffeeBeans); list.add(this.coffeeBeans);
return list; ingredients.setInputs(ItemStack.class, list);
}
@Override ingredients.setOutput(ItemStack.class, this.theOutput);
public List getOutputs(){
return Collections.singletonList(this.theOutput);
}
@Override
public List<FluidStack> getFluidInputs(){
return new ArrayList<FluidStack>();
}
@Override
public List<FluidStack> getFluidOutputs(){
return new ArrayList<FluidStack>();
} }
@Override @Override

View file

@ -16,11 +16,9 @@ import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.IDrawable; import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeCategory; import mezz.jei.api.recipe.BlankRecipeCategory;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
public class CrusherRecipeCategory implements IRecipeCategory{ public class CrusherRecipeCategory extends BlankRecipeCategory<CrusherRecipeWrapper>{
public static final String NAME = "actuallyadditions.crushing"; public static final String NAME = "actuallyadditions.crushing";
@ -30,53 +28,32 @@ public class CrusherRecipeCategory implements IRecipeCategory{
this.background = helper.createDrawable(AssetUtil.getGuiLocation("guiGrinder"), 60, 13, 56, 79); this.background = helper.createDrawable(AssetUtil.getGuiLocation("guiGrinder"), 60, 13, 56, 79);
} }
@Override @Override
public String getUid(){ public String getUid(){
return NAME; return NAME;
} }
@Override @Override
public String getTitle(){ public String getTitle(){
return StringUtil.localize("container.nei."+NAME+".name"); return StringUtil.localize("container.nei."+NAME+".name");
} }
@Override @Override
public IDrawable getBackground(){ public IDrawable getBackground(){
return this.background; return this.background;
} }
@Override @Override
public void drawExtras(Minecraft minecraft){ public void setRecipe(IRecipeLayout recipeLayout, CrusherRecipeWrapper wrapper, IIngredients ingredients){
recipeLayout.getItemStacks().init(0, true, 19, 7);
recipeLayout.getItemStacks().set(0, wrapper.theRecipe.inputStack);
} recipeLayout.getItemStacks().init(1, false, 7, 55);
recipeLayout.getItemStacks().set(1, wrapper.theRecipe.outputOneStack);
@Override if(wrapper.theRecipe.outputTwoStack != null){
public void drawAnimations(Minecraft minecraft){ recipeLayout.getItemStacks().init(2, false, 31, 55);
recipeLayout.getItemStacks().set(2, wrapper.theRecipe.outputTwoStack);
}
@Override
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper){
}
@Override
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients){
if(recipeWrapper instanceof CrusherRecipeWrapper){
CrusherRecipeWrapper wrapper = (CrusherRecipeWrapper)recipeWrapper;
recipeLayout.getItemStacks().init(0, true, 19, 7);
recipeLayout.getItemStacks().set(0, wrapper.theRecipe.inputStack);
recipeLayout.getItemStacks().init(1, false, 7, 55);
recipeLayout.getItemStacks().set(1, wrapper.theRecipe.outputOneStack);
if(wrapper.theRecipe.outputTwoStack != null){
recipeLayout.getItemStacks().init(2, false, 31, 55);
recipeLayout.getItemStacks().set(2, wrapper.theRecipe.outputTwoStack);
}
} }
} }
} }

View file

@ -35,32 +35,14 @@ public class CrusherRecipeWrapper extends RecipeWrapperWithButton{
@Override @Override
public void getIngredients(IIngredients ingredients){ public void getIngredients(IIngredients ingredients){
ingredients.setInput(ItemStack.class, this.theRecipe.inputStack);
}
@Override
public List getInputs(){
return Collections.singletonList(this.theRecipe.inputStack);
}
@Override
public List getOutputs(){
List list = new ArrayList(); List list = new ArrayList();
list.add(this.theRecipe.outputOneStack); list.add(this.theRecipe.outputOneStack);
if(this.theRecipe.outputTwoStack != null){ if(this.theRecipe.outputTwoStack != null){
list.add(this.theRecipe.outputTwoStack); list.add(this.theRecipe.outputTwoStack);
} }
return list; ingredients.setOutputs(ItemStack.class, list);
}
@Override
public List<FluidStack> getFluidInputs(){
return new ArrayList<FluidStack>();
}
@Override
public List<FluidStack> getFluidOutputs(){
return new ArrayList<FluidStack>();
} }
@Override @Override

View file

@ -16,11 +16,11 @@ import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.IDrawable; import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeCategory; import mezz.jei.api.recipe.BlankRecipeCategory;
import mezz.jei.api.recipe.IRecipeWrapper; import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
public class EmpowererRecipeCategory implements IRecipeCategory{ public class EmpowererRecipeCategory extends BlankRecipeCategory<EmpowererRecipeWrapper>{
public static final String NAME = "actuallyadditions.empowerer"; public static final String NAME = "actuallyadditions.empowerer";
@ -40,48 +40,29 @@ public class EmpowererRecipeCategory implements IRecipeCategory{
return StringUtil.localize("container.nei."+NAME+".name"); return StringUtil.localize("container.nei."+NAME+".name");
} }
@Override @Override
public IDrawable getBackground(){ public IDrawable getBackground(){
return this.background; return this.background;
} }
@Override @Override
public void drawExtras(Minecraft minecraft){ public void setRecipe(IRecipeLayout recipeLayout, EmpowererRecipeWrapper wrapper, IIngredients ingredients){
recipeLayout.getItemStacks().init(0, true, 31, 31);
recipeLayout.getItemStacks().set(0, wrapper.theRecipe.input);
} recipeLayout.getItemStacks().init(1, true, 1, 31);
recipeLayout.getItemStacks().set(1, wrapper.theRecipe.modifier1);
@Override recipeLayout.getItemStacks().init(2, true, 31, 1);
public void drawAnimations(Minecraft minecraft){ recipeLayout.getItemStacks().set(2, wrapper.theRecipe.modifier2);
} recipeLayout.getItemStacks().init(3, true, 61, 31);
recipeLayout.getItemStacks().set(3, wrapper.theRecipe.modifier3);
@Override recipeLayout.getItemStacks().init(4, true, 31, 61);
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper){ recipeLayout.getItemStacks().set(4, wrapper.theRecipe.modifier4);
}
@Override recipeLayout.getItemStacks().init(5, false, 112, 31);
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients){ recipeLayout.getItemStacks().set(5, wrapper.theRecipe.output);
if(recipeWrapper instanceof EmpowererRecipeWrapper){
EmpowererRecipeWrapper wrapper = (EmpowererRecipeWrapper)recipeWrapper;
recipeLayout.getItemStacks().init(0, true, 31, 31);
recipeLayout.getItemStacks().set(0, wrapper.theRecipe.input);
recipeLayout.getItemStacks().init(1, true, 1, 31);
recipeLayout.getItemStacks().set(1, wrapper.theRecipe.modifier1);
recipeLayout.getItemStacks().init(2, true, 31, 1);
recipeLayout.getItemStacks().set(2, wrapper.theRecipe.modifier2);
recipeLayout.getItemStacks().init(3, true, 61, 31);
recipeLayout.getItemStacks().set(3, wrapper.theRecipe.modifier3);
recipeLayout.getItemStacks().init(4, true, 31, 61);
recipeLayout.getItemStacks().set(4, wrapper.theRecipe.modifier4);
recipeLayout.getItemStacks().init(5, false, 112, 31);
recipeLayout.getItemStacks().set(5, wrapper.theRecipe.output);
}
} }
} }

View file

@ -35,27 +35,8 @@ public class EmpowererRecipeWrapper extends RecipeWrapperWithButton{
@Override @Override
public void getIngredients(IIngredients ingredients){ public void getIngredients(IIngredients ingredients){
ingredients.setInputs(ItemStack.class, Arrays.asList(this.theRecipe.input, this.theRecipe.modifier1, this.theRecipe.modifier2, this.theRecipe.modifier3, this.theRecipe.modifier4));
} ingredients.setOutput(ItemStack.class, this.theRecipe.output);
@Override
public List getInputs(){
return Arrays.asList(this.theRecipe.input, this.theRecipe.modifier1, this.theRecipe.modifier2, this.theRecipe.modifier3, this.theRecipe.modifier4);
}
@Override
public List getOutputs(){
return Collections.singletonList(this.theRecipe.output);
}
@Override
public List<FluidStack> getFluidInputs(){
return new ArrayList<FluidStack>();
}
@Override
public List<FluidStack> getFluidOutputs(){
return new ArrayList<FluidStack>();
} }
@Override @Override

View file

@ -17,12 +17,11 @@ import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.IDrawable; import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeCategory; import mezz.jei.api.recipe.BlankRecipeCategory;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
public class ReconstructorRecipeCategory implements IRecipeCategory{ public class ReconstructorRecipeCategory extends BlankRecipeCategory<ReconstructorRecipeWrapper>{
public static final String NAME = "actuallyadditions.reconstructor"; public static final String NAME = "actuallyadditions.reconstructor";
@ -33,19 +32,16 @@ public class ReconstructorRecipeCategory implements IRecipeCategory{
this.background = helper.createDrawable(AssetUtil.getGuiLocation("guiNEIAtomicReconstructor"), 0, 0, 96, 60); this.background = helper.createDrawable(AssetUtil.getGuiLocation("guiNEIAtomicReconstructor"), 0, 0, 96, 60);
} }
@Override @Override
public String getUid(){ public String getUid(){
return NAME; return NAME;
} }
@Override @Override
public String getTitle(){ public String getTitle(){
return StringUtil.localize("container.nei."+NAME+".name"); return StringUtil.localize("container.nei."+NAME+".name");
} }
@Override @Override
public IDrawable getBackground(){ public IDrawable getBackground(){
return this.background; return this.background;
@ -57,25 +53,11 @@ public class ReconstructorRecipeCategory implements IRecipeCategory{
} }
@Override @Override
public void drawAnimations(Minecraft minecraft){ public void setRecipe(IRecipeLayout recipeLayout, ReconstructorRecipeWrapper wrapper, IIngredients ingredients){
recipeLayout.getItemStacks().init(0, true, 4, 18);
recipeLayout.getItemStacks().set(0, wrapper.theRecipe.inputStack);
} recipeLayout.getItemStacks().init(1, false, 66, 18);
recipeLayout.getItemStacks().set(1, wrapper.theRecipe.outputStack);
@Override
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper){
}
@Override
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients){
if(recipeWrapper instanceof ReconstructorRecipeWrapper){
ReconstructorRecipeWrapper wrapper = (ReconstructorRecipeWrapper)recipeWrapper;
recipeLayout.getItemStacks().init(0, true, 4, 18);
recipeLayout.getItemStacks().set(0, wrapper.theRecipe.inputStack);
recipeLayout.getItemStacks().init(1, false, 66, 18);
recipeLayout.getItemStacks().set(1, wrapper.theRecipe.outputStack);
}
} }
} }

View file

@ -34,27 +34,8 @@ public class ReconstructorRecipeWrapper extends RecipeWrapperWithButton{
@Override @Override
public void getIngredients(IIngredients ingredients){ public void getIngredients(IIngredients ingredients){
ingredients.setInput(ItemStack.class, this.theRecipe.inputStack);
} ingredients.setOutput(ItemStack.class, this.theRecipe.outputStack);
@Override
public List getInputs(){
return Collections.singletonList(this.theRecipe.inputStack);
}
@Override
public List getOutputs(){
return Collections.singletonList(this.theRecipe.outputStack);
}
@Override
public List<FluidStack> getFluidInputs(){
return new ArrayList<FluidStack>();
}
@Override
public List<FluidStack> getFluidOutputs(){
return new ArrayList<FluidStack>();
} }
@Override @Override