use of hellfirepvp.astralsorcery.common.network.play.client.PktDiscoverConstellation in project AstralSorcery by HellFirePvP.
the class ConstellationDiscoveryScreen method checkConstellationMatch.
private void checkConstellationMatch() {
if (this.currentDrawArea == null || this.currentDrawArea.cstDisplay.isEmpty()) {
return;
}
PlayerProgress progress = ResearchHelper.getClientProgress();
for (IConstellation cst : this.currentDrawArea.cstDisplay.keySet()) {
ConstellationDisplayInformation info = this.currentDrawArea.cstDisplay.get(cst);
if (progress.hasConstellationDiscovered(cst) || !progress.hasSeenConstellation(cst)) {
continue;
}
if (cst.getStarConnections().size() != this.drawnLines.size()) {
continue;
}
if (!cst.canDiscover(Minecraft.getInstance().player, progress)) {
continue;
}
boolean didMatch = true;
for (StarConnection cstConnection : cst.getStarConnections()) {
Rectangle.Float rctFrom = info.frameDrawInformation.get(cstConnection.getLeft());
Rectangle.Float rctTo = info.frameDrawInformation.get(cstConnection.getRight());
if (rctFrom == null || rctTo == null) {
didMatch = false;
break;
}
if (!hasMatchingDrawnLine(rctFrom, rctTo)) {
didMatch = false;
break;
}
}
if (didMatch) {
PacketChannel.CHANNEL.sendToServer(new PktDiscoverConstellation(cst));
this.clearDrawing();
return;
}
}
}
Aggregations