Changed Metallurgic Infuser infuse system to use icons for textures

This commit is contained in:
aidancbrady 2016-01-29 17:47:41 -07:00
parent 06dc2227f2
commit 88cfee2ab2
14 changed files with 55 additions and 64 deletions

View file

@ -1,6 +1,6 @@
package mekanism.api.infuse;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
/**
@ -13,29 +13,29 @@ public final class InfuseType
/** The name of this infusion */
public String name;
/** The location of this infuse's GUI texture */
public ResourceLocation texture;
/** This infuse GUI's icon */
public IIcon icon;
/** The infuse's GUI texture X offset. */
public int texX;
/** The infuse's GUI texture Y offset. */
public int texY;
/** The location of this infuse GUI's icon */
public String textureLocation;
/** The unlocalized name of this type. */
public String unlocalizedName;
public InfuseType(String s, ResourceLocation location, int x, int y)
public InfuseType(String s, String tex)
{
name = s;
texture = location;
texX = x;
texY = y;
textureLocation = tex;
}
public void setIcon(IIcon i)
{
icon = i;
}
public InfuseType setUnlocalizedName(String name)
{
unlocalizedName = name;
unlocalizedName = "infuse." + name;
return this;
}

View file

@ -2,7 +2,6 @@ package mekanism.client.gui;
import java.util.List;
import mekanism.api.gas.GasStack;
import mekanism.api.util.ListUtils;
import mekanism.client.gui.element.GuiEnergyInfo;
import mekanism.client.gui.element.GuiEnergyInfo.IInfoHandler;
@ -19,6 +18,7 @@ import mekanism.common.tile.TileEntityFactory;
import mekanism.common.util.LangUtils;
import mekanism.common.util.MekanismUtils;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.IIcon;
import org.lwjgl.opengl.GL11;
@ -92,48 +92,30 @@ public class GuiFactory extends GuiMekanism
displayInt = tileEntity.getScaledEnergyLevel(52);
drawTexturedModalRect(guiWidth + 165, guiHeight + 17 + 52 - displayInt, 176, 52 - displayInt, 4, displayInt);
if(tileEntity.tier == FactoryTier.BASIC)
{
int xOffset = tileEntity.tier == FactoryTier.BASIC ? 59 : (tileEntity.tier == FactoryTier.ADVANCED ?
39 : 33);
int xDistance = tileEntity.tier == FactoryTier.BASIC ? 38 : (tileEntity.tier == FactoryTier.ADVANCED ?
26 : 19);
for(int i = 0; i < tileEntity.tier.processes; i++)
{
int xPos = 59 + (i*38);
int xPos = xOffset + (i*xDistance);
displayInt = tileEntity.getScaledProgress(20, i);
drawTexturedModalRect(guiWidth + xPos, guiHeight + 33, 176, 52, 8, displayInt);
}
}
else if(tileEntity.tier == FactoryTier.ADVANCED)
{
for(int i = 0; i < tileEntity.tier.processes; i++)
{
int xPos = 39 + (i*26);
displayInt = tileEntity.getScaledProgress(20, i);
drawTexturedModalRect(guiWidth + xPos, guiHeight + 33, 176, 52, 8, displayInt);
}
}
else if(tileEntity.tier == FactoryTier.ELITE)
{
for(int i = 0; i < tileEntity.tier.processes; i++)
{
int xPos = 33 + (i*19);
displayInt = tileEntity.getScaledProgress(20, i);
drawTexturedModalRect(guiWidth + xPos, guiHeight + 33, 176, 52, 8, displayInt);
}
}
if(tileEntity.getScaledGasLevel(160) > 0)
{
displayGauge(8, 78, tileEntity.getScaledGasLevel(160), 5, tileEntity.gasTank.getGas());
displayGauge(8, 78, tileEntity.getScaledGasLevel(160), 5, tileEntity.gasTank.getGas().getGas().getIcon());
}
super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY);
}
public void displayGauge(int xPos, int yPos, int sizeX, int sizeY, GasStack gas)
public void displayGauge(int xPos, int yPos, int sizeX, int sizeY, IIcon icon)
{
if(gas == null)
if(icon == null)
{
return;
}
@ -142,6 +124,6 @@ public class GuiFactory extends GuiMekanism
int guiHeight = (height - ySize) / 2;
mc.renderEngine.bindTexture(MekanismRenderer.getBlocksTexture());
drawTexturedModelRectFromIcon(guiWidth + xPos, guiHeight + yPos, gas.getGas().getIcon(), sizeX, sizeY);
drawTexturedModelRectFromIcon(guiWidth + xPos, guiHeight + yPos, icon, sizeX, sizeY);
}
}

View file

@ -9,15 +9,16 @@ import mekanism.client.gui.element.GuiEnergyInfo;
import mekanism.client.gui.element.GuiEnergyInfo.IInfoHandler;
import mekanism.client.gui.element.GuiPowerBar;
import mekanism.client.gui.element.GuiProgress;
import mekanism.client.gui.element.GuiRedstoneControl;
import mekanism.client.gui.element.GuiProgress.IProgressInfoHandler;
import mekanism.client.gui.element.GuiProgress.ProgressBar;
import mekanism.client.gui.element.GuiRedstoneControl;
import mekanism.client.gui.element.GuiSideConfigurationTab;
import mekanism.client.gui.element.GuiSlot;
import mekanism.client.gui.element.GuiSlot.SlotOverlay;
import mekanism.client.gui.element.GuiSlot.SlotType;
import mekanism.client.gui.element.GuiTransporterConfigTab;
import mekanism.client.gui.element.GuiUpgradeTab;
import mekanism.client.render.MekanismRenderer;
import mekanism.client.sound.SoundHandler;
import mekanism.common.Mekanism;
import mekanism.common.inventory.container.ContainerMetallurgicInfuser;
@ -100,9 +101,9 @@ public class GuiMetallurgicInfuser extends GuiMekanism
if(tileEntity.infuseStored.type != null)
{
mc.renderEngine.bindTexture(MekanismRenderer.getBlocksTexture());
int displayInt = tileEntity.getScaledInfuseLevel(52);
mc.renderEngine.bindTexture(tileEntity.infuseStored.type.texture);
drawTexturedModalRect(guiWidth + 7, guiHeight + 17 + 52 - displayInt, tileEntity.infuseStored.type.texX, tileEntity.infuseStored.type.texY + 52 - displayInt, 4, displayInt);
drawTexturedRectFromIcon(guiWidth + 7, guiHeight + 17 + 52 - displayInt, tileEntity.infuseStored.type.icon, 4, displayInt);
}
super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY);

View file

@ -1,6 +1,9 @@
package mekanism.client.nei;
import java.awt.*;
import static codechicken.lib.gui.GuiDraw.changeTexture;
import static codechicken.lib.gui.GuiDraw.drawTexturedModalRect;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@ -12,13 +15,14 @@ import mekanism.api.infuse.InfuseType;
import mekanism.client.gui.GuiMetallurgicInfuser;
import mekanism.client.gui.element.GuiElement;
import mekanism.client.gui.element.GuiPowerBar;
import mekanism.client.gui.element.GuiProgress;
import mekanism.client.gui.element.GuiSlot;
import mekanism.client.gui.element.GuiPowerBar.IPowerInfoHandler;
import mekanism.client.gui.element.GuiProgress;
import mekanism.client.gui.element.GuiProgress.IProgressInfoHandler;
import mekanism.client.gui.element.GuiProgress.ProgressBar;
import mekanism.client.gui.element.GuiSlot;
import mekanism.client.gui.element.GuiSlot.SlotOverlay;
import mekanism.client.gui.element.GuiSlot.SlotType;
import mekanism.client.render.MekanismRenderer;
import mekanism.common.recipe.RecipeHandler.Recipe;
import mekanism.common.recipe.machines.MetallurgicInfuserRecipe;
import mekanism.common.util.LangUtils;
@ -31,8 +35,6 @@ import org.lwjgl.opengl.GL11;
import codechicken.nei.NEIServerUtils;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.TemplateRecipeHandler;
import static codechicken.lib.gui.GuiDraw.changeTexture;
import static codechicken.lib.gui.GuiDraw.drawTexturedModalRect;
public class MetallurgicInfuserRecipeHandler extends BaseRecipeHandler
{
@ -132,8 +134,8 @@ public class MetallurgicInfuserRecipeHandler extends BaseRecipeHandler
float f = ticksPassed >= 20 && ticksPassed < 40 ? (ticksPassed - 20) % 20 / 20.0F : 1.0F;
if(ticksPassed < 20) f = 0.0F;
changeTexture(type.texture);
drawProgressBar(2, 2, type.texX, type.texY, 4, 52, f, 3);
changeTexture(MekanismRenderer.getBlocksTexture());
drawTexturedRectFromIcon(2, 2, type.icon, 4, (int)(52F*f));
}
@Override

View file

@ -10,6 +10,8 @@ import mekanism.api.EnumColor;
import mekanism.api.gas.Gas;
import mekanism.api.gas.GasRegistry;
import mekanism.api.gas.OreGas;
import mekanism.api.infuse.InfuseRegistry;
import mekanism.api.infuse.InfuseType;
import mekanism.api.transmitters.TransmissionType;
import mekanism.client.render.tileentity.RenderConfigurableMachine;
import mekanism.client.render.tileentity.RenderDynamicTank;
@ -128,6 +130,11 @@ public class MekanismRenderer
FluidRegistry.getFluid("brine").setIcons(event.map.registerIcon("mekanism:LiquidBrine"));
FluidRegistry.getFluid("heavywater").setIcons(event.map.registerIcon("mekanism:LiquidHeavyWater"));
for(InfuseType type : InfuseRegistry.getInfuseMap().values())
{
type.setIcon(event.map.registerIcon(type.textureLocation));
}
if(RenderPartTransmitter.getInstance() != null)
{
RenderPartTransmitter.getInstance().resetDisplayInts();

View file

@ -80,7 +80,6 @@ import mekanism.common.tile.TileEntitySolarEvaporationValve;
import mekanism.common.tile.TileEntityThermoelectricBoiler;
import mekanism.common.tile.TileEntityThermoelectricValve;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
import mekanism.common.voice.VoiceServerManager;
import mekanism.common.world.GenHandler;
import net.minecraft.entity.EnumCreatureType;
@ -1170,13 +1169,13 @@ public class Mekanism
MekanismBlocks.register();
//Register infuses
InfuseRegistry.registerInfuseType(new InfuseType("CARBON", MekanismUtils.getResource(ResourceType.INFUSE, "Infusions.png"), 0, 0).setUnlocalizedName("infuse.carbon"));
InfuseRegistry.registerInfuseType(new InfuseType("TIN", MekanismUtils.getResource(ResourceType.INFUSE, "Infusions.png"), 4, 0).setUnlocalizedName("infuse.tin"));
InfuseRegistry.registerInfuseType(new InfuseType("DIAMOND", MekanismUtils.getResource(ResourceType.INFUSE, "Infusions.png"), 8, 0).setUnlocalizedName("infuse.diamond"));
InfuseRegistry.registerInfuseType(new InfuseType("REDSTONE", MekanismUtils.getResource(ResourceType.INFUSE, "Infusions.png"), 16, 0).setUnlocalizedName("infuse.redstone"));
InfuseRegistry.registerInfuseType(new InfuseType("FUNGI", MekanismUtils.getResource(ResourceType.INFUSE, "Infusions.png"), 20, 0).setUnlocalizedName("infuse.fungi"));
InfuseRegistry.registerInfuseType(new InfuseType("BIO", MekanismUtils.getResource(ResourceType.INFUSE, "Infusions.png"), 12, 0).setUnlocalizedName("infuse.bio"));
InfuseRegistry.registerInfuseType(new InfuseType("OBSIDIAN", MekanismUtils.getResource(ResourceType.INFUSE, "Infusions.png"), 24, 0).setUnlocalizedName("infuse.obsidian"));
InfuseRegistry.registerInfuseType(new InfuseType("CARBON", "mekanism:infuse/Carbon").setUnlocalizedName("carbon"));
InfuseRegistry.registerInfuseType(new InfuseType("TIN", "mekanism:infuse/Tin").setUnlocalizedName("tin"));
InfuseRegistry.registerInfuseType(new InfuseType("DIAMOND", "mekanism:infuse/Diamond").setUnlocalizedName("diamond"));
InfuseRegistry.registerInfuseType(new InfuseType("REDSTONE", "mekanism:infuse/Redstone").setUnlocalizedName("redstone"));
InfuseRegistry.registerInfuseType(new InfuseType("FUNGI", "mekanism:infuse/Fungi").setUnlocalizedName("fungi"));
InfuseRegistry.registerInfuseType(new InfuseType("BIO", "mekanism:infuse/Bio").setUnlocalizedName("bio"));
InfuseRegistry.registerInfuseType(new InfuseType("OBSIDIAN", "mekanism:infuse/Obsidian").setUnlocalizedName("obsidian"));
}
@EventHandler

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB