2015-06-06 09:01:21 +02:00
|
|
|
package techreborn.compat.nei.recipes;
|
|
|
|
|
2015-06-06 10:04:56 +02:00
|
|
|
import codechicken.lib.gui.GuiDraw;
|
2015-06-06 09:01:21 +02:00
|
|
|
import codechicken.nei.PositionedStack;
|
2015-06-27 11:01:39 +02:00
|
|
|
import codechicken.nei.recipe.TemplateRecipeHandler;
|
2015-06-06 10:04:56 +02:00
|
|
|
import net.minecraft.client.Minecraft;
|
2015-06-06 09:01:21 +02:00
|
|
|
import net.minecraft.client.gui.inventory.GuiContainer;
|
2015-06-06 10:04:56 +02:00
|
|
|
import net.minecraft.client.renderer.texture.TextureMap;
|
|
|
|
import net.minecraft.util.IIcon;
|
2015-11-08 13:15:45 +01:00
|
|
|
import reborncore.client.gui.GuiUtil;
|
|
|
|
import reborncore.common.util.ItemUtils;
|
2015-06-06 09:01:21 +02:00
|
|
|
import techreborn.api.recipe.IBaseRecipeType;
|
2015-06-06 10:04:56 +02:00
|
|
|
import techreborn.api.recipe.machines.GrinderRecipe;
|
2015-06-06 09:01:21 +02:00
|
|
|
import techreborn.client.gui.GuiGrinder;
|
2015-07-24 23:29:00 +02:00
|
|
|
import techreborn.lib.Reference;
|
2015-06-06 09:01:21 +02:00
|
|
|
|
2015-07-02 20:51:24 +02:00
|
|
|
import java.awt.*;
|
2015-06-06 09:01:21 +02:00
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
public class GrinderRecipeHandler extends GenericRecipeHander implements INeiBaseRecipe {
|
2015-08-09 12:05:32 +02:00
|
|
|
@Override
|
|
|
|
public void addPositionedStacks(List<PositionedStack> input, List<PositionedStack> outputs, IBaseRecipeType recipeType) {
|
|
|
|
int offset = 4;
|
|
|
|
if (recipeType.getInputs().size() > 0) {
|
2015-09-11 14:34:20 +02:00
|
|
|
PositionedStack pStack = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(0)), 32 - offset, 26 - offset, false);
|
2015-08-09 12:05:32 +02:00
|
|
|
input.add(pStack);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (recipeType.getInputs().size() > 1) {
|
2015-09-11 14:34:20 +02:00
|
|
|
PositionedStack pStack2 = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(1)), 32 - offset, 44 - offset, false);
|
2015-08-09 12:05:32 +02:00
|
|
|
input.add(pStack2);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (recipeType.getOutputsSize() > 0) {
|
2015-09-11 14:34:20 +02:00
|
|
|
PositionedStack pStack3 = new PositionedStack(recipeType.getOutput(0), 77 - offset, 35 - offset, false);
|
2015-08-09 12:05:32 +02:00
|
|
|
outputs.add(pStack3);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (recipeType.getOutputsSize() > 1) {
|
2015-09-11 14:34:20 +02:00
|
|
|
PositionedStack pStack4 = new PositionedStack(recipeType.getOutput(1), 95 - offset, 35 - offset, false);
|
2015-08-09 12:05:32 +02:00
|
|
|
outputs.add(pStack4);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (recipeType.getOutputsSize() > 2) {
|
2015-09-11 14:34:20 +02:00
|
|
|
PositionedStack pStack5 = new PositionedStack(recipeType.getOutput(2), 113 - offset, 35 - offset, false);
|
2015-08-09 12:05:32 +02:00
|
|
|
outputs.add(pStack5);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (recipeType.getOutputsSize() > 3) {
|
2015-09-11 14:34:20 +02:00
|
|
|
PositionedStack pStack6 = new PositionedStack(recipeType.getOutput(3), 131 - offset, 35 - offset, false);
|
2015-08-09 12:05:32 +02:00
|
|
|
outputs.add(pStack6);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String getRecipeName() {
|
|
|
|
return Reference.grinderRecipe;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String getGuiTexture() {
|
|
|
|
return "techreborn:textures/gui/industrial_grinder.png";
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public Class<? extends GuiContainer> getGuiClass() {
|
|
|
|
return GuiGrinder.class;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public INeiBaseRecipe getNeiBaseRecipe() {
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void loadTransferRects() {
|
|
|
|
this.transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(
|
|
|
|
new Rectangle(44, 20, 25, 20), getNeiBaseRecipe().getRecipeName(), new Object[0]));
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void drawBackground(int recipeIndex) {
|
|
|
|
super.drawBackground(recipeIndex);
|
|
|
|
CachedRecipe recipe = arecipes.get(recipeIndex);
|
|
|
|
if (recipe instanceof CachedGenericRecipe) {
|
|
|
|
if (((CachedGenericRecipe) recipe).recipie instanceof GrinderRecipe) {
|
|
|
|
GrinderRecipe grinderRecipe = (GrinderRecipe) ((CachedGenericRecipe) recipe).recipie;
|
|
|
|
if (grinderRecipe.fluidStack != null) {
|
|
|
|
IIcon fluidIcon = grinderRecipe.fluidStack.getFluid().getIcon();
|
|
|
|
if (fluidIcon != null) {
|
|
|
|
|
|
|
|
Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
|
|
|
|
int liquidHeight = grinderRecipe.fluidStack.amount * 100 / 16000;
|
|
|
|
GuiUtil.drawRepeated(fluidIcon, 7, 22 + 47 - liquidHeight, 14.0D, liquidHeight, GuiDraw.gui.getZLevel());
|
|
|
|
|
|
|
|
}
|
|
|
|
GuiDraw.drawString(grinderRecipe.fluidStack.amount + "mb of " + grinderRecipe.fluidStack.getLocalizedName(), 14, 135, -1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2015-06-06 09:01:21 +02:00
|
|
|
}
|