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();
}
Aggregations