Search in sources :

Example 1 with HoverChecker

use of net.minecraftforge.fml.client.config.HoverChecker in project SecurityCraft by Geforce132.

the class GuiCustomizeBlock method initGui.

@Override
public void initGui() {
    super.initGui();
    for (int i = 0; i < tileEntity.getNumberOfCustomizableOptions(); i++) {
        descriptionButtons[i] = new GuiItemButton(i, guiLeft + 130, (guiTop + 10) + (i * 25), 20, 20, "", itemRender, new ItemStack(tileEntity.acceptedModules()[i].getItem()));
        this.buttonList.add(descriptionButtons[i]);
        this.hoverCheckers[i] = new HoverChecker(descriptionButtons[i], 20);
    }
    if (tileEntity.customOptions() != null) {
        for (int i = 0; i < tileEntity.customOptions().length; i++) {
            optionButtons[i] = new GuiButton(i, guiLeft + 178, (guiTop + 10) + (i * 25), 120, 20, getOptionButtonTitle(tileEntity.customOptions()[i]));
            optionButtons[i].packedFGColour = tileEntity.customOptions()[i].toString().matches(tileEntity.customOptions()[i].getDefaultValue().toString()) ? 16777120 : 14737632;
            this.buttonList.add(optionButtons[i]);
            this.hoverCheckers[i + tileEntity.getNumberOfCustomizableOptions()] = new HoverChecker(optionButtons[i], 20);
        }
    }
}
Also used : GuiButton(net.minecraft.client.gui.GuiButton) ItemStack(net.minecraft.item.ItemStack) GuiItemButton(net.geforcemods.securitycraft.gui.components.GuiItemButton) HoverChecker(net.minecraftforge.fml.client.config.HoverChecker)

Example 2 with HoverChecker

use of net.minecraftforge.fml.client.config.HoverChecker in project SecurityCraft by Geforce132.

the class GuiCameraMonitor method initGui.

@Override
@SuppressWarnings("unchecked")
public void initGui() {
    super.initGui();
    prevPageButton = new GuiButton(-1, this.width / 2 - 68, this.height / 2 + 40, 20, 20, "<");
    nextPageButton = new GuiButton(0, this.width / 2 + 52, this.height / 2 + 40, 20, 20, ">");
    this.buttonList.add(prevPageButton);
    this.buttonList.add(nextPageButton);
    cameraButtons[0] = new GuiButton(1, this.width / 2 - 38, this.height / 2 - 60 + 10, 20, 20, "#");
    cameraButtons[1] = new GuiButton(2, this.width / 2 - 8, this.height / 2 - 60 + 10, 20, 20, "#");
    cameraButtons[2] = new GuiButton(3, this.width / 2 + 22, this.height / 2 - 60 + 10, 20, 20, "#");
    cameraButtons[3] = new GuiButton(4, this.width / 2 - 38, this.height / 2 - 30 + 10, 20, 20, "#");
    cameraButtons[4] = new GuiButton(5, this.width / 2 - 8, this.height / 2 - 30 + 10, 20, 20, "#");
    cameraButtons[5] = new GuiButton(6, this.width / 2 + 22, this.height / 2 - 30 + 10, 20, 20, "#");
    cameraButtons[6] = new GuiButton(7, this.width / 2 - 38, this.height / 2 + 10, 20, 20, "#");
    cameraButtons[7] = new GuiButton(8, this.width / 2 - 8, this.height / 2 + 10, 20, 20, "#");
    cameraButtons[8] = new GuiButton(9, this.width / 2 + 22, this.height / 2 + 10, 20, 20, "#");
    cameraButtons[9] = new GuiButton(10, this.width / 2 - 38, this.height / 2 + 40, 80, 20, "#");
    for (int i = 0; i < 10; i++) {
        GuiButton button = cameraButtons[i];
        int camID = (button.id + ((page - 1) * 10));
        ArrayList<CameraView> views = this.cameraMonitor.getCameraPositions(this.nbtTag);
        CameraView view;
        button.displayString += camID;
        this.buttonList.add(button);
        if ((view = views.get(camID - 1)) != null) {
            if (view.dimension != Minecraft.getMinecraft().thePlayer.dimension) {
                hoverCheckers[button.id - 1] = new HoverChecker(button, 20);
                cameraViewDim[button.id - 1] = view.dimension;
            }
            if (BlockUtils.getBlock(Minecraft.getMinecraft().theWorld, view.getLocation()) != mod_SecurityCraft.securityCamera) {
                button.enabled = false;
                cameraTEs[button.id - 1] = null;
                continue;
            }
            cameraTEs[button.id - 1] = (TileEntitySCTE) Minecraft.getMinecraft().theWorld.getTileEntity(view.getLocation());
            hoverCheckers[button.id - 1] = new HoverChecker(button, 20);
        } else {
            button.enabled = false;
            cameraTEs[button.id - 1] = null;
            continue;
        }
    }
    if (page == 1) {
        prevPageButton.enabled = false;
    }
    if (page == 3 || cameraMonitor.getCameraPositions(nbtTag).size() < (page * 10) + 1) {
        nextPageButton.enabled = false;
    }
    for (int i = cameraMonitor.getCameraPositions(nbtTag).size() + 1; i <= (page * 10); i++) {
        cameraButtons[(i - 1) - ((page - 1) * 10)].enabled = false;
    }
}
Also used : GuiButton(net.minecraft.client.gui.GuiButton) CameraView(net.geforcemods.securitycraft.misc.CameraView) HoverChecker(net.minecraftforge.fml.client.config.HoverChecker)

Aggregations

GuiButton (net.minecraft.client.gui.GuiButton)2 HoverChecker (net.minecraftforge.fml.client.config.HoverChecker)2 GuiItemButton (net.geforcemods.securitycraft.gui.components.GuiItemButton)1 CameraView (net.geforcemods.securitycraft.misc.CameraView)1 ItemStack (net.minecraft.item.ItemStack)1