use of betterquesting.api2.client.gui.events.types.PEventButton in project BetterQuesting by Funwayguy.
the class GuiQuestLines 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 (// Quest Line Select
btn.getButtonID() == 1 && btn instanceof PanelButtonStorage) {
for (PanelButtonStorage b : qlBtns) {
if (b.getStoredValue() == selectedLine) {
b.setBtnState(true);
break;
}
}
@SuppressWarnings("unchecked") IQuestLine ql = ((PanelButtonStorage<IQuestLine>) btn).getStoredValue();
selectedLine = ql;
selectedLineId = QuestLineDatabase.INSTANCE.getKey(ql);
cvQuest.setQuestLine(ql);
paDesc.setText(I18n.format(ql.getUnlocalisedDescription()));
cvDesc.refreshScrollBounds();
scDesc.setEnabled(cvDesc.getScrollBounds().getHeight() > 0);
btn.setBtnState(false);
} else if (// Quest Instance Select
btn.getButtonID() == 2 && btn instanceof PanelButtonStorage) {
@SuppressWarnings("unchecked") IQuest quest = ((PanelButtonStorage<IQuest>) btn).getStoredValue();
GuiHome.bookmark = new GuiQuest(this, QuestDatabase.INSTANCE.getKey(quest));
this.lastScrollX = cvQuest.getScrollX();
this.lastScrollY = cvQuest.getScrollY();
this.lastZoom = cvQuest.getZoom();
mc.displayGuiScreen(GuiHome.bookmark);
} else if (btn.getButtonID() == 3) {
mc.displayGuiScreen(new GuiQuestLineEditorA(this));
}
}
use of betterquesting.api2.client.gui.events.types.PEventButton in project BetterQuesting by Funwayguy.
the class PanelButton method onMouseRelease.
@Override
public boolean onMouseRelease(int mx, int my, int click) {
if (!pendingRelease) {
return false;
}
pendingRelease = false;
IGuiRect bounds = this.getTransform();
boolean clicked = isEnabled() && click == 0 && bounds.contains(mx, my) && !PEventBroadcaster.INSTANCE.postEvent(new PEventButton(this));
if (clicked) {
Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0F));
}
return clicked;
}
use of betterquesting.api2.client.gui.events.types.PEventButton 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());
}));
}
}
use of betterquesting.api2.client.gui.events.types.PEventButton in project BetterQuesting by Funwayguy.
the class GuiQuest method onButtonPress.
private void onButtonPress(PEventButton event) {
IPanelButton btn = event.getButton();
if (// Exit
btn.getButtonID() == 0) {
mc.displayGuiScreen(this.parent);
} else if (// Edit
btn.getButtonID() == 1) {
mc.displayGuiScreen(new GuiQuestEditor(this, quest));
} else if (// Reward previous
btn.getButtonID() == 2) {
rewardIndex = MathHelper.clamp(rewardIndex - 1, 0, quest.getRewards().size() - 1);
refreshRewardPanel();
} else if (// Reward next
btn.getButtonID() == 3) {
rewardIndex = MathHelper.clamp(rewardIndex + 1, 0, quest.getRewards().size() - 1);
refreshRewardPanel();
} else if (// Task previous
btn.getButtonID() == 4) {
taskIndex = MathHelper.clamp(taskIndex - 1, 0, quest.getTasks().size() - 1);
refreshTaskPanel();
} else if (// Task next
btn.getButtonID() == 5) {
taskIndex = MathHelper.clamp(taskIndex + 1, 0, quest.getTasks().size() - 1);
refreshTaskPanel();
} else if (// Reward claim
btn.getButtonID() == 6) {
NBTTagCompound tags = new NBTTagCompound();
tags.setInteger("questID", QuestDatabase.INSTANCE.getKey(quest));
PacketSender.INSTANCE.sendToServer(new QuestingPacket(PacketTypeNative.CLAIM.GetLocation(), tags));
} else if (// Task detect/submit
btn.getButtonID() == 7) {
NBTTagCompound tags = new NBTTagCompound();
tags.setInteger("questID", QuestDatabase.INSTANCE.getKey(quest));
PacketSender.INSTANCE.sendToServer(new QuestingPacket(PacketTypeNative.DETECT.GetLocation(), tags));
}
}
use of betterquesting.api2.client.gui.events.types.PEventButton in project BetterQuesting by Funwayguy.
the class GuiThemes method onButtonPress.
@SuppressWarnings("unchecked")
private void onButtonPress(PEventButton event) {
Minecraft mc = Minecraft.getMinecraft();
IPanelButton btn = event.getButton();
if (// Exit
btn.getButtonID() == 0) {
mc.displayGuiScreen(this.parent);
} else if (btn.getButtonID() == 1 && btn instanceof PanelButtonStorage) {
ResourceLocation res = ((PanelButtonStorage<ResourceLocation>) btn).getStoredValue();
float scroll = scrollPanel.readValue();
betterquesting.client.themes.ThemeRegistry.INSTANCE.setCurrentTheme(res);
// ThemeRegistry.INSTANCE.setTheme(res);
this.initGui();
scrollPanel.writeValue(scroll);
}
}
Aggregations