Search in sources :

Example 1 with IRedstoneControl

use of pneumaticCraft.common.tileentity.IRedstoneControl in project PneumaticCraft by MineMaarten.

the class GuiPneumaticContainerBase method initGui.

@Override
public void initGui() {
    super.initGui();
    lastLeftStat = lastRightStat = null;
    if (shouldAddPressureTab() && te instanceof TileEntityPneumaticBase) {
        pressureStat = this.addAnimatedStat("gui.tab.pressure", new ItemStack(Blockss.pressureTube), 0xFF00AA00, false);
    }
    if (shouldAddProblemTab()) {
        problemTab = addAnimatedStat("gui.tab.problems", Textures.GUI_PROBLEMS_TEXTURE, 0xFFFF0000, false);
    }
    if (shouldAddRedstoneTab() && te instanceof IRedstoneControl) {
        redstoneTab = addAnimatedStat("gui.tab.redstoneBehaviour", new ItemStack(Items.redstone), 0xFFCC0000, true);
        List<String> curInfo = new ArrayList<String>();
        curInfo.add(I18n.format(getRedstoneString()));
        for (int i = 0; i < 3; i++) // create some space for the button
        curInfo.add("                                      ");
        redstoneTab.setTextWithoutCuttingString(curInfo);
        Rectangle buttonRect = redstoneTab.getButtonScaledRectangle(-170, 24, 170, 20);
        //getButtonFromRectangle(0, buttonRect, "-");
        redstoneButton = new GuiButtonSpecial(0, buttonRect.x, buttonRect.y, buttonRect.width, buttonRect.height, "-");
        redstoneTab.addWidget(redstoneButton);
    }
    if (te instanceof IInventory) {
        if (shouldAddInfoTab()) {
            String info = "gui.tab.info." + ((IInventory) te).getInventoryName();
            String translatedInfo = I18n.format(info);
            if (!translatedInfo.equals(info)) {
                addInfoTab(translatedInfo);
            }
        }
        if (te instanceof IHeatExchanger) {
            addAnimatedStat("gui.tab.info.heat.title", new ItemStack(Blocks.fire), 0xFFFF5500, false).setText("gui.tab.info.heat");
        }
        if (shouldAddUpgradeTab()) {
            String upgrades = "gui.tab.upgrades." + ((IInventory) te).getInventoryName();
            String translatedUpgrades = I18n.format(upgrades);
            List<String> upgradeText = new ArrayList<String>();
            if (te instanceof TileEntityPneumaticBase) {
                upgradeText.add("gui.tab.upgrades.volume");
                upgradeText.add("gui.tab.upgrades.security");
            }
            if (te instanceof IHeatExchanger) {
                upgradeText.add("gui.tab.upgrades.volumeCapacity");
            }
            if (!translatedUpgrades.equals(upgrades))
                upgradeText.add(upgrades);
            if (upgradeText.size() > 0)
                addAnimatedStat("gui.tab.upgrades", Textures.GUI_UPGRADES_LOCATION, 0xFF0000FF, true).setText(upgradeText);
        }
    }
}
Also used : IInventory(net.minecraft.inventory.IInventory) IHeatExchanger(pneumaticCraft.api.tileentity.IHeatExchanger) IRedstoneControl(pneumaticCraft.common.tileentity.IRedstoneControl) ArrayList(java.util.ArrayList) Rectangle(java.awt.Rectangle) ItemStack(net.minecraft.item.ItemStack) Point(java.awt.Point) TileEntityPneumaticBase(pneumaticCraft.common.tileentity.TileEntityPneumaticBase)

Aggregations

Point (java.awt.Point)1 Rectangle (java.awt.Rectangle)1 ArrayList (java.util.ArrayList)1 IInventory (net.minecraft.inventory.IInventory)1 ItemStack (net.minecraft.item.ItemStack)1 IHeatExchanger (pneumaticCraft.api.tileentity.IHeatExchanger)1 IRedstoneControl (pneumaticCraft.common.tileentity.IRedstoneControl)1 TileEntityPneumaticBase (pneumaticCraft.common.tileentity.TileEntityPneumaticBase)1