Search in sources :

Example 6 with TileEntityPneumaticBase

use of pneumaticCraft.common.tileentity.TileEntityPneumaticBase 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)

Example 7 with TileEntityPneumaticBase

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

the class ModuleNetworkManager method getConnectedModules.

public Set<TubeModule> getConnectedModules(TubeModule module) {
    Set<TubeModule> modules = new HashSet<TubeModule>();
    Set<TileEntityPressureTube> traversedTubes = new HashSet<TileEntityPressureTube>();
    Stack<TileEntityPressureTube> pendingTubes = new Stack<TileEntityPressureTube>();
    pendingTubes.push((TileEntityPressureTube) module.getTube());
    while (!pendingTubes.isEmpty()) {
        TileEntityPressureTube tube = pendingTubes.pop();
        for (TubeModule m : tube.modules) {
            if (m != null)
                modules.add(m);
        }
        TileEntityCache[] cache = ((TileEntityPneumaticBase) ((IPneumaticMachine) tube).getAirHandler()).getTileCache();
        for (ForgeDirection d : ForgeDirection.VALID_DIRECTIONS) {
            if (tube.sidesConnected[d.ordinal()]) {
                TileEntityPressureTube newTube = ModInteractionUtils.getInstance().getTube(cache[d.ordinal()].getTileEntity());
                if (newTube != null && !traversedTubes.contains(newTube)) {
                    pendingTubes.add(newTube);
                    traversedTubes.add(newTube);
                }
            }
        }
    }
    return modules;
}
Also used : ForgeDirection(net.minecraftforge.common.util.ForgeDirection) TileEntityPressureTube(pneumaticCraft.common.tileentity.TileEntityPressureTube) TileEntityCache(pneumaticCraft.common.util.TileEntityCache) HashSet(java.util.HashSet) Stack(java.util.Stack) TileEntityPneumaticBase(pneumaticCraft.common.tileentity.TileEntityPneumaticBase)

Example 8 with TileEntityPneumaticBase

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

the class WailaPneumaticHandler method addTipToMachine.

public static void addTipToMachine(List<String> currenttip, IPneumaticMachine machine, float pressure) {
    //This is used so that we can split values later easier and have them all in the same layout.
    Map<String, String> values = new HashMap<String, String>();
    values.put("Pressure", PneumaticCraftUtils.roundNumberTo(pressure, 1) + " bar");
    TileEntityPneumaticBase base = (TileEntityPneumaticBase) machine.getAirHandler();
    values.put("Max Pressure", base.DANGER_PRESSURE + " bar");
    //Get all the values from the map and put them in the list.
    for (Map.Entry<String, String> entry : values.entrySet()) {
        currenttip.add(entry.getKey() + ": " + /*SpecialChars.ALIGNRIGHT +*/
        SpecialChars.WHITE + entry.getValue());
    }
}
Also used : HashMap(java.util.HashMap) HashMap(java.util.HashMap) Map(java.util.Map) TileEntityPneumaticBase(pneumaticCraft.common.tileentity.TileEntityPneumaticBase)

Aggregations

TileEntityPneumaticBase (pneumaticCraft.common.tileentity.TileEntityPneumaticBase)8 Point (java.awt.Point)2 TileEntity (net.minecraft.tileentity.TileEntity)2 SideOnly (cpw.mods.fml.relauncher.SideOnly)1 Rectangle (java.awt.Rectangle)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1 Stack (java.util.Stack)1 IInventory (net.minecraft.inventory.IInventory)1 ItemStack (net.minecraft.item.ItemStack)1 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)1 IHeatExchanger (pneumaticCraft.api.tileentity.IHeatExchanger)1 IPneumaticMachine (pneumaticCraft.api.tileentity.IPneumaticMachine)1 IGuiWidget (pneumaticCraft.client.gui.widget.IGuiWidget)1 PacketDescriptionPacketRequest (pneumaticCraft.common.network.PacketDescriptionPacketRequest)1 IMinWorkingPressure (pneumaticCraft.common.tileentity.IMinWorkingPressure)1 IRedstoneControl (pneumaticCraft.common.tileentity.IRedstoneControl)1 TileEntityPressureTube (pneumaticCraft.common.tileentity.TileEntityPressureTube)1