use of mekanism.common.item.interfaces.IModeItem in project Mekanism by mekanism.
the class RenderTickHandler method renderStatusBar.
private void renderStatusBar(MatrixStack matrix, @Nonnull PlayerEntity player) {
// to be more faded in color, and blinks to full color just before disappearing
if (modeSwitchTimer > 1) {
if (minecraft.screen == null && minecraft.font != null) {
ItemStack stack = player.getMainHandItem();
if (IModeItem.isModeItem(stack, EquipmentSlotType.MAINHAND)) {
ITextComponent scrollTextComponent = ((IModeItem) stack.getItem()).getScrollTextComponent(stack);
if (scrollTextComponent != null) {
int x = minecraft.getWindow().getGuiScaledWidth();
int y = minecraft.getWindow().getGuiScaledHeight();
int color = Color.rgbad(1, 1, 1, modeSwitchTimer / 100F).argb();
minecraft.font.draw(matrix, scrollTextComponent, (x - minecraft.font.width(scrollTextComponent)) / 2, y - 60, color);
}
}
}
modeSwitchTimer--;
}
}
Aggregations