Search in sources :

Example 1 with IGuiScreen

use of pneumaticCraft.api.client.pneumaticHelmet.IGuiScreen in project PneumaticCraft by MineMaarten.

the class GuiDroneDebuggerOptions method initGui.

@Override
public void initGui(IGuiScreen gui) {
    GuiScreen guiScreen = (GuiScreen) gui;
    screenWidth = guiScreen.width;
    screenHeight = guiScreen.height;
    if (PneumaticCraft.proxy.getPlayer() != null) {
        ItemStack helmet = PneumaticCraft.proxy.getPlayer().getCurrentArmor(3);
        if (helmet != null) {
            int entityId = NBTUtil.getInteger(helmet, NBTKeys.PNEUMATIC_HELMET_DEBUGGING_DRONE);
            Entity entity = PneumaticCraft.proxy.getClientWorld().getEntityByID(entityId);
            if (entity instanceof EntityDrone) {
                selectedDrone = (EntityDrone) entity;
            }
        }
    }
    int spacing = 20;
    programmingStartX = spacing;
    programmingWidth = guiScreen.width - spacing * 2;
    programmingHeight = guiScreen.height - spacing - PROGRAMMING_START_Y;
    programmerUnit = new DebugInfoProgrammerUnit(selectedDrone != null ? selectedDrone.getProgWidgets() : new ArrayList<IProgWidget>(), gui.getFontRenderer(), 0, 0, guiScreen.width, guiScreen.height, 100, programmingStartX, PROGRAMMING_START_Y, programmingWidth, programmingHeight, 0, 0, 0);
    if (selectedDrone != null) {
        for (IProgWidget widget : selectedDrone.getProgWidgets()) {
            if (widget instanceof ProgWidgetStart) {
                programmerUnit.gotoPiece(widget);
                break;
            }
        }
    }
}
Also used : Entity(net.minecraft.entity.Entity) IProgWidget(pneumaticCraft.common.progwidgets.IProgWidget) EntityDrone(pneumaticCraft.common.entity.living.EntityDrone) IGuiScreen(pneumaticCraft.api.client.pneumaticHelmet.IGuiScreen) GuiScreen(net.minecraft.client.gui.GuiScreen) ItemStack(net.minecraft.item.ItemStack) ProgWidgetStart(pneumaticCraft.common.progwidgets.ProgWidgetStart)

Aggregations

GuiScreen (net.minecraft.client.gui.GuiScreen)1 Entity (net.minecraft.entity.Entity)1 ItemStack (net.minecraft.item.ItemStack)1 IGuiScreen (pneumaticCraft.api.client.pneumaticHelmet.IGuiScreen)1 EntityDrone (pneumaticCraft.common.entity.living.EntityDrone)1 IProgWidget (pneumaticCraft.common.progwidgets.IProgWidget)1 ProgWidgetStart (pneumaticCraft.common.progwidgets.ProgWidgetStart)1