JEI integration is done!

This commit is contained in:
aidancbrady committed 2016-05-20 13:46:52 -04:00
1 parent 2f7f38f327
commit 1e461abc3c
11 files changed
+515 -13

No files matched your search

@@ -1,5 +1,7 @@
package mekanism.client.jei.machine.chemical;
import java.util.List;
import mekanism.client.jei.BaseRecipeCategory;
import mekanism.common.recipe.machines.WasherRecipe;
import mezz.jei.api.IGuiHelper;
@@ -7,9 +9,11 @@ import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IGuiFluidStackGroup;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.gui.ITickTimer;
import mezz.jei.api.gui.ITooltipCallback;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.FluidStack;
public class ChemicalWasherRecipeCategory extends BaseRecipeCategory
{
@@ -43,9 +47,7 @@ public class ChemicalWasherRecipeCategory extends BaseRecipeCategory
super.drawExtras(minecraft);
drawTexturedRect(61-xOffset, 39-yOffset, 176, 63, 55, 8);
//displayGauge(58, 6-xOffset, 5-yOffset, 176, 4, 58, new FluidStack(FluidRegistry.WATER, 1), null);
if(tempRecipe.getInput().ingredient != null)
{
displayGauge(58, 27-xOffset, 14-yOffset, 176, 4, 58, null, tempRecipe.getInput().ingredient);
@@ -75,5 +77,13 @@ public class ChemicalWasherRecipeCategory extends BaseRecipeCategory
fluidStacks.init(0, true, 6-xOffset, 5-yOffset, 16, 58, 1000, false, fluidOverlay);
fluidStacks.set(0, recipeWrapper.getFluidInputs());
fluidStacks.addTooltipCallback(new ITooltipCallback<FluidStack>() {
@Override
public void onTooltip(int slotIndex, boolean input, FluidStack ingredient, List<String> tooltip)
{
tooltip.remove(1);
}
});
}
}
@@ -1,5 +1,136 @@
package mekanism.client.jei.machine.other;
public class ElectrolyticSeparatorRecipeCategory {
import java.util.List;
import mekanism.client.gui.element.GuiFluidGauge;
import mekanism.client.gui.element.GuiGasGauge;
import mekanism.client.gui.element.GuiGauge;
import mekanism.client.gui.element.GuiPowerBar;
import mekanism.client.gui.element.GuiPowerBar.IPowerInfoHandler;
import mekanism.client.gui.element.GuiProgress;
import mekanism.client.gui.element.GuiProgress.IProgressInfoHandler;
import mekanism.client.gui.element.GuiProgress.ProgressBar;
import mekanism.client.gui.element.GuiSlot;
import mekanism.client.gui.element.GuiSlot.SlotOverlay;
import mekanism.client.gui.element.GuiSlot.SlotType;
import mekanism.client.jei.BaseRecipeCategory;
import mekanism.common.recipe.machines.SeparatorRecipe;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IGuiFluidStackGroup;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.gui.ITickTimer;
import mezz.jei.api.gui.ITooltipCallback;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.FluidStack;
public class ElectrolyticSeparatorRecipeCategory extends BaseRecipeCategory
{
public IGuiHelper guiHelper;
public IDrawable background;
public IDrawable fluidOverlay;
public GuiGasGauge leftGas;
public GuiGasGauge rightGas;
public SeparatorRecipe tempRecipe;
public ITickTimer timer;
public ElectrolyticSeparatorRecipeCategory(IGuiHelper helper)
{
super("mekanism:gui/GuiElectrolyticSeparator.png", "electrolytic_separator", "tile.MachineBlock2.ElectrolyticSeparator.name", ProgressBar.BI);
guiHelper = helper;
timer = helper.createTickTimer(20, 20, false);
xOffset = 4;
yOffset = 9;
background = guiHelper.createDrawable(new ResourceLocation(guiTexture), xOffset, yOffset, 167, 62);
fluidOverlay = guiHelper.createDrawable(MekanismUtils.getResource(ResourceType.GUI_ELEMENT, GuiGauge.Type.STANDARD.textureLocation), 19, 1, 16, 59);
}
@Override
public void addGuiElements()
{
guiElements.add(GuiFluidGauge.getDummy(GuiGauge.Type.STANDARD, this, MekanismUtils.getResource(ResourceType.GUI, "GuiElectrolyticSeparator.png"), 5, 10));
guiElements.add(leftGas = GuiGasGauge.getDummy(GuiGauge.Type.SMALL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiElectrolyticSeparator.png"), 58, 18));
guiElements.add(rightGas = GuiGasGauge.getDummy(GuiGauge.Type.SMALL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiElectrolyticSeparator.png"), 100, 18));
guiElements.add(new GuiPowerBar(this, new IPowerInfoHandler() {
@Override
public double getLevel()
{
return 1F;
}
}, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 164, 15));
guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiElectrolyticSeparator.png"), 25, 34));
guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiElectrolyticSeparator.png"), 58, 51));
guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiElectrolyticSeparator.png"), 100, 51));
guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiElectrolyticSeparator.png"), 142, 34).with(SlotOverlay.POWER));
guiElements.add(new GuiProgress(new IProgressInfoHandler()
{
@Override
public double getProgress()
{
return 1;
}
}, progressBar, this, MekanismUtils.getResource(ResourceType.GUI, "GuiElectrolyticSeparator.png"), 78, 29));
}
@Override
public void drawExtras(Minecraft minecraft)
{
super.drawExtras(minecraft);
if(tempRecipe.getOutput().leftGas != null)
{
leftGas.setDummyType(tempRecipe.getOutput().leftGas.getGas());
leftGas.renderScale(0, 0, -xOffset, -yOffset);
}
if(tempRecipe.getOutput().rightGas != null)
{
rightGas.setDummyType(tempRecipe.getOutput().rightGas.getGas());
rightGas.renderScale(0, 0, -xOffset, -yOffset);
}
changeTexture(guiLocation);
}
@Override
public IDrawable getBackground()
{
return background;
}
@Override
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper)
{
if(recipeWrapper instanceof ElectrolyticSeparatorRecipeWrapper)
{
tempRecipe = ((ElectrolyticSeparatorRecipeWrapper)recipeWrapper).recipe;
}
IGuiFluidStackGroup fluidStacks = recipeLayout.getFluidStacks();
fluidStacks.init(0, true, 2, 2, 16, 58, tempRecipe.getInput().ingredient.amount, false, fluidOverlay);
fluidStacks.set(0, recipeWrapper.getFluidInputs());
fluidStacks.addTooltipCallback(new ITooltipCallback<FluidStack>() {
@Override
public void onTooltip(int slotIndex, boolean input, FluidStack ingredient, List<String> tooltip)
{
tooltip.remove(1);
}
});
}
}
@@ -10,7 +10,6 @@ import javax.annotation.Nullable;
import mekanism.common.recipe.machines.SeparatorRecipe;
import mezz.jei.api.recipe.BlankRecipeWrapper;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
public class ElectrolyticSeparatorRecipeWrapper extends BlankRecipeWrapper
@@ -52,11 +51,11 @@ public class ElectrolyticSeparatorRecipeWrapper extends BlankRecipeWrapper
{
List<String> currenttip = new ArrayList<String>();
if(mouseX >= 59-5 && mouseX <= 75-5 && mouseY >= 19-9 && mouseY <= 47-9)
if(mouseX >= 59-4 && mouseX <= 75-4 && mouseY >= 19-9 && mouseY <= 47-9)
{
currenttip.add(recipe.getOutput().leftGas.getGas().getLocalizedName());
}
else if(mouseX >= 101-5 && mouseX <= 117-5 && mouseY >= 19-9 && mouseY <= 47-9)
else if(mouseX >= 101-4 && mouseX <= 117-4 && mouseY >= 19-9 && mouseY <= 47-9)
{
currenttip.add(recipe.getOutput().rightGas.getGas().getLocalizedName());
}
@@ -1,5 +1,142 @@
package mekanism.client.jei.machine.other;
public class PRCRecipeCategory {
import java.util.List;
import mekanism.client.gui.element.GuiFluidGauge;
import mekanism.client.gui.element.GuiGasGauge;
import mekanism.client.gui.element.GuiGauge;
import mekanism.client.gui.element.GuiPowerBar;
import mekanism.client.gui.element.GuiPowerBar.IPowerInfoHandler;
import mekanism.client.gui.element.GuiProgress;
import mekanism.client.gui.element.GuiProgress.IProgressInfoHandler;
import mekanism.client.gui.element.GuiProgress.ProgressBar;
import mekanism.client.gui.element.GuiSlot;
import mekanism.client.gui.element.GuiSlot.SlotOverlay;
import mekanism.client.gui.element.GuiSlot.SlotType;
import mekanism.client.jei.BaseRecipeCategory;
import mekanism.common.recipe.machines.PressurizedRecipe;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IGuiFluidStackGroup;
import mezz.jei.api.gui.IGuiItemStackGroup;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.gui.ITickTimer;
import mezz.jei.api.gui.ITooltipCallback;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.FluidStack;
public class PRCRecipeCategory extends BaseRecipeCategory
{
public IGuiHelper guiHelper;
public IDrawable background;
public IDrawable fluidOverlay;
public GuiGasGauge gasInput;
public GuiGasGauge gasOutput;
public PressurizedRecipe tempRecipe;
public ITickTimer timer;
public PRCRecipeCategory(IGuiHelper helper)
{
super("mekanism:gui/nei/GuiPRC.png", "pressurized_reaction_chamber", "tile.MachineBlock2.PressurizedReactionChamber.short.name", ProgressBar.MEDIUM);
guiHelper = helper;
timer = helper.createTickTimer(20, 20, false);
xOffset = 3;
yOffset = 11;
background = guiHelper.createDrawable(new ResourceLocation(guiTexture), xOffset, yOffset, 170, 68);
fluidOverlay = guiHelper.createDrawable(MekanismUtils.getResource(ResourceType.GUI_ELEMENT, GuiGauge.Type.STANDARD.textureLocation), 19, 1, 16, 59);
}
@Override
public void addGuiElements()
{
guiElements.add(new GuiSlot(SlotType.INPUT, this, guiLocation, 53, 34));
guiElements.add(new GuiSlot(SlotType.POWER, this, guiLocation, 140, 18).with(SlotOverlay.POWER));
guiElements.add(new GuiSlot(SlotType.OUTPUT, this, guiLocation, 115, 34));
guiElements.add(GuiFluidGauge.getDummy(GuiGauge.Type.STANDARD_YELLOW, this, guiLocation, 5, 10));
guiElements.add(gasInput = GuiGasGauge.getDummy(GuiGauge.Type.STANDARD_RED, this, guiLocation, 28, 10));
guiElements.add(gasOutput = GuiGasGauge.getDummy(GuiGauge.Type.SMALL_BLUE, this, guiLocation, 140, 40));
guiElements.add(new GuiPowerBar(this, new IPowerInfoHandler() {
@Override
public double getLevel()
{
return 1F;
}
}, guiLocation, 164, 15));
guiElements.add(new GuiProgress(new IProgressInfoHandler()
{
@Override
public double getProgress()
{
return (float)timer.getValue() / 20F;
}
}, progressBar, this, guiLocation, 75, 37));
}
@Override
public void drawExtras(Minecraft minecraft)
{
super.drawExtras(minecraft);
if(tempRecipe.getInput().getGas() != null)
{
gasInput.setDummyType(tempRecipe.getInput().getGas().getGas());
gasInput.renderScale(0, 0, -xOffset, -yOffset);
}
if(tempRecipe.getOutput().getGasOutput() != null)
{
gasOutput.setDummyType(tempRecipe.getOutput().getGasOutput().getGas());
gasOutput.renderScale(0, 0, -xOffset, -yOffset);
}
}
@Override
public IDrawable getBackground()
{
return background;
}
@Override
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper)
{
if(recipeWrapper instanceof PRCRecipeWrapper)
{
tempRecipe = ((PRCRecipeWrapper)recipeWrapper).recipe;
}
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
itemStacks.init(0, true, 53-xOffset, 34-yOffset);
itemStacks.init(1, false, 115-xOffset, 34-yOffset);
itemStacks.set(0, recipeWrapper.getInputs());
itemStacks.set(1, recipeWrapper.getOutputs());
IGuiFluidStackGroup fluidStacks = recipeLayout.getFluidStacks();
fluidStacks.init(0, true, 3, 0, 16, 58, tempRecipe.getInput().getFluid().amount, false, fluidOverlay);
fluidStacks.set(0, recipeWrapper.getFluidInputs());
fluidStacks.addTooltipCallback(new ITooltipCallback<FluidStack>() {
@Override
public void onTooltip(int slotIndex, boolean input, FluidStack ingredient, List<String> tooltip)
{
tooltip.remove(1);
}
});
}
}
@@ -1,5 +1,78 @@
package mekanism.client.jei.machine.other;
public class RotaryCondensentratorRecipeCategory {
import mekanism.api.gas.GasStack;
import mekanism.client.jei.BaseRecipeCategory;
import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IGuiFluidStackGroup;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.gui.ITickTimer;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
import net.minecraft.util.ResourceLocation;
public class RotaryCondensentratorRecipeCategory extends BaseRecipeCategory
{
public IGuiHelper guiHelper;
public IDrawable background;
public IDrawable fluidOverlay;
public RotaryCondensentratorRecipeWrapper tempRecipe;
public ITickTimer timer;
public RotaryCondensentratorRecipeCategory(IGuiHelper helper)
{
super("mekanism:gui/nei/GuiRotaryCondensentrator.png", "rotary_condensentrator", "nei.rotaryCondensentrator", null);
guiHelper = helper;
timer = helper.createTickTimer(20, 20, false);
xOffset = 3;
yOffset = 12;
background = guiHelper.createDrawable(new ResourceLocation(guiTexture), xOffset, yOffset, 170, 71);
fluidOverlay = guiHelper.createDrawable(new ResourceLocation(guiTexture), 176, 40, 16, 59);
}
@Override
public void drawExtras(Minecraft minecraft)
{
super.drawExtras(minecraft);
if(tempRecipe.condensentrating)
{
drawTexturedRect(64-xOffset, 39-yOffset, 176, 123, 48, 8);
}
else {
drawTexturedRect(64-xOffset, 39-yOffset, 176, 115, 48, 8);
}
if(tempRecipe.gasType != null)
{
displayGauge(58, 26-xOffset, 14-yOffset, 176, 40, 58, null, new GasStack(tempRecipe.gasType, 1));
}
}
@Override
public IDrawable getBackground()
{
return background;
}
@Override
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper)
{
if(recipeWrapper instanceof RotaryCondensentratorRecipeWrapper)
{
tempRecipe = (RotaryCondensentratorRecipeWrapper)recipeWrapper;
}
IGuiFluidStackGroup fluidStacks = recipeLayout.getFluidStacks();
fluidStacks.init(0, !tempRecipe.condensentrating, 134-xOffset, 14-yOffset, 16, 58, 1000, false, fluidOverlay);
fluidStacks.set(0, tempRecipe.condensentrating ? recipeWrapper.getFluidOutputs() : recipeWrapper.getFluidInputs());
}
}
@@ -8,7 +8,10 @@ import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import mekanism.api.gas.Gas;
import mekanism.common.util.LangUtils;
import mezz.jei.api.recipe.BlankRecipeWrapper;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
@@ -71,6 +74,13 @@ public class RotaryCondensentratorRecipeWrapper extends BlankRecipeWrapper
}
}
@Override
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY)
{
FontRenderer fontRendererObj = minecraft.fontRendererObj;
fontRendererObj.drawString(condensentrating ? LangUtils.localize("gui.condensentrating") : LangUtils.localize("gui.decondensentrating"), 6-3, 74-12, 0x404040, false);
}
@Nullable
@Override
public List<String> getTooltipStrings(int mouseX, int mouseY)
@@ -1,5 +1,69 @@
package mekanism.client.jei.machine.other;
public class SolarNeutronRecipeCategory {
import mekanism.client.jei.BaseRecipeCategory;
import mekanism.common.recipe.machines.SolarNeutronRecipe;
import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.gui.ITickTimer;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
import net.minecraft.util.ResourceLocation;
public class SolarNeutronRecipeCategory extends BaseRecipeCategory
{
public IGuiHelper guiHelper;
public IDrawable background;
public SolarNeutronRecipe tempRecipe;
public ITickTimer timer;
public SolarNeutronRecipeCategory(IGuiHelper helper)
{
super("mekanism:gui/nei/GuiSolarNeutronActivator.png", "solar_neutron_activator", "tile.MachineBlock3.SolarNeutronActivator.name", null);
guiHelper = helper;
timer = helper.createTickTimer(20, 20, false);
xOffset = 3;
yOffset = 12;
background = guiHelper.createDrawable(new ResourceLocation(guiTexture), xOffset, yOffset, 170, 70);
}
@Override
public void drawExtras(Minecraft minecraft)
{
super.drawExtras(minecraft);
drawTexturedRect(64-xOffset, 39-yOffset, 176, 58, 55, 8);
if(tempRecipe.getInput().ingredient != null)
{
displayGauge(58, 26-xOffset, 14-yOffset, 176, 0, 58, null, tempRecipe.getInput().ingredient);
}
if(tempRecipe.getOutput().output != null)
{
displayGauge(58, 134-xOffset, 14-yOffset, 176, 0, 58, null, tempRecipe.getOutput().output);
}
}
@Override
public IDrawable getBackground()
{
return background;
}
@Override
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper)
{
if(recipeWrapper instanceof SolarNeutronRecipeWrapper)
{
tempRecipe = ((SolarNeutronRecipeWrapper)recipeWrapper).recipe;
}
}
}
@@ -43,11 +43,11 @@ public class SolarNeutronRecipeWrapper extends BlankRecipeWrapper
{
List<String> currenttip = new ArrayList<String>();
if(mouseX >= 26-5 && mouseX <= 42-5 && mouseY >= 14-12 && mouseY <= 72-12)
if(mouseX >= 26-3 && mouseX <= 42-3 && mouseY >= 14-12 && mouseY <= 72-12)
{
currenttip.add(LangUtils.localizeGasStack(recipe.getInput().ingredient));
}
else if(mouseX >= 134-5 && mouseX <= 150-5 && mouseY >= 14-12 && mouseY <= 72-12)
else if(mouseX >= 134-3 && mouseX <= 150-3 && mouseY >= 14-12 && mouseY <= 72-12)
{
currenttip.add(LangUtils.localizeGasStack(recipe.getOutput().output));
}
@@ -1,5 +1,83 @@
package mekanism.client.jei.machine.other;
public class ThermalEvaporationRecipeCategory {
import java.util.List;
import mekanism.client.jei.BaseRecipeCategory;
import mekanism.common.recipe.machines.ThermalEvaporationRecipe;
import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IGuiFluidStackGroup;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.gui.ITickTimer;
import mezz.jei.api.gui.ITooltipCallback;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.FluidStack;
public class ThermalEvaporationRecipeCategory extends BaseRecipeCategory
{
public IGuiHelper guiHelper;
public IDrawable background;
public IDrawable fluidOverlay;
public ThermalEvaporationRecipe tempRecipe;
public ITickTimer timer;
public ThermalEvaporationRecipeCategory(IGuiHelper helper)
{
super("mekanism:gui/nei/GuiThermalEvaporationController.png", "thermal_evaporation_plant", "gui.thermalEvaporationController.short", null);
guiHelper = helper;
timer = helper.createTickTimer(20, 20, false);
xOffset = 3;
yOffset = 12;
background = guiHelper.createDrawable(new ResourceLocation(guiTexture), xOffset, yOffset, 170, 62);
fluidOverlay = guiHelper.createDrawable(new ResourceLocation(guiTexture), 176, 0, 16, 59);
}
@Override
public void drawExtras(Minecraft minecraft)
{
super.drawExtras(minecraft);
drawTexturedRect(49-xOffset, 64-yOffset, 176, 59, 78, 8);
}
@Override
public IDrawable getBackground()
{
return background;
}
@Override
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper)
{
if(recipeWrapper instanceof ThermalEvaporationRecipeWrapper)
{
tempRecipe = ((ThermalEvaporationRecipeWrapper)recipeWrapper).recipe;
}
IGuiFluidStackGroup fluidStacks = recipeLayout.getFluidStacks();
fluidStacks.init(0, true, 7-xOffset, 14-yOffset, 16, 58, tempRecipe.getInput().ingredient.amount, false, fluidOverlay);
fluidStacks.init(1, false, 153-xOffset, 14-yOffset, 16, 58, tempRecipe.getOutput().output.amount, false, fluidOverlay);
fluidStacks.set(0, recipeWrapper.getFluidInputs());
fluidStacks.set(1, recipeWrapper.getFluidOutputs());
fluidStacks.addTooltipCallback(new ITooltipCallback<FluidStack>() {
@Override
public void onTooltip(int slotIndex, boolean input, FluidStack ingredient, List<String> tooltip)
{
tooltip.remove(1);
}
});
}
}