Search in sources :

Example 1 with IGuiScreen

use of me.desht.pneumaticcraft.api.client.pneumaticHelmet.IGuiScreen in project pnc-repressurized by TeamPneumatic.

the class GuiDroneDebuggerOptions method initGui.

@Override
public void initGui(IGuiScreen gui) {
    GuiScreen guiScreen = (GuiScreen) gui;
    screenWidth = guiScreen.width;
    screenHeight = guiScreen.height;
    if (PneumaticCraftRepressurized.proxy.getPlayer() != null) {
        ItemStack helmet = PneumaticCraftRepressurized.proxy.getPlayer().getItemStackFromSlot(EntityEquipmentSlot.HEAD);
        if (helmet != null) {
            int entityId = NBTUtil.getInteger(helmet, NBTKeys.PNEUMATIC_HELMET_DEBUGGING_DRONE);
            Entity entity = PneumaticCraftRepressurized.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(me.desht.pneumaticcraft.common.progwidgets.IProgWidget) EntityDrone(me.desht.pneumaticcraft.common.entity.living.EntityDrone) GuiScreen(net.minecraft.client.gui.GuiScreen) IGuiScreen(me.desht.pneumaticcraft.api.client.pneumaticHelmet.IGuiScreen) ItemStack(net.minecraft.item.ItemStack) ProgWidgetStart(me.desht.pneumaticcraft.common.progwidgets.ProgWidgetStart)

Aggregations

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