diff --git a/src/main/java/mekanism/client/jei/BaseRecipeCategory.java b/src/main/java/mekanism/client/jei/BaseRecipeCategory.java index cec1dedf7..50920691f 100644 --- a/src/main/java/mekanism/client/jei/BaseRecipeCategory.java +++ b/src/main/java/mekanism/client/jei/BaseRecipeCategory.java @@ -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 e.renderBackground(0, 0, -xOffset, -yOffset)); } @Override @@ -117,10 +109,6 @@ public abstract class BaseRecipeCategory implements IRecipeCategory { return stack; } } - return null; } @@ -65,18 +65,12 @@ public class GasStackHelper implements IIngredientHelper { @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(); } -} +} \ No newline at end of file diff --git a/src/main/java/mekanism/client/jei/GuiElementHandler.java b/src/main/java/mekanism/client/jei/GuiElementHandler.java index 93c97363f..d784d7b12 100644 --- a/src/main/java/mekanism/client/jei/GuiElementHandler.java +++ b/src/main/java/mekanism/client/jei/GuiElementHandler.java @@ -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 getGuiExtraAreas(GuiContainer gui) { if (gui instanceof GuiMekanism) { - List 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; } -} +} \ No newline at end of file diff --git a/src/main/java/mekanism/client/jei/gas/GasStackRenderer.java b/src/main/java/mekanism/client/jei/gas/GasStackRenderer.java index 92ccf5d86..7a466b1ee 100644 --- a/src/main/java/mekanism/client/jei/gas/GasStackRenderer.java +++ b/src/main/java/mekanism/client/jei/gas/GasStackRenderer.java @@ -56,15 +56,12 @@ public class GasStackRenderer implements IIngredientRenderer { 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 { 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 { 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 { } 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 { 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 { public List getTooltip(Minecraft minecraft, GasStack gasStack, ITooltipFlag tooltipFlag) { List 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 { 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 { SHOW_AMOUNT_AND_CAPACITY, ITEM_LIST } -} +} \ No newline at end of file diff --git a/src/main/java/mekanism/client/jei/machine/AdvancedMachineRecipeCategory.java b/src/main/java/mekanism/client/jei/machine/AdvancedMachineRecipeCategory.java index b51766b5a..2bee98a51 100644 --- a/src/main/java/mekanism/client/jei/machine/AdvancedMachineRecipeCategory.java +++ b/src/main/java/mekanism/client/jei/machine/AdvancedMachineRecipeCategory.java @@ -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 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 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); } -} +} \ No newline at end of file diff --git a/src/main/java/mekanism/client/jei/machine/AdvancedMachineRecipeWrapper.java b/src/main/java/mekanism/client/jei/machine/AdvancedMachineRecipeWrapper.java index 13588729d..47cd9b3a3 100644 --- a/src/main/java/mekanism/client/jei/machine/AdvancedMachineRecipeWrapper.java +++ b/src/main/java/mekanism/client/jei/machine/AdvancedMachineRecipeWrapper.java @@ -38,4 +38,4 @@ public class AdvancedMachineRecipeWrapper implements IRecipeWrapper { public AdvancedMachineRecipe getRecipe() { return recipe; } -} +} \ No newline at end of file diff --git a/src/main/java/mekanism/client/jei/machine/ChanceMachineRecipeCategory.java b/src/main/java/mekanism/client/jei/machine/ChanceMachineRecipeCategory.java index 28cb08ea1..54af484ec 100644 --- a/src/main/java/mekanism/client/jei/machine/ChanceMachineRecipeCategory.java +++ b/src/main/java/mekanism/client/jei/machine/ChanceMachineRecipeCategory.java @@ -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); + } } } -} +} \ No newline at end of file diff --git a/src/main/java/mekanism/client/jei/machine/ChanceMachineRecipeWrapper.java b/src/main/java/mekanism/client/jei/machine/ChanceMachineRecipeWrapper.java index 054a48245..23934d7ec 100644 --- a/src/main/java/mekanism/client/jei/machine/ChanceMachineRecipeWrapper.java +++ b/src/main/java/mekanism/client/jei/machine/ChanceMachineRecipeWrapper.java @@ -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; } -} +} \ No newline at end of file diff --git a/src/main/java/mekanism/client/jei/machine/DoubleMachineRecipeCategory.java b/src/main/java/mekanism/client/jei/machine/DoubleMachineRecipeCategory.java index c241bb8c1..0bf8cf357 100644 --- a/src/main/java/mekanism/client/jei/machine/DoubleMachineRecipeCategory.java +++ b/src/main/java/mekanism/client/jei/machine/DoubleMachineRecipeCategory.java @@ -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); } -} +} \ No newline at end of file diff --git a/src/main/java/mekanism/client/jei/machine/DoubleMachineRecipeWrapper.java b/src/main/java/mekanism/client/jei/machine/DoubleMachineRecipeWrapper.java index 6d26c4111..4c3f7d214 100644 --- a/src/main/java/mekanism/client/jei/machine/DoubleMachineRecipeWrapper.java +++ b/src/main/java/mekanism/client/jei/machine/DoubleMachineRecipeWrapper.java @@ -26,4 +26,4 @@ public class DoubleMachineRecipeWrapper implements IRecipeWrapper { public DoubleMachineRecipe getRecipe() { return recipe; } -} +} \ No newline at end of file diff --git a/src/main/java/mekanism/client/jei/machine/MachineRecipeCategory.java b/src/main/java/mekanism/client/jei/machine/MachineRecipeCategory.java index 8d3a4f9f1..09e28d395 100644 --- a/src/main/java/mekanism/client/jei/machine/MachineRecipeCategory.java +++ b/src/main/java/mekanism/client/jei/machine/MachineRecipeCategory.java @@ -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); } -} +} \ No newline at end of file diff --git a/src/main/java/mekanism/client/jei/machine/MachineRecipeWrapper.java b/src/main/java/mekanism/client/jei/machine/MachineRecipeWrapper.java index 804a54e63..402d1b50f 100644 --- a/src/main/java/mekanism/client/jei/machine/MachineRecipeWrapper.java +++ b/src/main/java/mekanism/client/jei/machine/MachineRecipeWrapper.java @@ -24,4 +24,4 @@ public class MachineRecipeWrapper implements IRecipeWrapper { public BasicMachineRecipe getRecipe() { return recipe; } -} +} \ No newline at end of file diff --git a/src/main/java/mekanism/client/jei/machine/chemical/ChemicalCrystallizerRecipeCategory.java b/src/main/java/mekanism/client/jei/machine/chemical/ChemicalCrystallizerRecipeCategory.java index d1eb810b9..e2f5510d2 100644 --- a/src/main/java/mekanism/client/jei/machine/chemical/ChemicalCrystallizerRecipeCategory.java +++ b/src/main/java/mekanism/client/jei/machine/chemical/ChemicalCrystallizerRecipeCategory.java @@ -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 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 gasStacks = recipeLayout.getIngredientsGroup(MekanismJEI.TYPE_GAS); - - initGas(gasStacks, 0, true, 6 - xOffset, 5 - yOffset, 16, 58, tempRecipe.getInput().ingredient, true); } -} +} \ No newline at end of file diff --git a/src/main/java/mekanism/client/jei/machine/chemical/ChemicalCrystallizerRecipeWrapper.java b/src/main/java/mekanism/client/jei/machine/chemical/ChemicalCrystallizerRecipeWrapper.java index ee9cbbe2c..18440704d 100644 --- a/src/main/java/mekanism/client/jei/machine/chemical/ChemicalCrystallizerRecipeWrapper.java +++ b/src/main/java/mekanism/client/jei/machine/chemical/ChemicalCrystallizerRecipeWrapper.java @@ -23,4 +23,4 @@ public class ChemicalCrystallizerRecipeWrapper implements IRecipeWrapper { public CrystallizerRecipe getRecipe() { return recipe; } -} +} \ No newline at end of file diff --git a/src/main/java/mekanism/client/jei/machine/chemical/ChemicalDissolutionChamberRecipeCategory.java b/src/main/java/mekanism/client/jei/machine/chemical/ChemicalDissolutionChamberRecipeCategory.java index 9a8742dde..6a0a3d151 100644 --- a/src/main/java/mekanism/client/jei/machine/chemical/ChemicalDissolutionChamberRecipeCategory.java +++ b/src/main/java/mekanism/client/jei/machine/chemical/ChemicalDissolutionChamberRecipeCategory.java @@ -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 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 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); } -} +} \ No newline at end of file diff --git a/src/main/java/mekanism/client/jei/machine/chemical/ChemicalDissolutionChamberRecipeWrapper.java b/src/main/java/mekanism/client/jei/machine/chemical/ChemicalDissolutionChamberRecipeWrapper.java index ba2581f38..bca1757e3 100644 --- a/src/main/java/mekanism/client/jei/machine/chemical/ChemicalDissolutionChamberRecipeWrapper.java +++ b/src/main/java/mekanism/client/jei/machine/chemical/ChemicalDissolutionChamberRecipeWrapper.java @@ -29,4 +29,4 @@ public class ChemicalDissolutionChamberRecipeWrapper implements IRecipeWrapper { public DissolutionRecipe getRecipe() { return recipe; } -} +} \ No newline at end of file diff --git a/src/main/java/mekanism/client/jei/machine/chemical/ChemicalInfuserRecipeCategory.java b/src/main/java/mekanism/client/jei/machine/chemical/ChemicalInfuserRecipeCategory.java index 7c322d73c..5a352a0dc 100644 --- a/src/main/java/mekanism/client/jei/machine/chemical/ChemicalInfuserRecipeCategory.java +++ b/src/main/java/mekanism/client/jei/machine/chemical/ChemicalInfuserRecipeCategory.java @@ -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 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 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); } } diff --git a/src/main/java/mekanism/client/jei/machine/chemical/ChemicalInfuserRecipeWrapper.java b/src/main/java/mekanism/client/jei/machine/chemical/ChemicalInfuserRecipeWrapper.java index c8ba291fd..010965119 100644 --- a/src/main/java/mekanism/client/jei/machine/chemical/ChemicalInfuserRecipeWrapper.java +++ b/src/main/java/mekanism/client/jei/machine/chemical/ChemicalInfuserRecipeWrapper.java @@ -23,4 +23,4 @@ public class ChemicalInfuserRecipeWrapper implements IRecipeWrapper { public ChemicalInfuserRecipe getRecipe() { return recipe; } -} +} \ No newline at end of file diff --git a/src/main/java/mekanism/client/jei/machine/chemical/ChemicalOxidizerRecipeCategory.java b/src/main/java/mekanism/client/jei/machine/chemical/ChemicalOxidizerRecipeCategory.java index 260bad9bb..e759c53ea 100644 --- a/src/main/java/mekanism/client/jei/machine/chemical/ChemicalOxidizerRecipeCategory.java +++ b/src/main/java/mekanism/client/jei/machine/chemical/ChemicalOxidizerRecipeCategory.java @@ -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 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 gasStacks = recipeLayout.getIngredientsGroup(MekanismJEI.TYPE_GAS); - - initGas(gasStacks, 0, false, 134 - xOffset, 14 - yOffset, 16, 58, tempRecipe.recipeOutput.output, true); } -} +} \ No newline at end of file diff --git a/src/main/java/mekanism/client/jei/machine/chemical/ChemicalOxidizerRecipeWrapper.java b/src/main/java/mekanism/client/jei/machine/chemical/ChemicalOxidizerRecipeWrapper.java index e55b8fdff..23ed8def6 100644 --- a/src/main/java/mekanism/client/jei/machine/chemical/ChemicalOxidizerRecipeWrapper.java +++ b/src/main/java/mekanism/client/jei/machine/chemical/ChemicalOxidizerRecipeWrapper.java @@ -23,4 +23,4 @@ public class ChemicalOxidizerRecipeWrapper implements IRecipeWrapper { public OxidationRecipe getRecipe() { return recipe; } -} +} \ No newline at end of file diff --git a/src/main/java/mekanism/client/jei/machine/chemical/ChemicalWasherRecipeCategory.java b/src/main/java/mekanism/client/jei/machine/chemical/ChemicalWasherRecipeCategory.java index debdf9264..3e008a071 100644 --- a/src/main/java/mekanism/client/jei/machine/chemical/ChemicalWasherRecipeCategory.java +++ b/src/main/java/mekanism/client/jei/machine/chemical/ChemicalWasherRecipeCategory.java @@ -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 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 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); } -} +} \ No newline at end of file diff --git a/src/main/java/mekanism/client/jei/machine/chemical/ChemicalWasherRecipeWrapper.java b/src/main/java/mekanism/client/jei/machine/chemical/ChemicalWasherRecipeWrapper.java index 1904a82ca..cbdea4633 100644 --- a/src/main/java/mekanism/client/jei/machine/chemical/ChemicalWasherRecipeWrapper.java +++ b/src/main/java/mekanism/client/jei/machine/chemical/ChemicalWasherRecipeWrapper.java @@ -27,4 +27,4 @@ public class ChemicalWasherRecipeWrapper implements IRecipeWrapper { public WasherRecipe getRecipe() { return recipe; } -} +} \ No newline at end of file diff --git a/src/main/java/mekanism/client/jei/machine/other/ElectrolyticSeparatorRecipeCategory.java b/src/main/java/mekanism/client/jei/machine/other/ElectrolyticSeparatorRecipeCategory.java index e89358942..28640ba7a 100644 --- a/src/main/java/mekanism/client/jei/machine/other/ElectrolyticSeparatorRecipeCategory.java +++ b/src/main/java/mekanism/client/jei/machine/other/ElectrolyticSeparatorRecipeCategory.java @@ -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 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 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); } -} +} \ No newline at end of file diff --git a/src/main/java/mekanism/client/jei/machine/other/ElectrolyticSeparatorRecipeWrapper.java b/src/main/java/mekanism/client/jei/machine/other/ElectrolyticSeparatorRecipeWrapper.java index b084ee8e6..cf9581ece 100644 --- a/src/main/java/mekanism/client/jei/machine/other/ElectrolyticSeparatorRecipeWrapper.java +++ b/src/main/java/mekanism/client/jei/machine/other/ElectrolyticSeparatorRecipeWrapper.java @@ -25,4 +25,4 @@ public class ElectrolyticSeparatorRecipeWrapper implements IRecipeWrapper { public SeparatorRecipe getRecipe() { return recipe; } -} +} \ No newline at end of file diff --git a/src/main/java/mekanism/client/jei/machine/other/MetallurgicInfuserRecipeCategory.java b/src/main/java/mekanism/client/jei/machine/other/MetallurgicInfuserRecipeCategory.java index 0d278a695..51c111483 100644 --- a/src/main/java/mekanism/client/jei/machine/other/MetallurgicInfuserRecipeCategory.java +++ b/src/main/java/mekanism/client/jei/machine/other/MetallurgicInfuserRecipeCategory.java @@ -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 getInfuseStacks(InfuseType type) { - List ret = new ArrayList<>(); - - for (Map.Entry 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)); } -} +} \ No newline at end of file diff --git a/src/main/java/mekanism/client/jei/machine/other/MetallurgicInfuserRecipeWrapper.java b/src/main/java/mekanism/client/jei/machine/other/MetallurgicInfuserRecipeWrapper.java index 1a902064c..f6656f415 100644 --- a/src/main/java/mekanism/client/jei/machine/other/MetallurgicInfuserRecipeWrapper.java +++ b/src/main/java/mekanism/client/jei/machine/other/MetallurgicInfuserRecipeWrapper.java @@ -24,7 +24,6 @@ public class MetallurgicInfuserRecipeWrapper implements IRecipeWrapper { public void getIngredients(IIngredients ingredients) { List inputStacks = Collections.singletonList(recipe.recipeInput.inputStack); List 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); diff --git a/src/main/java/mekanism/client/jei/machine/other/PRCRecipeCategory.java b/src/main/java/mekanism/client/jei/machine/other/PRCRecipeCategory.java index e570b2f11..68249cd9c 100644 --- a/src/main/java/mekanism/client/jei/machine/other/PRCRecipeCategory.java +++ b/src/main/java/mekanism/client/jei/machine/other/PRCRecipeCategory.java @@ -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 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 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); } -} +} \ No newline at end of file diff --git a/src/main/java/mekanism/client/jei/machine/other/PRCRecipeWrapper.java b/src/main/java/mekanism/client/jei/machine/other/PRCRecipeWrapper.java index 4ecba11cc..0eaecc340 100644 --- a/src/main/java/mekanism/client/jei/machine/other/PRCRecipeWrapper.java +++ b/src/main/java/mekanism/client/jei/machine/other/PRCRecipeWrapper.java @@ -26,4 +26,4 @@ public class PRCRecipeWrapper implements IRecipeWrapper { public PressurizedRecipe getRecipe() { return recipe; } -} +} \ No newline at end of file diff --git a/src/main/java/mekanism/client/jei/machine/other/RotaryCondensentratorRecipeCategory.java b/src/main/java/mekanism/client/jei/machine/other/RotaryCondensentratorRecipeCategory.java index becab9009..07aec1c66 100644 --- a/src/main/java/mekanism/client/jei/machine/other/RotaryCondensentratorRecipeCategory.java +++ b/src/main/java/mekanism/client/jei/machine/other/RotaryCondensentratorRecipeCategory.java @@ -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 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 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)); + } } } -} +} \ No newline at end of file diff --git a/src/main/java/mekanism/client/jei/machine/other/RotaryCondensentratorRecipeWrapper.java b/src/main/java/mekanism/client/jei/machine/other/RotaryCondensentratorRecipeWrapper.java index 244f78d50..afc28cd66 100644 --- a/src/main/java/mekanism/client/jei/machine/other/RotaryCondensentratorRecipeWrapper.java +++ b/src/main/java/mekanism/client/jei/machine/other/RotaryCondensentratorRecipeWrapper.java @@ -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); } -} +} \ No newline at end of file diff --git a/src/main/java/mekanism/client/jei/machine/other/SolarNeutronRecipeCategory.java b/src/main/java/mekanism/client/jei/machine/other/SolarNeutronRecipeCategory.java index 38371e051..a317911c3 100644 --- a/src/main/java/mekanism/client/jei/machine/other/SolarNeutronRecipeCategory.java +++ b/src/main/java/mekanism/client/jei/machine/other/SolarNeutronRecipeCategory.java @@ -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 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 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); } -} +} \ No newline at end of file diff --git a/src/main/java/mekanism/client/jei/machine/other/SolarNeutronRecipeWrapper.java b/src/main/java/mekanism/client/jei/machine/other/SolarNeutronRecipeWrapper.java index 04947f622..2115e6b4d 100644 --- a/src/main/java/mekanism/client/jei/machine/other/SolarNeutronRecipeWrapper.java +++ b/src/main/java/mekanism/client/jei/machine/other/SolarNeutronRecipeWrapper.java @@ -22,4 +22,4 @@ public class SolarNeutronRecipeWrapper implements IRecipeWrapper { public SolarNeutronRecipe getRecipe() { return recipe; } -} +} \ No newline at end of file diff --git a/src/main/java/mekanism/client/jei/machine/other/ThermalEvaporationRecipeCategory.java b/src/main/java/mekanism/client/jei/machine/other/ThermalEvaporationRecipeCategory.java index 60e1cbb3e..e09320e65 100644 --- a/src/main/java/mekanism/client/jei/machine/other/ThermalEvaporationRecipeCategory.java +++ b/src/main/java/mekanism/client/jei/machine/other/ThermalEvaporationRecipeCategory.java @@ -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); } -} +} \ No newline at end of file diff --git a/src/main/java/mekanism/client/jei/machine/other/ThermalEvaporationRecipeWrapper.java b/src/main/java/mekanism/client/jei/machine/other/ThermalEvaporationRecipeWrapper.java index 290ce9a88..f004ae77c 100644 --- a/src/main/java/mekanism/client/jei/machine/other/ThermalEvaporationRecipeWrapper.java +++ b/src/main/java/mekanism/client/jei/machine/other/ThermalEvaporationRecipeWrapper.java @@ -22,4 +22,4 @@ public class ThermalEvaporationRecipeWrapper implements IRecipeWrapper { public ThermalEvaporationRecipe getRecipe() { return recipe; } -} +} \ No newline at end of file