use of net.minecraft.client.gui.GuiScreen in project PneumaticCraft by MineMaarten.
the class GuiProgrammer method mouseClicked.
@Override
protected void mouseClicked(int x, int y, int par3) {
ItemStack programmedItem = te.getStackInSlot(TileEntityProgrammer.PROGRAM_SLOT);
if (nameField.isFocused() && programmedItem != null) {
programmedItem.setStackDisplayName(nameField.getText());
NetworkHandler.sendToServer(new PacketUpdateTextfield(te, 0));
}
super.mouseClicked(x, y, par3);
if (par3 == 1 && showingWidgetProgress == 0) {
IProgWidget widget = programmerUnit.getHoveredWidget(x, y);
if (widget != null) {
GuiScreen screen = widget.getOptionWindow(this);
if (screen != null)
mc.displayGuiScreen(screen);
}
}
}
use of net.minecraft.client.gui.GuiScreen 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;
}
}
}
}
use of net.minecraft.client.gui.GuiScreen in project PneumaticCraft by MineMaarten.
the class PacketSetGlobalVariable method handleClientSide.
@Override
@SideOnly(Side.CLIENT)
public void handleClientSide(PacketSetGlobalVariable message, EntityPlayer player) {
handleServerSide(message, player);
GuiScreen screen = Minecraft.getMinecraft().currentScreen;
if (screen instanceof GuiRemote) {
((GuiRemote) screen).onGlobalVariableChange(message.varName);
}
}
use of net.minecraft.client.gui.GuiScreen in project MinecraftForge by MinecraftForge.
the class FMLClientHandler method showGuiScreen.
@Override
public void showGuiScreen(@Nullable Object clientGuiElement) {
GuiScreen gui = (GuiScreen) clientGuiElement;
client.displayGuiScreen(gui);
}
use of net.minecraft.client.gui.GuiScreen in project MinecraftForge by MinecraftForge.
the class GuiModList method actionPerformed.
@Override
protected void actionPerformed(GuiButton button) throws IOException {
if (button.enabled) {
SortType type = SortType.getTypeForButton(button);
if (type != null) {
for (GuiButton b : buttonList) {
if (SortType.getTypeForButton(b) != null) {
b.enabled = true;
}
}
button.enabled = false;
sorted = false;
sortType = type;
this.mods = modList.getMods();
} else {
switch(button.id) {
case 6:
{
this.mc.displayGuiScreen(this.mainMenu);
return;
}
case 20:
{
try {
IModGuiFactory guiFactory = FMLClientHandler.instance().getGuiFactoryFor(selectedMod);
GuiScreen newScreen = guiFactory.mainConfigGuiClass().getConstructor(GuiScreen.class).newInstance(this);
this.mc.displayGuiScreen(newScreen);
} catch (Exception e) {
FMLLog.log(Level.ERROR, e, "There was a critical issue trying to build the config GUI for %s", selectedMod.getModId());
}
return;
}
}
}
}
super.actionPerformed(button);
}
Aggregations