diff --git a/src/main/java/mekanism/client/jei/BaseRecipeCategory.java b/src/main/java/mekanism/client/jei/BaseRecipeCategory.java index 7ffeba807..52a4a0bbf 100644 --- a/src/main/java/mekanism/client/jei/BaseRecipeCategory.java +++ b/src/main/java/mekanism/client/jei/BaseRecipeCategory.java @@ -6,8 +6,6 @@ import mekanism.client.gui.element.GuiElement; import mekanism.client.gui.element.GuiGauge; import mekanism.client.gui.element.GuiProgress.ProgressBar; import mekanism.client.jei.gas.GasStackRenderer; -import mekanism.client.render.MekanismRenderer; -import mekanism.client.render.MekanismRenderer.FluidType; import mekanism.common.util.LangUtils; import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils.ResourceType; @@ -21,9 +19,9 @@ import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fluids.FluidStack; import org.lwjgl.opengl.GL11; +import javax.annotation.Nullable; import java.util.Collections; import java.util.HashSet; import java.util.List; @@ -40,7 +38,8 @@ public abstract class BaseRecipeCategory implements IRecipeCategory, IGuiWrapper public String guiTexture; public ResourceLocation guiLocation; - + + @Nullable public ProgressBar progressBar; public ITickTimer timer; @@ -50,7 +49,7 @@ public abstract class BaseRecipeCategory implements IRecipeCategory, IGuiWrapper public IDrawable fluidOverlayLarge; public IDrawable fluidOverlaySmall; - public BaseRecipeCategory(IGuiHelper helper, String gui, String name, String unlocalized, ProgressBar progress) + public BaseRecipeCategory(IGuiHelper helper, String gui, String name, String unlocalized, @Nullable ProgressBar progress) { guiHelper = helper; guiTexture = gui; @@ -123,63 +122,6 @@ public abstract class BaseRecipeCategory implements IRecipeCategory, IGuiWrapper return null; } - public void displayGauge(int length, int xPos, int yPos, int overlayX, int overlayY, int scale, FluidStack fluid, GasStack gas) - { - if(fluid == null && gas == null) - { - return; - } - - int start = 0; - - while(true) - { - int renderRemaining; - - if(scale > 16) - { - renderRemaining = 16; - scale -= 16; - } - else { - renderRemaining = scale; - scale = 0; - } - - changeTexture(MekanismRenderer.getBlocksTexture()); - - if(fluid != null) - { - gui.drawTexturedModalRect(xPos, yPos + length - renderRemaining - start, MekanismRenderer.getFluidTexture(fluid.getFluid(), FluidType.STILL), 16, 16 - (16 - renderRemaining)); - } - else if(gas != null) - { - gui.drawTexturedModalRect(xPos, yPos + length - renderRemaining - start, gas.getGas().getSprite(), 16, 16 - (16 - renderRemaining)); - } - - start+=16; - - if(renderRemaining == 0 || scale == 0) - { - break; - } - } - - changeTexture(guiLocation); - gui.drawTexturedModalRect(xPos, yPos, overlayX, overlayY, 16, length+1); - } - - public void displayGauge(int xPos, int yPos, int sizeX, int sizeY, GasStack gas) - { - if(gas == null) - { - return; - } - - changeTexture(MekanismRenderer.getBlocksTexture()); - gui.drawTexturedModalRect(xPos, yPos, gas.getGas().getSprite(), sizeX, sizeY); - } - public String stripTexture() { return guiTexture.replace("mekanism:gui/", ""); diff --git a/src/main/java/mekanism/client/jei/MekanismJEI.java b/src/main/java/mekanism/client/jei/MekanismJEI.java index 022dd476a..ce56be244 100644 --- a/src/main/java/mekanism/client/jei/MekanismJEI.java +++ b/src/main/java/mekanism/client/jei/MekanismJEI.java @@ -240,7 +240,7 @@ public class MekanismJEI implements IModPlugin //TODO Update these to new JEI API - List condensentratorRecipes = new ArrayList(); + List condensentratorRecipes = new ArrayList<>(); RotaryCondensentratorRecipeCategory rotaryCondensentratorCategory = new RotaryCondensentratorRecipeCategory(registry.getJeiHelpers().getGuiHelper()); registry.addRecipeCategories(rotaryCondensentratorCategory); diff --git a/src/main/java/mekanism/client/jei/machine/AdvancedMachineRecipeCategory.java b/src/main/java/mekanism/client/jei/machine/AdvancedMachineRecipeCategory.java index 84445a403..d9b53018b 100644 --- a/src/main/java/mekanism/client/jei/machine/AdvancedMachineRecipeCategory.java +++ b/src/main/java/mekanism/client/jei/machine/AdvancedMachineRecipeCategory.java @@ -24,11 +24,14 @@ import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.IRecipeWrapper; import net.minecraft.util.ResourceLocation; +import javax.annotation.Nullable; + public class AdvancedMachineRecipeCategory extends BaseRecipeCategory { - public IDrawable background; - - public AdvancedMachineRecipe tempRecipe; + private IDrawable background; + + @Nullable + private AdvancedMachineRecipe tempRecipe; public AdvancedMachineRecipeCategory(IGuiHelper helper, String name, String unlocalized, ProgressBar progress) { @@ -73,7 +76,12 @@ public class AdvancedMachineRecipeCategory extends BaseRecipeCategory { if(recipeWrapper instanceof AdvancedMachineRecipeWrapper) { - tempRecipe = ((AdvancedMachineRecipeWrapper)recipeWrapper).recipe; + tempRecipe = ((AdvancedMachineRecipeWrapper)recipeWrapper).getRecipe(); + } + + if(tempRecipe == null) + { + return; } AdvancedMachineInput input = (AdvancedMachineInput)tempRecipe.recipeInput; diff --git a/src/main/java/mekanism/client/jei/machine/AdvancedMachineRecipeWrapper.java b/src/main/java/mekanism/client/jei/machine/AdvancedMachineRecipeWrapper.java index eaa213818..1d2e0124a 100644 --- a/src/main/java/mekanism/client/jei/machine/AdvancedMachineRecipeWrapper.java +++ b/src/main/java/mekanism/client/jei/machine/AdvancedMachineRecipeWrapper.java @@ -13,7 +13,7 @@ import net.minecraft.item.ItemStack; public abstract class AdvancedMachineRecipeWrapper implements IRecipeWrapper { - public AdvancedMachineRecipe recipe; + private AdvancedMachineRecipe recipe; public AdvancedMachineRecipeWrapper(AdvancedMachineRecipe r) { @@ -29,4 +29,9 @@ public abstract class AdvancedMachineRecipeWrapper implements IRecipeWrapper } public abstract List getFuelStacks(Gas gasType); + + public AdvancedMachineRecipe getRecipe() + { + return recipe; + } } diff --git a/src/main/java/mekanism/client/jei/machine/ChanceMachineRecipeCategory.java b/src/main/java/mekanism/client/jei/machine/ChanceMachineRecipeCategory.java index 32232f647..cb84a277e 100644 --- a/src/main/java/mekanism/client/jei/machine/ChanceMachineRecipeCategory.java +++ b/src/main/java/mekanism/client/jei/machine/ChanceMachineRecipeCategory.java @@ -22,11 +22,14 @@ import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.IRecipeWrapper; import net.minecraft.util.ResourceLocation; +import javax.annotation.Nullable; + public class ChanceMachineRecipeCategory extends BaseRecipeCategory { - public IDrawable background; - - public ChanceMachineRecipe tempRecipe; + private IDrawable background; + + @Nullable + private ChanceMachineRecipe tempRecipe; public ChanceMachineRecipeCategory(IGuiHelper helper, String name, String unlocalized, ProgressBar progress) { @@ -70,7 +73,12 @@ public class ChanceMachineRecipeCategory extends BaseRecipeCategory { if(recipeWrapper instanceof ChanceMachineRecipeWrapper) { - tempRecipe = ((ChanceMachineRecipeWrapper)recipeWrapper).recipe; + tempRecipe = ((ChanceMachineRecipeWrapper)recipeWrapper).getRecipe(); + } + + if(tempRecipe == null) + { + return; } IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks(); diff --git a/src/main/java/mekanism/client/jei/machine/ChanceMachineRecipeWrapper.java b/src/main/java/mekanism/client/jei/machine/ChanceMachineRecipeWrapper.java index 88e83896b..a3d3e2257 100644 --- a/src/main/java/mekanism/client/jei/machine/ChanceMachineRecipeWrapper.java +++ b/src/main/java/mekanism/client/jei/machine/ChanceMachineRecipeWrapper.java @@ -14,7 +14,7 @@ import java.util.Arrays; public class ChanceMachineRecipeWrapper implements IRecipeWrapper { - public ChanceMachineRecipe recipe; + private ChanceMachineRecipe recipe; public ChanceMachineRecipeWrapper(ChanceMachineRecipe r) { @@ -40,4 +40,9 @@ public class ChanceMachineRecipeWrapper implements IRecipeWrapper fontRendererObj.drawString(Math.round(output.secondaryChance*100) + "%", 104, 41, 0x404040, false); } } + + public ChanceMachineRecipe getRecipe() + { + return recipe; + } } diff --git a/src/main/java/mekanism/client/jei/machine/MachineRecipeCategory.java b/src/main/java/mekanism/client/jei/machine/MachineRecipeCategory.java index 3105dcb61..317c5b11a 100644 --- a/src/main/java/mekanism/client/jei/machine/MachineRecipeCategory.java +++ b/src/main/java/mekanism/client/jei/machine/MachineRecipeCategory.java @@ -20,11 +20,14 @@ import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.IRecipeWrapper; import net.minecraft.util.ResourceLocation; +import javax.annotation.Nullable; + public class MachineRecipeCategory extends BaseRecipeCategory { - public IDrawable background; - - public BasicMachineRecipe tempRecipe; + private IDrawable background; + + @Nullable + private BasicMachineRecipe tempRecipe; public MachineRecipeCategory(IGuiHelper helper, String name, String unlocalized, ProgressBar progress) { @@ -68,7 +71,12 @@ public class MachineRecipeCategory extends BaseRecipeCategory { if(recipeWrapper instanceof MachineRecipeWrapper) { - tempRecipe = ((MachineRecipeWrapper)recipeWrapper).recipe; + tempRecipe = ((MachineRecipeWrapper)recipeWrapper).getRecipe(); + } + + if(tempRecipe == null) + { + return; } IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks(); diff --git a/src/main/java/mekanism/client/jei/machine/MachineRecipeWrapper.java b/src/main/java/mekanism/client/jei/machine/MachineRecipeWrapper.java index 666d642c6..48716c727 100644 --- a/src/main/java/mekanism/client/jei/machine/MachineRecipeWrapper.java +++ b/src/main/java/mekanism/client/jei/machine/MachineRecipeWrapper.java @@ -9,7 +9,7 @@ import net.minecraft.item.ItemStack; public class MachineRecipeWrapper implements IRecipeWrapper { - public BasicMachineRecipe recipe; + private BasicMachineRecipe recipe; public MachineRecipeWrapper(BasicMachineRecipe r) { @@ -22,4 +22,9 @@ public class MachineRecipeWrapper implements IRecipeWrapper ingredients.setInput(ItemStack.class, ((ItemStackInput)recipe.getInput()).ingredient); ingredients.setOutput(ItemStack.class, ((ItemStackOutput)recipe.getOutput()).output); } + + public BasicMachineRecipe getRecipe() + { + return recipe; + } } 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 9fa765ff2..d8f53eda9 100644 --- a/src/main/java/mekanism/client/jei/machine/chemical/ChemicalCrystallizerRecipeCategory.java +++ b/src/main/java/mekanism/client/jei/machine/chemical/ChemicalCrystallizerRecipeCategory.java @@ -13,11 +13,14 @@ import mezz.jei.api.recipe.IRecipeWrapper; import net.minecraft.client.Minecraft; import net.minecraft.util.ResourceLocation; +import javax.annotation.Nullable; + public class ChemicalCrystallizerRecipeCategory extends BaseRecipeCategory { - public IDrawable background; - - public CrystallizerRecipe tempRecipe; + private IDrawable background; + + @Nullable + private CrystallizerRecipe tempRecipe; public ChemicalCrystallizerRecipeCategory(IGuiHelper helper) { @@ -49,7 +52,12 @@ public class ChemicalCrystallizerRecipeCategory extends BaseRecipeCategory { if(recipeWrapper instanceof ChemicalCrystallizerRecipeWrapper) { - tempRecipe = ((ChemicalCrystallizerRecipeWrapper)recipeWrapper).recipe; + tempRecipe = ((ChemicalCrystallizerRecipeWrapper)recipeWrapper).getRecipe(); + } + + if(tempRecipe == null) + { + return; } IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks(); 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 27a76a4f0..889e138bf 100644 --- a/src/main/java/mekanism/client/jei/machine/chemical/ChemicalCrystallizerRecipeWrapper.java +++ b/src/main/java/mekanism/client/jei/machine/chemical/ChemicalCrystallizerRecipeWrapper.java @@ -8,7 +8,7 @@ import net.minecraft.item.ItemStack; public class ChemicalCrystallizerRecipeWrapper implements IRecipeWrapper { - public CrystallizerRecipe recipe; + private CrystallizerRecipe recipe; public ChemicalCrystallizerRecipeWrapper(CrystallizerRecipe r) { @@ -21,4 +21,9 @@ public class ChemicalCrystallizerRecipeWrapper implements IRecipeWrapper ingredients.setInput(GasStack.class, recipe.recipeInput.ingredient); ingredients.setOutput(ItemStack.class, recipe.recipeOutput.output); } + + public CrystallizerRecipe getRecipe() + { + return recipe; + } } 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 69ac9010c..018f56a30 100644 --- a/src/main/java/mekanism/client/jei/machine/chemical/ChemicalDissolutionChamberRecipeCategory.java +++ b/src/main/java/mekanism/client/jei/machine/chemical/ChemicalDissolutionChamberRecipeCategory.java @@ -14,11 +14,14 @@ import mezz.jei.api.recipe.IRecipeWrapper; import net.minecraft.client.Minecraft; import net.minecraft.util.ResourceLocation; +import javax.annotation.Nullable; + public class ChemicalDissolutionChamberRecipeCategory extends BaseRecipeCategory { - public IDrawable background; - - public DissolutionRecipe tempRecipe; + private IDrawable background; + + @Nullable + private DissolutionRecipe tempRecipe; public ChemicalDissolutionChamberRecipeCategory(IGuiHelper helper) { @@ -50,7 +53,12 @@ public class ChemicalDissolutionChamberRecipeCategory extends BaseRecipeCategory { if(recipeWrapper instanceof ChemicalDissolutionChamberRecipeWrapper) { - tempRecipe = ((ChemicalDissolutionChamberRecipeWrapper)recipeWrapper).recipe; + tempRecipe = ((ChemicalDissolutionChamberRecipeWrapper)recipeWrapper).getRecipe(); + } + + if(tempRecipe == null) + { + return; } IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks(); 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 ab7446b8c..cf1cf2eaa 100644 --- a/src/main/java/mekanism/client/jei/machine/chemical/ChemicalDissolutionChamberRecipeWrapper.java +++ b/src/main/java/mekanism/client/jei/machine/chemical/ChemicalDissolutionChamberRecipeWrapper.java @@ -9,9 +9,7 @@ import net.minecraft.item.ItemStack; public class ChemicalDissolutionChamberRecipeWrapper implements IRecipeWrapper { - public DissolutionRecipe recipe; - - public ChemicalDissolutionChamberRecipeCategory category; + private DissolutionRecipe recipe; public ChemicalDissolutionChamberRecipeWrapper(DissolutionRecipe r) { @@ -25,4 +23,9 @@ public class ChemicalDissolutionChamberRecipeWrapper implements IRecipeWrapper ingredients.setInput(ItemStack.class, recipe.recipeInput.ingredient); ingredients.setOutput(GasStack.class, recipe.recipeOutput.output); } + + public DissolutionRecipe getRecipe() + { + return recipe; + } } 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 bdd6720c2..89d728ccd 100644 --- a/src/main/java/mekanism/client/jei/machine/chemical/ChemicalInfuserRecipeCategory.java +++ b/src/main/java/mekanism/client/jei/machine/chemical/ChemicalInfuserRecipeCategory.java @@ -12,11 +12,14 @@ import mezz.jei.api.recipe.IRecipeWrapper; import net.minecraft.client.Minecraft; import net.minecraft.util.ResourceLocation; +import javax.annotation.Nullable; + public class ChemicalInfuserRecipeCategory extends BaseRecipeCategory { - public IDrawable background; - - public ChemicalInfuserRecipe tempRecipe; + private IDrawable background; + + @Nullable + private ChemicalInfuserRecipe tempRecipe; public ChemicalInfuserRecipeCategory(IGuiHelper helper) { @@ -48,7 +51,12 @@ public class ChemicalInfuserRecipeCategory extends BaseRecipeCategory { if(recipeWrapper instanceof ChemicalInfuserRecipeWrapper) { - tempRecipe = ((ChemicalInfuserRecipeWrapper)recipeWrapper).recipe; + tempRecipe = ((ChemicalInfuserRecipeWrapper)recipeWrapper).getRecipe(); + } + + if(tempRecipe == null) + { + return; } IGuiIngredientGroup gasStacks = recipeLayout.getIngredientsGroup(GasStack.class); 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 5c84aa74d..2bfd3bd89 100644 --- a/src/main/java/mekanism/client/jei/machine/chemical/ChemicalInfuserRecipeWrapper.java +++ b/src/main/java/mekanism/client/jei/machine/chemical/ChemicalInfuserRecipeWrapper.java @@ -9,7 +9,7 @@ import mezz.jei.api.recipe.IRecipeWrapper; public class ChemicalInfuserRecipeWrapper implements IRecipeWrapper { - public ChemicalInfuserRecipe recipe; + private ChemicalInfuserRecipe recipe; public ChemicalInfuserRecipeWrapper(ChemicalInfuserRecipe r) { @@ -22,4 +22,9 @@ public class ChemicalInfuserRecipeWrapper implements IRecipeWrapper ingredients.setInputs(GasStack.class, Arrays.asList(recipe.recipeInput.leftGas, recipe.recipeInput.rightGas)); ingredients.setOutput(GasStack.class, recipe.recipeOutput.output); } + + public ChemicalInfuserRecipe getRecipe() + { + return recipe; + } } 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 7de701091..ca227aa5c 100644 --- a/src/main/java/mekanism/client/jei/machine/chemical/ChemicalOxidizerRecipeCategory.java +++ b/src/main/java/mekanism/client/jei/machine/chemical/ChemicalOxidizerRecipeCategory.java @@ -21,13 +21,16 @@ import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.IRecipeWrapper; import net.minecraft.util.ResourceLocation; +import javax.annotation.Nullable; + public class ChemicalOxidizerRecipeCategory extends BaseRecipeCategory { - public IDrawable background; + private IDrawable background; + + @Nullable + private OxidationRecipe tempRecipe; - public OxidationRecipe tempRecipe; - - public GuiGasGauge gasOutput; + private GuiGasGauge gasOutput = GuiGasGauge.getDummy(GuiGauge.Type.STANDARD, this, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalOxidizer.png"), 133, 13); public ChemicalOxidizerRecipeCategory(IGuiHelper helper) { @@ -42,7 +45,7 @@ public class ChemicalOxidizerRecipeCategory extends BaseRecipeCategory @Override public void addGuiElements() { - guiElements.add(gasOutput = GuiGasGauge.getDummy(GuiGauge.Type.STANDARD, this, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalOxidizer.png"), 133, 13)); + guiElements.add(gasOutput); guiElements.add(new GuiSlot(SlotType.NORMAL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalOxidizer.png"), 25, 35)); @@ -67,7 +70,12 @@ public class ChemicalOxidizerRecipeCategory extends BaseRecipeCategory { if(recipeWrapper instanceof ChemicalOxidizerRecipeWrapper) { - tempRecipe = ((ChemicalOxidizerRecipeWrapper)recipeWrapper).recipe; + tempRecipe = ((ChemicalOxidizerRecipeWrapper)recipeWrapper).getRecipe(); + } + + if(tempRecipe == null) + { + return; } IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks(); 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 2da1493b4..70afe3963 100644 --- a/src/main/java/mekanism/client/jei/machine/chemical/ChemicalOxidizerRecipeWrapper.java +++ b/src/main/java/mekanism/client/jei/machine/chemical/ChemicalOxidizerRecipeWrapper.java @@ -1,7 +1,6 @@ package mekanism.client.jei.machine.chemical; import mekanism.api.gas.GasStack; -import mekanism.client.jei.machine.BaseRecipeWrapper; import mekanism.common.recipe.machines.OxidationRecipe; import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.IRecipeWrapper; @@ -9,9 +8,7 @@ import net.minecraft.item.ItemStack; public class ChemicalOxidizerRecipeWrapper implements IRecipeWrapper { - public OxidationRecipe recipe; - - public ChemicalOxidizerRecipeCategory category; + private OxidationRecipe recipe; public ChemicalOxidizerRecipeWrapper(OxidationRecipe r) { @@ -24,4 +21,9 @@ public class ChemicalOxidizerRecipeWrapper implements IRecipeWrapper ingredients.setInput(ItemStack.class, recipe.recipeInput.ingredient); ingredients.setOutput(GasStack.class, recipe.recipeOutput.output); } + + public OxidationRecipe getRecipe() + { + return recipe; + } } 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 50e525118..7b891bf16 100644 --- a/src/main/java/mekanism/client/jei/machine/chemical/ChemicalWasherRecipeCategory.java +++ b/src/main/java/mekanism/client/jei/machine/chemical/ChemicalWasherRecipeCategory.java @@ -8,20 +8,20 @@ import mezz.jei.api.gui.IDrawable; import mezz.jei.api.gui.IGuiFluidStackGroup; import mezz.jei.api.gui.IGuiIngredientGroup; import mezz.jei.api.gui.IRecipeLayout; -import mezz.jei.api.gui.ITickTimer; import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.IRecipeWrapper; import net.minecraft.client.Minecraft; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fluids.FluidStack; +import javax.annotation.Nullable; + public class ChemicalWasherRecipeCategory extends BaseRecipeCategory { - public IDrawable background; - - public WasherRecipe tempRecipe; - - public ITickTimer timer; + private IDrawable background; + + @Nullable + private WasherRecipe tempRecipe; public ChemicalWasherRecipeCategory(IGuiHelper helper) { @@ -52,7 +52,12 @@ public class ChemicalWasherRecipeCategory extends BaseRecipeCategory { if(recipeWrapper instanceof ChemicalWasherRecipeWrapper) { - tempRecipe = ((ChemicalWasherRecipeWrapper)recipeWrapper).recipe; + tempRecipe = ((ChemicalWasherRecipeWrapper)recipeWrapper).getRecipe(); + } + + if(tempRecipe == null) + { + return; } IGuiFluidStackGroup fluidStacks = recipeLayout.getFluidStacks(); 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 5e0c15ceb..335a1c6c5 100644 --- a/src/main/java/mekanism/client/jei/machine/chemical/ChemicalWasherRecipeWrapper.java +++ b/src/main/java/mekanism/client/jei/machine/chemical/ChemicalWasherRecipeWrapper.java @@ -9,7 +9,7 @@ import net.minecraftforge.fluids.FluidStack; public class ChemicalWasherRecipeWrapper implements IRecipeWrapper { - public WasherRecipe recipe; + private WasherRecipe recipe; public ChemicalWasherRecipeWrapper(WasherRecipe r) { @@ -23,4 +23,9 @@ public class ChemicalWasherRecipeWrapper implements IRecipeWrapper ingredients.setInput(GasStack.class, recipe.recipeInput.ingredient); ingredients.setOutput(GasStack.class, recipe.recipeOutput.output); } + + public WasherRecipe getRecipe() + { + return recipe; + } } 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 9a089cbff..8562a7578 100644 --- a/src/main/java/mekanism/client/jei/machine/other/ElectrolyticSeparatorRecipeCategory.java +++ b/src/main/java/mekanism/client/jei/machine/other/ElectrolyticSeparatorRecipeCategory.java @@ -26,14 +26,17 @@ import mezz.jei.api.recipe.IRecipeWrapper; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fluids.FluidStack; +import javax.annotation.Nullable; + public class ElectrolyticSeparatorRecipeCategory extends BaseRecipeCategory { - public IDrawable background; - - public GuiGasGauge leftGas; - public GuiGasGauge rightGas; - - public SeparatorRecipe tempRecipe; + private IDrawable background; + + private GuiGasGauge leftGas = GuiGasGauge.getDummy(GuiGauge.Type.SMALL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiElectrolyticSeparator.png"), 58, 18); + private GuiGasGauge rightGas = GuiGasGauge.getDummy(GuiGauge.Type.SMALL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiElectrolyticSeparator.png"), 100, 18); + + @Nullable + private SeparatorRecipe tempRecipe; public ElectrolyticSeparatorRecipeCategory(IGuiHelper helper) { @@ -49,9 +52,7 @@ public class ElectrolyticSeparatorRecipeCategory extends BaseRecipeCategory public void addGuiElements() { guiElements.add(GuiFluidGauge.getDummy(GuiGauge.Type.STANDARD, this, MekanismUtils.getResource(ResourceType.GUI, "GuiElectrolyticSeparator.png"), 5, 10)); - leftGas = GuiGasGauge.getDummy(GuiGauge.Type.SMALL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiElectrolyticSeparator.png"), 58, 18); guiElements.add(leftGas); - rightGas = GuiGasGauge.getDummy(GuiGauge.Type.SMALL, this, MekanismUtils.getResource(ResourceType.GUI, "GuiElectrolyticSeparator.png"), 100, 18); guiElements.add(rightGas); guiElements.add(new GuiPowerBar(this, new IPowerInfoHandler() { @Override @@ -87,7 +88,12 @@ public class ElectrolyticSeparatorRecipeCategory extends BaseRecipeCategory { if(recipeWrapper instanceof ElectrolyticSeparatorRecipeWrapper) { - tempRecipe = ((ElectrolyticSeparatorRecipeWrapper)recipeWrapper).recipe; + tempRecipe = ((ElectrolyticSeparatorRecipeWrapper)recipeWrapper).getRecipe(); + } + + if(tempRecipe == null) + { + return; } IGuiFluidStackGroup fluidStacks = recipeLayout.getFluidStacks(); 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 64351dc3b..43da6f5fc 100644 --- a/src/main/java/mekanism/client/jei/machine/other/ElectrolyticSeparatorRecipeWrapper.java +++ b/src/main/java/mekanism/client/jei/machine/other/ElectrolyticSeparatorRecipeWrapper.java @@ -3,7 +3,6 @@ package mekanism.client.jei.machine.other; import java.util.Arrays; import mekanism.api.gas.GasStack; -import mekanism.client.jei.machine.BaseRecipeWrapper; import mekanism.common.recipe.machines.SeparatorRecipe; import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.IRecipeWrapper; @@ -11,7 +10,7 @@ import net.minecraftforge.fluids.FluidStack; public class ElectrolyticSeparatorRecipeWrapper implements IRecipeWrapper { - public SeparatorRecipe recipe; + private SeparatorRecipe recipe; public ElectrolyticSeparatorRecipeWrapper(SeparatorRecipe r) { @@ -24,4 +23,9 @@ public class ElectrolyticSeparatorRecipeWrapper implements IRecipeWrapper ingredients.setInput(FluidStack.class, recipe.recipeInput.ingredient); ingredients.setOutputs(GasStack.class, Arrays.asList(recipe.recipeOutput.leftGas, recipe.recipeOutput.rightGas)); } + + public SeparatorRecipe getRecipe() + { + return recipe; + } } 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 7b3565f9c..e26a76bee 100644 --- a/src/main/java/mekanism/client/jei/machine/other/MetallurgicInfuserRecipeCategory.java +++ b/src/main/java/mekanism/client/jei/machine/other/MetallurgicInfuserRecipeCategory.java @@ -20,22 +20,23 @@ 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.gui.ITickTimer; import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.IRecipeWrapper; import net.minecraft.client.Minecraft; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; +import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; import java.util.Map; public class MetallurgicInfuserRecipeCategory extends BaseRecipeCategory { - public IDrawable background; - - public MetallurgicInfuserRecipe tempRecipe; + private IDrawable background; + + @Nullable + private MetallurgicInfuserRecipe tempRecipe; public MetallurgicInfuserRecipeCategory(IGuiHelper helper) { @@ -90,6 +91,11 @@ public class MetallurgicInfuserRecipeCategory extends BaseRecipeCategory public void drawExtras(Minecraft minecraft) { super.drawExtras(minecraft); + + if(tempRecipe == null) + { + return; + } InfuseType type = tempRecipe.getInput().infuse.type; changeTexture(MekanismRenderer.getBlocksTexture()); @@ -107,7 +113,12 @@ public class MetallurgicInfuserRecipeCategory extends BaseRecipeCategory { if(recipeWrapper instanceof MetallurgicInfuserRecipeWrapper) { - tempRecipe = ((MetallurgicInfuserRecipeWrapper)recipeWrapper).recipe; + tempRecipe = ((MetallurgicInfuserRecipeWrapper)recipeWrapper).getRecipe(); + } + + if(tempRecipe == null) + { + return; } IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks(); 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 d3e3b61e5..700fae1d4 100644 --- a/src/main/java/mekanism/client/jei/machine/other/MetallurgicInfuserRecipeWrapper.java +++ b/src/main/java/mekanism/client/jei/machine/other/MetallurgicInfuserRecipeWrapper.java @@ -10,7 +10,7 @@ import java.util.List; public class MetallurgicInfuserRecipeWrapper implements IRecipeWrapper { - public MetallurgicInfuserRecipe recipe; + private MetallurgicInfuserRecipe recipe; public MetallurgicInfuserRecipeWrapper(MetallurgicInfuserRecipe r) { @@ -27,4 +27,9 @@ public class MetallurgicInfuserRecipeWrapper implements IRecipeWrapper ingredients.setInputLists(ItemStack.class, Arrays.asList(inputStacks, infuseStacks)); ingredients.setOutput(ItemStack.class, recipe.recipeOutput.output); } + + public MetallurgicInfuserRecipe getRecipe() + { + return recipe; + } } 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 61cc38dfb..b27446ab6 100644 --- a/src/main/java/mekanism/client/jei/machine/other/PRCRecipeCategory.java +++ b/src/main/java/mekanism/client/jei/machine/other/PRCRecipeCategory.java @@ -1,7 +1,5 @@ package mekanism.client.jei.machine.other; -import java.util.List; - import mekanism.api.gas.GasStack; import mekanism.client.gui.element.GuiFluidGauge; import mekanism.client.gui.element.GuiGasGauge; @@ -16,30 +14,27 @@ import mekanism.client.gui.element.GuiSlot.SlotOverlay; import mekanism.client.gui.element.GuiSlot.SlotType; import mekanism.client.jei.BaseRecipeCategory; import mekanism.common.recipe.machines.PressurizedRecipe; -import mekanism.common.util.MekanismUtils; -import mekanism.common.util.MekanismUtils.ResourceType; import mezz.jei.api.IGuiHelper; import mezz.jei.api.gui.IDrawable; import mezz.jei.api.gui.IGuiFluidStackGroup; import mezz.jei.api.gui.IGuiIngredientGroup; import mezz.jei.api.gui.IGuiItemStackGroup; import mezz.jei.api.gui.IRecipeLayout; -import mezz.jei.api.gui.ITickTimer; -import mezz.jei.api.gui.ITooltipCallback; import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.IRecipeWrapper; -import net.minecraft.client.Minecraft; import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fluids.FluidStack; + +import javax.annotation.Nullable; public class PRCRecipeCategory extends BaseRecipeCategory { - public IDrawable background; + private IDrawable background; - public GuiGasGauge gasInput; - public GuiGasGauge gasOutput; - - public PressurizedRecipe tempRecipe; + private GuiGasGauge gasInput = GuiGasGauge.getDummy(GuiGauge.Type.STANDARD_RED, this, guiLocation, 28, 10); + private GuiGasGauge gasOutput = GuiGasGauge.getDummy(GuiGauge.Type.SMALL_BLUE, this, guiLocation, 140, 40); + + @Nullable + private PressurizedRecipe tempRecipe; public PRCRecipeCategory(IGuiHelper helper) { @@ -59,9 +54,7 @@ public class PRCRecipeCategory extends BaseRecipeCategory guiElements.add(new GuiSlot(SlotType.OUTPUT, this, guiLocation, 115, 34)); guiElements.add(GuiFluidGauge.getDummy(GuiGauge.Type.STANDARD_YELLOW, this, guiLocation, 5, 10)); - gasInput = GuiGasGauge.getDummy(GuiGauge.Type.STANDARD_RED, this, guiLocation, 28, 10); guiElements.add(gasInput); - gasOutput = GuiGasGauge.getDummy(GuiGauge.Type.SMALL_BLUE, this, guiLocation, 140, 40); guiElements.add(gasOutput); guiElements.add(new GuiPowerBar(this, new IPowerInfoHandler() { @@ -92,7 +85,12 @@ public class PRCRecipeCategory extends BaseRecipeCategory { if(recipeWrapper instanceof PRCRecipeWrapper) { - tempRecipe = ((PRCRecipeWrapper)recipeWrapper).recipe; + tempRecipe = ((PRCRecipeWrapper)recipeWrapper).getRecipe(); + } + + if(tempRecipe == null) + { + return; } IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks(); 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 1bf5003cb..f13daf211 100644 --- a/src/main/java/mekanism/client/jei/machine/other/PRCRecipeWrapper.java +++ b/src/main/java/mekanism/client/jei/machine/other/PRCRecipeWrapper.java @@ -1,7 +1,6 @@ package mekanism.client.jei.machine.other; import mekanism.api.gas.GasStack; -import mekanism.client.jei.machine.BaseRecipeWrapper; import mekanism.common.recipe.machines.PressurizedRecipe; import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.IRecipeWrapper; @@ -10,7 +9,7 @@ import net.minecraftforge.fluids.FluidStack; public class PRCRecipeWrapper implements IRecipeWrapper { - public PressurizedRecipe recipe; + private PressurizedRecipe recipe; public PRCRecipeWrapper(PressurizedRecipe r) { @@ -26,4 +25,9 @@ public class PRCRecipeWrapper implements IRecipeWrapper ingredients.setOutput(ItemStack.class, recipe.recipeOutput.getItemOutput()); ingredients.setOutput(GasStack.class, recipe.recipeOutput.getGasOutput()); } + + public PressurizedRecipe getRecipe() + { + return recipe; + } } 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 8e071621f..e62b6e9d7 100644 --- a/src/main/java/mekanism/client/jei/machine/other/SolarNeutronRecipeCategory.java +++ b/src/main/java/mekanism/client/jei/machine/other/SolarNeutronRecipeCategory.java @@ -12,11 +12,14 @@ import mezz.jei.api.recipe.IRecipeWrapper; import net.minecraft.client.Minecraft; import net.minecraft.util.ResourceLocation; +import javax.annotation.Nullable; + public class SolarNeutronRecipeCategory extends BaseRecipeCategory { - public IDrawable background; - - public SolarNeutronRecipe tempRecipe; + private IDrawable background; + + @Nullable + private SolarNeutronRecipe tempRecipe; public SolarNeutronRecipeCategory(IGuiHelper helper) { @@ -47,7 +50,12 @@ public class SolarNeutronRecipeCategory extends BaseRecipeCategory { if(recipeWrapper instanceof SolarNeutronRecipeWrapper) { - tempRecipe = ((SolarNeutronRecipeWrapper)recipeWrapper).recipe; + tempRecipe = ((SolarNeutronRecipeWrapper)recipeWrapper).getRecipe(); + } + + if(tempRecipe == null) + { + return; } IGuiIngredientGroup gasStacks = recipeLayout.getIngredientsGroup(GasStack.class); 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 246984dd4..ef0f11e5a 100644 --- a/src/main/java/mekanism/client/jei/machine/other/SolarNeutronRecipeWrapper.java +++ b/src/main/java/mekanism/client/jei/machine/other/SolarNeutronRecipeWrapper.java @@ -1,16 +1,13 @@ package mekanism.client.jei.machine.other; import mekanism.api.gas.GasStack; -import mekanism.client.jei.machine.BaseRecipeWrapper; import mekanism.common.recipe.machines.SolarNeutronRecipe; import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.IRecipeWrapper; public class SolarNeutronRecipeWrapper implements IRecipeWrapper { - public SolarNeutronRecipe recipe; - - public SolarNeutronRecipeCategory category; + private SolarNeutronRecipe recipe; public SolarNeutronRecipeWrapper(SolarNeutronRecipe r) { @@ -23,4 +20,9 @@ public class SolarNeutronRecipeWrapper implements IRecipeWrapper ingredients.setInput(GasStack.class, recipe.getInput().ingredient); ingredients.setOutput(GasStack.class, recipe.getOutput().output); } + + public SolarNeutronRecipe getRecipe() + { + return recipe; + } } 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 b42e097b2..23cbbe39b 100644 --- a/src/main/java/mekanism/client/jei/machine/other/ThermalEvaporationRecipeCategory.java +++ b/src/main/java/mekanism/client/jei/machine/other/ThermalEvaporationRecipeCategory.java @@ -1,26 +1,24 @@ package mekanism.client.jei.machine.other; -import java.util.List; - import mekanism.client.jei.BaseRecipeCategory; import mekanism.common.recipe.machines.ThermalEvaporationRecipe; import mezz.jei.api.IGuiHelper; import mezz.jei.api.gui.IDrawable; import mezz.jei.api.gui.IGuiFluidStackGroup; import mezz.jei.api.gui.IRecipeLayout; -import mezz.jei.api.gui.ITickTimer; -import mezz.jei.api.gui.ITooltipCallback; import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.IRecipeWrapper; import net.minecraft.client.Minecraft; import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fluids.FluidStack; + +import javax.annotation.Nullable; public class ThermalEvaporationRecipeCategory extends BaseRecipeCategory { - public IDrawable background; - - public ThermalEvaporationRecipe tempRecipe; + private IDrawable background; + + @Nullable + private ThermalEvaporationRecipe tempRecipe; public ThermalEvaporationRecipeCategory(IGuiHelper helper) { @@ -51,7 +49,12 @@ public class ThermalEvaporationRecipeCategory extends BaseRecipeCategory { if(recipeWrapper instanceof ThermalEvaporationRecipeWrapper) { - tempRecipe = ((ThermalEvaporationRecipeWrapper)recipeWrapper).recipe; + tempRecipe = ((ThermalEvaporationRecipeWrapper)recipeWrapper).getRecipe(); + } + + if(tempRecipe == null) + { + return; } IGuiFluidStackGroup fluidStacks = recipeLayout.getFluidStacks(); 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 a5c70a38e..2482af075 100644 --- a/src/main/java/mekanism/client/jei/machine/other/ThermalEvaporationRecipeWrapper.java +++ b/src/main/java/mekanism/client/jei/machine/other/ThermalEvaporationRecipeWrapper.java @@ -7,7 +7,7 @@ import net.minecraftforge.fluids.FluidStack; public class ThermalEvaporationRecipeWrapper implements IRecipeWrapper { - public ThermalEvaporationRecipe recipe; + private ThermalEvaporationRecipe recipe; public ThermalEvaporationRecipeWrapper(ThermalEvaporationRecipe r) { @@ -20,4 +20,9 @@ public class ThermalEvaporationRecipeWrapper implements IRecipeWrapper ingredients.setInput(FluidStack.class, recipe.getInput().ingredient); ingredients.setOutput(FluidStack.class, recipe.getOutput().output); } + + public ThermalEvaporationRecipe getRecipe() + { + return recipe; + } }