Clicking energy info tab will toggle energy unit display type

This commit is contained in:
aidancbrady 2016-02-01 14:42:44 -07:00
parent 7c52d03cb5
commit 1a35ed161a
2 changed files with 22 additions and 3 deletions

View file

@ -1,14 +1,18 @@
package mekanism.client.gui.element; package mekanism.client.gui.element;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import mekanism.api.MekanismConfig.general;
import mekanism.api.util.UnitDisplayUtils.EnergyType;
import mekanism.client.gui.IGuiWrapper; import mekanism.client.gui.IGuiWrapper;
import mekanism.common.util.LangUtils;
import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType; import mekanism.common.util.MekanismUtils.ResourceType;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import codechicken.lib.vec.Rectangle4i;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import codechicken.lib.vec.Rectangle4i;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public class GuiEnergyInfo extends GuiElement public class GuiEnergyInfo extends GuiElement
@ -48,7 +52,15 @@ public class GuiEnergyInfo extends GuiElement
{ {
if(xAxis >= -21 && xAxis <= -3 && yAxis >= 142 && yAxis <= 160) if(xAxis >= -21 && xAxis <= -3 && yAxis >= 142 && yAxis <= 160)
{ {
displayTooltips(infoHandler.getInfo(), xAxis, yAxis); List<String> info = new ArrayList<String>();
for(String s : infoHandler.getInfo())
{
info.add(s);
}
info.add(LangUtils.localize("gui.energyType") + ": " + general.activeType);
displayTooltips(info, xAxis, yAxis);
} }
} }
@ -56,5 +68,11 @@ public class GuiEnergyInfo extends GuiElement
public void preMouseClicked(int xAxis, int yAxis, int button) {} public void preMouseClicked(int xAxis, int yAxis, int button) {}
@Override @Override
public void mouseClicked(int xAxis, int yAxis, int button) {} public void mouseClicked(int xAxis, int yAxis, int button)
{
if(button == 0)
{
general.activeType = EnergyType.values()[(general.activeType.ordinal()+1)%EnergyType.values().length];
}
}
} }

View file

@ -497,6 +497,7 @@ gui.maxProduction=Max Production
gui.limiting=Limiting gui.limiting=Limiting
gui.steamInput=Steam Input gui.steamInput=Steam Input
gui.capacity=Capacity gui.capacity=Capacity
gui.energyType=Energy Type
gui.reactor.injectionRate=Injection Rate gui.reactor.injectionRate=Injection Rate