Search in sources :

Example 1 with PacketRobit

use of mekanism.common.network.to_server.PacketRobit in project Mekanism by mekanism.

the class GuiRobitMain method addGuiElements.

@Override
protected void addGuiElements() {
    super.addGuiElements();
    addButton(new GuiSecurityTab(this, robit, 120));
    addButton(GuiSideHolder.create(this, 176, 6, 106, false, false, SpecialColors.TAB_ROBIT_MENU));
    addButton(new GuiInnerScreen(this, 27, 16, 122, 56));
    addButton(new GuiHorizontalPowerBar(this, robit.getEnergyContainer(), 27, 74, 120));
    addButton(new MekanismImageButton(this, 6, 16, 18, getButtonLocation("home"), () -> {
        Mekanism.packetHandler.sendToServer(new PacketRobit(RobitPacketType.GO_HOME, robit));
        getMinecraft().setScreen(null);
    }, getOnHover(MekanismLang.ROBIT_TELEPORT)));
    renameButton = addButton(new MekanismImageButton(this, 6, 35, 18, getButtonLocation("rename"), () -> openWindow(new GuiRobitRename(this, 27, 16, robit), () -> renameButton), getOnHover(MekanismLang.ROBIT_RENAME)));
    skinButton = addButton(new MekanismImageButton(this, 6, 54, 18, getButtonLocation("skin"), () -> openWindow(new GuiRobitSkinSelect(this, 4, -12, robit), () -> skinButton), getOnHover(MekanismLang.ROBIT_SKIN_SELECT)));
    addButton(new MekanismImageButton(this, 152, 35, 18, getButtonLocation("drop"), () -> Mekanism.packetHandler.sendToServer(new PacketRobit(RobitPacketType.DROP_PICKUP, robit)), getOnHover(MekanismLang.ROBIT_TOGGLE_PICKUP)));
    addButton(new MekanismImageButton(this, 152, 54, 18, getButtonLocation("follow"), () -> Mekanism.packetHandler.sendToServer(new PacketRobit(RobitPacketType.FOLLOW, robit)), getOnHover(MekanismLang.ROBIT_TOGGLE_FOLLOW)));
    addButton(new MekanismImageButton(this, 179, 10, 18, getButtonLocation("main"), () -> {
    // Clicking main button doesn't do anything while already on the main GUI
    }, getOnHover(MekanismLang.ROBIT)));
    addButton(new MekanismImageButton(this, 179, 30, 18, getButtonLocation("crafting"), () -> Mekanism.packetHandler.sendToServer(new PacketGuiButtonPress(ClickedEntityButton.ROBIT_CRAFTING, robit)), getOnHover(MekanismLang.ROBIT_CRAFTING)));
    addButton(new MekanismImageButton(this, 179, 50, 18, getButtonLocation("inventory"), () -> Mekanism.packetHandler.sendToServer(new PacketGuiButtonPress(ClickedEntityButton.ROBIT_INVENTORY, robit)), getOnHover(MekanismLang.ROBIT_INVENTORY)));
    addButton(new MekanismImageButton(this, 179, 70, 18, getButtonLocation("smelting"), () -> Mekanism.packetHandler.sendToServer(new PacketGuiButtonPress(ClickedEntityButton.ROBIT_SMELTING, robit)), getOnHover(MekanismLang.ROBIT_SMELTING)));
    addButton(new MekanismImageButton(this, 179, 90, 18, getButtonLocation("repair"), () -> Mekanism.packetHandler.sendToServer(new PacketGuiButtonPress(ClickedEntityButton.ROBIT_REPAIR, robit)), getOnHover(MekanismLang.ROBIT_REPAIR)));
}
Also used : GuiInnerScreen(mekanism.client.gui.element.GuiInnerScreen) GuiRobitSkinSelect(mekanism.client.gui.element.window.GuiRobitSkinSelect) PacketGuiButtonPress(mekanism.common.network.to_server.PacketGuiButtonPress) GuiSecurityTab(mekanism.client.gui.element.tab.GuiSecurityTab) GuiHorizontalPowerBar(mekanism.client.gui.element.bar.GuiHorizontalPowerBar) PacketRobit(mekanism.common.network.to_server.PacketRobit) GuiRobitRename(mekanism.client.gui.element.window.GuiRobitRename) MekanismImageButton(mekanism.client.gui.element.button.MekanismImageButton)

Example 2 with PacketRobit

use of mekanism.common.network.to_server.PacketRobit in project Mekanism by mekanism.

the class GuiRobitRename method changeName.

private void changeName() {
    String name = nameChangeField.getText().trim();
    if (!name.isEmpty()) {
        Mekanism.packetHandler.sendToServer(new PacketRobit(robit, name));
        close();
    }
}
Also used : PacketRobit(mekanism.common.network.to_server.PacketRobit)

Aggregations

PacketRobit (mekanism.common.network.to_server.PacketRobit)2 GuiInnerScreen (mekanism.client.gui.element.GuiInnerScreen)1 GuiHorizontalPowerBar (mekanism.client.gui.element.bar.GuiHorizontalPowerBar)1 MekanismImageButton (mekanism.client.gui.element.button.MekanismImageButton)1 GuiSecurityTab (mekanism.client.gui.element.tab.GuiSecurityTab)1 GuiRobitRename (mekanism.client.gui.element.window.GuiRobitRename)1 GuiRobitSkinSelect (mekanism.client.gui.element.window.GuiRobitSkinSelect)1 PacketGuiButtonPress (mekanism.common.network.to_server.PacketGuiButtonPress)1