Initial port of fluid gui code to nei. Needs some rearraning
This commit is contained in:
parent
56619a0ac4
commit
6f80bf7e72
3 changed files with 70 additions and 14 deletions
|
@ -2,6 +2,7 @@ package techreborn.compat.nei;
|
|||
|
||||
import codechicken.nei.api.API;
|
||||
import codechicken.nei.api.IConfigureNEI;
|
||||
import techreborn.api.recipe.machines.GrinderRecipe;
|
||||
import techreborn.compat.nei.recipes.*;
|
||||
import techreborn.lib.ModInfo;
|
||||
|
||||
|
@ -58,6 +59,10 @@ public class NEIConfig implements IConfigureNEI {
|
|||
API.registerUsageHandler(cent);
|
||||
API.registerRecipeHandler(cent);
|
||||
|
||||
GrinderRecipeHandler grind = new GrinderRecipeHandler();
|
||||
API.registerUsageHandler(grind);
|
||||
API.registerRecipeHandler(grind);
|
||||
|
||||
API.registerUsageHandler(shapedRollingMachineHandler);
|
||||
API.registerRecipeHandler(shapedRollingMachineHandler);
|
||||
|
||||
|
|
|
@ -1,9 +1,14 @@
|
|||
package techreborn.compat.nei.recipes;
|
||||
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import ic2.core.util.DrawUtil;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.util.IIcon;
|
||||
import techreborn.api.recipe.IBaseRecipeType;
|
||||
import techreborn.client.gui.GuiAlloySmelter;
|
||||
import techreborn.api.recipe.machines.GrinderRecipe;
|
||||
import techreborn.client.gui.GuiGrinder;
|
||||
import techreborn.util.ItemUtils;
|
||||
|
||||
|
@ -13,23 +18,41 @@ public class GrinderRecipeHandler extends GenericRecipeHander implements INeiBas
|
|||
@Override
|
||||
public void addPositionedStacks(List<PositionedStack> input, List<PositionedStack> outputs, IBaseRecipeType recipeType) {
|
||||
int offset = 4;
|
||||
PositionedStack pStack = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(0)), 0 - offset, 32 - offset);
|
||||
input.add(pStack);
|
||||
if (recipeType.getInputs().size() > 0) {
|
||||
PositionedStack pStack = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(0)), 0 - offset, 32 - offset);
|
||||
input.add(pStack);
|
||||
}
|
||||
|
||||
PositionedStack pStack2 = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(1)), 32 - offset, 44 - offset);
|
||||
input.add(pStack2);
|
||||
|
||||
PositionedStack pStack3 = new PositionedStack(recipeType.getOutputs().get(0), 2 - offset, 77 - offset);
|
||||
outputs.add(pStack3);
|
||||
if (recipeType.getInputs().size() > 1) {
|
||||
PositionedStack pStack2 = new PositionedStack(ItemUtils.getStackWithAllOre(recipeType.getInputs().get(1)), 32 - offset, 44 - offset);
|
||||
input.add(pStack2);
|
||||
}
|
||||
|
||||
PositionedStack pStack4 = new PositionedStack(recipeType.getOutputs().get(1), 2 - offset, 95 - offset);
|
||||
outputs.add(pStack4);
|
||||
|
||||
PositionedStack pStack5 = new PositionedStack(recipeType.getOutputs().get(2), 4 - offset, 113 - offset);
|
||||
outputs.add(pStack5);
|
||||
if (recipeType.getOutputs().size() > 0) {
|
||||
PositionedStack pStack3 = new PositionedStack(recipeType.getOutputs().get(0), 2 - offset, 77 - offset);
|
||||
outputs.add(pStack3);
|
||||
}
|
||||
|
||||
|
||||
if (recipeType.getInputs().size() > 1) {
|
||||
PositionedStack pStack4 = new PositionedStack(recipeType.getOutputs().get(1), 2 - offset, 95 - offset);
|
||||
outputs.add(pStack4);
|
||||
}
|
||||
|
||||
|
||||
if (recipeType.getInputs().size() > 2) {
|
||||
PositionedStack pStack5 = new PositionedStack(recipeType.getOutputs().get(2), 4 - offset, 113 - offset);
|
||||
outputs.add(pStack5);
|
||||
}
|
||||
|
||||
|
||||
if (recipeType.getInputs().size() > 3) {
|
||||
PositionedStack pStack6 = new PositionedStack(recipeType.getOutputs().get(3), 5 - offset, 131 - offset);
|
||||
outputs.add(pStack6);
|
||||
}
|
||||
|
||||
PositionedStack pStack6 = new PositionedStack(recipeType.getOutputs().get(3), 5 - offset, 131 - offset);
|
||||
outputs.add(pStack6);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -51,4 +74,32 @@ public class GrinderRecipeHandler extends GenericRecipeHander implements INeiBas
|
|||
public INeiBaseRecipe getNeiBaseRecipe() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@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) {
|
||||
// GuiDraw.drawRect(7, 16, 176, 31, 0);
|
||||
// drawTexturedModalRect(k + 7, l + 15, 176, 31, 20, 55);
|
||||
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
|
||||
int liquidHeight = grinderRecipe.fluidStack.amount * 47 / 16000;
|
||||
DrawUtil.drawRepeated(fluidIcon, 11, 19 + 47 - liquidHeight, 12.0D, liquidHeight, GuiDraw.gui.getZLevel());
|
||||
|
||||
|
||||
// this.mc.renderEngine.bindTexture(texture);
|
||||
// drawTexturedModalRect(k + 11, l + 19, 176, 86, 12, 47);
|
||||
}
|
||||
GuiDraw.drawString(grinderRecipe.fluidStack.amount + "mb of " + grinderRecipe.fluidStack.getLocalizedName(), 14, 124, -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ public class TileGrinder extends TileMachineBase implements IWrenchable, IEnergy
|
|||
public int tickTime;
|
||||
public BasicSink energy;
|
||||
public Inventory inventory = new Inventory(6, "TileGrinder", 64);
|
||||
public Tank tank = new Tank("TileGrinder",16000, this);
|
||||
public Tank tank = new Tank("TileGrinder", 16000, this);
|
||||
public RecipeCrafter crafter;
|
||||
|
||||
public TileGrinder() {
|
||||
|
|
Loading…
Add table
Reference in a new issue