Notes
Notes - notes.io |
import java.awt.Color;
import me.aristhena.client.module.Module;
import me.aristhena.client.module.Module.Mod;
import me.aristhena.event.EventTarget;
import me.aristhena.event.events.Render2DEvent;
import me.aristhena.utils.ClientUtils;
import me.aristhena.utils.minecraft.FontRenderer;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemBow;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import net.minecraft.item.ItemTool;
import org.lwjgl.opengl.GL11;
@Module.Mod(displayName="Armor")
public class ArmorHud
extends Module
{
public Minecraft mc;
public ArmorHud()
{
this.mc = Minecraft.getMinecraft();
}
@EventTarget
private void onRender2D(Render2DEvent e)
{
int itemX = e.getWidth() / 2 + 9;
for (int i = 0; i < 5; i++)
{
ItemStack ia = this.mc.thePlayer.getEquipmentInSlot(i);
if (ia != null)
{
float oldZ = this.mc.getRenderItem().zLevel;
GL11.glPushMatrix();
GlStateManager.clear(256);
GlStateManager.disableAlpha();
RenderHelper.enableStandardItemLighting();
this.mc.getRenderItem().zLevel = -100.0F;
this.mc.getRenderItem().renderItemIntoGUI(ia, itemX, e.getHeight() - 55);
this.mc.getRenderItem().renderItemOverlays(this.mc.fontRendererObj, ia, itemX, e.getHeight() - 55);
this.mc.getRenderItem().zLevel = oldZ;
RenderHelper.disableStandardItemLighting();
GlStateManager.enableAlpha();
GL11.glPopMatrix();
if (((ia.getItem() instanceof ItemSword)) || ((ia.getItem() instanceof ItemTool)) || ((ia.getItem() instanceof ItemArmor)) || ((ia.getItem() instanceof ItemBow)))
{
GlStateManager.pushMatrix();
int durability = ia.getMaxDamage() - ia.getItemDamage();
int y = e.getHeight() - 60;
GlStateManager.scale(0.5D, 0.5D, 0.5D);
ClientUtils.clientFont().drawStringWithShadow(durability, (itemX + 4) / 0.5F, y / 0.5F, getRainbow(15000, -15 * y));
GlStateManager.popMatrix();
}
itemX += 16;
}
}
}
public static int getRainbow(int speed, int offset)
{
float hue = (float)((System.currentTimeMillis() + offset) % speed);
hue /= speed;
return Color.getHSBColor(hue, 1.0F, 1.0F).getRGB();
}
}
|
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