> sbEvents : eventMap.entrySet()) {
for (SBEvent sbEvent : sbEvents.getValue()) {
long timeUntilMillis = sbEvents.getKey() - currentTime;
int x = guiLeft + 29 + 17 * (index % 3);
int y = guiTop + 44 + 17 * (index / 3);
if (sbEvent.id.equals("spooky_festival")) {
if (sbEvents.getKey() > currentTime - HOUR && (sbEvents.getKey() < spookyStart || spookyStart == 0)) {
spookyStart = sbEvents.getKey();
}
}
if (index >= 21) {
if (nextEvent != null) break;
if (eventFavourites.isEmpty()) {
nextEvent = sbEvent;
timeUntilNext = timeUntilMillis;
} else if (eventFavourites.contains(sbEvent.id)) {
nextEvent = sbEvent;
timeUntilNext = timeUntilMillis;
}
continue;
}
if (firstEvent == null) {
firstEvent = sbEvent;
timeUntilFirst = timeUntilMillis;
}
String[] split = sbEvent.id.split(":");
boolean containsId = false;
for (int i = 1; i < split.length; i++) {
if (eventFavourites.contains(split[0] + ":" + split[i])) {
containsId = true;
break;
}
}
if (eventFavourites.isEmpty()) {
if (nextEvent == null) {
nextEvent = sbEvent;
timeUntilNext = timeUntilMillis;
}
} else if (eventFavourites.contains(split[0]) || containsId) {
if (nextEvent == null) {
nextEvent = sbEvent;
timeUntilNext = timeUntilMillis;
}
GlStateManager.depthMask(false);
GlStateManager.translate(0, 0, -2);
Gui.drawRect(x, y, x + 16, y + 16, 0xcfffbf49);
GlStateManager.translate(0, 0, 2);
GlStateManager.depthMask(true);
}
Utils.drawItemStackWithText(sbEvent.stack, x, y, "" + (index + 1));
if (mouseX >= x && mouseX <= x + 16) {
if (mouseY >= y && mouseY <= y + 16) {
tooltipToDisplay = Utils.createList(
sbEvent.display,
EnumChatFormatting.GRAY + "Starts in: " + EnumChatFormatting.YELLOW + prettyTime(timeUntilMillis, false)
);
if (sbEvent.lastsFor >= 0) {
tooltipToDisplay.add(EnumChatFormatting.GRAY + "Lasts for: " + EnumChatFormatting.YELLOW +
prettyTime(sbEvent.lastsFor, true));
}
if (sbEvent.desc != null) {
tooltipToDisplay.add("");
tooltipToDisplay.addAll(sbEvent.desc);
}
}
}
index++;
}
}
//Special Events
for (int i = 0; i < 21; i++) {
int itemIndex = 10 + i + (i / 7) * 2;
ItemStack item = cc.getLowerChestInventory().getStackInSlot(itemIndex);
if (item == null) continue;
String eventId = getIdForDisplayName(item.getDisplayName());
NBTTagCompound tag = item.getTagCompound();
tag.setString("event_id", eventId);
item.setTagCompound(tag);
int x = guiLeft + 89 + 17 * (i % 3);
int y = guiTop + 44 + 17 * (i / 3);
if (eventFavourites.contains(eventId)) {
GlStateManager.depthMask(false);
GlStateManager.translate(0, 0, -2);
Gui.drawRect(x, y, x + 16, y + 16, 0xcfffbf49);
GlStateManager.translate(0, 0, 2);
GlStateManager.depthMask(true);
}
Utils.drawItemStackWithText(item, x, y, "" + (i + 1));
if (mouseX >= x && mouseX <= x + 16) {
if (mouseY >= y && mouseY <= y + 16) {
tooltipToDisplay = item.getTooltip(Minecraft.getMinecraft().thePlayer, false);
}
}
}
if (nextEvent == null) {
nextEvent = firstEvent;
timeUntilNext = timeUntilFirst;
}
if (nextEvent != null) {
String nextS = EnumChatFormatting.YELLOW + "Next: ";
int nextSLen = fr.getStringWidth(nextS);
fr.drawString(nextS, guiLeft + 8, guiTop + 6, -1, false);
String until = " " + EnumChatFormatting.YELLOW + prettyTime(timeUntilNext, false);
int untilLen = fr.getStringWidth(until);
fr.drawString(until, guiLeft + xSize - 8 - untilLen, guiTop + 6, -1, false);
int eventTitleLen = xSize - 16 - untilLen - nextSLen;
int displayWidth = fr.getStringWidth(nextEvent.display);
int spaceLen = fr.getCharWidth(' ');
if (displayWidth > eventTitleLen) {
GL11.glEnable(GL11.GL_SCISSOR_TEST);
GL11.glScissor(
(guiLeft + 8 + nextSLen) * scaledResolution.getScaleFactor(),
0,
eventTitleLen * scaledResolution.getScaleFactor(),
Minecraft.getMinecraft().displayHeight
);
fr.drawString(nextEvent.display + " " + nextEvent.display,
guiLeft + 8 + nextSLen - (float) (currentTime / 50.0 % (displayWidth + spaceLen)), guiTop + 6, -1, false
);
GL11.glDisable(GL11.GL_SCISSOR_TEST);
} else {
fr.drawString(nextEvent.display, guiLeft + 8 + nextSLen, guiTop + 6, -1, false);
}
if (mouseX > guiLeft && mouseX < guiLeft + 168) {
if (mouseY > guiTop && mouseY < guiTop + 20) {
tooltipToDisplay = Utils.createList(
nextEvent.display,
EnumChatFormatting.GRAY + "Starts in: " + EnumChatFormatting.YELLOW + prettyTime(timeUntilNext, false)
);
if (nextEvent.lastsFor >= 0) {
tooltipToDisplay.add(EnumChatFormatting.GRAY + "Lasts for: " + EnumChatFormatting.YELLOW +
prettyTime(nextEvent.lastsFor, true));
}
if (nextEvent.desc != null) {
tooltipToDisplay.add("");
tooltipToDisplay.addAll(nextEvent.desc);
}
}
}
}
GlStateManager.color(1, 1, 1, 1);
Minecraft.getMinecraft().getTextureManager().bindTexture(help);
Utils.drawTexturedRect(guiLeft + xSize - 18, guiTop + ySize + 2, 16, 16, GL11.GL_LINEAR);
if (mouseX >= guiLeft + xSize - 18 && mouseX < guiLeft + xSize - 2) {
if (mouseY >= guiTop + ySize + 2 && mouseY <= guiTop + ySize + 18) {
tooltipToDisplay = new ArrayList<>();
tooltipToDisplay.add(EnumChatFormatting.AQUA + "NEU Calendar Help");
tooltipToDisplay.add(EnumChatFormatting.YELLOW + "This calendar displays various SkyBlock events");
tooltipToDisplay.add(EnumChatFormatting.YELLOW + "'Daily' events are events that happen frequently");
tooltipToDisplay.add(EnumChatFormatting.YELLOW + "'Special' events are events that happen infrequently");
tooltipToDisplay.add(EnumChatFormatting.YELLOW + "");
tooltipToDisplay.add(EnumChatFormatting.YELLOW + "The eventbar at the top will also show in your inventory");
tooltipToDisplay.add(EnumChatFormatting.YELLOW + "");
tooltipToDisplay.add(EnumChatFormatting.YELLOW + "Press 'F' on an event to mark it as a favourite");
tooltipToDisplay.add(EnumChatFormatting.YELLOW + "Favourited events will show over normal events");
tooltipToDisplay.add(EnumChatFormatting.YELLOW + "Favourited events will also give a notification when it");
tooltipToDisplay.add(EnumChatFormatting.YELLOW + "is about to start and when it does start");
tooltipToDisplay.add(EnumChatFormatting.YELLOW + "");
tooltipToDisplay.add(EnumChatFormatting.DARK_GRAY + "In order to show crop types for Jacob's Farming");
tooltipToDisplay.add(EnumChatFormatting.DARK_GRAY + "contest, visit the full SkyBlock calendar and go all");
tooltipToDisplay.add(EnumChatFormatting.DARK_GRAY + "the way to the end of the SkyBlock year");
Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1, fr);
tooltipToDisplay = null;
}
}
if (jfFavouriteSelect != null) {
int arrowLen = fr.getStringWidth("> ");
int selectSizeX = 0;
int selectStringIndex = 0;
for (String s : jfFavouriteSelect) {
int sWidth = fr.getStringWidth(s);
if (selectStringIndex + 1 == jfFavouriteSelectIndex) sWidth += arrowLen;
if (sWidth > selectSizeX) {
selectSizeX = sWidth;
}
selectStringIndex++;
}
selectSizeX += +10;
GlStateManager.translate(0, 0, 19);
Gui.drawRect(jfFavouriteSelectX + 2, jfFavouriteSelectY + 2, jfFavouriteSelectX + selectSizeX + 2,
jfFavouriteSelectY + 18 + jfFavouriteSelect.size() * 10 + 2, 0xa0000000
);
GlStateManager.depthFunc(GL11.GL_LESS);
GlStateManager.translate(0, 0, 1);
Gui.drawRect(jfFavouriteSelectX + 1, jfFavouriteSelectY + 1, jfFavouriteSelectX + selectSizeX - 1,
jfFavouriteSelectY + 18 + jfFavouriteSelect.size() * 10 - 1, 0xffc0c0c0
);
Gui.drawRect(jfFavouriteSelectX, jfFavouriteSelectY, jfFavouriteSelectX + selectSizeX - 1,
jfFavouriteSelectY + 18 + jfFavouriteSelect.size() * 10 - 1, 0xfff0f0f0
);
Gui.drawRect(jfFavouriteSelectX, jfFavouriteSelectY, jfFavouriteSelectX + selectSizeX,
jfFavouriteSelectY + 18 + jfFavouriteSelect.size() * 10, 0xff909090
);
GlStateManager.depthFunc(GL11.GL_LEQUAL);
String all = (NotEnoughUpdates.INSTANCE.config.hidden.eventFavourites.contains("jacob_farming") ?
EnumChatFormatting.DARK_GREEN : EnumChatFormatting.DARK_GRAY) + "All";
if (jfFavouriteSelectIndex == 0) {
fr.drawString(
EnumChatFormatting.BLACK + "> " + all,
jfFavouriteSelectX + 5,
jfFavouriteSelectY + 5,
0xff000000
);
} else {
fr.drawString(all, jfFavouriteSelectX + 5, jfFavouriteSelectY + 5, 0xff000000);
}
fr.drawString(EnumChatFormatting.BLACK + "> ", jfFavouriteSelectX + 6,
jfFavouriteSelectY + 10 * jfFavouriteSelectIndex + 5, 0xff000000
);
selectStringIndex = 0;
for (String s : jfFavouriteSelect) {
EnumChatFormatting colour = NotEnoughUpdates.INSTANCE.config.hidden.eventFavourites.contains(
"jacob_farming:" + s)
? EnumChatFormatting.DARK_GREEN : EnumChatFormatting.DARK_GRAY;
s = (selectStringIndex + 1 == jfFavouriteSelectIndex ? EnumChatFormatting.BLACK + "> " : "") + colour + s;
fr.drawString(s, jfFavouriteSelectX + 5, jfFavouriteSelectY + 10 * selectStringIndex + 15, 0xff000000);
selectStringIndex++;
}
GlStateManager.translate(0, 0, -20);
} else if (tooltipToDisplay != null) {
Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1, fr);
}
GlStateManager.translate(0, 0, -10);
}
private String prettyTime(long millis, boolean trimmed) {
long seconds = millis / 1000 % 60;
long minutes = (millis / 1000 / 60) % 60;
long hours = (millis / 1000 / 60 / 60) % 24;
long days = (millis / 1000 / 60 / 60 / 24);
String endsIn = "";
if (millis < 0) {
endsIn += "Now!";
} else if (minutes == 0 && hours == 0 && days == 0) {
endsIn += seconds + "s";
} else if (hours == 0 && days == 0) {
if (trimmed && seconds == 0) {
endsIn += minutes + "m";
} else {
endsIn += minutes + "m" + seconds + "s";
}
} else if (days == 0) {
if (hours <= 6) {
if (trimmed && seconds == 0) {
if (minutes == 0) {
endsIn += hours + "h";
} else {
endsIn += hours + "h" + minutes + "m";
}
} else {
endsIn += hours + "h" + minutes + "m" + seconds + "s";
}
} else {
endsIn += hours + "h";
}
} else {
endsIn += days + "d" + hours + "h";
}
return endsIn;
}
Shader blurShaderHorz = null;
Framebuffer blurOutputHorz = null;
Shader blurShaderVert = null;
Framebuffer blurOutputVert = null;
/**
* Creates a projection matrix that projects from our coordinate space [0->width; 0->height] to OpenGL coordinate
* space [-1 -> 1; 1 -> -1] (Note: flipped y-axis).
*
* This is so that we can render to and from the framebuffer in a way that is familiar to us, instead of needing to
* apply scales and translations manually.
*/
private Matrix4f createProjectionMatrix(int width, int height) {
Matrix4f projMatrix = new Matrix4f();
projMatrix.setIdentity();
projMatrix.m00 = 2.0F / (float) width;
projMatrix.m11 = 2.0F / (float) (-height);
projMatrix.m22 = -0.0020001999F;
projMatrix.m33 = 1.0F;
projMatrix.m03 = -1.0F;
projMatrix.m13 = 1.0F;
projMatrix.m23 = -1.0001999F;
return projMatrix;
}
}