2013-08-27 00:49:32 +02:00
|
|
|
package mekanism.client.gui;
|
2013-08-26 02:54:34 +02:00
|
|
|
|
|
|
|
import mekanism.api.Object3D;
|
|
|
|
import mekanism.common.IUpgradeTile;
|
|
|
|
import mekanism.common.PacketHandler;
|
|
|
|
import mekanism.common.PacketHandler.Transmission;
|
|
|
|
import mekanism.common.network.PacketRemoveUpgrade;
|
2013-08-27 00:57:08 +02:00
|
|
|
import mekanism.common.util.MekanismUtils;
|
|
|
|
import mekanism.common.util.MekanismUtils.ResourceType;
|
2013-08-26 02:54:34 +02:00
|
|
|
import net.minecraft.client.gui.inventory.GuiContainer;
|
|
|
|
import net.minecraft.tileentity.TileEntity;
|
|
|
|
import net.minecraft.util.ResourceLocation;
|
|
|
|
|
|
|
|
public class GuiUpgradeManagement extends GuiElement
|
|
|
|
{
|
|
|
|
public GuiUpgradeManagement(GuiContainer gui, TileEntity tile, ResourceLocation def)
|
|
|
|
{
|
|
|
|
super(MekanismUtils.getResource(ResourceType.GUI, "GuiUpgradeManagement.png"), gui, tile, def);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void renderBackground(int xAxis, int yAxis, int guiWidth, int guiHeight)
|
|
|
|
{
|
2013-09-28 03:59:47 +02:00
|
|
|
mc.renderEngine.bindTexture(RESOURCE);
|
2013-08-26 02:54:34 +02:00
|
|
|
|
2013-10-26 06:02:57 +02:00
|
|
|
guiObj.drawTexturedModalRect(guiWidth + 176, guiHeight + 6, 0, 0, 26, 63);
|
2013-08-26 02:54:34 +02:00
|
|
|
|
|
|
|
IUpgradeTile upgradeTile = (IUpgradeTile)tileEntity;
|
|
|
|
int displayInt = upgradeTile.getComponent().getScaledUpgradeProgress(14);
|
|
|
|
|
2013-10-26 06:02:57 +02:00
|
|
|
guiObj.drawTexturedModalRect(guiWidth + 180, guiHeight + 30, 26, 0, 10, displayInt);
|
2013-08-26 02:54:34 +02:00
|
|
|
|
2013-09-28 03:59:47 +02:00
|
|
|
mc.renderEngine.bindTexture(defaultLocation);
|
2013-08-26 02:54:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void renderForeground(int xAxis, int yAxis)
|
|
|
|
{
|
2013-09-28 03:59:47 +02:00
|
|
|
mc.renderEngine.bindTexture(RESOURCE);
|
2013-08-26 02:54:34 +02:00
|
|
|
|
|
|
|
IUpgradeTile upgradeTile = (IUpgradeTile)tileEntity;
|
|
|
|
|
2013-08-29 19:03:32 +02:00
|
|
|
if(getFontRenderer() != null)
|
|
|
|
{
|
|
|
|
getFontRenderer().drawString("S:" + (upgradeTile.getSpeedMultiplier()+1) + "x", 179, 47, 0x404040);
|
|
|
|
getFontRenderer().drawString("E:" + (upgradeTile.getEnergyMultiplier()+1) + "x", 179, 57, 0x404040);
|
|
|
|
}
|
2013-08-26 02:54:34 +02:00
|
|
|
|
|
|
|
if(xAxis >= 179 && xAxis <= 198 && yAxis >= 47 && yAxis <= 54)
|
|
|
|
{
|
|
|
|
displayTooltip("Remove speed upgrade", xAxis, yAxis);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(xAxis >= 179 && xAxis <= 198 && yAxis >= 57 && yAxis <= 64)
|
|
|
|
{
|
|
|
|
displayTooltip("Remove energy upgrade", xAxis, yAxis);
|
|
|
|
}
|
|
|
|
|
2013-09-28 03:59:47 +02:00
|
|
|
mc.renderEngine.bindTexture(defaultLocation);
|
2013-08-26 02:54:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2013-08-27 00:28:55 +02:00
|
|
|
public void preMouseClicked(int xAxis, int yAxis, int button)
|
2013-08-26 02:54:34 +02:00
|
|
|
{
|
2013-08-27 00:28:55 +02:00
|
|
|
if(button == 0)
|
2013-08-26 02:54:34 +02:00
|
|
|
{
|
2013-08-27 00:28:55 +02:00
|
|
|
if(xAxis >= 180 && xAxis <= 196 && yAxis >= 11 && yAxis <= 27)
|
|
|
|
{
|
|
|
|
offsetX(26);
|
|
|
|
}
|
2013-08-26 02:54:34 +02:00
|
|
|
}
|
2013-08-27 00:28:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void mouseClicked(int xAxis, int yAxis, int button)
|
|
|
|
{
|
|
|
|
if(button == 0)
|
2013-08-26 02:54:34 +02:00
|
|
|
{
|
2013-08-27 00:28:55 +02:00
|
|
|
if(xAxis >= 179 && xAxis <= 198 && yAxis >= 47 && yAxis <= 54)
|
|
|
|
{
|
|
|
|
mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
|
|
|
|
PacketHandler.sendPacket(Transmission.SERVER, new PacketRemoveUpgrade().setParams(Object3D.get(tileEntity), (byte)0));
|
|
|
|
}
|
|
|
|
|
|
|
|
if(xAxis >= 179 && xAxis <= 198 && yAxis >= 57 && yAxis <= 64)
|
|
|
|
{
|
|
|
|
mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
|
|
|
|
PacketHandler.sendPacket(Transmission.SERVER, new PacketRemoveUpgrade().setParams(Object3D.get(tileEntity), (byte)1));
|
|
|
|
}
|
|
|
|
|
|
|
|
if(xAxis >= 180 && xAxis <= 196 && yAxis >= 11 && yAxis <= 27)
|
|
|
|
{
|
|
|
|
offsetX(-26);
|
|
|
|
}
|
2013-08-26 02:54:34 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|