use of pokefenn.totemic.tileentity.totem.StateCeremonyEffect in project Totemic by TeamTotemic.
the class GameOverlay method renderHUD.
@SubscribeEvent
public void renderHUD(RenderGameOverlayEvent.Post event) {
if (event.getType() != ElementType.ALL)
return;
Minecraft mc = Minecraft.getMinecraft();
mc.mcProfiler.startSection("totemicHUD");
if (activeTotem != null) {
if (activeTotem.isInvalid() || !(activeTotem.getState() instanceof StateStartup || activeTotem.getState() instanceof StateCeremonyEffect))
activeTotem = null;
}
if (activeTotem != null) {
int w = 117;
int h = 30;
double texW = 128;
double texH = 64;
float hudX = (event.getResolution().getScaledWidth() - w) / 2 + ModConfig.client.ceremonyHudPositionX;
float hudY = (event.getResolution().getScaledHeight() - h) / 2 + ModConfig.client.ceremonyHudPositionY;
Tessellator tes = Tessellator.getInstance();
BufferBuilder buf = tes.getBuffer();
FontRenderer font = mc.fontRenderer;
GL11.glPushAttrib(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_ENABLE_BIT);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.pushMatrix();
GlStateManager.translate(hudX, hudY, 0);
// Background
mc.renderEngine.bindTexture(hudTexture);
buf.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
RenderHelper.addQuad(buf, 0, 0, 0, w, h, 0, 0, w / texW, h / texH);
tes.draw();
int barW = 104;
int barH = 7;
if (activeTotem.getState() instanceof StateStartup) {
StateStartup state = (StateStartup) activeTotem.getState();
Ceremony cer = state.getCeremony();
String locName = I18n.format(cer.getUnlocalizedName());
int nameX = (w - font.getStringWidth(locName)) / 2;
font.drawString(locName, nameX, 1, 0xC8000000);
GlStateManager.color(1, 1, 1);
mc.renderEngine.bindTexture(hudTexture);
buf.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
// Note
RenderHelper.addQuad(buf, 1, 10, 0, 9, 9, 16 / texW, 48 / texH, 8 / texW, 8 / texH);
// Clock
RenderHelper.addQuad(buf, 1, 20, 0, 9, 9, 0 / texW, 48 / texH, 16 / texW, 16 / texH);
float musicW = state.getTotalMusic() / (float) cer.getMusicNeeded() * barW;
float timeW = Math.min(state.getTime() / (float) cer.getAdjustedMaxStartupTime(mc.world.getDifficulty()), 1.0f) * barW;
// Music bar
RenderHelper.addQuad(buf, 11, 11, 0, musicW, barH, 0, 32 / texH, musicW / texW, barH / texH);
// Time bar
RenderHelper.addQuad(buf, 11, 21, 0, timeW, barH, 0, 32 / texH, timeW / texW, barH / texH);
tes.draw();
} else if (activeTotem.getState() instanceof StateCeremonyEffect) {
StateCeremonyEffect state = (StateCeremonyEffect) activeTotem.getState();
Ceremony cer = state.getCeremony();
String locName = I18n.format(cer.getUnlocalizedName());
int nameX = (w - font.getStringWidth(locName)) / 2;
font.drawString(locName, nameX, 1, 0xC8000000);
}
GlStateManager.popMatrix();
GL11.glPopAttrib();
}
mc.mcProfiler.endSection();
}
use of pokefenn.totemic.tileentity.totem.StateCeremonyEffect in project Totemic by TeamTotemic.
the class WailaTotemBase method getWailaBody.
@Override
@Nonnull
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
TileTotemBase tile = (TileTotemBase) accessor.getTileEntity();
if (tile.getState() instanceof StateSelection) {
String selectors = ((StateSelection) tile.getState()).getSelectors().stream().map(instr -> I18n.format(instr.getUnlocalizedName())).collect(Collectors.joining(", "));
currenttip.add(I18n.format("totemicmisc.selection", selectors));
} else if (tile.getState() instanceof StateStartup) {
Ceremony ceremony = ((StateStartup) tile.getState()).getCeremony();
currenttip.add(I18n.format("totemic.waila.ceremonyStartup", I18n.format(ceremony.getUnlocalizedName())));
} else if (tile.getState() instanceof StateCeremonyEffect) {
Ceremony ceremony = ((StateCeremonyEffect) tile.getState()).getCeremony();
currenttip.add(I18n.format("totemic.waila.ceremonyEffect", I18n.format(ceremony.getUnlocalizedName())));
}
return currenttip;
}
Aggregations