MCPcopy Create free account
hub / github.com/DGVPSH/SlackOpen / drawArmor

Method drawArmor

src/main/java/cc/slack/utils/render/RenderUtil.java:679–730  ·  view source on GitHub ↗
(EntityPlayer player, int x, int y, float size)

Source from the content-addressed store, hash-verified

677 }
678
679 public static void drawArmor(EntityPlayer player, int x, int y, float size) {
680 if (player.inventory.armorInventory.length > 0) {
681 List<ItemStack> items = new ArrayList<>();
682 if (player.getHeldItem() != null) {
683 items.add(player.getHeldItem());
684 }
685 for (int index = 3; index >= 0; index--) {
686 ItemStack stack = player.inventory.armorInventory[index];
687 if (stack != null) {
688 items.add(stack);
689 }
690 }
691 int armorX = x - ((items.size() * 18) / 2);
692 for (ItemStack stack : items) {
693 GlStateManager.pushMatrix();
694 GlStateManager.enableLighting();
695 mc.getRenderItem().renderItemAndEffectIntoGUI(stack, armorX, y);
696 mc.getRenderItem().renderItemOverlays(mc.MCfontRenderer, stack, armorX, y);
697 GlStateManager.disableLighting();
698 GlStateManager.popMatrix();
699 GlStateManager.disableDepth();
700 NBTTagList enchants = stack.getEnchantmentTagList();
701 GlStateManager.pushMatrix();
702 GlStateManager.scale(size, size, size);
703 if (stack.getItem() == Items.golden_apple && stack.getMetadata() == 1) {
704 mc.MCfontRenderer.drawString("op", armorX / size, y / size, 0xFFFF0000, true);
705 }
706 Enchantment[] important = new Enchantment[]{Enchantment.protection, Enchantment.sharpness, Enchantment.fireAspect, Enchantment.efficiency, Enchantment.power, Enchantment.flame};
707 if (enchants != null) {
708 int ency = y + 8;
709 for (int index = 0; index < enchants.tagCount(); ++index) {
710 short id = enchants.getCompoundTagAt(index).getShort("id");
711 short level = enchants.getCompoundTagAt(index).getShort("lvl");
712 Enchantment enc = Enchantment.getEnchantmentById(id);
713 for (Enchantment importantEnchantment : important) {
714 if (enc == importantEnchantment) {
715 String encName = enc.getTranslatedName(level).substring(0, 1).toLowerCase();
716 if (level > 99) encName = encName + "99+";
717 else encName = encName + level;
718 mc.MCfontRenderer.drawString(encName, armorX / size + 4, ency / size, 0xDDD1E6, true);
719 ency -= 5;
720 break;
721 }
722 }
723 }
724 }
725 GlStateManager.enableDepth();
726 GlStateManager.popMatrix();
727 armorX += 18;
728 }
729 }
730 }
731
732 public static Vector4d getProjectedEntity(EntityPlayer ent, double partialTicks) {
733 return getProjectedEntity(ent, partialTicks, 1);

Callers 1

onRenderMethod · 0.95

Calls 15

pushMatrixMethod · 0.95
enableLightingMethod · 0.95
disableLightingMethod · 0.95
popMatrixMethod · 0.95
disableDepthMethod · 0.95
getEnchantmentTagListMethod · 0.95
scaleMethod · 0.95
getItemMethod · 0.95
getMetadataMethod · 0.95
tagCountMethod · 0.95
getCompoundTagAtMethod · 0.95
getEnchantmentByIdMethod · 0.95

Tested by

no test coverage detected