NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

package me.superblaubeere27.client.notifications;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;

import java.awt.Color;

import org.lwjgl.opengl.GL11;

public class Notification {
private NotificationType type;
private String title;
private String messsage;
private long start;

private long fadedIn;
private long fadeOut;
private long end;


public Notification(NotificationType type, String title, String messsage, int length) {
this.type = type;
this.title = title;
this.messsage = messsage;

fadedIn = 200 * length;
fadeOut = fadedIn + 500 * length;
end = fadeOut + fadedIn;
}

public void show() {
start = System.currentTimeMillis();
}

public boolean isShown() {
return getTime() <= end;
}

private long getTime() {
return System.currentTimeMillis() - start;
}

public void render() {
double offset = 0;
int width = 120;
int height = 30;
long time = getTime();

if (time < fadedIn) {
offset = Math.tanh(time / (double) (fadedIn) * 3.0) * width;
} else if (time > fadeOut) {
offset = (Math.tanh(3.0 - (time - fadeOut) / (double) (end - fadeOut) * 3.0) * width);
} else {
offset = width;
}

Color color = new Color(0, 0, 0, 220);
Color color1;

if (type == NotificationType.INFO)
color1 = new Color(0, 26, 169);
else if (type == NotificationType.WARNING)
color1 = new Color(204, 193, 0);
else {
color1 = new Color(204, 0, 18);
int i = Math.max(0, Math.min(255, (int) (Math.sin(time / 100.0) * 255.0 / 2 + 127.5)));
color = new Color(i, 0, 0, 220);
}

FontRenderer fontRenderer = Minecraft.getMinecraft().fontRendererObj;

drawRect(GuiScreen.width - offset, GuiScreen.height - 5 - height, GuiScreen.width, GuiScreen.height - 5, color.getRGB());
drawRect(GuiScreen.width - offset, GuiScreen.height - 5 - height, GuiScreen.width - offset + 4, GuiScreen.height - 5, color1.getRGB());

fontRenderer.drawString(title, (int) (GuiScreen.width - offset + 8), GuiScreen.height - 2 - height, -1);
fontRenderer.drawString(messsage, (int) (GuiScreen.width - offset + 8), GuiScreen.height - 15, -1);
}

public static void drawRect(double left, double top, double right, double bottom, int color) {
if (left < right) {
double i = left;
left = right;
right = i;
}

if (top < bottom) {
double j = top;
top = bottom;
bottom = j;
}

float f3 = (float) (color >> 24 & 255) / 255.0F;
float f = (float) (color >> 16 & 255) / 255.0F;
float f1 = (float) (color >> 8 & 255) / 255.0F;
float f2 = (float) (color & 255) / 255.0F;
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
GlStateManager.enableBlend();
GlStateManager.disableTexture2D();
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
GlStateManager.color(f, f1, f2, f3);
worldrenderer.begin(7, DefaultVertexFormats.POSITION);
worldrenderer.pos(left, bottom, 0.0D).endVertex();
worldrenderer.pos(right, bottom, 0.0D).endVertex();
worldrenderer.pos(right, top, 0.0D).endVertex();
worldrenderer.pos(left, top, 0.0D).endVertex();
tessellator.draw();
GlStateManager.enableTexture2D();
GlStateManager.disableBlend();
}

public static void drawRect(int mode, double left, double top, double right, double bottom, int color) {
if (left < right) {
double i = left;
left = right;
right = i;
}

if (top < bottom) {
double j = top;
top = bottom;
bottom = j;
}

float f3 = (float) (color >> 24 & 255) / 255.0F;
float f = (float) (color >> 16 & 255) / 255.0F;
float f1 = (float) (color >> 8 & 255) / 255.0F;
float f2 = (float) (color & 255) / 255.0F;
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
GlStateManager.enableBlend();
GlStateManager.disableTexture2D();
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
GlStateManager.color(f, f1, f2, f3);
worldrenderer.begin(mode, DefaultVertexFormats.POSITION);
worldrenderer.pos(left, bottom, 0.0D).endVertex();
worldrenderer.pos(right, bottom, 0.0D).endVertex();
worldrenderer.pos(right, top, 0.0D).endVertex();
worldrenderer.pos(left, top, 0.0D).endVertex();
tessellator.draw();
GlStateManager.enableTexture2D();
GlStateManager.disableBlend();
}
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.