Cleanup some JEI gui code

This commit is contained in:
pupnewfster authored and Dave Smith committed 2019-03-20 15:59:34 -06:00
1 parent a446777f3a
commit 1c592ec3fa
34 files changed
+267 -539

No files matched your search

@@ -8,7 +8,7 @@ import javax.annotation.Nullable;
import mekanism.api.gas.GasStack;
import mekanism.client.gui.IGuiWrapper;
import mekanism.client.gui.element.GuiElement;
import mekanism.client.gui.element.GuiGauge;
import mekanism.client.gui.element.GuiGauge.Type;
import mekanism.client.gui.element.GuiProgress.ProgressBar;
import mekanism.client.jei.gas.GasStackRenderer;
import mekanism.common.Mekanism;
@@ -33,7 +33,6 @@ public abstract class BaseRecipeCategory implements IRecipeCategory<IRecipeWrapp
private static final GuiDummy gui = new GuiDummy();
protected IGuiHelper guiHelper;
protected String guiTexture;
protected ResourceLocation guiLocation;
@Nullable
protected ProgressBar progressBar;
@@ -46,10 +45,9 @@ public abstract class BaseRecipeCategory implements IRecipeCategory<IRecipeWrapp
private String recipeName;
private String unlocalizedName;
public BaseRecipeCategory(IGuiHelper helper, String gui, String name, String unlocalized,
public BaseRecipeCategory(IGuiHelper helper, String guiTexture, String name, String unlocalized,
@Nullable ProgressBar progress) {
guiHelper = helper;
guiTexture = gui;
guiLocation = new ResourceLocation(guiTexture);
progressBar = progress;
@@ -59,12 +57,9 @@ public abstract class BaseRecipeCategory implements IRecipeCategory<IRecipeWrapp
timer = helper.createTickTimer(20, 20, false);
fluidOverlayLarge = guiHelper.createDrawable(
MekanismUtils.getResource(ResourceType.GUI_ELEMENT, GuiGauge.Type.STANDARD.textureLocation), 19, 1, 16,
59);
fluidOverlaySmall = guiHelper.createDrawable(
MekanismUtils.getResource(ResourceType.GUI_ELEMENT, GuiGauge.Type.STANDARD.textureLocation), 19, 1, 16,
29);
ResourceLocation resource = MekanismUtils.getResource(ResourceType.GUI_ELEMENT, Type.STANDARD.textureLocation);
fluidOverlayLarge = guiHelper.createDrawable(resource, 19, 1, 16, 59);
fluidOverlaySmall = guiHelper.createDrawable(resource, 19, 1, 16, 29);
addGuiElements();
}
@@ -88,10 +83,7 @@ public abstract class BaseRecipeCategory implements IRecipeCategory<IRecipeWrapp
public void drawExtras(Minecraft minecraft) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
changeTexture(guiLocation);
for (GuiElement e : guiElements) {
e.renderBackground(0, 0, -xOffset, -yOffset);
}
guiElements.forEach(e -> e.renderBackground(0, 0, -xOffset, -yOffset));
}
@Override
@@ -117,10 +109,6 @@ public abstract class BaseRecipeCategory implements IRecipeCategory<IRecipeWrapp
return null;
}
public String stripTexture() {
return guiTexture.replace("mekanism:gui/", "");
}
public void changeTexture(ResourceLocation texture) {
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
}
@@ -155,4 +143,4 @@ public abstract class BaseRecipeCategory implements IRecipeCategory<IRecipeWrapp
public static class GuiDummy extends Gui {
}
}
}
@@ -1,6 +1,7 @@
package mekanism.client.jei;
import com.google.common.base.MoreObjects;
import com.google.common.base.MoreObjects.ToStringHelper;
import java.awt.Color;
import java.util.Collections;
import java.util.List;
@@ -24,7 +25,6 @@ public class GasStackHelper implements IIngredientHelper<GasStack> {
return stack;
}
}
return null;
}
@@ -65,18 +65,12 @@ public class GasStackHelper implements IIngredientHelper<GasStack> {
@Override
public String getErrorInfo(@Nullable GasStack ingredient) {
MoreObjects.ToStringHelper toStringHelper = MoreObjects.toStringHelper(GasStack.class);
Gas gas = ingredient.getGas();
if (gas != null) {
toStringHelper.add("Gas", gas.getLocalizedName());
} else {
toStringHelper.add("Gas", "null");
ToStringHelper toStringHelper = MoreObjects.toStringHelper(GasStack.class);
Gas gas = ingredient == null ? null : ingredient.getGas();
toStringHelper.add("Gas", gas != null ? gas.getLocalizedName() : "null");
if (ingredient != null) {
toStringHelper.add("Amount", ingredient.amount);
}
toStringHelper.add("Amount", ingredient.amount);
return toStringHelper.toString();
}
}
}
@@ -1,10 +1,9 @@
package mekanism.client.jei;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import mekanism.client.gui.GuiMekanism;
import mekanism.client.gui.element.GuiElement;
import mezz.jei.api.gui.IAdvancedGuiHandler;
import net.minecraft.client.gui.inventory.GuiContainer;
@@ -18,17 +17,11 @@ public class GuiElementHandler implements IAdvancedGuiHandler {
@Override
public List<Rectangle> getGuiExtraAreas(GuiContainer gui) {
if (gui instanceof GuiMekanism) {
List<Rectangle> list = new ArrayList<>();
GuiMekanism guiMek = (GuiMekanism) gui;
for (GuiElement element : guiMek.getGuiElements()) {
list.add(element.getBounds(guiMek.getXPos(), guiMek.getYPos()).toRectangle());
}
return list;
return guiMek.getGuiElements().stream()
.map(element -> element.getBounds(guiMek.getXPos(), guiMek.getYPos()).toRectangle())
.collect(Collectors.toList());
}
return null;
}
@@ -36,4 +29,4 @@ public class GuiElementHandler implements IAdvancedGuiHandler {
public Object getIngredientUnderMouse(GuiContainer guiContainer, int mouseX, int mouseY) {
return null;
}
}
}
@@ -56,15 +56,12 @@ public class GasStackRenderer implements IIngredientRenderer<GasStack> {
TextureMap textureMapBlocks = minecraft.getTextureMapBlocks();
ResourceLocation gasStill = gas.getIcon();
TextureAtlasSprite gasStillSprite = null;
if (gasStill != null) {
gasStillSprite = textureMapBlocks.getTextureExtry(gasStill.toString());
}
if (gasStillSprite == null) {
gasStillSprite = textureMapBlocks.getMissingSprite();
}
return gasStillSprite;
}
@@ -72,7 +69,6 @@ public class GasStackRenderer implements IIngredientRenderer<GasStack> {
float red = (color >> 16 & 0xFF) / 255.0F;
float green = (color >> 8 & 0xFF) / 255.0F;
float blue = (color & 0xFF) / 255.0F;
GlStateManager.color(red, green, blue, 1.0F);
}
@@ -99,11 +95,8 @@ public class GasStackRenderer implements IIngredientRenderer<GasStack> {
public void render(Minecraft minecraft, final int xPosition, final int yPosition, @Nullable GasStack gasStack) {
GlStateManager.enableBlend();
GlStateManager.enableAlpha();
drawGas(minecraft, xPosition, yPosition, gasStack);
GlStateManager.color(1, 1, 1, 1);
if (overlay != null) {
GlStateManager.pushMatrix();
GlStateManager.translate(0, 0, 200);
@@ -116,31 +109,18 @@ public class GasStackRenderer implements IIngredientRenderer<GasStack> {
}
private void drawGas(Minecraft minecraft, final int xPosition, final int yPosition, @Nullable GasStack gasStack) {
if (gasStack == null) {
return;
}
Gas gas = gasStack.getGas();
Gas gas = gasStack == null ? null : gasStack.getGas();
if (gas == null) {
return;
}
TextureAtlasSprite gasStillSprite = getStillGasSprite(minecraft, gas);
int gasColor = gas.getTint();
int scaledAmount = (gasStack.amount * height) / capacityMb;
if (gasStack.amount > 0 && scaledAmount < MIN_FLUID_HEIGHT) {
scaledAmount = MIN_FLUID_HEIGHT;
}
if (scaledAmount > height) {
scaledAmount = height;
}
drawTiledSprite(minecraft, xPosition, yPosition, width, height, gasColor, scaledAmount, gasStillSprite);
drawTiledSprite(minecraft, xPosition, yPosition, width, height, gas.getTint(), scaledAmount, getStillGasSprite(minecraft, gas));
}
private void drawTiledSprite(Minecraft minecraft, final int xPosition, final int yPosition, final int tiledWidth,
@@ -152,21 +132,20 @@ public class GasStackRenderer implements IIngredientRenderer<GasStack> {
final int xRemainder = tiledWidth - (xTileCount * TEX_WIDTH);
final int yTileCount = scaledAmount / TEX_HEIGHT;
final int yRemainder = scaledAmount - (yTileCount * TEX_HEIGHT);
final int yStart = yPosition + tiledHeight;
for (int xTile = 0; xTile <= xTileCount; xTile++) {
for (int yTile = 0; yTile <= yTileCount; yTile++) {
int width = (xTile == xTileCount) ? xRemainder : TEX_WIDTH;
int height = (yTile == yTileCount) ? yRemainder : TEX_HEIGHT;
int width = (xTile == xTileCount) ? xRemainder : TEX_WIDTH;
if (width > 0) {
int x = xPosition + (xTile * TEX_WIDTH);
int y = yStart - ((yTile + 1) * TEX_HEIGHT);
if (width > 0 && height > 0) {
int maskTop = TEX_HEIGHT - height;
int maskRight = TEX_WIDTH - width;
drawTextureWithMasking(x, y, sprite, maskTop, maskRight, 100);
int maskRight = TEX_WIDTH - width;
for (int yTile = 0; yTile <= yTileCount; yTile++) {
int height = (yTile == yTileCount) ? yRemainder : TEX_HEIGHT;
if (height > 0) {
int y = yStart - ((yTile + 1) * TEX_HEIGHT);
int maskTop = TEX_HEIGHT - height;
drawTextureWithMasking(x, y, sprite, maskTop, maskRight, 100);
}
}
}
}
@@ -176,14 +155,11 @@ public class GasStackRenderer implements IIngredientRenderer<GasStack> {
public List<String> getTooltip(Minecraft minecraft, GasStack gasStack, ITooltipFlag tooltipFlag) {
List<String> tooltip = new ArrayList<>();
Gas gasType = gasStack.getGas();
if (gasType == null) {
return tooltip;
}
String gasName = gasType.getLocalizedName();
tooltip.add(gasName);
if (tooltipMode == TooltipMode.SHOW_AMOUNT_AND_CAPACITY) {
String amount = LangUtils
.localizeWithFormat("jei.tooltip.liquid.amount.with.capacity", gasStack.amount, capacityMb);
@@ -192,7 +168,6 @@ public class GasStackRenderer implements IIngredientRenderer<GasStack> {
String amount = LangUtils.localizeWithFormat("jei.tooltip.liquid.amount", gasStack.amount);
tooltip.add(TextFormatting.GRAY + amount);
}
return tooltip;
}
@@ -206,4 +181,4 @@ public class GasStackRenderer implements IIngredientRenderer<GasStack> {
SHOW_AMOUNT_AND_CAPACITY,
ITEM_LIST
}
}
}
@@ -15,8 +15,6 @@ import mekanism.common.recipe.inputs.AdvancedMachineInput;
import mekanism.common.recipe.machines.AdvancedMachineRecipe;
import mekanism.common.recipe.outputs.ItemStackOutput;
import mekanism.common.tile.prefab.TileEntityAdvancedElectricMachine;
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.IGuiIngredientGroup;
@@ -24,7 +22,6 @@ import mezz.jei.api.gui.IGuiItemStackGroup;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.util.ResourceLocation;
public class AdvancedMachineRecipeCategory extends BaseRecipeCategory {
@@ -32,37 +29,27 @@ public class AdvancedMachineRecipeCategory extends BaseRecipeCategory {
public AdvancedMachineRecipeCategory(IGuiHelper helper, String name, String unlocalized, ProgressBar progress) {
super(helper, "mekanism:gui/GuiAdvancedMachine.png", name, unlocalized, progress);
background = guiHelper.createDrawable(new ResourceLocation(guiTexture), 28, 16, 144, 54);
background = guiHelper.createDrawable(guiLocation, 28, 16, 144, 54);
}
@Override
public void addGuiElements() {
guiElements
.add(new GuiSlot(SlotType.INPUT, this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 55,
16));
guiElements
.add(new GuiSlot(SlotType.POWER, this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 30,
34).with(SlotOverlay.POWER));
guiElements
.add(new GuiSlot(SlotType.EXTRA, this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 55,
52));
guiElements
.add(new GuiSlot(SlotType.OUTPUT_LARGE, this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()),
111, 30));
guiElements.add(new GuiSlot(SlotType.INPUT, this, guiLocation, 55, 16));
guiElements.add(new GuiSlot(SlotType.POWER, this, guiLocation, 30, 34).with(SlotOverlay.POWER));
guiElements.add(new GuiSlot(SlotType.EXTRA, this, guiLocation, 55, 52));
guiElements.add(new GuiSlot(SlotType.OUTPUT_LARGE, this, guiLocation, 111, 30));
guiElements.add(new GuiPowerBar(this, new IPowerInfoHandler() {
@Override
public double getLevel() {
return 1F;
}
}, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 164, 15));
}, guiLocation, 164, 15));
guiElements.add(new GuiProgress(new IProgressInfoHandler() {
@Override
public double getProgress() {
return (double) timer.getValue() / 20F;
}
}, progressBar, this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 77, 37));
}, progressBar, this, guiLocation, 77, 37));
}
@Override
@@ -72,28 +59,20 @@ public class AdvancedMachineRecipeCategory extends BaseRecipeCategory {
@Override
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients) {
if (!(recipeWrapper instanceof AdvancedMachineRecipeWrapper)) {
return;
if (recipeWrapper instanceof AdvancedMachineRecipeWrapper) {
AdvancedMachineRecipe tempRecipe = ((AdvancedMachineRecipeWrapper) recipeWrapper).getRecipe();
AdvancedMachineInput input = (AdvancedMachineInput) tempRecipe.recipeInput;
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
itemStacks.init(0, true, 27, 0);
itemStacks.init(1, false, 87, 18);
itemStacks.init(2, false, 27, 36);
itemStacks.set(0, input.itemStack);
itemStacks.set(1, ((ItemStackOutput) tempRecipe.recipeOutput).output);
itemStacks.set(2, ((AdvancedMachineRecipeWrapper) recipeWrapper).getFuelStacks(input.gasType));
IGuiIngredientGroup<GasStack> gasStacks = recipeLayout.getIngredientsGroup(MekanismJEI.TYPE_GAS);
initGas(gasStacks, 0, true, 33, 21, 6, 12,
new GasStack(input.gasType, TileEntityAdvancedElectricMachine.BASE_TICKS_REQUIRED
* TileEntityAdvancedElectricMachine.BASE_GAS_PER_TICK), false);
}
AdvancedMachineRecipe tempRecipe = ((AdvancedMachineRecipeWrapper) recipeWrapper).getRecipe();
AdvancedMachineInput input = (AdvancedMachineInput) tempRecipe.recipeInput;
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
itemStacks.init(0, true, 27, 0);
itemStacks.init(1, false, 87, 18);
itemStacks.init(2, false, 27, 36);
itemStacks.set(0, input.itemStack);
itemStacks.set(1, ((ItemStackOutput) tempRecipe.recipeOutput).output);
itemStacks.set(2, ((AdvancedMachineRecipeWrapper) recipeWrapper).getFuelStacks(input.gasType));
IGuiIngredientGroup<GasStack> gasStacks = recipeLayout.getIngredientsGroup(MekanismJEI.TYPE_GAS);
initGas(gasStacks, 0, true, 33, 21, 6, 12,
new GasStack(input.gasType, TileEntityAdvancedElectricMachine.BASE_TICKS_REQUIRED
* TileEntityAdvancedElectricMachine.BASE_GAS_PER_TICK), false);
}
}
}
@@ -38,4 +38,4 @@ public class AdvancedMachineRecipeWrapper implements IRecipeWrapper {
public AdvancedMachineRecipe getRecipe() {
return recipe;
}
}
}
@@ -12,15 +12,12 @@ import mekanism.client.jei.BaseRecipeCategory;
import mekanism.common.recipe.inputs.ItemStackInput;
import mekanism.common.recipe.machines.ChanceMachineRecipe;
import mekanism.common.recipe.outputs.ChanceOutput;
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.IGuiItemStackGroup;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.util.ResourceLocation;
public class ChanceMachineRecipeCategory extends BaseRecipeCategory {
@@ -28,34 +25,26 @@ public class ChanceMachineRecipeCategory extends BaseRecipeCategory {
public ChanceMachineRecipeCategory(IGuiHelper helper, String name, String unlocalized, ProgressBar progress) {
super(helper, "mekanism:gui/GuiBasicMachine.png", name, unlocalized, progress);
background = guiHelper.createDrawable(new ResourceLocation(guiTexture), 28, 16, 144, 54);
background = guiHelper.createDrawable(guiLocation, 28, 16, 144, 54);
}
@Override
public void addGuiElements() {
guiElements
.add(new GuiSlot(SlotType.INPUT, this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 55,
16));
guiElements
.add(new GuiSlot(SlotType.POWER, this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 55,
52).with(SlotOverlay.POWER));
guiElements
.add(new GuiSlot(SlotType.OUTPUT_WIDE, this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()),
111, 30));
guiElements.add(new GuiSlot(SlotType.INPUT, this, guiLocation, 55, 16));
guiElements.add(new GuiSlot(SlotType.POWER, this, guiLocation, 55, 52).with(SlotOverlay.POWER));
guiElements.add(new GuiSlot(SlotType.OUTPUT_WIDE, this, guiLocation, 111, 30));
guiElements.add(new GuiPowerBar(this, new IPowerInfoHandler() {
@Override
public double getLevel() {
return 1F;
}
}, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 164, 15));
}, guiLocation, 164, 15));
guiElements.add(new GuiProgress(new IProgressInfoHandler() {
@Override
public double getProgress() {
return (double) timer.getValue() / 20F;
}
}, progressBar, this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 77, 37));
}, progressBar, this, guiLocation, 77, 37));
}
@Override
@@ -65,28 +54,20 @@ public class ChanceMachineRecipeCategory extends BaseRecipeCategory {
@Override
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients) {
if (!(recipeWrapper instanceof ChanceMachineRecipeWrapper)) {
return;
}
ChanceMachineRecipe tempRecipe = ((ChanceMachineRecipeWrapper) recipeWrapper).getRecipe();
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
itemStacks.init(0, true, 27, 0);
itemStacks.init(1, false, 87, 18);
itemStacks.init(2, false, 103, 18);
itemStacks.set(0, ((ItemStackInput) tempRecipe.recipeInput).ingredient);
ChanceOutput output = (ChanceOutput) tempRecipe.getOutput();
if (output.hasPrimary()) {
itemStacks.set(1, output.primaryOutput);
}
if (output.hasSecondary()) {
itemStacks.set(2, output.secondaryOutput);
if (recipeWrapper instanceof ChanceMachineRecipeWrapper) {
ChanceMachineRecipe tempRecipe = ((ChanceMachineRecipeWrapper) recipeWrapper).getRecipe();
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
itemStacks.init(0, true, 27, 0);
itemStacks.init(1, false, 87, 18);
itemStacks.init(2, false, 103, 18);
itemStacks.set(0, ((ItemStackInput) tempRecipe.recipeInput).ingredient);
ChanceOutput output = (ChanceOutput) tempRecipe.getOutput();
if (output.hasPrimary()) {
itemStacks.set(1, output.primaryOutput);
}
if (output.hasSecondary()) {
itemStacks.set(2, output.secondaryOutput);
}
}
}
}
}
@@ -29,7 +29,6 @@ public class ChanceMachineRecipeWrapper implements IRecipeWrapper {
@Override
public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) {
ChanceOutput output = (ChanceOutput) recipe.getOutput();
if (output.hasSecondary()) {
FontRenderer fontRendererObj = minecraft.fontRenderer;
fontRendererObj.drawString(Math.round(output.secondaryChance * 100) + "%", 104, 41, 0x404040, false);
@@ -39,4 +38,4 @@ public class ChanceMachineRecipeWrapper implements IRecipeWrapper {
public ChanceMachineRecipe getRecipe() {
return recipe;
}
}
}
@@ -12,15 +12,12 @@ import mekanism.client.jei.BaseRecipeCategory;
import mekanism.common.recipe.inputs.DoubleMachineInput;
import mekanism.common.recipe.machines.DoubleMachineRecipe;
import mekanism.common.recipe.outputs.ItemStackOutput;
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.IGuiItemStackGroup;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.util.ResourceLocation;
public class DoubleMachineRecipeCategory extends BaseRecipeCategory {
@@ -28,37 +25,27 @@ public class DoubleMachineRecipeCategory extends BaseRecipeCategory {
public DoubleMachineRecipeCategory(IGuiHelper helper, String name, String unlocalized, ProgressBar progress) {
super(helper, "mekanism:gui/guibasicmachine.png", name, unlocalized, progress);
background = guiHelper.createDrawable(new ResourceLocation(guiTexture), 28, 16, 144, 54);
background = guiHelper.createDrawable(guiLocation, 28, 16, 144, 54);
}
@Override
public void addGuiElements() {
guiElements
.add(new GuiSlot(SlotType.INPUT, this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 55,
16));
guiElements
.add(new GuiSlot(SlotType.POWER, this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 30,
34).with(SlotOverlay.POWER));
guiElements
.add(new GuiSlot(SlotType.EXTRA, this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 55,
52));
guiElements
.add(new GuiSlot(SlotType.OUTPUT_LARGE, this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()),
111, 30));
guiElements.add(new GuiSlot(SlotType.INPUT, this, guiLocation, 55, 16));
guiElements.add(new GuiSlot(SlotType.POWER, this, guiLocation, 30, 34).with(SlotOverlay.POWER));
guiElements.add(new GuiSlot(SlotType.EXTRA, this, guiLocation, 55, 52));
guiElements.add(new GuiSlot(SlotType.OUTPUT_LARGE, this, guiLocation, 111, 30));
guiElements.add(new GuiPowerBar(this, new IPowerInfoHandler() {
@Override
public double getLevel() {
return 1F;
}
}, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 164, 15));
}, guiLocation, 164, 15));
guiElements.add(new GuiProgress(new IProgressInfoHandler() {
@Override
public double getProgress() {
return (double) timer.getValue() / 20F;
}
}, progressBar, this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 77, 37));
}, progressBar, this, guiLocation, 77, 37));
}
@Override
@@ -68,22 +55,16 @@ public class DoubleMachineRecipeCategory extends BaseRecipeCategory {
@Override
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients) {
if (!(recipeWrapper instanceof DoubleMachineRecipeWrapper)) {
return;
if (recipeWrapper instanceof DoubleMachineRecipeWrapper) {
DoubleMachineRecipe tempRecipe = ((DoubleMachineRecipeWrapper) recipeWrapper).getRecipe();
DoubleMachineInput input = (DoubleMachineInput) tempRecipe.recipeInput;
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
itemStacks.init(0, true, 27, 0);
itemStacks.init(1, false, 87, 18);
itemStacks.init(2, false, 27, 36);
itemStacks.set(0, input.itemStack);
itemStacks.set(1, ((ItemStackOutput) tempRecipe.recipeOutput).output);
itemStacks.set(2, input.extraStack);
}
DoubleMachineRecipe tempRecipe = ((DoubleMachineRecipeWrapper) recipeWrapper).getRecipe();
DoubleMachineInput input = (DoubleMachineInput) tempRecipe.recipeInput;
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
itemStacks.init(0, true, 27, 0);
itemStacks.init(1, false, 87, 18);
itemStacks.init(2, false, 27, 36);
itemStacks.set(0, input.itemStack);
itemStacks.set(1, ((ItemStackOutput) tempRecipe.recipeOutput).output);
itemStacks.set(2, input.extraStack);
}
}
}
@@ -26,4 +26,4 @@ public class DoubleMachineRecipeWrapper implements IRecipeWrapper {
public DoubleMachineRecipe getRecipe() {
return recipe;
}
}
}
@@ -9,16 +9,12 @@ 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.BasicMachineRecipe;
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.IGuiItemStackGroup;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.util.ResourceLocation;
public class MachineRecipeCategory extends BaseRecipeCategory {
@@ -26,34 +22,26 @@ public class MachineRecipeCategory extends BaseRecipeCategory {
public MachineRecipeCategory(IGuiHelper helper, String name, String unlocalized, ProgressBar progress) {
super(helper, "mekanism:gui/GuiBasicMachine.png", name, unlocalized, progress);
background = guiHelper.createDrawable(new ResourceLocation(guiTexture), 28, 16, 144, 54);
background = guiHelper.createDrawable(guiLocation, 28, 16, 144, 54);
}
@Override
public void addGuiElements() {
guiElements
.add(new GuiSlot(SlotType.INPUT, this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 55,
16));
guiElements
.add(new GuiSlot(SlotType.POWER, this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 55,
52).with(SlotOverlay.POWER));
guiElements
.add(new GuiSlot(SlotType.OUTPUT_LARGE, this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()),
111, 30));
guiElements.add(new GuiSlot(SlotType.INPUT, this, guiLocation, 55, 16));
guiElements.add(new GuiSlot(SlotType.POWER, this, guiLocation, 55, 52).with(SlotOverlay.POWER));
guiElements.add(new GuiSlot(SlotType.OUTPUT_LARGE, this, guiLocation, 111, 30));
guiElements.add(new GuiPowerBar(this, new IPowerInfoHandler() {
@Override
public double getLevel() {
return 1F;
}
}, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 164, 15));
}, guiLocation, 164, 15));
guiElements.add(new GuiProgress(new IProgressInfoHandler() {
@Override
public double getProgress() {
return (double) timer.getValue() / 20F;
}
}, progressBar, this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 77, 37));
}, progressBar, this, guiLocation, 77, 37));
}
@Override
@@ -63,17 +51,11 @@ public class MachineRecipeCategory extends BaseRecipeCategory {
@Override
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients) {
if (!(recipeWrapper instanceof MachineRecipeWrapper)) {
return;
if (recipeWrapper instanceof MachineRecipeWrapper) {
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
itemStacks.init(0, true, 27, 0);
itemStacks.init(1, false, 87, 18);
itemStacks.set(ingredients);
}
BasicMachineRecipe tempRecipe = ((MachineRecipeWrapper) recipeWrapper).getRecipe();
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
itemStacks.init(0, true, 27, 0);
itemStacks.init(1, false, 87, 18);
itemStacks.set(ingredients);
}
}
}
@@ -24,4 +24,4 @@ public class MachineRecipeWrapper implements IRecipeWrapper {
public BasicMachineRecipe getRecipe() {
return recipe;
}
}
}
@@ -12,7 +12,6 @@ import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
import net.minecraft.util.ResourceLocation;
public class ChemicalCrystallizerRecipeCategory extends BaseRecipeCategory {
@@ -21,19 +20,15 @@ public class ChemicalCrystallizerRecipeCategory extends BaseRecipeCategory {
public ChemicalCrystallizerRecipeCategory(IGuiHelper helper) {
super(helper, "mekanism:gui/nei/GuiChemicalCrystallizer.png", "chemical_crystallizer",
"tile.MachineBlock2.ChemicalCrystallizer.name", null);
xOffset = 5;
yOffset = 3;
background = guiHelper.createDrawable(new ResourceLocation(guiTexture), xOffset, yOffset, 147, 79);
background = guiHelper.createDrawable(guiLocation, xOffset, yOffset, 147, 79);
}
@Override
public void drawExtras(Minecraft minecraft) {
super.drawExtras(minecraft);
float f = (float) timer.getValue() / 20F;
drawTexturedRect(53 - xOffset, 61 - yOffset, 176, 63, (int) (48 * f), 8);
drawTexturedRect(53 - xOffset, 61 - yOffset, 176, 63, (int) (48 * ((float) timer.getValue() / 20F)), 8);
}
@Override
@@ -43,19 +38,13 @@ public class ChemicalCrystallizerRecipeCategory extends BaseRecipeCategory {
@Override
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients) {
if (!(recipeWrapper instanceof ChemicalCrystallizerRecipeWrapper)) {
return;
if (recipeWrapper instanceof ChemicalCrystallizerRecipeWrapper) {
CrystallizerRecipe tempRecipe = ((ChemicalCrystallizerRecipeWrapper) recipeWrapper).getRecipe();
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
itemStacks.init(0, false, 130 - xOffset, 56 - yOffset);
itemStacks.set(0, tempRecipe.getOutput().output);
IGuiIngredientGroup<GasStack> gasStacks = recipeLayout.getIngredientsGroup(MekanismJEI.TYPE_GAS);
initGas(gasStacks, 0, true, 6 - xOffset, 5 - yOffset, 16, 58, tempRecipe.getInput().ingredient, true);
}
CrystallizerRecipe tempRecipe = ((ChemicalCrystallizerRecipeWrapper) recipeWrapper).getRecipe();
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
itemStacks.init(0, false, 130 - xOffset, 56 - yOffset);
itemStacks.set(0, tempRecipe.getOutput().output);
IGuiIngredientGroup<GasStack> gasStacks = recipeLayout.getIngredientsGroup(MekanismJEI.TYPE_GAS);
initGas(gasStacks, 0, true, 6 - xOffset, 5 - yOffset, 16, 58, tempRecipe.getInput().ingredient, true);
}
}
}
@@ -23,4 +23,4 @@ public class ChemicalCrystallizerRecipeWrapper implements IRecipeWrapper {
public CrystallizerRecipe getRecipe() {
return recipe;
}
}
}
@@ -14,7 +14,6 @@ import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
import net.minecraft.util.ResourceLocation;
public class ChemicalDissolutionChamberRecipeCategory extends BaseRecipeCategory {
@@ -23,19 +22,15 @@ public class ChemicalDissolutionChamberRecipeCategory extends BaseRecipeCategory
public ChemicalDissolutionChamberRecipeCategory(IGuiHelper helper) {
super(helper, "mekanism:gui/nei/GuiChemicalDissolutionChamber.png", "chemical_dissolution_chamber",
"gui.chemicalDissolutionChamber.short", null);
xOffset = 3;
yOffset = 3;
background = guiHelper.createDrawable(new ResourceLocation(guiTexture), xOffset, yOffset, 170, 79);
background = guiHelper.createDrawable(guiLocation, xOffset, yOffset, 170, 79);
}
@Override
public void drawExtras(Minecraft minecraft) {
super.drawExtras(minecraft);
float f = (float) timer.getValue() / 20F;
drawTexturedRect(64 - xOffset, 40 - yOffset, 176, 63, (int) (48 * f), 8);
drawTexturedRect(64 - xOffset, 40 - yOffset, 176, 63, (int) (48 * ((float) timer.getValue() / 20F)), 8);
}
@Override
@@ -45,23 +40,17 @@ public class ChemicalDissolutionChamberRecipeCategory extends BaseRecipeCategory
@Override
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients) {
if (!(recipeWrapper instanceof ChemicalDissolutionChamberRecipeWrapper)) {
return;
if (recipeWrapper instanceof ChemicalDissolutionChamberRecipeWrapper) {
DissolutionRecipe tempRecipe = ((ChemicalDissolutionChamberRecipeWrapper) recipeWrapper).getRecipe();
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
itemStacks.init(0, true, 25 - xOffset, 35 - yOffset);
itemStacks.set(0, tempRecipe.getInput().ingredient);
IGuiIngredientGroup<GasStack> gasStacks = recipeLayout.getIngredientsGroup(MekanismJEI.TYPE_GAS);
initGas(gasStacks, 0, true, 6 - xOffset, 5 - yOffset, 16, 58,
new GasStack(MekanismFluids.SulfuricAcid, TileEntityChemicalDissolutionChamber.BASE_INJECT_USAGE
* TileEntityChemicalDissolutionChamber.BASE_TICKS_REQUIRED),
true);
initGas(gasStacks, 1, false, 134 - xOffset, 14 - yOffset, 16, 58, tempRecipe.getOutput().output, true);
}
DissolutionRecipe tempRecipe = ((ChemicalDissolutionChamberRecipeWrapper) recipeWrapper).getRecipe();
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
itemStacks.init(0, true, 25 - xOffset, 35 - yOffset);
itemStacks.set(0, tempRecipe.getInput().ingredient);
IGuiIngredientGroup<GasStack> gasStacks = recipeLayout.getIngredientsGroup(MekanismJEI.TYPE_GAS);
initGas(gasStacks, 0, true, 6 - xOffset, 5 - yOffset, 16, 58,
new GasStack(MekanismFluids.SulfuricAcid, TileEntityChemicalDissolutionChamber.BASE_INJECT_USAGE
* TileEntityChemicalDissolutionChamber.BASE_TICKS_REQUIRED),
true);
initGas(gasStacks, 1, false, 134 - xOffset, 14 - yOffset, 16, 58, tempRecipe.getOutput().output, true);
}
}
}
@@ -29,4 +29,4 @@ public class ChemicalDissolutionChamberRecipeWrapper implements IRecipeWrapper {
public DissolutionRecipe getRecipe() {
return recipe;
}
}
}
@@ -11,7 +11,6 @@ import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
import net.minecraft.util.ResourceLocation;
public class ChemicalInfuserRecipeCategory extends BaseRecipeCategory {
@@ -20,17 +19,14 @@ public class ChemicalInfuserRecipeCategory extends BaseRecipeCategory {
public ChemicalInfuserRecipeCategory(IGuiHelper helper) {
super(helper, "mekanism:gui/nei/GuiChemicalInfuser.png", "chemical_infuser",
"tile.MachineBlock2.ChemicalInfuser.name", null);
xOffset = 3;
yOffset = 3;
background = guiHelper.createDrawable(new ResourceLocation(guiTexture), xOffset, yOffset, 170, 80);
background = guiHelper.createDrawable(guiLocation, xOffset, yOffset, 170, 80);
}
@Override
public void drawExtras(Minecraft minecraft) {
super.drawExtras(minecraft);
drawTexturedRect(47 - xOffset, 39 - yOffset, 176, 71, 28, 8);
drawTexturedRect(101 - xOffset, 39 - yOffset, 176, 63, 28, 8);
}
@@ -42,16 +38,12 @@ public class ChemicalInfuserRecipeCategory extends BaseRecipeCategory {
@Override
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients) {
if (!(recipeWrapper instanceof ChemicalInfuserRecipeWrapper)) {
return;
if (recipeWrapper instanceof ChemicalInfuserRecipeWrapper) {
ChemicalInfuserRecipe tempRecipe = ((ChemicalInfuserRecipeWrapper) recipeWrapper).getRecipe();
IGuiIngredientGroup<GasStack> gasStacks = recipeLayout.getIngredientsGroup(MekanismJEI.TYPE_GAS);
initGas(gasStacks, 0, true, 26 - xOffset, 14 - yOffset, 16, 58, tempRecipe.getInput().leftGas, true);
initGas(gasStacks, 1, true, 134 - xOffset, 14 - yOffset, 16, 58, tempRecipe.getInput().rightGas, true);
initGas(gasStacks, 2, false, 80 - xOffset, 5 - yOffset, 16, 58, tempRecipe.getOutput().output, true);return;
}
ChemicalInfuserRecipe tempRecipe = ((ChemicalInfuserRecipeWrapper) recipeWrapper).getRecipe();
IGuiIngredientGroup<GasStack> gasStacks = recipeLayout.getIngredientsGroup(MekanismJEI.TYPE_GAS);
initGas(gasStacks, 0, true, 26 - xOffset, 14 - yOffset, 16, 58, tempRecipe.getInput().leftGas, true);
initGas(gasStacks, 1, true, 134 - xOffset, 14 - yOffset, 16, 58, tempRecipe.getInput().rightGas, true);
initGas(gasStacks, 2, false, 80 - xOffset, 5 - yOffset, 16, 58, tempRecipe.getOutput().output, true);
}
}
@@ -23,4 +23,4 @@ public class ChemicalInfuserRecipeWrapper implements IRecipeWrapper {
public ChemicalInfuserRecipe getRecipe() {
return recipe;
}
}
}
@@ -11,8 +11,6 @@ import mekanism.client.gui.element.GuiSlot.SlotType;
import mekanism.client.jei.BaseRecipeCategory;
import mekanism.client.jei.MekanismJEI;
import mekanism.common.recipe.machines.OxidationRecipe;
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.IGuiIngredientGroup;
@@ -20,7 +18,6 @@ import mezz.jei.api.gui.IGuiItemStackGroup;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.util.ResourceLocation;
public class ChemicalOxidizerRecipeCategory extends BaseRecipeCategory {
@@ -29,27 +26,21 @@ public class ChemicalOxidizerRecipeCategory extends BaseRecipeCategory {
public ChemicalOxidizerRecipeCategory(IGuiHelper helper) {
super(helper, "mekanism:gui/GuiChemicalOxidizer.png", "chemical_oxidizer",
"tile.MachineBlock2.ChemicalOxidizer.name", ProgressBar.LARGE_RIGHT);
xOffset = 20;
yOffset = 12;
background = guiHelper.createDrawable(new ResourceLocation(guiTexture), xOffset, yOffset, 132, 62);
background = guiHelper.createDrawable(guiLocation, xOffset, yOffset, 132, 62);
}
@Override
public void addGuiElements() {
guiElements.add(GuiGasGauge.getDummy(GuiGauge.Type.STANDARD, this,
MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalOxidizer.png"), 133, 13));
guiElements.add(new GuiSlot(SlotType.NORMAL, this,
MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalOxidizer.png"), 25, 35));
guiElements.add(GuiGasGauge.getDummy(GuiGauge.Type.STANDARD, this, guiLocation, 133, 13));
guiElements.add(new GuiSlot(SlotType.NORMAL, this, guiLocation, 25, 35));
guiElements.add(new GuiProgress(new IProgressInfoHandler() {
@Override
public double getProgress() {
return (double) timer.getValue() / 20F;
}
}, progressBar, this, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalOxidizer.png"), 62, 39));
}, progressBar, this, guiLocation, 62, 39));
}
@Override
@@ -59,19 +50,13 @@ public class ChemicalOxidizerRecipeCategory extends BaseRecipeCategory {
@Override
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients) {
if (!(recipeWrapper instanceof ChemicalOxidizerRecipeWrapper)) {
return;
if (recipeWrapper instanceof ChemicalOxidizerRecipeWrapper) {
OxidationRecipe tempRecipe = ((ChemicalOxidizerRecipeWrapper) recipeWrapper).getRecipe();
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
itemStacks.init(0, true, 25 - xOffset, 35 - yOffset);
itemStacks.set(0, tempRecipe.getInput().ingredient);
IGuiIngredientGroup<GasStack> gasStacks = recipeLayout.getIngredientsGroup(MekanismJEI.TYPE_GAS);
initGas(gasStacks, 0, false, 134 - xOffset, 14 - yOffset, 16, 58, tempRecipe.recipeOutput.output, true);
}
OxidationRecipe tempRecipe = ((ChemicalOxidizerRecipeWrapper) recipeWrapper).getRecipe();
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
itemStacks.init(0, true, 25 - xOffset, 35 - yOffset);
itemStacks.set(0, tempRecipe.getInput().ingredient);
IGuiIngredientGroup<GasStack> gasStacks = recipeLayout.getIngredientsGroup(MekanismJEI.TYPE_GAS);
initGas(gasStacks, 0, false, 134 - xOffset, 14 - yOffset, 16, 58, tempRecipe.recipeOutput.output, true);
}
}
}
@@ -23,4 +23,4 @@ public class ChemicalOxidizerRecipeWrapper implements IRecipeWrapper {
public OxidationRecipe getRecipe() {
return recipe;
}
}
}
@@ -14,7 +14,6 @@ import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.ingredients.VanillaTypes;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
import net.minecraft.util.ResourceLocation;
public class ChemicalWasherRecipeCategory extends BaseRecipeCategory {
@@ -23,17 +22,14 @@ public class ChemicalWasherRecipeCategory extends BaseRecipeCategory {
public ChemicalWasherRecipeCategory(IGuiHelper helper) {
super(helper, "mekanism:gui/nei/GuiChemicalWasher.png", "chemical_washer",
"tile.MachineBlock2.ChemicalWasher.name", null);
xOffset = 3;
yOffset = 3;
background = guiHelper.createDrawable(new ResourceLocation(guiTexture), xOffset, yOffset, 170, 70);
background = guiHelper.createDrawable(guiLocation, xOffset, yOffset, 170, 70);
}
@Override
public void drawExtras(Minecraft minecraft) {
super.drawExtras(minecraft);
drawTexturedRect(61 - xOffset, 39 - yOffset, 176, 63, 55, 8);
}
@@ -44,21 +40,15 @@ public class ChemicalWasherRecipeCategory extends BaseRecipeCategory {
@Override
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients) {
if (!(recipeWrapper instanceof ChemicalWasherRecipeWrapper)) {
return;
if (recipeWrapper instanceof ChemicalWasherRecipeWrapper) {
WasherRecipe tempRecipe = ((ChemicalWasherRecipeWrapper) recipeWrapper).getRecipe();
IGuiFluidStackGroup fluidStacks = recipeLayout.getFluidStacks();
fluidStacks.init(0, true, 6 - xOffset, 5 - yOffset, 16, 58, TileEntityChemicalWasher.WATER_USAGE, false,
fluidOverlayLarge);
fluidStacks.set(0, ingredients.getInputs(VanillaTypes.FLUID).get(0));
IGuiIngredientGroup<GasStack> gasStacks = recipeLayout.getIngredientsGroup(MekanismJEI.TYPE_GAS);
initGas(gasStacks, 0, true, 27 - xOffset, 14 - yOffset, 16, 58, tempRecipe.getInput().ingredient, true);
initGas(gasStacks, 1, false, 134 - xOffset, 14 - yOffset, 16, 58, tempRecipe.getOutput().output, true);
}
WasherRecipe tempRecipe = ((ChemicalWasherRecipeWrapper) recipeWrapper).getRecipe();
IGuiFluidStackGroup fluidStacks = recipeLayout.getFluidStacks();
fluidStacks.init(0, true, 6 - xOffset, 5 - yOffset, 16, 58, TileEntityChemicalWasher.WATER_USAGE, false,
fluidOverlayLarge);
fluidStacks.set(0, ingredients.getInputs(VanillaTypes.FLUID).get(0));
IGuiIngredientGroup<GasStack> gasStacks = recipeLayout.getIngredientsGroup(MekanismJEI.TYPE_GAS);
initGas(gasStacks, 0, true, 27 - xOffset, 14 - yOffset, 16, 58, tempRecipe.getInput().ingredient, true);
initGas(gasStacks, 1, false, 134 - xOffset, 14 - yOffset, 16, 58, tempRecipe.getOutput().output, true);
}
}
}
@@ -27,4 +27,4 @@ public class ChemicalWasherRecipeWrapper implements IRecipeWrapper {
public WasherRecipe getRecipe() {
return recipe;
}
}
}
@@ -15,8 +15,6 @@ import mekanism.client.gui.element.GuiSlot.SlotType;
import mekanism.client.jei.BaseRecipeCategory;
import mekanism.client.jei.MekanismJEI;
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;
@@ -25,7 +23,6 @@ import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.ingredients.VanillaTypes;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.util.ResourceLocation;
public class ElectrolyticSeparatorRecipeCategory extends BaseRecipeCategory {
@@ -38,40 +35,30 @@ public class ElectrolyticSeparatorRecipeCategory extends BaseRecipeCategory {
xOffset = 4;
yOffset = 9;
background = guiHelper.createDrawable(new ResourceLocation(guiTexture), xOffset, yOffset, 167, 62);
background = guiHelper.createDrawable(guiLocation, xOffset, yOffset, 167, 62);
}
@Override
public void addGuiElements() {
guiElements.add(GuiFluidGauge.getDummy(GuiGauge.Type.STANDARD, this,
MekanismUtils.getResource(ResourceType.GUI, "GuiElectrolyticSeparator.png"), 5, 10));
guiElements.add(GuiGasGauge.getDummy(GuiGauge.Type.SMALL, this,
MekanismUtils.getResource(ResourceType.GUI, "GuiElectrolyticSeparator.png"), 58, 18));
guiElements.add(GuiGasGauge.getDummy(GuiGauge.Type.SMALL, this,
MekanismUtils.getResource(ResourceType.GUI, "GuiElectrolyticSeparator.png"), 100, 18));
guiElements.add(GuiFluidGauge.getDummy(GuiGauge.Type.STANDARD, this, guiLocation, 5, 10));
guiElements.add(GuiGasGauge.getDummy(GuiGauge.Type.SMALL, this, guiLocation, 58, 18));
guiElements.add(GuiGasGauge.getDummy(GuiGauge.Type.SMALL, this, guiLocation, 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));
}, guiLocation, 164, 15));
guiElements.add(new GuiSlot(SlotType.NORMAL, this, guiLocation, 25, 34));
guiElements.add(new GuiSlot(SlotType.NORMAL, this, guiLocation, 58, 51));
guiElements.add(new GuiSlot(SlotType.NORMAL, this, guiLocation, 100, 51));
guiElements.add(new GuiSlot(SlotType.NORMAL, this, guiLocation, 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));
}, progressBar, this, guiLocation, 78, 29));
}
@Override
@@ -81,20 +68,14 @@ public class ElectrolyticSeparatorRecipeCategory extends BaseRecipeCategory {
@Override
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients) {
if (!(recipeWrapper instanceof ElectrolyticSeparatorRecipeWrapper)) {
return;
if (recipeWrapper instanceof ElectrolyticSeparatorRecipeWrapper) {
SeparatorRecipe tempRecipe = ((ElectrolyticSeparatorRecipeWrapper) recipeWrapper).getRecipe();
IGuiFluidStackGroup fluidStacks = recipeLayout.getFluidStacks();
fluidStacks.init(0, true, 2, 2, 16, 58, tempRecipe.getInput().ingredient.amount, false, fluidOverlayLarge);
fluidStacks.set(0, ingredients.getInputs(VanillaTypes.FLUID).get(0));
IGuiIngredientGroup<GasStack> gasStacks = recipeLayout.getIngredientsGroup(MekanismJEI.TYPE_GAS);
initGas(gasStacks, 0, false, 59 - xOffset, 19 - yOffset, 16, 28, tempRecipe.recipeOutput.leftGas, true);
initGas(gasStacks, 1, false, 101 - xOffset, 19 - yOffset, 16, 28, tempRecipe.recipeOutput.rightGas, true);
}
SeparatorRecipe tempRecipe = ((ElectrolyticSeparatorRecipeWrapper) recipeWrapper).getRecipe();
IGuiFluidStackGroup fluidStacks = recipeLayout.getFluidStacks();
fluidStacks.init(0, true, 2, 2, 16, 58, tempRecipe.getInput().ingredient.amount, false, fluidOverlayLarge);
fluidStacks.set(0, ingredients.getInputs(VanillaTypes.FLUID).get(0));
IGuiIngredientGroup<GasStack> gasStacks = recipeLayout.getIngredientsGroup(MekanismJEI.TYPE_GAS);
initGas(gasStacks, 0, false, 59 - xOffset, 19 - yOffset, 16, 28, tempRecipe.recipeOutput.leftGas, true);
initGas(gasStacks, 1, false, 101 - xOffset, 19 - yOffset, 16, 28, tempRecipe.recipeOutput.rightGas, true);
}
}
}
@@ -25,4 +25,4 @@ public class ElectrolyticSeparatorRecipeWrapper implements IRecipeWrapper {
public SeparatorRecipe getRecipe() {
return recipe;
}
}
}
@@ -1,9 +1,8 @@
package mekanism.client.jei.machine.other;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import mekanism.api.infuse.InfuseObject;
import java.util.Map.Entry;
import java.util.stream.Collectors;
import mekanism.api.infuse.InfuseRegistry;
import mekanism.api.infuse.InfuseType;
import mekanism.client.gui.element.GuiPowerBar;
@@ -16,8 +15,6 @@ import mekanism.client.gui.element.GuiSlot.SlotOverlay;
import mekanism.client.gui.element.GuiSlot.SlotType;
import mekanism.client.jei.BaseRecipeCategory;
import mekanism.common.recipe.machines.MetallurgicInfuserRecipe;
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.IGuiItemStackGroup;
@@ -25,7 +22,6 @@ import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
public class MetallurgicInfuserRecipeCategory extends BaseRecipeCategory {
@@ -34,52 +30,34 @@ public class MetallurgicInfuserRecipeCategory extends BaseRecipeCategory {
public MetallurgicInfuserRecipeCategory(IGuiHelper helper) {
super(helper, "mekanism:gui/GuiMetallurgicInfuser.png", "metallurgic_infuser",
"tile.MachineBlock.MetallurgicInfuser.name", ProgressBar.MEDIUM);
xOffset = 5;
yOffset = 16;
background = guiHelper.createDrawable(new ResourceLocation(guiTexture), xOffset, yOffset, 166, 54);
background = guiHelper.createDrawable(guiLocation, xOffset, yOffset, 166, 54);
}
public static List<ItemStack> getInfuseStacks(InfuseType type) {
List<ItemStack> ret = new ArrayList<>();
for (Map.Entry<ItemStack, InfuseObject> obj : InfuseRegistry.getObjectMap().entrySet()) {
if (obj.getValue().type == type) {
ret.add(obj.getKey());
}
}
return ret;
return InfuseRegistry.getObjectMap().entrySet().stream()
.filter(obj -> obj.getValue().type == type).map(Entry::getKey).collect(Collectors.toList());
}
@Override
public void addGuiElements() {
guiElements
.add(new GuiSlot(SlotType.EXTRA, this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 16,
34));
guiElements
.add(new GuiSlot(SlotType.INPUT, this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 50,
42));
guiElements
.add(new GuiSlot(SlotType.POWER, this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 142,
34).with(SlotOverlay.POWER));
guiElements
.add(new GuiSlot(SlotType.OUTPUT, this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 108,
42));
guiElements.add(new GuiSlot(SlotType.EXTRA, this, guiLocation, 16, 34));
guiElements.add(new GuiSlot(SlotType.INPUT, this, guiLocation, 50, 42));
guiElements.add(new GuiSlot(SlotType.POWER, this, guiLocation, 142, 34).with(SlotOverlay.POWER));
guiElements.add(new GuiSlot(SlotType.OUTPUT, this, guiLocation, 108, 42));
guiElements.add(new GuiPowerBar(this, new IPowerInfoHandler() {
@Override
public double getLevel() {
return 1F;
}
}, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 164, 15));
}, guiLocation, 164, 15));
guiElements.add(new GuiProgress(new IProgressInfoHandler() {
@Override
public double getProgress() {
return (double) timer.getValue() / 20F;
}
}, ProgressBar.MEDIUM, this, MekanismUtils.getResource(ResourceType.GUI, stripTexture()), 70, 46));
}, ProgressBar.MEDIUM, this, guiLocation, 70, 46));
}
@Override
@@ -89,20 +67,15 @@ public class MetallurgicInfuserRecipeCategory extends BaseRecipeCategory {
@Override
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients) {
if (!(recipeWrapper instanceof MetallurgicInfuserRecipeWrapper)) {
return;
if (recipeWrapper instanceof MetallurgicInfuserRecipeWrapper) {
MetallurgicInfuserRecipe tempRecipe = ((MetallurgicInfuserRecipeWrapper) recipeWrapper).getRecipe();
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
itemStacks.init(0, true, 45, 26);
itemStacks.init(1, false, 103, 26);
itemStacks.init(2, true, 11, 18);
itemStacks.set(0, tempRecipe.getInput().inputStack);
itemStacks.set(1, tempRecipe.getOutput().output);
itemStacks.set(2, getInfuseStacks(tempRecipe.getInput().infuse.type));
}
MetallurgicInfuserRecipe tempRecipe = ((MetallurgicInfuserRecipeWrapper) recipeWrapper).getRecipe();
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
itemStacks.init(0, true, 45, 26);
itemStacks.init(1, false, 103, 26);
itemStacks.init(2, true, 11, 18);
itemStacks.set(0, tempRecipe.getInput().inputStack);
itemStacks.set(1, tempRecipe.getOutput().output);
itemStacks.set(2, getInfuseStacks(tempRecipe.getInput().infuse.type));
}
}
}
@@ -24,7 +24,6 @@ public class MetallurgicInfuserRecipeWrapper implements IRecipeWrapper {
public void getIngredients(IIngredients ingredients) {
List<ItemStack> inputStacks = Collections.singletonList(recipe.recipeInput.inputStack);
List<ItemStack> infuseStacks = MetallurgicInfuserRecipeCategory.getInfuseStacks(recipe.getInput().infuse.type);
ingredients.setInput(VanillaTypes.ITEM, recipe.recipeInput.inputStack);
ingredients.setInputLists(VanillaTypes.ITEM, Arrays.asList(inputStacks, infuseStacks));
ingredients.setOutput(VanillaTypes.ITEM, recipe.recipeOutput.output);
@@ -23,7 +23,6 @@ import mezz.jei.api.gui.IGuiItemStackGroup;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.util.ResourceLocation;
public class PRCRecipeCategory extends BaseRecipeCategory {
@@ -32,11 +31,9 @@ public class PRCRecipeCategory extends BaseRecipeCategory {
public PRCRecipeCategory(IGuiHelper helper) {
super(helper, "mekanism:gui/nei/GuiPRC.png", "pressurized_reaction_chamber",
"tile.MachineBlock2.PressurizedReactionChamber.short.name", ProgressBar.MEDIUM);
xOffset = 3;
yOffset = 11;
background = guiHelper.createDrawable(new ResourceLocation(guiTexture), xOffset, yOffset, 170, 68);
background = guiHelper.createDrawable(guiLocation, xOffset, yOffset, 170, 68);
}
@Override
@@ -44,11 +41,9 @@ public class PRCRecipeCategory extends BaseRecipeCategory {
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(GuiGasGauge.getDummy(GuiGauge.Type.STANDARD_RED, this, guiLocation, 28, 10));
guiElements.add(GuiGasGauge.getDummy(GuiGauge.Type.SMALL_BLUE, this, guiLocation, 140, 40));
guiElements.add(new GuiPowerBar(this, new IPowerInfoHandler() {
@Override
public double getLevel() {
@@ -70,28 +65,19 @@ public class PRCRecipeCategory extends BaseRecipeCategory {
@Override
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients) {
if (!(recipeWrapper instanceof PRCRecipeWrapper)) {
return;
if (recipeWrapper instanceof PRCRecipeWrapper) {
PressurizedRecipe tempRecipe = ((PRCRecipeWrapper) recipeWrapper).getRecipe();
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
itemStacks.init(0, true, 53 - xOffset, 34 - yOffset);
itemStacks.init(1, false, 115 - xOffset, 34 - yOffset);
itemStacks.set(0, tempRecipe.recipeInput.getSolid());
itemStacks.set(1, tempRecipe.recipeOutput.getItemOutput());
IGuiFluidStackGroup fluidStacks = recipeLayout.getFluidStacks();
fluidStacks.init(0, true, 3, 0, 16, 58, tempRecipe.getInput().getFluid().amount, false, fluidOverlayLarge);
fluidStacks.set(0, tempRecipe.recipeInput.getFluid());
IGuiIngredientGroup<GasStack> gasStacks = recipeLayout.getIngredientsGroup(MekanismJEI.TYPE_GAS);
initGas(gasStacks, 0, true, 29 - xOffset, 11 - yOffset, 16, 58, tempRecipe.recipeInput.getGas(), true);
initGas(gasStacks, 1, false, 141 - xOffset, 41 - yOffset, 16, 28, tempRecipe.recipeOutput.getGasOutput(), true);
}
PressurizedRecipe tempRecipe = ((PRCRecipeWrapper) recipeWrapper).getRecipe();
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
itemStacks.init(0, true, 53 - xOffset, 34 - yOffset);
itemStacks.init(1, false, 115 - xOffset, 34 - yOffset);
itemStacks.set(0, tempRecipe.recipeInput.getSolid());
itemStacks.set(1, tempRecipe.recipeOutput.getItemOutput());
IGuiFluidStackGroup fluidStacks = recipeLayout.getFluidStacks();
fluidStacks.init(0, true, 3, 0, 16, 58, tempRecipe.getInput().getFluid().amount, false, fluidOverlayLarge);
fluidStacks.set(0, tempRecipe.recipeInput.getFluid());
IGuiIngredientGroup<GasStack> gasStacks = recipeLayout.getIngredientsGroup(MekanismJEI.TYPE_GAS);
initGas(gasStacks, 0, true, 29 - xOffset, 11 - yOffset, 16, 58, tempRecipe.recipeInput.getGas(), true);
initGas(gasStacks, 1, false, 141 - xOffset, 41 - yOffset, 16, 28, tempRecipe.recipeOutput.getGasOutput(), true);
}
}
}
@@ -26,4 +26,4 @@ public class PRCRecipeWrapper implements IRecipeWrapper {
public PressurizedRecipe getRecipe() {
return recipe;
}
}
}
@@ -13,7 +13,6 @@ import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.ingredients.VanillaTypes;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
import net.minecraft.util.ResourceLocation;
public class RotaryCondensentratorRecipeCategory extends BaseRecipeCategory {
@@ -24,29 +23,23 @@ public class RotaryCondensentratorRecipeCategory extends BaseRecipeCategory {
private RotaryCondensentratorRecipeWrapper tempRecipe;
public RotaryCondensentratorRecipeCategory(IGuiHelper helper, boolean condensentrating) {
super(helper,
"mekanism:gui/nei/GuiRotaryCondensentrator.png",
super(helper, "mekanism:gui/nei/GuiRotaryCondensentrator.png",
condensentrating ? "rotary_condensentrator_condensentrating"
: "rotary_condensentrator_decondensentrating",
condensentrating ? "gui.condensentrating" : "gui.decondensentrating",
null);
condensentrating ? "gui.condensentrating" : "gui.decondensentrating", null);
xOffset = 3;
yOffset = 12;
background = guiHelper.createDrawable(new ResourceLocation(guiTexture), xOffset, yOffset, 170, 71);
background = guiHelper.createDrawable(guiLocation, xOffset, yOffset, 170, 71);
this.condensentrating = condensentrating;
}
@Override
public void drawExtras(Minecraft minecraft) {
super.drawExtras(minecraft);
//TODO: Move this to the wrapper
if (tempRecipe == null) {
return;
}
if (condensentrating) {
drawTexturedRect(64 - xOffset, 39 - yOffset, 176, 123, 48, 8);
} else {
@@ -61,24 +54,22 @@ public class RotaryCondensentratorRecipeCategory extends BaseRecipeCategory {
@Override
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients) {
if (!(recipeWrapper instanceof RotaryCondensentratorRecipeWrapper)) {
return;
}
tempRecipe = (RotaryCondensentratorRecipeWrapper) recipeWrapper;
IGuiFluidStackGroup fluidStacks = recipeLayout.getFluidStacks();
IGuiIngredientGroup<GasStack> gasStacks = recipeLayout.getIngredientsGroup(MekanismJEI.TYPE_GAS);
fluidStacks.init(0, !tempRecipe.condensentrating, 134 - xOffset, 14 - yOffset, 16, 58, tempRecipe.fluidAmount, false,
fluidOverlayLarge);
if (tempRecipe.condensentrating) {
initGas(gasStacks, 0, true, 26 - xOffset, 14 - yOffset, 16, 58, new GasStack(tempRecipe.gasType, tempRecipe.gasAmount), true);
fluidStacks.set(0, ingredients.getOutputs(VanillaTypes.FLUID).get(0));
} else {
initGas(gasStacks, 0, false, 26 - xOffset, 14 - yOffset, 16, 58, new GasStack(tempRecipe.gasType, tempRecipe.gasAmount), true);
fluidStacks.set(0, ingredients.getInputs(VanillaTypes.FLUID).get(0));
if (recipeWrapper instanceof RotaryCondensentratorRecipeWrapper) {
tempRecipe = (RotaryCondensentratorRecipeWrapper) recipeWrapper;
IGuiFluidStackGroup fluidStacks = recipeLayout.getFluidStacks();
IGuiIngredientGroup<GasStack> gasStacks = recipeLayout.getIngredientsGroup(MekanismJEI.TYPE_GAS);
fluidStacks
.init(0, !tempRecipe.condensentrating, 134 - xOffset, 14 - yOffset, 16, 58, tempRecipe.fluidAmount,
false, fluidOverlayLarge);
if (tempRecipe.condensentrating) {
initGas(gasStacks, 0, true, 26 - xOffset, 14 - yOffset, 16, 58,
new GasStack(tempRecipe.gasType, tempRecipe.gasAmount), true);
fluidStacks.set(0, ingredients.getOutputs(VanillaTypes.FLUID).get(0));
} else {
initGas(gasStacks, 0, false, 26 - xOffset, 14 - yOffset, 16, 58,
new GasStack(tempRecipe.gasType, tempRecipe.gasAmount), true);
fluidStacks.set(0, ingredients.getInputs(VanillaTypes.FLUID).get(0));
}
}
}
}
}
@@ -18,13 +18,11 @@ public class RotaryCondensentratorRecipeWrapper implements IRecipeWrapper {
public Gas gasType;
public int gasAmount = 1;
public int fluidAmount = 1;
public boolean condensentrating;
public RotaryCondensentratorRecipeWrapper(Fluid fluid, Gas gas, boolean b) {
fluidType = fluid;
gasType = gas;
condensentrating = b;
}
@@ -44,4 +42,4 @@ public class RotaryCondensentratorRecipeWrapper implements IRecipeWrapper {
minecraft.fontRenderer.drawString(condensentrating ? LangUtils.localize("gui.condensentrating")
: LangUtils.localize("gui.decondensentrating"), 6 - 3, 74 - 12, 0x404040, false);
}
}
}
@@ -11,7 +11,6 @@ import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
import net.minecraft.util.ResourceLocation;
public class SolarNeutronRecipeCategory extends BaseRecipeCategory {
@@ -20,17 +19,14 @@ public class SolarNeutronRecipeCategory extends BaseRecipeCategory {
public SolarNeutronRecipeCategory(IGuiHelper helper) {
super(helper, "mekanism:gui/nei/GuiSolarNeutronActivator.png", "solar_neutron_activator",
"tile.MachineBlock3.SolarNeutronActivator.name", null);
xOffset = 3;
yOffset = 12;
background = guiHelper.createDrawable(new ResourceLocation(guiTexture), xOffset, yOffset, 170, 70);
background = guiHelper.createDrawable(guiLocation, xOffset, yOffset, 170, 70);
}
@Override
public void drawExtras(Minecraft minecraft) {
super.drawExtras(minecraft);
drawTexturedRect(64 - xOffset, 39 - yOffset, 176, 58, 55, 8);
}
@@ -41,15 +37,11 @@ public class SolarNeutronRecipeCategory extends BaseRecipeCategory {
@Override
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients) {
if (!(recipeWrapper instanceof SolarNeutronRecipeWrapper)) {
return;
if (recipeWrapper instanceof SolarNeutronRecipeWrapper) {
SolarNeutronRecipe tempRecipe = ((SolarNeutronRecipeWrapper) recipeWrapper).getRecipe();
IGuiIngredientGroup<GasStack> gasStacks = recipeLayout.getIngredientsGroup(MekanismJEI.TYPE_GAS);
initGas(gasStacks, 0, true, 26 - xOffset, 14 - yOffset, 16, 58, tempRecipe.recipeInput.ingredient, true);
initGas(gasStacks, 1, false, 134 - xOffset, 14 - yOffset, 16, 58, tempRecipe.recipeOutput.output, true);
}
SolarNeutronRecipe tempRecipe = ((SolarNeutronRecipeWrapper) recipeWrapper).getRecipe();
IGuiIngredientGroup<GasStack> gasStacks = recipeLayout.getIngredientsGroup(MekanismJEI.TYPE_GAS);
initGas(gasStacks, 0, true, 26 - xOffset, 14 - yOffset, 16, 58, tempRecipe.recipeInput.ingredient, true);
initGas(gasStacks, 1, false, 134 - xOffset, 14 - yOffset, 16, 58, tempRecipe.recipeOutput.output, true);
}
}
}
@@ -22,4 +22,4 @@ public class SolarNeutronRecipeWrapper implements IRecipeWrapper {
public SolarNeutronRecipe getRecipe() {
return recipe;
}
}
}
@@ -9,7 +9,6 @@ import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
import net.minecraft.util.ResourceLocation;
public class ThermalEvaporationRecipeCategory extends BaseRecipeCategory {
@@ -18,17 +17,14 @@ public class ThermalEvaporationRecipeCategory extends BaseRecipeCategory {
public ThermalEvaporationRecipeCategory(IGuiHelper helper) {
super(helper, "mekanism:gui/nei/GuiThermalEvaporationController.png", "thermal_evaporation_plant",
"gui.thermalEvaporationController.short", null);
xOffset = 3;
yOffset = 12;
background = guiHelper.createDrawable(new ResourceLocation(guiTexture), xOffset, yOffset, 170, 62);
background = guiHelper.createDrawable(guiLocation, xOffset, yOffset, 170, 62);
}
@Override
public void drawExtras(Minecraft minecraft) {
super.drawExtras(minecraft);
drawTexturedRect(49 - xOffset, 64 - yOffset, 176, 59, 78, 8);
}
@@ -39,20 +35,15 @@ public class ThermalEvaporationRecipeCategory extends BaseRecipeCategory {
@Override
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients) {
if (!(recipeWrapper instanceof ThermalEvaporationRecipeWrapper)) {
return;
if (recipeWrapper instanceof ThermalEvaporationRecipeWrapper) {
ThermalEvaporationRecipe tempRecipe = ((ThermalEvaporationRecipeWrapper) recipeWrapper).getRecipe();
IGuiFluidStackGroup fluidStacks = recipeLayout.getFluidStacks();
fluidStacks.init(0, true, 7 - xOffset, 14 - yOffset, 16, 58, tempRecipe.getInput().ingredient.amount, false,
fluidOverlayLarge);
fluidStacks.init(1, false, 153 - xOffset, 14 - yOffset, 16, 58, tempRecipe.getOutput().output.amount, false,
fluidOverlayLarge);
fluidStacks.set(0, tempRecipe.recipeInput.ingredient);
fluidStacks.set(1, tempRecipe.recipeOutput.output);
}
ThermalEvaporationRecipe tempRecipe = ((ThermalEvaporationRecipeWrapper) recipeWrapper).getRecipe();
IGuiFluidStackGroup fluidStacks = recipeLayout.getFluidStacks();
fluidStacks.init(0, true, 7 - xOffset, 14 - yOffset, 16, 58, tempRecipe.getInput().ingredient.amount, false,
fluidOverlayLarge);
fluidStacks.init(1, false, 153 - xOffset, 14 - yOffset, 16, 58, tempRecipe.getOutput().output.amount, false,
fluidOverlayLarge);
fluidStacks.set(0, tempRecipe.recipeInput.ingredient);
fluidStacks.set(1, tempRecipe.recipeOutput.output);
}
}
}
@@ -22,4 +22,4 @@ public class ThermalEvaporationRecipeWrapper implements IRecipeWrapper {
public ThermalEvaporationRecipe getRecipe() {
return recipe;
}
}
}