JEI cleanup, pass 4

Updated last recipe category
Changed some fields to final
Fixed some bugs caused by cleanup (null entries in guiElements)
Fixed bugs in MekanismJEI where the wrong constructor was being searched for
This commit is contained in:
Tom Elfring committed 2017-08-13 12:46:14 +02:00
1 parent 5f23ad4725
commit 2ce4bfcd9a
33 files changed
+122 -226

No files matched your search

@@ -5,6 +5,8 @@ import java.util.List;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import javax.annotation.Nullable;
public interface IGuiWrapper
{
void drawTexturedRect(int x, int y, int u, int v, int w, int h);
@@ -15,5 +17,6 @@ public interface IGuiWrapper
void displayTooltips(List<String> list, int xAxis, int yAxis);
@Nullable
FontRenderer getFont();
}
@@ -29,25 +29,27 @@ import java.util.Set;
public abstract class BaseRecipeCategory implements IRecipeCategory, IGuiWrapper
{
public static final GuiDummy gui = new GuiDummy();
private static final GuiDummy gui = new GuiDummy();
public IGuiHelper guiHelper;
protected IGuiHelper guiHelper;
public String recipeName;
public String unlocalizedName;
private String recipeName;
private String unlocalizedName;
public String guiTexture;
public ResourceLocation guiLocation;
protected String guiTexture;
protected ResourceLocation guiLocation;
@Nullable
public ProgressBar progressBar;
public ITickTimer timer;
protected ProgressBar progressBar;
protected ITickTimer timer;
public int xOffset = 28;
public int yOffset = 16;
protected int xOffset = 28;
protected int yOffset = 16;
public IDrawable fluidOverlayLarge;
public IDrawable fluidOverlaySmall;
protected IDrawable fluidOverlayLarge;
protected IDrawable fluidOverlaySmall;
protected Set<GuiElement> guiElements = new HashSet<>();
public BaseRecipeCategory(IGuiHelper helper, String gui, String name, String unlocalized, @Nullable ProgressBar progress)
{
@@ -132,8 +134,6 @@ public abstract class BaseRecipeCategory implements IRecipeCategory, IGuiWrapper
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
}
public Set<GuiElement> guiElements = new HashSet<>();
public void addGuiElements() {}
public static class GuiDummy extends Gui {}
@@ -150,7 +150,7 @@ public abstract class BaseRecipeCategory implements IRecipeCategory, IGuiWrapper
return Collections.emptyList();
}
protected void initGas(IGuiIngredientGroup<GasStack> group, int slot, boolean input, int x, int y, int width, int height, GasStack stack, boolean overlay)
protected void initGas(IGuiIngredientGroup<GasStack> group, int slot, boolean input, int x, int y, int width, int height, @Nullable GasStack stack, boolean overlay)
{
if(stack == null) return;
@@ -29,7 +29,6 @@ import mekanism.client.gui.GuiThermalEvaporationController;
import mekanism.client.gui.element.GuiProgress.ProgressBar;
import mekanism.client.jei.gas.GasStackRenderer;
import mekanism.client.jei.machine.AdvancedMachineRecipeCategory;
import mekanism.client.jei.machine.BaseRecipeHandler;
import mekanism.client.jei.machine.ChanceMachineRecipeCategory;
import mekanism.client.jei.machine.MachineRecipeCategory;
import mekanism.client.jei.machine.advanced.ChemicalInjectionChamberRecipeWrapper;
@@ -72,6 +71,9 @@ import mekanism.common.block.states.BlockStateMachine.MachineType;
import mekanism.common.inventory.container.ContainerFormulaicAssemblicator;
import mekanism.common.inventory.container.ContainerRobitInventory;
import mekanism.common.recipe.RecipeHandler.Recipe;
import mekanism.common.recipe.machines.AdvancedMachineRecipe;
import mekanism.common.recipe.machines.BasicMachineRecipe;
import mekanism.common.recipe.machines.ChanceMachineRecipe;
import mekanism.common.recipe.machines.ChemicalInfuserRecipe;
import mekanism.common.recipe.machines.CombinerRecipe;
import mekanism.common.recipe.machines.CrusherRecipe;
@@ -157,7 +159,7 @@ public class MekanismJEI implements IModPlugin
ElectrolyticSeparatorRecipeCategory electrolyticSeparatorCategory = new ElectrolyticSeparatorRecipeCategory(registry.getJeiHelpers().getGuiHelper());
MetallurgicInfuserRecipeCategory metallurgicInfuserCategory = new MetallurgicInfuserRecipeCategory(registry.getJeiHelpers().getGuiHelper());
PRCRecipeCategory prcCategory = new PRCRecipeCategory(registry.getJeiHelpers().getGuiHelper());
// RotaryCondensentratorRecipeCategory rotaryCondensentratorCategory = new RotaryCondensentratorRecipeCategory(registry.getJeiHelpers().getGuiHelper());
RotaryCondensentratorRecipeCategory rotaryCondensentratorCategory = new RotaryCondensentratorRecipeCategory(registry.getJeiHelpers().getGuiHelper());
SolarNeutronRecipeCategory solarNeutronCategory = new SolarNeutronRecipeCategory(registry.getJeiHelpers().getGuiHelper());
ThermalEvaporationRecipeCategory thermalEvaporationCategory = new ThermalEvaporationRecipeCategory(registry.getJeiHelpers().getGuiHelper());
@@ -172,7 +174,7 @@ public class MekanismJEI implements IModPlugin
MachineRecipeCategory machineRecipeCategoryCrusher = new MachineRecipeCategory(registry.getJeiHelpers().getGuiHelper(), Recipe.CRUSHER.name().toLowerCase(), "tile.MachineBlock.Crusher.name", ProgressBar.CRUSH);
registry.addRecipeCategories(chemicalCrystallizerCategory, chemicalDissolutionChamberCategory, chemicalInfuserCategory, chemicalOxidizerCategory,
chemicalWasherCategory, electrolyticSeparatorCategory, metallurgicInfuserCategory, prcCategory, /*rotaryCondensentratorCategory,*/ solarNeutronCategory,
chemicalWasherCategory, electrolyticSeparatorCategory, metallurgicInfuserCategory, prcCategory, rotaryCondensentratorCategory, solarNeutronCategory,
thermalEvaporationCategory, advancedMachineRecipeCategoryCombiner, advancedMachineRecipeCategoryPurificationChamber, advancedMachineRecipeCategoryOsmiumCompressor,
advancedMachineRecipeCategoryChemicalInjectionChamber, chanceMachineRecipeCategoryPrecisionSawmill, machineRecipeCategoryEnrichment,
machineRecipeCategoryCrusher
@@ -188,25 +190,25 @@ public class MekanismJEI implements IModPlugin
registry.getJeiHelpers().getIngredientBlacklist().addIngredientToBlacklist(new ItemStack(MekanismBlocks.BoundingBlock));
registry.handleRecipes(EnrichmentRecipe.class, EnrichmentRecipeWrapper::new, "mekanism.enrichment_chamber");
addRecipes(registry, Recipe.ENRICHMENT_CHAMBER, EnrichmentRecipe.class, EnrichmentRecipeWrapper.class, "mekanism.enrichment_chamber");
addRecipes(registry, Recipe.ENRICHMENT_CHAMBER, BasicMachineRecipe.class, EnrichmentRecipeWrapper.class, "mekanism.enrichment_chamber");
registry.handleRecipes(CrusherRecipe.class, CrusherRecipeWrapper::new, "mekanism.crusher");
addRecipes(registry, Recipe.CRUSHER, CrusherRecipe.class, CrusherRecipeWrapper.class, "mekanism.crusher");
addRecipes(registry, Recipe.CRUSHER, BasicMachineRecipe.class, CrusherRecipeWrapper.class, "mekanism.crusher");
registry.handleRecipes(CombinerRecipe.class, CombinerRecipeWrapper::new, "mekanism.combiner");
addRecipes(registry, Recipe.COMBINER, CombinerRecipe.class, CombinerRecipeWrapper.class, "mekanism.combiner");
addRecipes(registry, Recipe.COMBINER, AdvancedMachineRecipe.class, CombinerRecipeWrapper.class, "mekanism.combiner");
registry.handleRecipes(PurificationRecipe.class, PurificationChamberRecipeWrapper::new, "mekanism.purification_chamber");
addRecipes(registry, Recipe.PURIFICATION_CHAMBER, PurificationRecipe.class, PurificationChamberRecipeWrapper.class, "mekanism.purification_chamber");
addRecipes(registry, Recipe.PURIFICATION_CHAMBER, AdvancedMachineRecipe.class, PurificationChamberRecipeWrapper.class, "mekanism.purification_chamber");
registry.handleRecipes(OsmiumCompressorRecipe.class, OsmiumCompressorRecipeWrapper::new, "mekanism.osmium_compressor");
addRecipes(registry, Recipe.OSMIUM_COMPRESSOR, OsmiumCompressorRecipe.class, OsmiumCompressorRecipeWrapper.class, "mekanism.osmium_compressor");
addRecipes(registry, Recipe.OSMIUM_COMPRESSOR, AdvancedMachineRecipe.class, OsmiumCompressorRecipeWrapper.class, "mekanism.osmium_compressor");
registry.handleRecipes(InjectionRecipe.class, ChemicalInjectionChamberRecipeWrapper::new, "mekanism.chemical_injection_chamber");
addRecipes(registry, Recipe.CHEMICAL_INJECTION_CHAMBER, InjectionRecipe.class, ChemicalInjectionChamberRecipeWrapper.class, "mekanism.chemical_injection_chamber");
addRecipes(registry, Recipe.CHEMICAL_INJECTION_CHAMBER, AdvancedMachineRecipe.class, ChemicalInjectionChamberRecipeWrapper.class, "mekanism.chemical_injection_chamber");
registry.handleRecipes(SawmillRecipe.class, PrecisionSawmillRecipeWrapper::new, "mekanism.precision_sawmill");
addRecipes(registry, Recipe.PRECISION_SAWMILL, SawmillRecipe.class, PrecisionSawmillRecipeWrapper.class, "mekanism.precision_sawmill");
addRecipes(registry, Recipe.PRECISION_SAWMILL, ChanceMachineRecipe.class, PrecisionSawmillRecipeWrapper.class, "mekanism.precision_sawmill");
registry.handleRecipes(MetallurgicInfuserRecipe.class, MetallurgicInfuserRecipeWrapper::new, "mekanism.metallurgic_infuser");
addRecipes(registry, Recipe.METALLURGIC_INFUSER, MetallurgicInfuserRecipe.class, MetallurgicInfuserRecipeWrapper.class, "mekanism.metallurgic_infuser");
@@ -238,26 +240,18 @@ public class MekanismJEI implements IModPlugin
registry.handleRecipes(PressurizedRecipe.class, PRCRecipeWrapper::new, "mekanism.pressurized_reaction_chamber");
addRecipes(registry, Recipe.PRESSURIZED_REACTION_CHAMBER, PressurizedRecipe.class, PRCRecipeWrapper.class, "mekanism.pressurized_reaction_chamber");
//TODO Update these to new JEI API
List<RotaryCondensentratorRecipeWrapper> condensentratorRecipes = new ArrayList<>();
RotaryCondensentratorRecipeCategory rotaryCondensentratorCategory = new RotaryCondensentratorRecipeCategory(registry.getJeiHelpers().getGuiHelper());
registry.addRecipeCategories(rotaryCondensentratorCategory);
registry.addRecipeHandlers(new BaseRecipeHandler(rotaryCondensentratorCategory, RotaryCondensentratorRecipeWrapper.class));
for(Gas gas : GasRegistry.getRegisteredGasses())
{
if(gas.hasFluid())
{
condensentratorRecipes.add(new RotaryCondensentratorRecipeWrapper(gas.getFluid(), gas, true, rotaryCondensentratorCategory));
condensentratorRecipes.add(new RotaryCondensentratorRecipeWrapper(gas.getFluid(), gas, false, rotaryCondensentratorCategory));
condensentratorRecipes.add(new RotaryCondensentratorRecipeWrapper(gas.getFluid(), gas, true));
condensentratorRecipes.add(new RotaryCondensentratorRecipeWrapper(gas.getFluid(), gas, false));
}
}
//-TODO
registry.addRecipes(condensentratorRecipes, rotaryCondensentratorCategory.getUid());
registry.addRecipes(condensentratorRecipes, "mekanism.rotary_condensentrator");
registry.addRecipeClickArea(GuiEnrichmentChamber.class, 79, 40, 24, 7, "mekanism.enrichment_chamber");
registry.addRecipeClickArea(GuiCrusher.class, 79, 40, 24, 7, "mekanism.crusher");
registry.addRecipeClickArea(GuiCombiner.class, 79, 40, 24, 7, "mekanism.combiner");
@@ -28,7 +28,7 @@ import javax.annotation.Nullable;
public class AdvancedMachineRecipeCategory extends BaseRecipeCategory
{
private IDrawable background;
private final IDrawable background;
@Nullable
private AdvancedMachineRecipe tempRecipe;
@@ -74,15 +74,12 @@ public class AdvancedMachineRecipeCategory extends BaseRecipeCategory
@Override
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients)
{
if(recipeWrapper instanceof AdvancedMachineRecipeWrapper)
{
tempRecipe = ((AdvancedMachineRecipeWrapper)recipeWrapper).getRecipe();
}
if(tempRecipe == null)
if(!(recipeWrapper instanceof AdvancedMachineRecipeWrapper))
{
return;
}
tempRecipe = ((AdvancedMachineRecipeWrapper)recipeWrapper).getRecipe();
AdvancedMachineInput input = (AdvancedMachineInput)tempRecipe.recipeInput;
@@ -13,7 +13,7 @@ import net.minecraft.item.ItemStack;
public abstract class AdvancedMachineRecipeWrapper implements IRecipeWrapper
{
private AdvancedMachineRecipe recipe;
private final AdvancedMachineRecipe recipe;
public AdvancedMachineRecipeWrapper(AdvancedMachineRecipe r)
{
@@ -1,46 +0,0 @@
package mekanism.client.jei.machine;
import mekanism.client.jei.BaseRecipeCategory;
import mezz.jei.api.recipe.IRecipeHandler;
import mezz.jei.api.recipe.IRecipeWrapper;
import javax.annotation.Nonnull;
public class BaseRecipeHandler<CATEGORY extends BaseRecipeCategory, WRAPPER extends BaseRecipeWrapper> implements IRecipeHandler<WRAPPER>
{
private final CATEGORY category;
public Class<WRAPPER> wrapperClass;
public BaseRecipeHandler(CATEGORY c, Class<WRAPPER> wrapper)
{
category = c;
wrapperClass = wrapper;
}
@Override
public Class<WRAPPER> getRecipeClass()
{
return wrapperClass;
}
@Nonnull
@Override
public IRecipeWrapper getRecipeWrapper(@Nonnull WRAPPER recipe)
{
return recipe;
}
@Override
public boolean isRecipeValid(@Nonnull WRAPPER recipe)
{
return recipe.getCategory() == category;
}
@Override
public String getRecipeCategoryUid(@Nonnull WRAPPER recipe)
{
return category.getUid();
}
}
@@ -1,9 +0,0 @@
package mekanism.client.jei.machine;
import mekanism.client.jei.BaseRecipeCategory;
import mezz.jei.api.recipe.BlankRecipeWrapper;
public abstract class BaseRecipeWrapper extends BlankRecipeWrapper
{
public abstract BaseRecipeCategory getCategory();
}
@@ -26,7 +26,7 @@ import javax.annotation.Nullable;
public class ChanceMachineRecipeCategory extends BaseRecipeCategory
{
private IDrawable background;
private final IDrawable background;
@Nullable
private ChanceMachineRecipe tempRecipe;
@@ -71,15 +71,12 @@ public class ChanceMachineRecipeCategory extends BaseRecipeCategory
@Override
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients)
{
if(recipeWrapper instanceof ChanceMachineRecipeWrapper)
{
tempRecipe = ((ChanceMachineRecipeWrapper)recipeWrapper).getRecipe();
}
if(tempRecipe == null)
if(!(recipeWrapper instanceof ChanceMachineRecipeWrapper))
{
return;
}
tempRecipe = ((ChanceMachineRecipeWrapper)recipeWrapper).getRecipe();
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
@@ -14,7 +14,7 @@ import java.util.Arrays;
public class ChanceMachineRecipeWrapper implements IRecipeWrapper
{
private ChanceMachineRecipe recipe;
private final ChanceMachineRecipe recipe;
public ChanceMachineRecipeWrapper(ChanceMachineRecipe r)
{
@@ -24,7 +24,7 @@ import javax.annotation.Nullable;
public class MachineRecipeCategory extends BaseRecipeCategory
{
private IDrawable background;
private final IDrawable background;
@Nullable
private BasicMachineRecipe tempRecipe;
@@ -69,15 +69,12 @@ public class MachineRecipeCategory extends BaseRecipeCategory
@Override
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients)
{
if(recipeWrapper instanceof MachineRecipeWrapper)
{
tempRecipe = ((MachineRecipeWrapper)recipeWrapper).getRecipe();
}
if(tempRecipe == null)
if(!(recipeWrapper instanceof MachineRecipeWrapper))
{
return;
}
tempRecipe = ((MachineRecipeWrapper)recipeWrapper).getRecipe();
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
@@ -9,7 +9,7 @@ import net.minecraft.item.ItemStack;
public class MachineRecipeWrapper implements IRecipeWrapper
{
private BasicMachineRecipe recipe;
private final BasicMachineRecipe recipe;
public MachineRecipeWrapper(BasicMachineRecipe r)
{
@@ -17,7 +17,7 @@ import javax.annotation.Nullable;
public class ChemicalCrystallizerRecipeCategory extends BaseRecipeCategory
{
private IDrawable background;
private final IDrawable background;
@Nullable
private CrystallizerRecipe tempRecipe;
@@ -50,15 +50,12 @@ public class ChemicalCrystallizerRecipeCategory extends BaseRecipeCategory
@Override
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients)
{
if(recipeWrapper instanceof ChemicalCrystallizerRecipeWrapper)
{
tempRecipe = ((ChemicalCrystallizerRecipeWrapper)recipeWrapper).getRecipe();
}
if(tempRecipe == null)
if(!(recipeWrapper instanceof ChemicalCrystallizerRecipeWrapper))
{
return;
}
tempRecipe = ((ChemicalCrystallizerRecipeWrapper)recipeWrapper).getRecipe();
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
@@ -8,7 +8,7 @@ import net.minecraft.item.ItemStack;
public class ChemicalCrystallizerRecipeWrapper implements IRecipeWrapper
{
private CrystallizerRecipe recipe;
private final CrystallizerRecipe recipe;
public ChemicalCrystallizerRecipeWrapper(CrystallizerRecipe r)
{
@@ -18,7 +18,7 @@ import javax.annotation.Nullable;
public class ChemicalDissolutionChamberRecipeCategory extends BaseRecipeCategory
{
private IDrawable background;
private final IDrawable background;
@Nullable
private DissolutionRecipe tempRecipe;
@@ -51,15 +51,12 @@ public class ChemicalDissolutionChamberRecipeCategory extends BaseRecipeCategory
@Override
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients)
{
if(recipeWrapper instanceof ChemicalDissolutionChamberRecipeWrapper)
{
tempRecipe = ((ChemicalDissolutionChamberRecipeWrapper)recipeWrapper).getRecipe();
}
if(tempRecipe == null)
if(!(recipeWrapper instanceof ChemicalDissolutionChamberRecipeWrapper))
{
return;
}
tempRecipe = ((ChemicalDissolutionChamberRecipeWrapper)recipeWrapper).getRecipe();
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
@@ -9,7 +9,7 @@ import net.minecraft.item.ItemStack;
public class ChemicalDissolutionChamberRecipeWrapper implements IRecipeWrapper
{
private DissolutionRecipe recipe;
private final DissolutionRecipe recipe;
public ChemicalDissolutionChamberRecipeWrapper(DissolutionRecipe r)
{
@@ -16,7 +16,7 @@ import javax.annotation.Nullable;
public class ChemicalInfuserRecipeCategory extends BaseRecipeCategory
{
private IDrawable background;
private final IDrawable background;
@Nullable
private ChemicalInfuserRecipe tempRecipe;
@@ -49,15 +49,12 @@ public class ChemicalInfuserRecipeCategory extends BaseRecipeCategory
@Override
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients)
{
if(recipeWrapper instanceof ChemicalInfuserRecipeWrapper)
{
tempRecipe = ((ChemicalInfuserRecipeWrapper)recipeWrapper).getRecipe();
}
if(tempRecipe == null)
if(!(recipeWrapper instanceof ChemicalInfuserRecipeWrapper))
{
return;
}
tempRecipe = ((ChemicalInfuserRecipeWrapper)recipeWrapper).getRecipe();
IGuiIngredientGroup<GasStack> gasStacks = recipeLayout.getIngredientsGroup(GasStack.class);
@@ -9,7 +9,7 @@ import mezz.jei.api.recipe.IRecipeWrapper;
public class ChemicalInfuserRecipeWrapper implements IRecipeWrapper
{
private ChemicalInfuserRecipe recipe;
private final ChemicalInfuserRecipe recipe;
public ChemicalInfuserRecipeWrapper(ChemicalInfuserRecipe r)
{
@@ -25,13 +25,11 @@ import javax.annotation.Nullable;
public class ChemicalOxidizerRecipeCategory extends BaseRecipeCategory
{
private IDrawable background;
private final IDrawable background;
@Nullable
private OxidationRecipe tempRecipe;
private GuiGasGauge gasOutput = GuiGasGauge.getDummy(GuiGauge.Type.STANDARD, this, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalOxidizer.png"), 133, 13);
public ChemicalOxidizerRecipeCategory(IGuiHelper helper)
{
super(helper, "mekanism:gui/GuiChemicalOxidizer.png", "chemical_oxidizer", "tile.MachineBlock2.ChemicalOxidizer.name", ProgressBar.LARGE_RIGHT);
@@ -45,7 +43,7 @@ public class ChemicalOxidizerRecipeCategory extends BaseRecipeCategory
@Override
public void addGuiElements()
{
guiElements.add(gasOutput);
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));
@@ -68,15 +66,12 @@ public class ChemicalOxidizerRecipeCategory extends BaseRecipeCategory
@Override
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients)
{
if(recipeWrapper instanceof ChemicalOxidizerRecipeWrapper)
{
tempRecipe = ((ChemicalOxidizerRecipeWrapper)recipeWrapper).getRecipe();
}
if(tempRecipe == null)
if(!(recipeWrapper instanceof ChemicalOxidizerRecipeWrapper))
{
return;
}
tempRecipe = ((ChemicalOxidizerRecipeWrapper)recipeWrapper).getRecipe();
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
@@ -8,7 +8,7 @@ import net.minecraft.item.ItemStack;
public class ChemicalOxidizerRecipeWrapper implements IRecipeWrapper
{
private OxidationRecipe recipe;
private final OxidationRecipe recipe;
public ChemicalOxidizerRecipeWrapper(OxidationRecipe r)
{
@@ -18,7 +18,7 @@ import javax.annotation.Nullable;
public class ChemicalWasherRecipeCategory extends BaseRecipeCategory
{
private IDrawable background;
private final IDrawable background;
@Nullable
private WasherRecipe tempRecipe;
@@ -50,15 +50,12 @@ public class ChemicalWasherRecipeCategory extends BaseRecipeCategory
@Override
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients)
{
if(recipeWrapper instanceof ChemicalWasherRecipeWrapper)
{
tempRecipe = ((ChemicalWasherRecipeWrapper)recipeWrapper).getRecipe();
}
if(tempRecipe == null)
if(!(recipeWrapper instanceof ChemicalWasherRecipeWrapper))
{
return;
}
tempRecipe = ((ChemicalWasherRecipeWrapper)recipeWrapper).getRecipe();
IGuiFluidStackGroup fluidStacks = recipeLayout.getFluidStacks();
@@ -9,7 +9,7 @@ import net.minecraftforge.fluids.FluidStack;
public class ChemicalWasherRecipeWrapper implements IRecipeWrapper
{
private WasherRecipe recipe;
private final WasherRecipe recipe;
public ChemicalWasherRecipeWrapper(WasherRecipe r)
{
@@ -30,10 +30,7 @@ import javax.annotation.Nullable;
public class ElectrolyticSeparatorRecipeCategory extends BaseRecipeCategory
{
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);
private final IDrawable background;
@Nullable
private SeparatorRecipe tempRecipe;
@@ -52,8 +49,8 @@ public class ElectrolyticSeparatorRecipeCategory extends BaseRecipeCategory
public void addGuiElements()
{
guiElements.add(GuiFluidGauge.getDummy(GuiGauge.Type.STANDARD, this, MekanismUtils.getResource(ResourceType.GUI, "GuiElectrolyticSeparator.png"), 5, 10));
guiElements.add(leftGas);
guiElements.add(rightGas);
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(new GuiPowerBar(this, new IPowerInfoHandler() {
@Override
public double getLevel()
@@ -86,15 +83,12 @@ public class ElectrolyticSeparatorRecipeCategory extends BaseRecipeCategory
@Override
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients)
{
if(recipeWrapper instanceof ElectrolyticSeparatorRecipeWrapper)
{
tempRecipe = ((ElectrolyticSeparatorRecipeWrapper)recipeWrapper).getRecipe();
}
if(tempRecipe == null)
if(!(recipeWrapper instanceof ElectrolyticSeparatorRecipeWrapper))
{
return;
}
tempRecipe = ((ElectrolyticSeparatorRecipeWrapper)recipeWrapper).getRecipe();
IGuiFluidStackGroup fluidStacks = recipeLayout.getFluidStacks();
@@ -10,7 +10,7 @@ import net.minecraftforge.fluids.FluidStack;
public class ElectrolyticSeparatorRecipeWrapper implements IRecipeWrapper
{
private SeparatorRecipe recipe;
private final SeparatorRecipe recipe;
public ElectrolyticSeparatorRecipeWrapper(SeparatorRecipe r)
{
@@ -33,7 +33,7 @@ import java.util.Map;
public class MetallurgicInfuserRecipeCategory extends BaseRecipeCategory
{
private IDrawable background;
private final IDrawable background;
@Nullable
private MetallurgicInfuserRecipe tempRecipe;
@@ -111,15 +111,12 @@ public class MetallurgicInfuserRecipeCategory extends BaseRecipeCategory
@Override
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients)
{
if(recipeWrapper instanceof MetallurgicInfuserRecipeWrapper)
{
tempRecipe = ((MetallurgicInfuserRecipeWrapper)recipeWrapper).getRecipe();
}
if(tempRecipe == null)
if(!(recipeWrapper instanceof MetallurgicInfuserRecipeWrapper))
{
return;
}
tempRecipe = ((MetallurgicInfuserRecipeWrapper)recipeWrapper).getRecipe();
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
@@ -10,7 +10,7 @@ import java.util.List;
public class MetallurgicInfuserRecipeWrapper implements IRecipeWrapper
{
private MetallurgicInfuserRecipe recipe;
private final MetallurgicInfuserRecipe recipe;
public MetallurgicInfuserRecipeWrapper(MetallurgicInfuserRecipe r)
{
@@ -28,10 +28,7 @@ import javax.annotation.Nullable;
public class PRCRecipeCategory extends BaseRecipeCategory
{
private IDrawable background;
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);
private final IDrawable background;
@Nullable
private PressurizedRecipe tempRecipe;
@@ -54,8 +51,8 @@ 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));
guiElements.add(gasInput);
guiElements.add(gasOutput);
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
@@ -83,15 +80,12 @@ public class PRCRecipeCategory extends BaseRecipeCategory
@Override
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients)
{
if(recipeWrapper instanceof PRCRecipeWrapper)
{
tempRecipe = ((PRCRecipeWrapper)recipeWrapper).getRecipe();
}
if(tempRecipe == null)
if(!(recipeWrapper instanceof PRCRecipeWrapper))
{
return;
}
tempRecipe = ((PRCRecipeWrapper)recipeWrapper).getRecipe();
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
@@ -9,7 +9,7 @@ import net.minecraftforge.fluids.FluidStack;
public class PRCRecipeWrapper implements IRecipeWrapper
{
private PressurizedRecipe recipe;
private final PressurizedRecipe recipe;
public PRCRecipeWrapper(PressurizedRecipe r)
{
@@ -13,11 +13,14 @@ import net.minecraft.client.Minecraft;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.FluidStack;
import javax.annotation.Nullable;
public class RotaryCondensentratorRecipeCategory extends BaseRecipeCategory
{
public IDrawable background;
public RotaryCondensentratorRecipeWrapper tempRecipe;
private final IDrawable background;
@Nullable
private RotaryCondensentratorRecipeWrapper tempRecipe;
public RotaryCondensentratorRecipeCategory(IGuiHelper helper)
{
@@ -33,6 +36,11 @@ public class RotaryCondensentratorRecipeCategory extends BaseRecipeCategory
public void drawExtras(Minecraft minecraft)
{
super.drawExtras(minecraft);
if(tempRecipe == null)
{
return;
}
if(tempRecipe.condensentrating)
{
@@ -52,10 +60,12 @@ public class RotaryCondensentratorRecipeCategory extends BaseRecipeCategory
@Override
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients)
{
if(recipeWrapper instanceof RotaryCondensentratorRecipeWrapper)
if(!(recipeWrapper instanceof RotaryCondensentratorRecipeWrapper))
{
tempRecipe = (RotaryCondensentratorRecipeWrapper)recipeWrapper;
return;
}
tempRecipe = (RotaryCondensentratorRecipeWrapper)recipeWrapper;
IGuiFluidStackGroup fluidStacks = recipeLayout.getFluidStacks();
IGuiIngredientGroup<GasStack> gasStacks = recipeLayout.getIngredientsGroup(GasStack.class);
@@ -4,29 +4,26 @@ import javax.annotation.Nonnull;
import mekanism.api.gas.Gas;
import mekanism.api.gas.GasStack;
import mekanism.client.jei.machine.BaseRecipeWrapper;
import mekanism.common.util.LangUtils;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
public class RotaryCondensentratorRecipeWrapper extends BaseRecipeWrapper
public class RotaryCondensentratorRecipeWrapper implements IRecipeWrapper
{
public Fluid fluidType;
public Gas gasType;
public boolean condensentrating = true;
public RotaryCondensentratorRecipeCategory category;
public RotaryCondensentratorRecipeWrapper(Fluid fluid, Gas gas, boolean b, RotaryCondensentratorRecipeCategory c)
public RotaryCondensentratorRecipeWrapper(Fluid fluid, Gas gas, boolean b)
{
fluidType = fluid;
gasType = gas;
condensentrating = b;
category = c;
}
@Override
@@ -48,10 +45,4 @@ public class RotaryCondensentratorRecipeWrapper extends BaseRecipeWrapper
{
minecraft.fontRenderer.drawString(condensentrating ? LangUtils.localize("gui.condensentrating") : LangUtils.localize("gui.decondensentrating"), 6-3, 74-12, 0x404040, false);
}
@Override
public RotaryCondensentratorRecipeCategory getCategory()
{
return category;
}
}
@@ -16,7 +16,7 @@ import javax.annotation.Nullable;
public class SolarNeutronRecipeCategory extends BaseRecipeCategory
{
private IDrawable background;
private final IDrawable background;
@Nullable
private SolarNeutronRecipe tempRecipe;
@@ -48,15 +48,12 @@ public class SolarNeutronRecipeCategory extends BaseRecipeCategory
@Override
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients)
{
if(recipeWrapper instanceof SolarNeutronRecipeWrapper)
{
tempRecipe = ((SolarNeutronRecipeWrapper)recipeWrapper).getRecipe();
}
if(tempRecipe == null)
if(!(recipeWrapper instanceof SolarNeutronRecipeWrapper))
{
return;
}
tempRecipe = ((SolarNeutronRecipeWrapper)recipeWrapper).getRecipe();
IGuiIngredientGroup<GasStack> gasStacks = recipeLayout.getIngredientsGroup(GasStack.class);
@@ -7,7 +7,7 @@ import mezz.jei.api.recipe.IRecipeWrapper;
public class SolarNeutronRecipeWrapper implements IRecipeWrapper
{
private SolarNeutronRecipe recipe;
private final SolarNeutronRecipe recipe;
public SolarNeutronRecipeWrapper(SolarNeutronRecipe r)
{
@@ -15,7 +15,7 @@ import javax.annotation.Nullable;
public class ThermalEvaporationRecipeCategory extends BaseRecipeCategory
{
private IDrawable background;
private final IDrawable background;
@Nullable
private ThermalEvaporationRecipe tempRecipe;
@@ -47,15 +47,12 @@ public class ThermalEvaporationRecipeCategory extends BaseRecipeCategory
@Override
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients)
{
if(recipeWrapper instanceof ThermalEvaporationRecipeWrapper)
{
tempRecipe = ((ThermalEvaporationRecipeWrapper)recipeWrapper).getRecipe();
}
if(tempRecipe == null)
if(!(recipeWrapper instanceof ThermalEvaporationRecipeWrapper))
{
return;
}
tempRecipe = ((ThermalEvaporationRecipeWrapper)recipeWrapper).getRecipe();
IGuiFluidStackGroup fluidStacks = recipeLayout.getFluidStacks();
@@ -7,7 +7,7 @@ import net.minecraftforge.fluids.FluidStack;
public class ThermalEvaporationRecipeWrapper implements IRecipeWrapper
{
private ThermalEvaporationRecipe recipe;
private final ThermalEvaporationRecipe recipe;
public ThermalEvaporationRecipeWrapper(ThermalEvaporationRecipe r)
{