Added Coffee Machine JEI recipe

Removed some stuff from the API that doesn't really belong there
This commit is contained in:
Ellpeck 2016-01-17 12:17:24 +01:00
parent 957acd8ab8
commit 59d835ed4f
25 changed files with 270 additions and 29 deletions

View file

@ -28,7 +28,7 @@ public class ActuallyAdditionsAPI{
public static final String MOD_ID = "ActuallyAdditions";
public static final String API_ID = MOD_ID+"API";
public static final String API_VERSION = "6";
public static final String API_VERSION = "7";
public static List<CrusherRecipe> crusherRecipes = new ArrayList<CrusherRecipe>();
public static List<BallOfFurReturn> ballOfFurReturnItems = new ArrayList<BallOfFurReturn>();

View file

@ -10,7 +10,6 @@
package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.api.block.IHudDisplay;
import de.ellpeck.actuallyadditions.api.lens.ILensItem;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityAtomicReconstructor;

View file

@ -10,7 +10,6 @@
package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.api.block.IHudDisplay;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.items.ItemFertilizer;
import de.ellpeck.actuallyadditions.mod.items.ItemMisc;

View file

@ -10,7 +10,6 @@
package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.api.block.IHudDisplay;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLavaFactoryController;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;

View file

@ -11,7 +11,6 @@
package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.api.block.IHudDisplay;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;

View file

@ -10,7 +10,6 @@
package de.ellpeck.actuallyadditions.mod.blocks;
import de.ellpeck.actuallyadditions.api.block.IHudDisplay;
import de.ellpeck.actuallyadditions.api.tile.IPhantomTile;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase;

View file

@ -8,7 +8,7 @@
* © 2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.api.block;
package de.ellpeck.actuallyadditions.mod.blocks;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
@ -19,9 +19,6 @@ import net.minecraft.util.MovingObjectPosition;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
/**
* Extending this will cause displayHud() to be called when hovering over it in-world
*/
public interface IHudDisplay{
@SideOnly(Side.CLIENT)

View file

@ -10,8 +10,8 @@
package de.ellpeck.actuallyadditions.mod.event;
import de.ellpeck.actuallyadditions.api.block.IHudDisplay;
import de.ellpeck.actuallyadditions.api.tile.IEnergyDisplay;
import de.ellpeck.actuallyadditions.mod.blocks.IHudDisplay;
import de.ellpeck.actuallyadditions.mod.tile.IEnergyDisplay;
import de.ellpeck.actuallyadditions.mod.tile.IRedstoneToggle;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.PosUtil;

View file

@ -11,11 +11,11 @@
package de.ellpeck.actuallyadditions.mod.items;
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.api.block.IHudDisplay;
import de.ellpeck.actuallyadditions.api.booklet.BookletPage;
import de.ellpeck.actuallyadditions.api.internal.EntrySet;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.achievement.TheAchievements;
import de.ellpeck.actuallyadditions.mod.blocks.IHudDisplay;
import de.ellpeck.actuallyadditions.mod.booklet.BookletUtils;
import de.ellpeck.actuallyadditions.mod.booklet.GuiBooklet;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;

View file

@ -13,6 +13,8 @@ package de.ellpeck.actuallyadditions.mod.jei;
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.mod.jei.booklet.BookletRecipeCategory;
import de.ellpeck.actuallyadditions.mod.jei.booklet.BookletRecipeHandler;
import de.ellpeck.actuallyadditions.mod.jei.coffee.CoffeeMachineRecipeCategory;
import de.ellpeck.actuallyadditions.mod.jei.coffee.CoffeeMachineRecipeHandler;
import mezz.jei.api.*;
@JEIPlugin
@ -33,14 +35,17 @@ public class JEIActuallyAdditionsPlugin implements IModPlugin{
@Override
public void register(IModRegistry registry){
registry.addRecipeCategories(
new BookletRecipeCategory(this.helpers.getGuiHelper())
new BookletRecipeCategory(this.helpers.getGuiHelper()),
new CoffeeMachineRecipeCategory(this.helpers.getGuiHelper())
);
registry.addRecipeHandlers(
new BookletRecipeHandler()
new BookletRecipeHandler(),
new CoffeeMachineRecipeHandler()
);
registry.addRecipes(ActuallyAdditionsAPI.bookletPagesWithItemStackData);
registry.addRecipes(ActuallyAdditionsAPI.coffeeMachineIngredients);
}
@Override

View file

@ -24,7 +24,7 @@ public abstract class RecipeWrapperWithButton{
protected TexturedButton theButton;
public RecipeWrapperWithButton(){
this.theButton = new TexturedButton(23782, 0, 84, 146, 154, 20, 20){
this.theButton = new TexturedButton(23782, this.getButtonX(), this.getButtonY(), 146, 154, 20, 20){
@Override
public void drawButton(Minecraft minecraft, int x, int y){
super.drawButton(minecraft, x, y);
@ -57,4 +57,7 @@ public abstract class RecipeWrapperWithButton{
}
public abstract BookletPage getPage();
public abstract int getButtonX();
public abstract int getButtonY();
}

View file

@ -100,4 +100,14 @@ public class BookletRecipeWrapper extends RecipeWrapperWithButton implements IRe
public BookletPage getPage(){
return this.thePage;
}
@Override
public int getButtonX(){
return 0;
}
@Override
public int getButtonY(){
return 84;
}
}

View file

@ -0,0 +1,79 @@
/*
* This file ("CoffeeMachineRecipeCategory.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.coffee;
import de.ellpeck.actuallyadditions.mod.nei.NEICoffeeMachineRecipe;
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 javax.annotation.Nonnull;
public class CoffeeMachineRecipeCategory implements IRecipeCategory{
private IDrawable background;
public CoffeeMachineRecipeCategory(IGuiHelper helper){
this.background = helper.createDrawable(AssetUtil.getGuiLocation("guiNEICoffeeMachine"), 0, 0, 126, 88);
}
@Nonnull
@Override
public String getUid(){
return NEICoffeeMachineRecipe.NAME;
}
@Nonnull
@Override
public String getTitle(){
return StringUtil.localize("container.nei."+NEICoffeeMachineRecipe.NAME+".name");
}
@Nonnull
@Override
public IDrawable getBackground(){
return this.background;
}
@Override
public void drawExtras(Minecraft minecraft){
}
@Override
public void drawAnimations(Minecraft minecraft){
}
@Override
public void setRecipe(@Nonnull IRecipeLayout recipeLayout, @Nonnull IRecipeWrapper recipeWrapper){
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

@ -0,0 +1,44 @@
/*
* This file ("CoffeeMachineRecipeHandler.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.coffee;
import de.ellpeck.actuallyadditions.api.recipe.coffee.CoffeeIngredient;
import de.ellpeck.actuallyadditions.mod.nei.NEICoffeeMachineRecipe;
import mezz.jei.api.recipe.IRecipeHandler;
import mezz.jei.api.recipe.IRecipeWrapper;
import javax.annotation.Nonnull;
public class CoffeeMachineRecipeHandler implements IRecipeHandler<CoffeeIngredient>{
@Nonnull
@Override
public Class getRecipeClass(){
return CoffeeIngredient.class;
}
@Nonnull
@Override
public String getRecipeCategoryUid(){
return NEICoffeeMachineRecipe.NAME;
}
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(@Nonnull CoffeeIngredient recipe){
return new CoffeeMachineRecipeWrapper(recipe);
}
@Override
public boolean isRecipeValid(@Nonnull CoffeeIngredient recipe){
return true;
}
}

View file

@ -0,0 +1,120 @@
/*
* This file ("CoffeeMachineRecipeWrapper.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.coffee;
import com.google.common.collect.ImmutableList;
import de.ellpeck.actuallyadditions.api.booklet.BookletPage;
import de.ellpeck.actuallyadditions.api.recipe.coffee.CoffeeBrewing;
import de.ellpeck.actuallyadditions.api.recipe.coffee.CoffeeIngredient;
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
import de.ellpeck.actuallyadditions.mod.booklet.BookletUtils;
import de.ellpeck.actuallyadditions.mod.items.InitItems;
import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems;
import de.ellpeck.actuallyadditions.mod.jei.RecipeWrapperWithButton;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
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.ArrayList;
import java.util.Collections;
import java.util.List;
public class CoffeeMachineRecipeWrapper extends RecipeWrapperWithButton implements IRecipeWrapper{
public CoffeeIngredient theIngredient;
public ItemStack theOutput;
public ItemStack cup = new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CUP.ordinal());
public ItemStack coffeeBeans = new ItemStack(InitItems.itemCoffeeBean);
public CoffeeMachineRecipeWrapper(CoffeeIngredient ingredient){
this.theIngredient = ingredient;
this.theOutput = new ItemStack(InitItems.itemCoffee);
CoffeeBrewing.addEffectToStack(this.theOutput, this.theIngredient);
}
@Override
public List getInputs(){
List list = new ArrayList();
list.add(this.theIngredient.ingredient);
list.add(this.cup);
list.add(this.coffeeBeans);
return list;
}
@Override
public List getOutputs(){
return Collections.singletonList(this.theOutput);
}
@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){
if(this.theIngredient.getExtraText() != null){
Minecraft.getMinecraft().fontRendererObj.drawString(StringUtil.localize("container.nei."+ModUtil.MOD_ID_LOWER+".coffee.special")+":", 2, 4, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false);
Minecraft.getMinecraft().fontRendererObj.drawString(this.theIngredient.getExtraText(), 2, 16, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false);
}
if(this.theIngredient.maxAmplifier > 0){
Minecraft.getMinecraft().fontRendererObj.drawString(StringUtil.localize("container.nei."+ModUtil.MOD_ID_LOWER+".coffee.maxAmount")+": "+this.theIngredient.maxAmplifier, 2, 28, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false);
}
}
@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.blockCoffeeMachine));
}
@Override
public int getButtonX(){
return 0;
}
@Override
public int getButtonY(){
return 70;
}
}

View file

@ -113,7 +113,6 @@ public class NEICoffeeMachineRecipe extends TemplateRecipeHandler implements INE
GuiDraw.drawString(StringUtil.localize("container.nei."+ModUtil.MOD_ID_LOWER+".coffee.special")+":", 2, 4, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false);
GuiDraw.drawString(cache.extraText, 2, 16, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false);
}
GuiDraw.drawString(StringUtil.localize("container.nei."+ModUtil.MOD_ID_LOWER+".coffee.shift"), 1, 75, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false);
if(cache.maxAmp > 0){
GuiDraw.drawString(StringUtil.localize("container.nei."+ModUtil.MOD_ID_LOWER+".coffee.maxAmount")+": "+cache.maxAmp, 2, 28, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false);

View file

@ -8,14 +8,11 @@
* © 2016 Ellpeck
*/
package de.ellpeck.actuallyadditions.api.tile;
package de.ellpeck.actuallyadditions.mod.tile;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
/**
* Extending this will cause a block to show "getEnergy()/maxEnergy() RF" when hovering over it in-world
*/
public interface IEnergyDisplay{
@SideOnly(Side.CLIENT)

View file

@ -15,7 +15,6 @@ import cofh.api.energy.IEnergyReceiver;
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
import de.ellpeck.actuallyadditions.api.lens.ILensItem;
import de.ellpeck.actuallyadditions.api.lens.Lens;
import de.ellpeck.actuallyadditions.api.tile.IEnergyDisplay;
import de.ellpeck.actuallyadditions.mod.items.lens.Lenses;
import de.ellpeck.actuallyadditions.mod.network.PacketHandler;
import de.ellpeck.actuallyadditions.mod.network.PacketParticle;

View file

@ -12,7 +12,6 @@ package de.ellpeck.actuallyadditions.mod.tile;
import cofh.api.energy.EnergyStorage;
import cofh.api.energy.IEnergyReceiver;
import de.ellpeck.actuallyadditions.api.tile.IEnergyDisplay;
import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.entity.item.EntityFireworkRocket;
import net.minecraft.init.Items;

View file

@ -12,7 +12,6 @@ package de.ellpeck.actuallyadditions.mod.tile;
import cofh.api.energy.EnergyStorage;
import cofh.api.energy.IEnergyProvider;
import de.ellpeck.actuallyadditions.api.tile.IEnergyDisplay;
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
import net.minecraft.nbt.NBTTagCompound;

View file

@ -12,7 +12,6 @@ package de.ellpeck.actuallyadditions.mod.tile;
import cofh.api.energy.EnergyStorage;
import cofh.api.energy.IEnergyProvider;
import de.ellpeck.actuallyadditions.api.tile.IEnergyDisplay;
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
import de.ellpeck.actuallyadditions.mod.util.Util;
import de.ellpeck.actuallyadditions.mod.util.WorldUtil;

View file

@ -12,7 +12,6 @@ package de.ellpeck.actuallyadditions.mod.tile;
import cofh.api.energy.EnergyStorage;
import cofh.api.energy.IEnergyReceiver;
import de.ellpeck.actuallyadditions.api.tile.IEnergyDisplay;
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheMiscBlocks;
import de.ellpeck.actuallyadditions.mod.util.PosUtil;

View file

@ -12,7 +12,6 @@ package de.ellpeck.actuallyadditions.mod.tile;
import cofh.api.energy.EnergyStorage;
import cofh.api.energy.IEnergyProvider;
import de.ellpeck.actuallyadditions.api.tile.IEnergyDisplay;
import de.ellpeck.actuallyadditions.mod.network.PacketHandler;
import de.ellpeck.actuallyadditions.mod.network.PacketParticle;
import de.ellpeck.actuallyadditions.mod.util.PosUtil;

View file

@ -12,7 +12,6 @@ package de.ellpeck.actuallyadditions.mod.tile;
import cofh.api.energy.EnergyStorage;
import cofh.api.energy.IEnergyReceiver;
import de.ellpeck.actuallyadditions.api.tile.IEnergyDisplay;
import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
import de.ellpeck.actuallyadditions.mod.network.PacketHandler;
import de.ellpeck.actuallyadditions.mod.network.PacketParticle;

View file

@ -18,7 +18,6 @@ container.nei.actuallyadditions.treasureChest.info=Items at
container.nei.actuallyadditions.coffee.name=Coffee Machine
container.nei.actuallyadditions.coffee.special=Special Feature
container.nei.actuallyadditions.coffee.maxAmount=Max Amount
container.nei.actuallyadditions.coffee.shift=[SHIFT]!
container.nei.actuallyadditions.coffee.extra.milk=+01:00, -1 Level
container.nei.actuallyadditions.reconstructor.name=Atomic Reconstructor