Search in sources :

Example 1 with GuiJsonEditor

use of betterquesting.client.gui.editors.json.scrolling.GuiJsonEditor in project BetterQuesting by Funwayguy.

the class GuiTaskEditDefault method initGui.

@Override
public void initGui() {
    super.initGui();
    if (!isDone) {
        this.isDone = true;
        ITask task = quest.getTasks().getValue(tID);
        if (task != null) {
            this.mc.displayGuiScreen(new GuiJsonEditor(this, json, task.getDocumentation(), this));
        } else {
            this.mc.displayGuiScreen(parent);
        }
    } else {
        this.mc.displayGuiScreen(parent);
    }
}
Also used : ITask(betterquesting.api.questing.tasks.ITask) GuiJsonEditor(betterquesting.client.gui.editors.json.scrolling.GuiJsonEditor)

Example 2 with GuiJsonEditor

use of betterquesting.client.gui.editors.json.scrolling.GuiJsonEditor in project BetterQuesting by Funwayguy.

the class GuiJsonTypeMenu method actionPerformed.

@Override
public void actionPerformed(GuiButton button) {
    if (button.id == 1) {
        this.lastType = EditType.ITEM;
        this.mc.displayGuiScreen(new GuiJsonItemSelection(this, itemCallback, stack));
    } else if (button.id == 2) {
        this.lastType = EditType.ENTITY;
        this.mc.displayGuiScreen(new GuiJsonEntitySelection(this, entityCallback, entity));
    } else if (button.id == 3) {
        this.lastType = EditType.NONE;
        this.mc.displayGuiScreen(new GuiJsonEditor(this, json, null));
    } else if (button.id == 4) {
        this.lastType = EditType.FLUID;
        this.mc.displayGuiScreen(new GuiJsonFluidSelection(this, fluidCallback, fluid));
    } else {
        this.lastType = EditType.NONE;
        super.actionPerformed(button);
    }
}
Also used : GuiJsonEditor(betterquesting.client.gui.editors.json.scrolling.GuiJsonEditor)

Example 3 with GuiJsonEditor

use of betterquesting.client.gui.editors.json.scrolling.GuiJsonEditor in project BetterQuesting by Funwayguy.

the class GuiHome method onButtonPress.

private void onButtonPress(PEventButton event) {
    Minecraft mc = Minecraft.getMinecraft();
    IPanelButton btn = event.getButton();
    if (// Exit
    btn.getButtonID() == 0) {
        mc.displayGuiScreen(this.parent);
    } else if (// Quests
    btn.getButtonID() == 1) {
        mc.displayGuiScreen(new GuiQuestLines(this));
    } else if (// Party
    btn.getButtonID() == 2) {
        IParty party = PartyManager.INSTANCE.getUserParty(QuestingAPI.getQuestingUUID(mc.player));
        if (party != null) {
            mc.displayGuiScreen(new GuiManageParty(this, party));
        } else {
            mc.displayGuiScreen(new GuiNoParty(this));
        }
    } else if (// Theme
    btn.getButtonID() == 3) {
        mc.displayGuiScreen(new GuiThemes(this));
    } else if (// Editor
    btn.getButtonID() == 4) {
        mc.displayGuiScreen(new GuiJsonEditor(this, QuestSettings.INSTANCE.writeToNBT(new NBTTagCompound(), EnumSaveType.CONFIG), null, (NBTTagCompound value) -> {
            QuestSettings.INSTANCE.readFromNBT(value, EnumSaveType.CONFIG);
            PacketSender.INSTANCE.sendToServer(QuestSettings.INSTANCE.getSyncPacket());
        }));
    }
}
Also used : IPanelButton(betterquesting.api2.client.gui.controls.IPanelButton) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) IParty(betterquesting.api.questing.party.IParty) Minecraft(net.minecraft.client.Minecraft) GuiJsonEditor(betterquesting.client.gui.editors.json.scrolling.GuiJsonEditor) GuiManageParty(betterquesting.client.gui.party.GuiManageParty) GuiNoParty(betterquesting.client.gui.party.GuiNoParty)

Example 4 with GuiJsonEditor

use of betterquesting.client.gui.editors.json.scrolling.GuiJsonEditor in project BetterQuesting by Funwayguy.

the class GuiRewardEditDefault method initGui.

@Override
public void initGui() {
    super.initGui();
    if (!isDone) {
        this.isDone = true;
        IReward reward = quest.getRewards().getValue(rID);
        if (reward != null) {
            this.mc.displayGuiScreen(new GuiJsonEditor(this, json, reward.getDocumentation(), this));
        } else {
            this.mc.displayGuiScreen(parent);
        }
    } else {
        this.mc.displayGuiScreen(parent);
    }
}
Also used : IReward(betterquesting.api.questing.rewards.IReward) GuiJsonEditor(betterquesting.client.gui.editors.json.scrolling.GuiJsonEditor)

Example 5 with GuiJsonEditor

use of betterquesting.client.gui.editors.json.scrolling.GuiJsonEditor in project BetterQuesting by Funwayguy.

the class GuiQuestEditor method actionPerformed.

@Override
public void actionPerformed(GuiButton button) {
    super.actionPerformed(button);
    if (// Rewards
    button.id == 1) {
        mc.displayGuiScreen(new GuiRewardEditor(this, quest));
    } else if (// Tasks
    button.id == 2) {
        mc.displayGuiScreen(new GuiTaskEditor(this, quest));
    } else if (// Prerequisites
    button.id == 3) {
        mc.displayGuiScreen(new GuiPrerequisiteEditor(this, quest));
    } else if (// Raw JSON
    button.id == 4) {
        this.lastEdit = new NBTTagCompound();
        quest.writeToNBT(lastEdit, EnumSaveType.CONFIG);
        JsonDocEvent event = new JsonDocEvent(new JsonDocBasic(null, "jdoc.betterquesting.quest"));
        MinecraftForge.EVENT_BUS.post(event);
        mc.displayGuiScreen(new GuiJsonEditor(this, lastEdit, event.getJdocResult()));
    } else if (button.id == 5) {
        boolean main = !quest.getProperties().getProperty(NativeProps.MAIN);
        quest.getProperties().setProperty(NativeProps.MAIN, main);
        button.displayString = I18n.format("betterquesting.btn.is_main") + ": " + main;
        SendChanges();
    } else if (button.id == 6) {
        EnumLogic[] logicList = EnumLogic.values();
        EnumLogic logic = quest.getProperties().getProperty(NativeProps.LOGIC_QUEST);
        logic = logicList[(logic.ordinal() + 1) % logicList.length];
        quest.getProperties().setProperty(NativeProps.LOGIC_QUEST, logic);
        button.displayString = I18n.format("betterquesting.btn.logic") + ": " + logic;
        SendChanges();
    } else if (button.id == 7) {
        EnumQuestVisibility[] visList = EnumQuestVisibility.values();
        EnumQuestVisibility vis = quest.getProperties().getProperty(NativeProps.VISIBILITY);
        vis = visList[(vis.ordinal() + 1) % visList.length];
        quest.getProperties().setProperty(NativeProps.VISIBILITY, vis);
        button.displayString = I18n.format("betterquesting.btn.show") + ": " + vis;
        SendChanges();
    }
}
Also used : EnumLogic(betterquesting.api.enums.EnumLogic) GuiTaskEditor(betterquesting.client.gui.editors.tasks.GuiTaskEditor) JsonDocEvent(betterquesting.api.events.JsonDocEvent) JsonDocBasic(betterquesting.api.jdoc.JsonDocBasic) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) EnumQuestVisibility(betterquesting.api.enums.EnumQuestVisibility) GuiRewardEditor(betterquesting.client.gui.editors.rewards.GuiRewardEditor) GuiJsonEditor(betterquesting.client.gui.editors.json.scrolling.GuiJsonEditor)

Aggregations

GuiJsonEditor (betterquesting.client.gui.editors.json.scrolling.GuiJsonEditor)5 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)2 EnumLogic (betterquesting.api.enums.EnumLogic)1 EnumQuestVisibility (betterquesting.api.enums.EnumQuestVisibility)1 JsonDocEvent (betterquesting.api.events.JsonDocEvent)1 JsonDocBasic (betterquesting.api.jdoc.JsonDocBasic)1 IParty (betterquesting.api.questing.party.IParty)1 IReward (betterquesting.api.questing.rewards.IReward)1 ITask (betterquesting.api.questing.tasks.ITask)1 IPanelButton (betterquesting.api2.client.gui.controls.IPanelButton)1 GuiRewardEditor (betterquesting.client.gui.editors.rewards.GuiRewardEditor)1 GuiTaskEditor (betterquesting.client.gui.editors.tasks.GuiTaskEditor)1 GuiManageParty (betterquesting.client.gui.party.GuiManageParty)1 GuiNoParty (betterquesting.client.gui.party.GuiNoParty)1 Minecraft (net.minecraft.client.Minecraft)1