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);
}
}
}
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;
}
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());
}
}
Aggregations