icbm/src/main/java/icbm/gangshao/shimian/GuiPlatformSlots.java

76 lines
2.6 KiB
Java
Raw Normal View History

2022-11-09 22:15:45 +01:00
package icbm.gangshao.shimian;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
2022-11-10 21:41:55 +01:00
import icbm.gangshao.platform.TTurretPlatform;
2022-11-09 22:15:45 +01:00
import icbm.gangshao.turret.TTurretBase;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
2022-12-10 12:08:47 +01:00
import universalelectricity.api.energy.UnitDisplay;
2022-11-09 22:15:45 +01:00
@SideOnly(Side.CLIENT)
public class GuiPlatformSlots extends GuiPlatformContainer {
2022-11-09 22:16:55 +01:00
public GuiPlatformSlots(
2022-11-10 21:41:55 +01:00
final InventoryPlayer inventoryPlayer, final TTurretPlatform tileEntity
2022-11-09 22:16:55 +01:00
) {
2022-11-09 22:15:45 +01:00
super(inventoryPlayer, tileEntity);
}
@Override
protected void drawGuiContainerForegroundLayer(final int x, final int y) {
this.fontRendererObj.drawString("Ammunition", 8, 30, 4210752);
final TTurretBase turret = super.tileEntity.getTurret(false);
2022-11-09 22:16:55 +01:00
2022-11-09 22:15:45 +01:00
if (turret != null && turret.getFiringRequest() > 0.0) {
String color = "§4";
2022-11-09 22:16:55 +01:00
2022-11-09 22:15:45 +01:00
if (super.tileEntity.isRunning()) {
color = "§a";
}
2022-11-09 22:16:55 +01:00
2022-11-09 22:15:45 +01:00
this.fontRendererObj.drawString("Energy Per Shot", 85, 33, 4210752);
this.fontRendererObj.drawString(
2022-11-09 22:16:55 +01:00
color
2022-12-10 12:08:47 +01:00
+ UnitDisplay.getDisplayShort(
2022-11-09 22:16:55 +01:00
Math.min(
super.tileEntity.wattsReceived, turret.getFiringRequest()
),
2022-12-10 12:08:47 +01:00
UnitDisplay.Unit.JOULES
2022-11-09 22:16:55 +01:00
),
87,
43,
4210752
);
2022-11-09 22:15:45 +01:00
this.fontRendererObj.drawString(
2022-11-09 22:16:55 +01:00
color + "of "
2022-12-10 12:08:47 +01:00
+ UnitDisplay.getDisplayShort(
2022-11-09 22:16:55 +01:00
super.tileEntity.getTurret(false).getFiringRequest(),
2022-12-10 12:08:47 +01:00
UnitDisplay.Unit.JOULES
2022-11-09 22:16:55 +01:00
),
87,
53,
4210752
);
2022-11-09 22:15:45 +01:00
}
2022-11-09 22:16:55 +01:00
2022-11-09 22:15:45 +01:00
this.fontRendererObj.drawString("Upgrades", 87, 66, 4210752);
super.drawGuiContainerForegroundLayer(x, y);
}
@Override
2022-11-09 22:16:55 +01:00
protected void
drawGuiContainerBackgroundLayer(final float par1, final int x, final int y) {
2022-11-10 21:41:55 +01:00
super.drawGuiContainerBackgroundLayer(par1, x, y);
2022-11-09 22:15:45 +01:00
this.mc.renderEngine.bindTexture(
2022-11-09 22:16:55 +01:00
new ResourceLocation("icbm", "textures/gui/gui_platform_slot.png")
);
2022-11-09 22:15:45 +01:00
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
final int containerWidth = (this.width - this.xSize) / 2;
final int containerHeight = (this.height - this.ySize) / 2;
2022-11-09 22:16:55 +01:00
this.drawTexturedModalRect(
containerWidth, containerHeight, 0, 0, this.xSize, this.ySize
);
2022-11-09 22:15:45 +01:00
}
}