use of hellfirepvp.astralsorcery.client.screen.journal.overlay.ScreenJournalOverlayPerkStatistics in project AstralSorcery by HellFirePvP.
the class ScreenJournalPerkTree method mouseClicked.
@Override
public boolean mouseClicked(double mouseX, double mouseY, int mouseButton) {
if (super.mouseClicked(mouseX, mouseY, mouseButton)) {
return true;
}
Minecraft mc = Minecraft.getInstance();
if (socketMenu != null && (mouseButton == 0 || mouseButton == 1) && rSocketMenu != null && !rSocketMenu.contains(mouseX, mouseY)) {
closeSocketMenu();
}
if (mouseButton == 0) {
if (socketMenu != null) {
for (Rectangle.Float r : slotsSocketMenu.keySet()) {
if (r.contains(mouseX, mouseY) && !socketMenu.hasItem(mc.player, LogicalSide.CLIENT)) {
int slotId = slotsSocketMenu.get(r);
if (tryInsertGem(slotId, socketMenu)) {
return true;
}
}
}
}
if (handleBookmarkClick(mouseX, mouseY)) {
return true;
}
if (rectSealBox.contains(mouseX - guiLeft, mouseY - guiTop)) {
if (!this.foundSeals.isEmpty()) {
this.mouseSealStack = new ItemStack(ItemsAS.PERK_SEAL);
}
return true;
}
if (rStatStar.contains(mouseX, mouseY)) {
this.expectReinit = true;
mc.displayGuiScreen(new ScreenJournalOverlayPerkStatistics(this));
return true;
}
}
PlayerProgress prog = ResearchHelper.getClientProgress();
PlayerPerkData perkData = prog.getPerkData();
for (Map.Entry<AbstractPerk, Rectangle.Float> rctPerk : this.thisFramePerks.entrySet()) {
if (rctPerk.getValue().contains(mouseX, mouseY) && this.guiBox.isInBox(mouseX - guiLeft, mouseY - guiTop)) {
AbstractPerk perk = rctPerk.getKey();
if (mouseButton == 0 && mc.gameSettings.showDebugInfo && hasControlDown()) {
String perkKey = perk.getRegistryName().toString();
Minecraft.getInstance().keyboardListener.setClipboardString(perkKey);
mc.player.sendMessage(new TranslationTextComponent("astralsorcery.misc.ctrlcopy.copied", perkKey), Util.DUMMY_UUID);
break;
}
if (mouseButton == 1) {
if (perkData.hasPerkEffect(perk) && perk instanceof GemSocketPerk) {
if (((GemSocketPerk) perk).hasItem(mc.player, LogicalSide.CLIENT)) {
PktPerkGemModification pkt = PktPerkGemModification.dropItem(perk);
PacketChannel.CHANNEL.sendToServer(pkt);
AstralSorcery.getProxy().scheduleClientside(() -> {
if (mc.currentScreen == this) {
// Only if user hasn't closed
updateSearchHighlight();
}
}, 10);
SoundHelper.playSoundClient(SoundEvents.BLOCK_GLASS_PLACE, .35F, 9f);
} else {
this.socketMenu = (GemSocketPerk) perk;
}
return true;
}
} else if (mouseButton == 0) {
if (perk.handleMouseClick(this, mouseX, mouseY)) {
return true;
}
if (!perkData.hasPerkAllocation(perk) && perk.mayUnlockPerk(prog, mc.player)) {
this.unlockPrimed = perk;
} else if (this.sealBreakPrimed != null && this.tickSealBreak > 0) {
PktRequestPerkSealAction pkt = new PktRequestPerkSealAction(perk, false);
PacketChannel.CHANNEL.sendToServer(pkt);
} else if (prog.getPerkData().isPerkSealed(perk)) {
this.sealBreakPrimed = perk;
this.tickSealBreak = 4;
}
return true;
}
}
}
return false;
}
Aggregations