Search in sources :

Example 1 with GuiButtonStorage

use of betterquesting.api.client.gui.controls.GuiButtonStorage in project BetterQuesting by Funwayguy.

the class GuiImporters method mouseClicked.

@Override
public void mouseClicked(int mx, int my, int click) throws IOException {
    super.mouseClicked(mx, my, click);
    GuiButtonThemed btn = this.btnList.getButtonUnderMouse(mx, my);
    if (click == 0 && btn != null && btn.mousePressed(mc, mx, my)) {
        btn.playPressSound(mc.getSoundHandler());
        @SuppressWarnings("unchecked") IImporter imp = ((GuiButtonStorage<IImporter>) btn).getStored();
        this.selected = imp;
        if (impGui != null) {
            this.embedded.remove(impGui);
        }
        impGui = new GuiImporterEmbedded(imp, guiLeft + sizeX / 2 + 8, guiTop + 32, sizeX / 2 - 24, sizeY - 84);
        this.embedded.add(impGui);
    }
}
Also used : GuiButtonStorage(betterquesting.api.client.gui.controls.GuiButtonStorage) GuiButtonThemed(betterquesting.api.client.gui.controls.GuiButtonThemed) IImporter(betterquesting.api.client.importers.IImporter)

Example 2 with GuiButtonStorage

use of betterquesting.api.client.gui.controls.GuiButtonStorage in project BetterQuesting by Funwayguy.

the class GuiJsonEntitySelection method updateSearch.

private void updateSearch() {
    if (searching == null) {
        return;
    } else if (!searching.hasNext()) {
        searching = null;
        return;
    }
    int pass = 0;
    int btnWidth = btnList.getListWidth();
    while (searching.hasNext() && pass < 64) {
        String key = searching.next();
        Class<?> cls = EntityList.getClass(new ResourceLocation(key));
        boolean abs = cls == null ? false : Modifier.isAbstract(cls.getModifiers());
        if (!abs && key.toLowerCase().contains(searchTxt)) {
            GuiButtonStorage<String> btn = new GuiButtonStorage<String>(1, 0, 0, btnWidth, 20, key);
            btn.setStored(key);
            btnList.addButtonRow(btn);
        }
    }
}
Also used : GuiButtonStorage(betterquesting.api.client.gui.controls.GuiButtonStorage) ResourceLocation(net.minecraft.util.ResourceLocation)

Example 3 with GuiButtonStorage

use of betterquesting.api.client.gui.controls.GuiButtonStorage in project BetterQuesting by Funwayguy.

the class GuiImporters method initGui.

@Override
public void initGui() {
    super.initGui();
    btnList = new GuiScrollingButtons(mc, guiLeft + 16, guiTop + 32, sizeX / 2 - 24, sizeY - 64);
    for (IImporter imp : ImporterRegistry.INSTANCE.getImporters()) {
        GuiButtonStorage<IImporter> btnImp = new GuiButtonStorage<IImporter>(0, 0, 0, btnList.getListWidth(), 20, I18n.format(imp.getUnlocalisedName()));
        btnImp.setStored(imp);
        btnList.addButtonRow(btnImp);
    }
    this.embedded.add(btnList);
    int btnX = guiLeft + 16 + ((sizeX - 32) / 4) * 3 - 50;
    this.buttonList.add(new GuiButtonThemed(1, btnX, guiTop + sizeY - 52, 100, 20, I18n.format("betterquesting.btn.import")));
}
Also used : GuiButtonStorage(betterquesting.api.client.gui.controls.GuiButtonStorage) GuiButtonThemed(betterquesting.api.client.gui.controls.GuiButtonThemed) IImporter(betterquesting.api.client.importers.IImporter) GuiScrollingButtons(betterquesting.api.client.gui.lists.GuiScrollingButtons)

Aggregations

GuiButtonStorage (betterquesting.api.client.gui.controls.GuiButtonStorage)3 GuiButtonThemed (betterquesting.api.client.gui.controls.GuiButtonThemed)2 IImporter (betterquesting.api.client.importers.IImporter)2 GuiScrollingButtons (betterquesting.api.client.gui.lists.GuiScrollingButtons)1 ResourceLocation (net.minecraft.util.ResourceLocation)1