- 769
- 1
- 42
Доброе утро. Делаю собственную машину, почти все сделал, осталось лишь решить одну проблему. В моем гуи есть отображение уровня заряда. Я хочу, чтобы полоска заряда отображалась снизу вверх, а не слево направо. Подскажите, как исправить?
Гуи
Гуи
Код:
package vacuum.core.gui;
import java.util.ArrayList;
import java.util.List;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import micdoodle8.mods.galacticraft.core.GalacticraftCore;
import micdoodle8.mods.galacticraft.core.client.gui.container.GuiContainerGC;
import micdoodle8.mods.galacticraft.core.client.gui.element.GuiElementInfoRegion;
import micdoodle8.mods.galacticraft.core.energy.EnergyDisplayHelper;
import micdoodle8.mods.galacticraft.core.util.EnumColor;
import micdoodle8.mods.galacticraft.core.util.GCCoreUtil;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import vacuum.core.inventory.CoreMaceratorContainer;
import vacuum.core.tile.CoreTileEntityMacerator;
@SideOnly(Side.CLIENT)
public class CoreMaceratorGui extends GuiContainerGC {
private static final ResourceLocation maceratorTexture = new ResourceLocation("horizon:textures/gui/gui_Macerator.png");
private GuiElementInfoRegion electricInfoRegion = new GuiElementInfoRegion(0, 0, 9, 56, null, 0, 0, this);
private CoreTileEntityMacerator tileEntity;
public CoreMaceratorGui(InventoryPlayer par1InventoryPlayer, CoreTileEntityMacerator tileEntity) {
super(new CoreMaceratorContainer(par1InventoryPlayer, tileEntity));
this.tileEntity = tileEntity;
}
@Override
public void initGui() {
super.initGui();
this.electricInfoRegion.tooltipStrings = new ArrayList<String>();
this.electricInfoRegion.xPosition = (this.width - this.xSize) / 2 + 158;
this.electricInfoRegion.yPosition = (this.height - this.ySize) / 2 + 8;
this.electricInfoRegion.parentWidth = this.width;
this.electricInfoRegion.parentHeight = this.height;
this.infoRegions.add(this.electricInfoRegion);
List<String> batterySlotDesc = new ArrayList<String>();
batterySlotDesc.add(GCCoreUtil.translate("gui.batterySlot.machineDesc.0"));
batterySlotDesc.add(GCCoreUtil.translate("gui.batterySlot.machineDesc.1"));
this.infoRegions.add(new GuiElementInfoRegion((this.width - this.xSize) / 2 + 72, (this.height - this.ySize) / 3 + 62, 18, 18, batterySlotDesc, this.width, this.height, this));
}
@Override
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
this.fontRendererObj.drawString(this.tileEntity.getInventoryName(), 45, 6, 4210752);
String displayText = "";
if (this.tileEntity.processTicks > 0) {
displayText = EnumColor.BRIGHT_GREEN + GCCoreUtil.translate("gui.status.running.maceratorName");
} else {
displayText = EnumColor.ORANGE + GCCoreUtil.translate("gui.status.idle.maceratorName");
}
this.fontRendererObj.drawString(GCCoreUtil.translate("gui.message.status.maceratorName") + ": " + displayText, 97, 52, 4210752);
this.fontRendererObj.drawString(GCCoreUtil.translate("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
}
@Override
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
this.mc.renderEngine.bindTexture(CoreMaceratorGui.maceratorTexture);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
int containerWidth = (this.width - this.xSize) / 2;
int containerHeight = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(containerWidth, containerHeight, 0, 0, this.xSize, this.ySize);
int scale;
List<String> electricityDesc = new ArrayList<String>();
electricityDesc.add(GCCoreUtil.translate("gui.energyStorage.desc.0"));
EnergyDisplayHelper.getEnergyDisplayTooltip(this.tileEntity.getEnergyStoredGC(), this.tileEntity.getMaxEnergyStoredGC(), electricityDesc);
this.electricInfoRegion.tooltipStrings = electricityDesc;
if (this.tileEntity.processTicks > 0) {
scale = (int) ((double) this.tileEntity.processTicks / (double) this.tileEntity.processTime * 23);
this.drawTexturedModalRect(containerWidth + 66, containerHeight + 14, 176, 70, 30 - scale, 41);
}
if (this.tileEntity.getEnergyStoredGC() > 0) {
scale = this.tileEntity.getScaledElecticalLevel(8);
this.drawTexturedModalRect(containerWidth + 159, containerHeight + 8, 176, 7, scale, 54);
this.drawTexturedModalRect(containerWidth + 157, containerHeight + 66, 176, 61, 11, 10);
}
}
}