Updated NEI module to reflect new GUI changes, added PRC to RecipeHelper

This commit is contained in:
Aidan C. Brady 2014-06-14 18:33:48 +02:00
parent 3b99d376a4
commit 5c36612146
38 changed files with 336 additions and 109 deletions

View file

@ -207,7 +207,7 @@ public final class RecipeHelper
}
/**
* Add a Electrolytic Separator recipe.
* Add a Chemical Crystallizer recipe.
* @param input - input GasStack
* @param output - output ItemStack
*/
@ -237,4 +237,22 @@ public final class RecipeHelper
System.err.println("Error while adding recipe: " + e.getMessage());
}
}
/**
* Add a Pressurized Reaction Chamber recipe.
* @param input - input PressurizedReactants
* @param output - output PressurizedProducts
* @param extraEnergy - extra energy needed by the recipe
* @param ticks - amount of ticks it takes for this recipe to complete
*/
public static void addPRCRecipe(PressurizedReactants input, PressurizedProducts output, double extraEnergy, int ticks)
{
try {
Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler");
Method m = recipeClass.getMethod("addPRCRecipe", PressurizedReactants.class, PressurizedProducts.class, Double.TYPE, Integer.TYPE);
m.invoke(null, input, output);
} catch(Exception e) {
System.err.println("Error while adding recipe: " + e.getMessage());
}
}
}

View file

@ -6,6 +6,7 @@ import mekanism.api.ListUtils;
import mekanism.api.gas.GasStack;
import mekanism.client.gui.GuiEnergyInfo.IInfoHandler;
import mekanism.client.gui.GuiProgress.IProgressInfoHandler;
import mekanism.client.gui.GuiProgress.ProgressBar;
import mekanism.client.gui.GuiSlot.SlotOverlay;
import mekanism.client.gui.GuiSlot.SlotType;
import mekanism.client.render.MekanismRenderer;
@ -54,7 +55,12 @@ public class GuiAdvancedElectricMachine extends GuiMekanism
{
return tileEntity.getScaledProgress();
}
}, tileEntity.getProgressType(), this, tileEntity.guiLocation, 77, 37));
}, getProgressType(), this, tileEntity.guiLocation, 77, 37));
}
public ProgressBar getProgressType()
{
return ProgressBar.BLUE;
}
@Override

View file

@ -5,6 +5,7 @@ import java.util.List;
import mekanism.api.ListUtils;
import mekanism.client.gui.GuiEnergyInfo.IInfoHandler;
import mekanism.client.gui.GuiProgress.IProgressInfoHandler;
import mekanism.client.gui.GuiProgress.ProgressBar;
import mekanism.client.gui.GuiSlot.SlotOverlay;
import mekanism.client.gui.GuiSlot.SlotType;
import mekanism.common.inventory.container.ContainerChanceMachine;
@ -51,7 +52,12 @@ public class GuiChanceMachine extends GuiMekanism
{
return tileEntity.getScaledProgress();
}
}, tileEntity.getProgressType(), this, tileEntity.guiLocation, 77, 37));
}, getProgressType(), this, tileEntity.guiLocation, 77, 37));
}
public ProgressBar getProgressType()
{
return ProgressBar.BLUE;
}
@Override

View file

@ -1,5 +1,6 @@
package mekanism.client.gui;
import mekanism.client.gui.GuiProgress.ProgressBar;
import mekanism.common.tile.TileEntityAdvancedElectricMachine;
import net.minecraft.entity.player.InventoryPlayer;
import cpw.mods.fml.relauncher.Side;
@ -12,4 +13,10 @@ public class GuiChemicalInjectionChamber extends GuiAdvancedElectricMachine
{
super(inventory, tentity);
}
@Override
public ProgressBar getProgressType()
{
return ProgressBar.YELLOW;
}
}

View file

@ -1,5 +1,6 @@
package mekanism.client.gui;
import mekanism.client.gui.GuiProgress.ProgressBar;
import mekanism.common.tile.TileEntityAdvancedElectricMachine;
import net.minecraft.entity.player.InventoryPlayer;
import cpw.mods.fml.relauncher.Side;
@ -12,4 +13,10 @@ public class GuiCombiner extends GuiAdvancedElectricMachine
{
super(inventory, tentity);
}
@Override
public ProgressBar getProgressType()
{
return ProgressBar.STONE;
}
}

View file

@ -1,5 +1,6 @@
package mekanism.client.gui;
import mekanism.client.gui.GuiProgress.ProgressBar;
import mekanism.common.tile.TileEntityElectricMachine;
import net.minecraft.entity.player.InventoryPlayer;
import cpw.mods.fml.relauncher.Side;
@ -12,4 +13,10 @@ public class GuiCrusher extends GuiElectricMachine
{
super(inventory, tentity);
}
@Override
public ProgressBar getProgressType()
{
return ProgressBar.CRUSH;
}
}

View file

@ -5,6 +5,7 @@ import java.util.List;
import mekanism.api.ListUtils;
import mekanism.client.gui.GuiEnergyInfo.IInfoHandler;
import mekanism.client.gui.GuiProgress.IProgressInfoHandler;
import mekanism.client.gui.GuiProgress.ProgressBar;
import mekanism.client.gui.GuiSlot.SlotOverlay;
import mekanism.client.gui.GuiSlot.SlotType;
import mekanism.common.inventory.container.ContainerElectricMachine;
@ -51,7 +52,12 @@ public class GuiElectricMachine extends GuiMekanism
{
return tileEntity.getScaledProgress();
}
}, tileEntity.getProgressType(), this, tileEntity.guiLocation, 77, 37));
}, getProgressType(), this, tileEntity.guiLocation, 77, 37));
}
public ProgressBar getProgressType()
{
return ProgressBar.BLUE;
}
@Override

View file

@ -1,5 +1,6 @@
package mekanism.client.gui;
import mekanism.client.gui.GuiProgress.ProgressBar;
import mekanism.common.tile.TileEntityElectricMachine;
import net.minecraft.entity.player.InventoryPlayer;
import cpw.mods.fml.relauncher.Side;
@ -12,4 +13,10 @@ public class GuiEnergizedSmelter extends GuiElectricMachine
{
super(inventory, tentity);
}
@Override
public ProgressBar getProgressType()
{
return ProgressBar.GREEN;
}
}

View file

@ -1,5 +1,6 @@
package mekanism.client.gui;
import mekanism.client.gui.GuiProgress.ProgressBar;
import mekanism.common.tile.TileEntityElectricMachine;
import net.minecraft.entity.player.InventoryPlayer;
import cpw.mods.fml.relauncher.Side;
@ -12,4 +13,10 @@ public class GuiEnrichmentChamber extends GuiElectricMachine
{
super(inventory, tentity);
}
@Override
public ProgressBar getProgressType()
{
return ProgressBar.BLUE;
}
}

View file

@ -1,5 +1,6 @@
package mekanism.client.gui;
import mekanism.client.gui.GuiProgress.ProgressBar;
import mekanism.common.tile.TileEntityAdvancedElectricMachine;
import net.minecraft.entity.player.InventoryPlayer;
import cpw.mods.fml.relauncher.Side;
@ -12,4 +13,10 @@ public class GuiOsmiumCompressor extends GuiAdvancedElectricMachine
{
super(inventory, tentity);
}
@Override
public ProgressBar getProgressType()
{
return ProgressBar.RED;
}
}

View file

@ -16,6 +16,10 @@ import net.minecraftforge.fluids.FluidTank;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class GuiPRC extends GuiMekanism
{
public TileEntityPRC tileEntity;
@ -60,7 +64,7 @@ public class GuiPRC extends GuiMekanism
{
return tileEntity.getScaledProgress();
}
}, ProgressBar.MEDIUM, this, MekanismUtils.getResource(ResourceType.GUI, "GuiPRC.png"), 75, 37));
}, getProgressType(), this, MekanismUtils.getResource(ResourceType.GUI, "GuiPRC.png"), 75, 37));
}
@Override
@ -90,4 +94,8 @@ public class GuiPRC extends GuiMekanism
super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY);
}
public ProgressBar getProgressType()
{
return ProgressBar.MEDIUM;
}
}

View file

@ -17,15 +17,51 @@ public class GuiPowerBar extends GuiElement
private int height = 56;
private int innerOffsetY = 2;
private TileEntityElectricBlock tileEntityElectric;
private TileEntityElectricBlock tileEntity;
private IPowerInfoHandler handler;
public GuiPowerBar(IGuiWrapper gui, TileEntityElectricBlock tile, ResourceLocation def, int x, int y)
{
super(MekanismUtils.getResource(ResourceType.GUI_ELEMENT, "GuiPowerBar.png"), gui, def);
tileEntityElectric = tile;
tileEntity = tile;
handler = new IPowerInfoHandler() {
@Override
public String getTooltip()
{
return MekanismUtils.getEnergyDisplay(tileEntity.getEnergy());
}
@Override
public double getLevel()
{
return tileEntity.getEnergy()/tileEntity.getMaxEnergy();
}
};
xLocation = x;
yLocation = y;
}
public GuiPowerBar(IGuiWrapper gui, IPowerInfoHandler h, ResourceLocation def, int x, int y)
{
super(MekanismUtils.getResource(ResourceType.GUI_ELEMENT, "GuiPowerBar.png"), gui, def);
handler = h;
xLocation = x;
yLocation = y;
}
public static abstract class IPowerInfoHandler
{
public String getTooltip()
{
return null;
}
public abstract double getLevel();
}
@Override
public void renderBackground(int xAxis, int yAxis, int guiWidth, int guiHeight)
@ -33,8 +69,12 @@ public class GuiPowerBar extends GuiElement
mc.renderEngine.bindTexture(RESOURCE);
guiObj.drawTexturedRect(guiWidth + xLocation, guiHeight + yLocation, 0, 0, width, height);
int displayInt = tileEntityElectric.getScaledEnergyLevel(52) + innerOffsetY;
guiObj.drawTexturedRect(guiWidth + xLocation, guiHeight + yLocation + height - displayInt, 6, height - displayInt, width, displayInt);
if(handler.getLevel() > 0)
{
int displayInt = (int)(handler.getLevel()*52) + innerOffsetY;
guiObj.drawTexturedRect(guiWidth + xLocation, guiHeight + yLocation + height - displayInt, 6, height - displayInt, width, displayInt);
}
mc.renderEngine.bindTexture(defaultLocation);
}
@ -44,9 +84,9 @@ public class GuiPowerBar extends GuiElement
{
mc.renderEngine.bindTexture(RESOURCE);
if(xAxis >= xLocation && xAxis <= xLocation + width && yAxis >= yLocation && yAxis <= yLocation + height)
if(handler.getTooltip() != null && xAxis >= xLocation && xAxis <= xLocation + width && yAxis >= yLocation && yAxis <= yLocation + height)
{
displayTooltip(MekanismUtils.getEnergyDisplay(tileEntityElectric.getEnergy()), xAxis, yAxis);
displayTooltip(handler.getTooltip(), xAxis, yAxis);
}
mc.renderEngine.bindTexture(defaultLocation);

View file

@ -1,12 +1,22 @@
package mekanism.client.gui;
import mekanism.client.gui.GuiProgress.ProgressBar;
import mekanism.common.tile.TileEntityChanceMachine;
import net.minecraft.entity.player.InventoryPlayer;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class GuiPrecisionSawmill extends GuiChanceMachine
{
public GuiPrecisionSawmill(InventoryPlayer inventory, TileEntityChanceMachine tentity)
{
super(inventory, tentity);
}
@Override
public ProgressBar getProgressType()
{
return ProgressBar.PURPLE;
}
}

View file

@ -1,5 +1,6 @@
package mekanism.client.gui;
import mekanism.client.gui.GuiProgress.ProgressBar;
import mekanism.common.tile.TileEntityAdvancedElectricMachine;
import net.minecraft.entity.player.InventoryPlayer;
import cpw.mods.fml.relauncher.Side;
@ -12,4 +13,10 @@ public class GuiPurificationChamber extends GuiAdvancedElectricMachine
{
super(inventory, tentity);
}
@Override
public ProgressBar getProgressType()
{
return ProgressBar.RED;
}
}

View file

@ -13,8 +13,18 @@ import java.util.Set;
import mekanism.api.AdvancedInput;
import mekanism.api.gas.Gas;
import mekanism.api.gas.GasStack;
import mekanism.client.gui.GuiElement;
import mekanism.client.gui.GuiPowerBar;
import mekanism.client.gui.GuiProgress;
import mekanism.client.gui.GuiPowerBar.IPowerInfoHandler;
import mekanism.client.gui.GuiProgress.IProgressInfoHandler;
import mekanism.client.gui.GuiProgress.ProgressBar;
import mekanism.client.gui.GuiSlot;
import mekanism.client.gui.GuiSlot.SlotOverlay;
import mekanism.client.gui.GuiSlot.SlotType;
import mekanism.common.ObfuscatedNames;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.item.ItemStack;
@ -37,10 +47,31 @@ public abstract class AdvancedMachineRecipeHandler extends BaseRecipeHandler
public abstract List<ItemStack> getFuelStacks(Gas gasType);
public abstract ProgressBar getProgressType();
@Override
public void addGuiElements()
{
guiElements.add(new GuiSlot(SlotType.INPUT, this, MekanismUtils.getResource(ResourceType.GUI, getGuiTexture()), 55, 16));
guiElements.add(new GuiSlot(SlotType.POWER, this, MekanismUtils.getResource(ResourceType.GUI, getGuiTexture()), 30, 34).with(SlotOverlay.POWER));
guiElements.add(new GuiSlot(SlotType.EXTRA, this, MekanismUtils.getResource(ResourceType.GUI, getGuiTexture()), 55, 52));
guiElements.add(new GuiSlot(SlotType.OUTPUT_LARGE, this, MekanismUtils.getResource(ResourceType.GUI, getGuiTexture()), 111, 30));
guiElements.add(new GuiPowerBar(this, new IPowerInfoHandler() {
@Override
public double getLevel()
{
return ticksPassed <= 20 ? ticksPassed / 20.0F : 1.0F;
}
}, MekanismUtils.getResource(ResourceType.GUI, getGuiTexture()), 164, 15));
guiElements.add(new GuiProgress(new IProgressInfoHandler()
{
@Override
public double getProgress()
{
return ticksPassed >= 40 ? (ticksPassed - 40) % 20 / 20.0F : 0.0F;
}
}, getProgressType(), this, MekanismUtils.getResource(ResourceType.GUI, getGuiTexture()), 77, 37));
}
@Override
@ -49,6 +80,11 @@ public abstract class AdvancedMachineRecipeHandler extends BaseRecipeHandler
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
changeTexture(getGuiTexture());
drawTexturedModalRect(12, 0, 28, 5, 144, 68);
for(GuiElement e : guiElements)
{
e.renderBackground(0, 0, -16, -5);
}
}
@Override
@ -56,12 +92,9 @@ public abstract class AdvancedMachineRecipeHandler extends BaseRecipeHandler
{
CachedIORecipe recipe = (CachedIORecipe)arecipes.get(i);
float f = ticksPassed >= 20 ? (ticksPassed - 20) % 20 / 20.0F : 0;
drawProgressBar(63, 34, 176, 0, 24, 7, f, 0);
if(recipe.input.gasType != null)
if(recipe.input.gasType != null && ticksPassed >= 20)
{
int displayInt = ticksPassed < 20 ? ticksPassed*12 / 20 : 12;
int displayInt = ticksPassed < 40 ? (ticksPassed-20)*12 / 20 : 12;
displayGauge(45, 32 + 12 - displayInt, 6, displayInt, new GasStack(recipe.input.gasType, 1));
}
}

View file

@ -10,6 +10,17 @@ import java.util.Map.Entry;
import java.util.Set;
import mekanism.api.ChanceOutput;
import mekanism.client.gui.GuiElement;
import mekanism.client.gui.GuiPowerBar;
import mekanism.client.gui.GuiPowerBar.IPowerInfoHandler;
import mekanism.client.gui.GuiProgress;
import mekanism.client.gui.GuiProgress.IProgressInfoHandler;
import mekanism.client.gui.GuiProgress.ProgressBar;
import mekanism.client.gui.GuiSlot;
import mekanism.client.gui.GuiSlot.SlotOverlay;
import mekanism.client.gui.GuiSlot.SlotType;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
import net.minecraft.item.ItemStack;
import org.lwjgl.opengl.GL11;
@ -26,10 +37,30 @@ public abstract class ChanceMachineRecipeHandler extends BaseRecipeHandler
public abstract Set<Entry<ItemStack, ChanceOutput>> getRecipes();
public abstract ProgressBar getProgressType();
@Override
public void addGuiElements()
{
guiElements.add(new GuiSlot(SlotType.INPUT, this, MekanismUtils.getResource(ResourceType.GUI, getGuiTexture()), 55, 16));
guiElements.add(new GuiSlot(SlotType.POWER, this, MekanismUtils.getResource(ResourceType.GUI, getGuiTexture()), 55, 52).with(SlotOverlay.POWER));
guiElements.add(new GuiSlot(SlotType.OUTPUT_WIDE, this, MekanismUtils.getResource(ResourceType.GUI, getGuiTexture()), 111, 30));
guiElements.add(new GuiPowerBar(this, new IPowerInfoHandler() {
@Override
public double getLevel()
{
return ticksPassed <= 20 ? ticksPassed / 20.0F : 1.0F;
}
}, MekanismUtils.getResource(ResourceType.GUI, getGuiTexture()), 164, 15));
guiElements.add(new GuiProgress(new IProgressInfoHandler()
{
@Override
public double getProgress()
{
return ticksPassed >= 20 ? (ticksPassed - 20) % 20 / 20.0F : 0.0F;
}
}, getProgressType(), this, MekanismUtils.getResource(ResourceType.GUI, getGuiTexture()), 77, 37));
}
@Override
@ -38,6 +69,11 @@ public abstract class ChanceMachineRecipeHandler extends BaseRecipeHandler
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
changeTexture(getGuiTexture());
drawTexturedModalRect(12, 0, 28, 5, 144, 68);
for(GuiElement e : guiElements)
{
e.renderBackground(0, 0, -16, -5);
}
}
@Override
@ -45,11 +81,6 @@ public abstract class ChanceMachineRecipeHandler extends BaseRecipeHandler
{
CachedIORecipe recipe = (CachedIORecipe)arecipes.get(i);
float f = ticksPassed >= 20 ? (ticksPassed - 20) % 20 / 20.0F : 0.0F;
drawProgressBar(63, 34, 176, 0, 24, 7, f, 0);
f = ticksPassed <= 20 ? ticksPassed / 20.0F : 1.0F;
drawProgressBar(149, 12, 176, 7, 4, 52, f, 3);
if(recipe.output.hasSecondary())
{
drawString(Math.round(recipe.output.secondaryChance*100) + "%", 116, 52, 0x404040, false);
@ -103,7 +134,7 @@ public abstract class ChanceMachineRecipeHandler extends BaseRecipeHandler
@Override
public String getGuiTexture()
{
return "mekanism:gui/GuiAdvancedMachine.png";
return "mekanism:gui/GuiBasicMachine.png";
}
@Override

View file

@ -8,6 +8,7 @@ import mekanism.api.ListUtils;
import mekanism.api.gas.Gas;
import mekanism.api.gas.GasRegistry;
import mekanism.client.gui.GuiChemicalInjectionChamber;
import mekanism.client.gui.GuiProgress.ProgressBar;
import mekanism.common.recipe.RecipeHandler.Recipe;
import mekanism.common.util.MekanismUtils;
import net.minecraft.item.ItemStack;
@ -67,6 +68,12 @@ public class ChemicalInjectionChamberRecipeHandler extends AdvancedMachineRecipe
return new ArrayList<ItemStack>();
}
@Override
public ProgressBar getProgressType()
{
return ProgressBar.YELLOW;
}
@Override
public Class getGuiClass()

View file

@ -6,6 +6,7 @@ import java.util.Set;
import mekanism.api.ListUtils;
import mekanism.api.gas.Gas;
import mekanism.client.gui.GuiCombiner;
import mekanism.client.gui.GuiProgress.ProgressBar;
import mekanism.common.recipe.RecipeHandler.Recipe;
import mekanism.common.util.MekanismUtils;
import net.minecraft.init.Blocks;
@ -42,6 +43,12 @@ public class CombinerRecipeHandler extends AdvancedMachineRecipeHandler
{
return "mekanism:gui/GuiCombiner.png";
}
@Override
public ProgressBar getProgressType()
{
return ProgressBar.STONE;
}
@Override
public List<ItemStack> getFuelStacks(Gas gasType)

View file

@ -4,6 +4,7 @@ import java.util.Set;
import mekanism.client.gui.GuiCrusher;
import mekanism.client.gui.GuiSlot;
import mekanism.client.gui.GuiProgress.ProgressBar;
import mekanism.client.gui.GuiSlot.SlotType;
import mekanism.common.recipe.RecipeHandler.Recipe;
import mekanism.common.util.MekanismUtils;
@ -28,6 +29,12 @@ public class CrusherRecipeHandler extends MachineRecipeHandler
{
return "crusher";
}
@Override
public ProgressBar getProgressType()
{
return ProgressBar.CRUSH;
}
@Override
public Set getRecipes()

View file

@ -3,6 +3,7 @@ package mekanism.client.nei;
import java.util.Set;
import mekanism.client.gui.GuiEnrichmentChamber;
import mekanism.client.gui.GuiProgress.ProgressBar;
import mekanism.common.recipe.RecipeHandler.Recipe;
import mekanism.common.util.MekanismUtils;
@ -25,6 +26,12 @@ public class EnrichmentChamberRecipeHandler extends MachineRecipeHandler
{
return "chamber";
}
@Override
public ProgressBar getProgressType()
{
return ProgressBar.BLUE;
}
@Override
public Set getRecipes()

View file

@ -10,7 +10,9 @@ import java.util.Map.Entry;
import java.util.Set;
import mekanism.client.gui.GuiElement;
import mekanism.client.gui.GuiPowerBar;
import mekanism.client.gui.GuiProgress;
import mekanism.client.gui.GuiPowerBar.IPowerInfoHandler;
import mekanism.client.gui.GuiProgress.IProgressInfoHandler;
import mekanism.client.gui.GuiProgress.ProgressBar;
import mekanism.client.gui.GuiSlot;
@ -18,7 +20,6 @@ import mekanism.client.gui.GuiSlot.SlotOverlay;
import mekanism.client.gui.GuiSlot.SlotType;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
import net.minecraft.item.ItemStack;
import org.lwjgl.opengl.GL11;
@ -35,6 +36,8 @@ public abstract class MachineRecipeHandler extends BaseRecipeHandler
public abstract Set<Entry<ItemStack, ItemStack>> getRecipes();
public abstract ProgressBar getProgressType();
@Override
public void addGuiElements()
{
@ -42,6 +45,13 @@ public abstract class MachineRecipeHandler extends BaseRecipeHandler
guiElements.add(new GuiSlot(SlotType.POWER, this, MekanismUtils.getResource(ResourceType.GUI, getGuiTexture()), 55, 52).with(SlotOverlay.POWER));
guiElements.add(new GuiSlot(SlotType.OUTPUT_LARGE, this, MekanismUtils.getResource(ResourceType.GUI, getGuiTexture()), 111, 30));
guiElements.add(new GuiPowerBar(this, new IPowerInfoHandler() {
@Override
public double getLevel()
{
return ticksPassed <= 20 ? ticksPassed / 20.0F : 1.0F;
}
}, MekanismUtils.getResource(ResourceType.GUI, getGuiTexture()), 164, 15));
guiElements.add(new GuiProgress(new IProgressInfoHandler()
{
@Override
@ -49,7 +59,7 @@ public abstract class MachineRecipeHandler extends BaseRecipeHandler
{
return ticksPassed >= 20 ? (ticksPassed - 20) % 20 / 20.0F : 0.0F;
}
}, ProgressBar.BLUE, this, MekanismUtils.getResource(ResourceType.GUI, getGuiTexture()), 77, 37));
}, getProgressType(), this, MekanismUtils.getResource(ResourceType.GUI, getGuiTexture()), 77, 37));
}
@Override
@ -65,15 +75,6 @@ public abstract class MachineRecipeHandler extends BaseRecipeHandler
}
}
@Override
public void drawExtras(int i)
{
float f = ticksPassed >= 20 ? (ticksPassed - 20) % 20 / 20.0F : 0.0F;
drawProgressBar(63, 34, 176, 0, 24, 7, f, 0);
f = ticksPassed <= 20 ? ticksPassed / 20.0F : 1.0F;
drawProgressBar(149, 12, 176, 7, 4, 52, f, 3);
}
@Override
public void onUpdate()
{

View file

@ -15,9 +15,19 @@ import mekanism.api.infuse.InfuseRegistry;
import mekanism.api.infuse.InfuseType;
import mekanism.api.infuse.InfusionInput;
import mekanism.api.infuse.InfusionOutput;
import mekanism.client.gui.GuiElement;
import mekanism.client.gui.GuiMetallurgicInfuser;
import mekanism.client.gui.GuiPowerBar;
import mekanism.client.gui.GuiPowerBar.IPowerInfoHandler;
import mekanism.client.gui.GuiProgress;
import mekanism.client.gui.GuiSlot;
import mekanism.client.gui.GuiProgress.IProgressInfoHandler;
import mekanism.client.gui.GuiProgress.ProgressBar;
import mekanism.client.gui.GuiSlot.SlotOverlay;
import mekanism.client.gui.GuiSlot.SlotType;
import mekanism.common.recipe.RecipeHandler.Recipe;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
import net.minecraft.item.ItemStack;
import org.lwjgl.opengl.GL11;
@ -29,6 +39,30 @@ import codechicken.nei.recipe.TemplateRecipeHandler;
public class MetallurgicInfuserRecipeHandler extends BaseRecipeHandler
{
private int ticksPassed;
@Override
public void addGuiElements()
{
guiElements.add(new GuiSlot(SlotType.EXTRA, this, MekanismUtils.getResource(ResourceType.GUI, getGuiTexture()), 16, 34));
guiElements.add(new GuiSlot(SlotType.INPUT, this, MekanismUtils.getResource(ResourceType.GUI, getGuiTexture()), 50, 42));
guiElements.add(new GuiSlot(SlotType.POWER, this, MekanismUtils.getResource(ResourceType.GUI, getGuiTexture()), 142, 34).with(SlotOverlay.POWER));
guiElements.add(new GuiSlot(SlotType.OUTPUT, this, MekanismUtils.getResource(ResourceType.GUI, getGuiTexture()), 108, 42));
guiElements.add(new GuiPowerBar(this, new IPowerInfoHandler() {
@Override
public double getLevel()
{
return ticksPassed <= 20 ? ticksPassed / 20.0F : 1.0F;
}
}, MekanismUtils.getResource(ResourceType.GUI, getGuiTexture()), 164, 15));
guiElements.add(new GuiProgress(new IProgressInfoHandler() {
@Override
public double getProgress()
{
return ticksPassed >= 40 ? (ticksPassed - 40) % 20 / 20.0F : 0.0F;
}
}, ProgressBar.MEDIUM, this, MekanismUtils.getResource(ResourceType.GUI, getGuiTexture()), 70, 46));
}
@Override
public String getRecipeName()
@ -85,6 +119,11 @@ public class MetallurgicInfuserRecipeHandler extends BaseRecipeHandler
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
changeTexture(getGuiTexture());
drawTexturedModalRect(0, 0, 5, 15, 166, 56);
for(GuiElement e : guiElements)
{
e.renderBackground(0, 0, -5, -15);
}
}
@Override
@ -92,15 +131,9 @@ public class MetallurgicInfuserRecipeHandler extends BaseRecipeHandler
{
InfuseType type = ((CachedIORecipe)arecipes.get(i)).infusionType;
float f = ticksPassed >= 40 ? (ticksPassed - 40) % 20 / 20.0F : 0.0F;
drawProgressBar(67, 32, 176, 52, 32, 8, f, 0);
f = ticksPassed >= 20 && ticksPassed < 40 ? (ticksPassed - 20) % 20 / 20.0F : 1.0F;
float f = ticksPassed >= 20 && ticksPassed < 40 ? (ticksPassed - 20) % 20 / 20.0F : 1.0F;
if(ticksPassed < 20) f = 0.0F;
f = ticksPassed <= 20 ? ticksPassed / 20.0F : 1.0F;
drawProgressBar(160, 2, 176, 0, 4, 52, f, 3);
changeTexture(type.texture);
drawProgressBar(2, 2, type.texX, type.texY, 4, 52, f, 3);
}
@ -164,12 +197,6 @@ public class MetallurgicInfuserRecipeHandler extends BaseRecipeHandler
}
}
@Override
public void addGuiElements()
{
}
public class CachedIORecipe extends TemplateRecipeHandler.CachedRecipe
{
public List<ItemStack> infuseStacks;

View file

@ -107,6 +107,6 @@ public class NEIMekanismConfig implements IConfigureNEI
@Override
public String getVersion()
{
return "1.2";
return "1.3";
}
}

View file

@ -6,6 +6,7 @@ import java.util.Set;
import mekanism.api.ListUtils;
import mekanism.api.gas.Gas;
import mekanism.client.gui.GuiOsmiumCompressor;
import mekanism.client.gui.GuiProgress.ProgressBar;
import mekanism.common.Mekanism;
import mekanism.common.recipe.RecipeHandler.Recipe;
import mekanism.common.util.MekanismUtils;
@ -36,6 +37,12 @@ public class OsmiumCompressorRecipeHandler extends AdvancedMachineRecipeHandler
{
return Recipe.OSMIUM_COMPRESSOR.get().entrySet();
}
@Override
public ProgressBar getProgressType()
{
return ProgressBar.RED;
}
@Override
public List<ItemStack> getFuelStacks(Gas gasType)

View file

@ -3,6 +3,7 @@ package mekanism.client.nei;
import java.util.Set;
import mekanism.client.gui.GuiPrecisionSawmill;
import mekanism.client.gui.GuiProgress.ProgressBar;
import mekanism.common.recipe.RecipeHandler.Recipe;
import mekanism.common.util.MekanismUtils;
@ -31,6 +32,12 @@ public class PrecisionSawmillRecipeHandler extends ChanceMachineRecipeHandler
{
return Recipe.PRECISION_SAWMILL.get().entrySet();
}
@Override
public ProgressBar getProgressType()
{
return ProgressBar.PURPLE;
}
@Override
public Class getGuiClass()

View file

@ -7,6 +7,7 @@ import java.util.Set;
import mekanism.api.ListUtils;
import mekanism.api.gas.Gas;
import mekanism.api.gas.GasRegistry;
import mekanism.client.gui.GuiProgress.ProgressBar;
import mekanism.client.gui.GuiPurificationChamber;
import mekanism.common.recipe.RecipeHandler.Recipe;
import mekanism.common.util.MekanismUtils;
@ -38,6 +39,12 @@ public class PurificationChamberRecipeHandler extends AdvancedMachineRecipeHandl
{
return Recipe.PURIFICATION_CHAMBER.get().entrySet();
}
@Override
public ProgressBar getProgressType()
{
return ProgressBar.RED;
}
@Override
public List<ItemStack> getFuelStacks(Gas gasType)

View file

@ -174,10 +174,11 @@ public final class RecipeHandler
}
/**
* Add a Pressurized Reaction Chamber recipe
* Add a Pressurized Reaction Chamber recipe.
* @param input - input PressurizedReactants
* @param output - output PressurizedProducts
* @param extraEnergy - extra energy needed by the recipe
* @param ticks - amount of ticks it takes for this recipe to complete
*/
public static void addPRCRecipe(PressurizedReactants input, PressurizedProducts output, double extraEnergy, int ticks)
{

View file

@ -84,8 +84,6 @@ public abstract class TileEntityBasicMachine extends TileEntityElectricBlock imp
isActive = false;
}
public abstract ProgressBar getProgressType();
@Override
public void onUpdate()
{

View file

@ -88,10 +88,4 @@ public class TileEntityChemicalInjectionChamber extends TileEntityAdvancedElectr
{
return gas == GasRegistry.getGas("sulfuricAcid") || gas == GasRegistry.getGas("water") || gas == GasRegistry.getGas("hydrogenChloride");
}
@Override
public ProgressBar getProgressType()
{
return ProgressBar.YELLOW;
}
}

View file

@ -43,10 +43,4 @@ public class TileEntityCombiner extends TileEntityAdvancedElectricMachine
{
return false;
}
@Override
public ProgressBar getProgressType()
{
return ProgressBar.STONE;
}
}

View file

@ -2,7 +2,6 @@ package mekanism.common.tile;
import java.util.Map;
import mekanism.client.gui.GuiProgress.ProgressBar;
import mekanism.common.Mekanism;
import mekanism.common.block.BlockMachine.MachineType;
import mekanism.common.recipe.RecipeHandler.Recipe;
@ -57,10 +56,4 @@ public class TileEntityCrusher extends TileEntityElectricMachine
{
return 0.5F;
}
@Override
public ProgressBar getProgressType()
{
return ProgressBar.CRUSH;
}
}

View file

@ -22,10 +22,4 @@ public class TileEntityEnergizedSmelter extends TileEntityElectricMachine
{
return furnaceRecipes;
}
@Override
public ProgressBar getProgressType()
{
return ProgressBar.GREEN;
}
}

View file

@ -25,10 +25,4 @@ public class TileEntityEnrichmentChamber extends TileEntityElectricMachine
{
return 0.3F;
}
@Override
public ProgressBar getProgressType()
{
return ProgressBar.BLUE;
}
}

View file

@ -5,7 +5,6 @@ import java.util.Map;
import mekanism.api.gas.Gas;
import mekanism.api.gas.GasRegistry;
import mekanism.api.gas.GasStack;
import mekanism.client.gui.GuiProgress.ProgressBar;
import mekanism.common.Mekanism;
import mekanism.common.block.BlockMachine.MachineType;
import mekanism.common.recipe.RecipeHandler.Recipe;
@ -54,10 +53,4 @@ public class TileEntityOsmiumCompressor extends TileEntityAdvancedElectricMachin
{
return false;
}
@Override
public ProgressBar getProgressType()
{
return ProgressBar.RED;
}
}

View file

@ -15,7 +15,6 @@ import mekanism.api.gas.GasStack;
import mekanism.api.gas.GasTank;
import mekanism.api.gas.IGasHandler;
import mekanism.api.gas.ITubeConnection;
import mekanism.client.gui.GuiProgress.ProgressBar;
import mekanism.common.Mekanism;
import mekanism.common.SideData;
import mekanism.common.block.BlockMachine.MachineType;
@ -95,6 +94,7 @@ public class TileEntityPRC extends TileEntityBasicMachine implements IFluidHandl
}
else {
TICKS_REQUIRED = 100;
if(prevEnergy >= getEnergy())
{
setActive(false);
@ -125,12 +125,6 @@ public class TileEntityPRC extends TileEntityBasicMachine implements IFluidHandl
}
}
@Override
public ProgressBar getProgressType()
{
return ProgressBar.MEDIUM;
}
@Override
public boolean isItemValidForSlot(int slotID, ItemStack itemstack)
{

View file

@ -27,10 +27,4 @@ public class TileEntityPrecisionSawmill extends TileEntityChanceMachine
{
return 0.7F;
}
@Override
public ProgressBar getProgressType()
{
return ProgressBar.PURPLE;
}
}

View file

@ -82,10 +82,4 @@ public class TileEntityPurificationChamber extends TileEntityAdvancedElectricMac
{
return gas == GasRegistry.getGas("oxygen");
}
@Override
public ProgressBar getProgressType()
{
return ProgressBar.RED;
}
}

View file

@ -413,7 +413,7 @@ gui.digitalMiner.running=Running
gui.digitalMiner.inverse=Inverse mode
//Recipe names
recipe.mekanismShaped=Shaped Crafting
recipe.mekanismShaped=Shaped
//Item and block tooltip text
tooltip.configurator.modify=Modify