Search in sources :

Example 1 with IHUDElement

use of mekanism.api.gear.IHUDElement in project Mekanism by mekanism.

the class HUDRenderer method renderMekaSuitModuleIcons.

private void renderMekaSuitModuleIcons(MatrixStack matrix, float partialTick, int color) {
    // create list of all elements to render
    List<IHUDElement> elements = new ArrayList<>();
    // Add any elements that might be on modules in the meka suit while worn
    for (EquipmentSlotType type : EnumUtils.ARMOR_SLOTS) {
        ItemStack stack = getStack(type);
        if (stack.getItem() instanceof ItemMekaSuitArmor) {
            elements.addAll(((ItemMekaSuitArmor) stack.getItem()).getHUDElements(minecraft.player, stack));
        }
    }
    // Add any elements that might be on modules in the meka tool when it is held
    for (EquipmentSlotType type : EnumUtils.HAND_SLOTS) {
        ItemStack stack = getStack(type);
        if (stack.getItem() instanceof ItemMekaTool) {
            elements.addAll(((ItemMekaTool) stack.getItem()).getHUDElements(minecraft.player, stack));
        }
    }
    int startX = minecraft.getWindow().getGuiScaledWidth() - 10;
    int curY = minecraft.getWindow().getGuiScaledHeight() - 10;
    matrix.pushPose();
    for (IHUDElement element : elements) {
        int elementWidth = 24 + minecraft.font.width(element.getText());
        curY -= 18;
        renderHUDElement(matrix, startX - elementWidth, curY, element, color, true);
    }
    matrix.popPose();
}
Also used : ItemMekaTool(mekanism.common.item.gear.ItemMekaTool) ItemMekaSuitArmor(mekanism.common.item.gear.ItemMekaSuitArmor) EquipmentSlotType(net.minecraft.inventory.EquipmentSlotType) ArrayList(java.util.ArrayList) ItemStack(net.minecraft.item.ItemStack) IHUDElement(mekanism.api.gear.IHUDElement)

Aggregations

ArrayList (java.util.ArrayList)1 IHUDElement (mekanism.api.gear.IHUDElement)1 ItemMekaSuitArmor (mekanism.common.item.gear.ItemMekaSuitArmor)1 ItemMekaTool (mekanism.common.item.gear.ItemMekaTool)1 EquipmentSlotType (net.minecraft.inventory.EquipmentSlotType)1 ItemStack (net.minecraft.item.ItemStack)1