mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-26 08:48:34 +01:00
Reconstructor recipe handler
This commit is contained in:
parent
924e7da95f
commit
5ca0fd53d3
4 changed files with 224 additions and 2 deletions
|
@ -17,6 +17,8 @@ import de.ellpeck.actuallyadditions.mod.jei.coffee.CoffeeMachineRecipeCategory;
|
||||||
import de.ellpeck.actuallyadditions.mod.jei.coffee.CoffeeMachineRecipeHandler;
|
import de.ellpeck.actuallyadditions.mod.jei.coffee.CoffeeMachineRecipeHandler;
|
||||||
import de.ellpeck.actuallyadditions.mod.jei.crusher.CrusherRecipeCategory;
|
import de.ellpeck.actuallyadditions.mod.jei.crusher.CrusherRecipeCategory;
|
||||||
import de.ellpeck.actuallyadditions.mod.jei.crusher.CrusherRecipeHandler;
|
import de.ellpeck.actuallyadditions.mod.jei.crusher.CrusherRecipeHandler;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.jei.reconstructor.ReconstructorRecipeCategory;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.jei.reconstructor.ReconstructorRecipeHandler;
|
||||||
import mezz.jei.api.*;
|
import mezz.jei.api.*;
|
||||||
|
|
||||||
@JEIPlugin
|
@JEIPlugin
|
||||||
|
@ -39,18 +41,21 @@ public class JEIActuallyAdditionsPlugin implements IModPlugin{
|
||||||
registry.addRecipeCategories(
|
registry.addRecipeCategories(
|
||||||
new BookletRecipeCategory(this.helpers.getGuiHelper()),
|
new BookletRecipeCategory(this.helpers.getGuiHelper()),
|
||||||
new CoffeeMachineRecipeCategory(this.helpers.getGuiHelper()),
|
new CoffeeMachineRecipeCategory(this.helpers.getGuiHelper()),
|
||||||
new CrusherRecipeCategory(this.helpers.getGuiHelper())
|
new CrusherRecipeCategory(this.helpers.getGuiHelper()),
|
||||||
|
new ReconstructorRecipeCategory(this.helpers.getGuiHelper())
|
||||||
);
|
);
|
||||||
|
|
||||||
registry.addRecipeHandlers(
|
registry.addRecipeHandlers(
|
||||||
new BookletRecipeHandler(),
|
new BookletRecipeHandler(),
|
||||||
new CoffeeMachineRecipeHandler(),
|
new CoffeeMachineRecipeHandler(),
|
||||||
new CrusherRecipeHandler()
|
new CrusherRecipeHandler(),
|
||||||
|
new ReconstructorRecipeHandler()
|
||||||
);
|
);
|
||||||
|
|
||||||
registry.addRecipes(ActuallyAdditionsAPI.bookletPagesWithItemStackData);
|
registry.addRecipes(ActuallyAdditionsAPI.bookletPagesWithItemStackData);
|
||||||
registry.addRecipes(ActuallyAdditionsAPI.coffeeMachineIngredients);
|
registry.addRecipes(ActuallyAdditionsAPI.coffeeMachineIngredients);
|
||||||
registry.addRecipes(ActuallyAdditionsAPI.crusherRecipes);
|
registry.addRecipes(ActuallyAdditionsAPI.crusherRecipes);
|
||||||
|
registry.addRecipes(ActuallyAdditionsAPI.reconstructorLensNoneRecipes);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -0,0 +1,77 @@
|
||||||
|
/*
|
||||||
|
* This file ("ReconstructorRecipeCategory.java") is part of the Actually Additions Mod for Minecraft.
|
||||||
|
* It is created and owned by Ellpeck and distributed
|
||||||
|
* under the Actually Additions License to be found at
|
||||||
|
* http://ellpeck.de/actaddlicense/
|
||||||
|
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||||
|
*
|
||||||
|
* © 2016 Ellpeck
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.ellpeck.actuallyadditions.mod.jei.reconstructor;
|
||||||
|
|
||||||
|
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.nei.NEIReconstructorRecipe;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||||
|
import mezz.jei.api.IGuiHelper;
|
||||||
|
import mezz.jei.api.gui.IDrawable;
|
||||||
|
import mezz.jei.api.gui.IRecipeLayout;
|
||||||
|
import mezz.jei.api.recipe.IRecipeCategory;
|
||||||
|
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
public class ReconstructorRecipeCategory implements IRecipeCategory{
|
||||||
|
|
||||||
|
private IDrawable background;
|
||||||
|
private static final ItemStack RECONSTRUCTOR = new ItemStack(InitBlocks.blockAtomicReconstructor);
|
||||||
|
|
||||||
|
public ReconstructorRecipeCategory(IGuiHelper helper){
|
||||||
|
this.background = helper.createDrawable(AssetUtil.getGuiLocation("guiNEIAtomicReconstructor"), 0, 0, 96, 60);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
@Override
|
||||||
|
public String getUid(){
|
||||||
|
return NEIReconstructorRecipe.NAME;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
@Override
|
||||||
|
public String getTitle(){
|
||||||
|
return StringUtil.localize("container.nei."+NEIReconstructorRecipe.NAME+".name");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
@Override
|
||||||
|
public IDrawable getBackground(){
|
||||||
|
return this.background;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawExtras(Minecraft minecraft){
|
||||||
|
AssetUtil.renderStackToGui(RECONSTRUCTOR, 34, 19, 1.0F);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawAnimations(Minecraft minecraft){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper){
|
||||||
|
if(recipeWrapper instanceof ReconstructorRecipeWrapper){
|
||||||
|
ReconstructorRecipeWrapper wrapper = (ReconstructorRecipeWrapper)recipeWrapper;
|
||||||
|
|
||||||
|
recipeLayout.getItemStacks().init(0, true, 4, 18);
|
||||||
|
recipeLayout.getItemStacks().set(0, wrapper.theRecipe.getInputs());
|
||||||
|
|
||||||
|
recipeLayout.getItemStacks().init(1, true, 66, 18);
|
||||||
|
recipeLayout.getItemStacks().set(1, wrapper.theRecipe.getOutputs());
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,44 @@
|
||||||
|
/*
|
||||||
|
* This file ("ReconstructorRecipeHandler.java") is part of the Actually Additions Mod for Minecraft.
|
||||||
|
* It is created and owned by Ellpeck and distributed
|
||||||
|
* under the Actually Additions License to be found at
|
||||||
|
* http://ellpeck.de/actaddlicense/
|
||||||
|
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||||
|
*
|
||||||
|
* © 2016 Ellpeck
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.ellpeck.actuallyadditions.mod.jei.reconstructor;
|
||||||
|
|
||||||
|
import de.ellpeck.actuallyadditions.api.recipe.LensNoneRecipe;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.nei.NEIReconstructorRecipe;
|
||||||
|
import mezz.jei.api.recipe.IRecipeHandler;
|
||||||
|
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
public class ReconstructorRecipeHandler implements IRecipeHandler<LensNoneRecipe>{
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
@Override
|
||||||
|
public Class getRecipeClass(){
|
||||||
|
return LensNoneRecipe.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
@Override
|
||||||
|
public String getRecipeCategoryUid(){
|
||||||
|
return NEIReconstructorRecipe.NAME;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
@Override
|
||||||
|
public IRecipeWrapper getRecipeWrapper(@Nonnull LensNoneRecipe recipe){
|
||||||
|
return new ReconstructorRecipeWrapper(recipe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isRecipeValid(@Nonnull LensNoneRecipe recipe){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,96 @@
|
||||||
|
/*
|
||||||
|
* This file ("ReconstructorRecipeWrapper.java") is part of the Actually Additions Mod for Minecraft.
|
||||||
|
* It is created and owned by Ellpeck and distributed
|
||||||
|
* under the Actually Additions License to be found at
|
||||||
|
* http://ellpeck.de/actaddlicense/
|
||||||
|
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||||
|
*
|
||||||
|
* © 2016 Ellpeck
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.ellpeck.actuallyadditions.mod.jei.reconstructor;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
|
import de.ellpeck.actuallyadditions.api.booklet.BookletPage;
|
||||||
|
import de.ellpeck.actuallyadditions.api.recipe.LensNoneRecipe;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.booklet.BookletUtils;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.jei.RecipeWrapperWithButton;
|
||||||
|
import mezz.jei.api.recipe.IRecipeWrapper;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class ReconstructorRecipeWrapper extends RecipeWrapperWithButton implements IRecipeWrapper{
|
||||||
|
|
||||||
|
public LensNoneRecipe theRecipe;
|
||||||
|
|
||||||
|
public ReconstructorRecipeWrapper(LensNoneRecipe recipe){
|
||||||
|
this.theRecipe = recipe;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List getInputs(){
|
||||||
|
return this.theRecipe.getInputs();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List getOutputs(){
|
||||||
|
return this.theRecipe.getOutputs();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<FluidStack> getFluidInputs(){
|
||||||
|
return ImmutableList.of();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<FluidStack> getFluidOutputs(){
|
||||||
|
return ImmutableList.of();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY){
|
||||||
|
this.updateButton(minecraft, mouseX, mouseY);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawAnimations(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public List<String> getTooltipStrings(int mouseX, int mouseY){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean handleClick(@Nonnull Minecraft minecraft, int mouseX, int mouseY, int mouseButton){
|
||||||
|
return this.handleClick(minecraft, mouseX, mouseY);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BookletPage getPage(){
|
||||||
|
return BookletUtils.getFirstPageForStack(new ItemStack(InitBlocks.blockAtomicReconstructor));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getButtonX(){
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getButtonY(){
|
||||||
|
return 40;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue