Search in sources :

Example 11 with GuiButtonThemed

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

the class ScrollingJsonEntry method setupEntry.

public void setupEntry(int px, int width) {
    btnList.clear();
    int margin = px + (width / 3);
    int ctrlSpace = MathHelper.ceil((width / 3F) * 2F);
    int n = 0;
    if (allowEdit && je != null) {
        n = 20;
        btnDel = new GuiButtonThemed(3, px + width - n, 0, 20, 20, "x");
        btnDel.packedFGColour = Color.RED.getRGB();
        btnList.add(btnDel);
    }
    if (allowEdit) {
        n = 40;
        btnAdd = new GuiButtonThemed(2, px + width - n, 0, 20, 20, "+");
        btnAdd.packedFGColour = Color.GREEN.getRGB();
        btnList.add(btnAdd);
    }
    if (je == null) {
        return;
    } else if (je.getId() == 9) {
        btnMain = new GuiButtonJson<NBTTagList>(0, margin, 0, ctrlSpace - n, 20, (NBTTagList) je, false);
        btnList.add(btnMain);
    } else if (je.getId() == 10) {
        NBTTagCompound jo = (NBTTagCompound) je;
        if (JsonHelper.isItem(jo) || JsonHelper.isFluid(jo) || JsonHelper.isEntity(jo)) {
            n += 20;
            btnAdv = new GuiButtonThemed(1, px + width - n, 0, 20, 20, "...");
            btnList.add(btnAdv);
        }
        btnMain = new GuiButtonJson<NBTTagCompound>(0, margin, 0, ctrlSpace - n, 20, jo, false);
        btnList.add(btnMain);
    } else if (je instanceof NBTPrimitive) {
        NBTPrimitive jp = (NBTPrimitive) je;
        /*if(jp.isBoolean())
			{
				btnMain = new GuiButtonJson<JsonPrimitive>(0, margin, 0, ctrlSpace - n, 20, jp, false);
				btnList.add(btnMain);
			} else if(jp.isNumber())*/
        {
            GuiNumberField num = new GuiNumberField(mc.fontRenderer, margin + 1, 0, ctrlSpace - n - 2, 18);
            num.setMaxStringLength(Integer.MAX_VALUE);
            num.setText("" + jp.getDouble());
            txtMain = num;
        }
    // else
    } else if (je.getId() == 8) {
        NBTTagString jp = (NBTTagString) je;
        GuiBigTextField txt = new GuiBigTextField(mc.fontRenderer, margin + 1, 1, ctrlSpace - n - 2, 18);
        txt.setMaxStringLength(Integer.MAX_VALUE);
        txt.setText(jp.getString());
        if (json.getId() == 10) {
            txt.enableBigEdit(new TextCallbackJsonObject((NBTTagCompound) json, key));
        } else if (json.getId() == 9) {
            txt.enableBigEdit(new TextCallbackJsonArray((NBTTagList) json, idx));
        }
        txtMain = txt;
    }
}
Also used : NBTPrimitive(net.minecraft.nbt.NBTPrimitive) GuiButtonJson(betterquesting.api.client.gui.controls.GuiButtonJson) TextCallbackJsonArray(betterquesting.client.gui.editors.json.TextCallbackJsonArray) GuiNumberField(betterquesting.api.client.gui.controls.GuiNumberField) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) GuiBigTextField(betterquesting.api.client.gui.controls.GuiBigTextField) GuiButtonThemed(betterquesting.api.client.gui.controls.GuiButtonThemed) NBTTagString(net.minecraft.nbt.NBTTagString) TextCallbackJsonObject(betterquesting.client.gui.editors.json.TextCallbackJsonObject)

Example 12 with GuiButtonThemed

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

the class ScrollingJsonEntry method onMouseClick.

@Override
public void onMouseClick(int mx, int my, int px, int py, int click, int index) {
    if (txtMain != null) {
        txtMain.mouseClicked(mx, my, click);
    }
    for (GuiButtonThemed btn : btnList) {
        if (btn.mousePressed(mc, mx, my)) {
            btn.playPressSound(mc.getSoundHandler());
            onActionPerformed(btn);
        }
    }
}
Also used : GuiButtonThemed(betterquesting.api.client.gui.controls.GuiButtonThemed)

Example 13 with GuiButtonThemed

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

the class GuiRewardEditor method mouseClicked.

@Override
public void mouseClicked(int mx, int my, int click) throws IOException {
    super.mouseClicked(mx, my, click);
    if (click != 0) {
        return;
    }
    GuiButtonThemed btn1 = btnsLeft.getButtonUnderMouse(mx, my);
    if (btn1 != null && btn1.mousePressed(mc, mx, my)) {
        btn1.playPressSound(mc.getSoundHandler());
        this.actionPerformed(btn1);
        return;
    }
    GuiButtonThemed btn2 = btnsRight.getButtonUnderMouse(mx, my);
    if (btn2 != null && btn2.mousePressed(mc, mx, my)) {
        btn2.playPressSound(mc.getSoundHandler());
        this.actionPerformed(btn2);
        return;
    }
}
Also used : GuiButtonThemed(betterquesting.api.client.gui.controls.GuiButtonThemed)

Example 14 with GuiButtonThemed

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

the class GuiTaskEditor method mouseClicked.

@Override
public void mouseClicked(int mx, int my, int click) throws IOException {
    super.mouseClicked(mx, my, click);
    if (click != 0) {
        return;
    }
    GuiButtonThemed btn1 = btnsLeft.getButtonUnderMouse(mx, my);
    if (btn1 != null && btn1.mousePressed(mc, mx, my)) {
        btn1.playPressSound(mc.getSoundHandler());
        this.actionPerformed(btn1);
        return;
    }
    GuiButtonThemed btn2 = btnsRight.getButtonUnderMouse(mx, my);
    if (btn2 != null && btn2.mousePressed(mc, mx, my)) {
        btn2.playPressSound(mc.getSoundHandler());
        this.actionPerformed(btn2);
        return;
    }
}
Also used : GuiButtonThemed(betterquesting.api.client.gui.controls.GuiButtonThemed)

Example 15 with GuiButtonThemed

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

the class GuiJsonEntitySelection method mouseClicked.

@Override
public void mouseClicked(int mx, int my, int click) throws IOException {
    super.mouseClicked(mx, my, click);
    this.searchField.mouseClicked(mx, my, click);
    GuiButtonThemed btn = btnList.getButtonUnderMouse(mx, my);
    if (btn != null && btn.mousePressed(mc, mx, my) && click == 0) {
        btn.playPressSound(mc.getSoundHandler());
        actionPerformed(btn);
    }
}
Also used : GuiButtonThemed(betterquesting.api.client.gui.controls.GuiButtonThemed)

Aggregations

GuiButtonThemed (betterquesting.api.client.gui.controls.GuiButtonThemed)32 GuiBigTextField (betterquesting.api.client.gui.controls.GuiBigTextField)7 GuiTextField (net.minecraft.client.gui.GuiTextField)5 GuiScrollingButtons (betterquesting.api.client.gui.lists.GuiScrollingButtons)4 IQuest (betterquesting.api.questing.IQuest)3 UUID (java.util.UUID)3 GuiButtonStorage (betterquesting.api.client.gui.controls.GuiButtonStorage)2 GuiNumberField (betterquesting.api.client.gui.controls.GuiNumberField)2 GuiScrollingText (betterquesting.api.client.gui.lists.GuiScrollingText)2 IImporter (betterquesting.api.client.importers.IImporter)2 ItemStack (net.minecraft.item.ItemStack)2 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)2 QuestLineButtonTree (betterquesting.api.client.gui.QuestLineButtonTree)1 GuiButtonJson (betterquesting.api.client.gui.controls.GuiButtonJson)1 IToolboxTab (betterquesting.api.client.toolbox.IToolboxTab)1 IQuestLine (betterquesting.api.questing.IQuestLine)1 IParty (betterquesting.api.questing.party.IParty)1 BigItemStack (betterquesting.api.utils.BigItemStack)1 GuiQuestLinesEmbedded (betterquesting.client.gui.GuiQuestLinesEmbedded)1 TextCallbackJsonArray (betterquesting.client.gui.editors.json.TextCallbackJsonArray)1