use of net.minecraftforge.client.event.RenderGameOverlayEvent in project MinecraftForge by MinecraftForge.
the class ForgeHooksClient method bossBarRenderPre.
public static RenderGameOverlayEvent.BossInfo bossBarRenderPre(ScaledResolution res, BossInfoLerping bossInfo, int x, int y, int increment) {
RenderGameOverlayEvent.BossInfo evt = new RenderGameOverlayEvent.BossInfo(new RenderGameOverlayEvent(Animation.getPartialTickTime(), res), BOSSINFO, bossInfo, x, y, increment);
MinecraftForge.EVENT_BUS.post(evt);
return evt;
}
use of net.minecraftforge.client.event.RenderGameOverlayEvent in project SilentGems by SilentChaos512.
the class GuiToolSouls method renderAPBars.
public static void renderAPBars(RenderGameOverlayEvent event) {
if (event.getType() != ElementType.HOTBAR || !(event instanceof RenderGameOverlayEvent.Post)) {
return;
}
// boolean temp = true; if (temp) return;
Minecraft mc = Minecraft.getMinecraft();
ScaledResolution sr = event.getResolution();
GlStateManager.pushMatrix();
// GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
mc.getTextureManager().bindTexture(WIDGETS_TEX_PATH);
EntityPlayer player = mc.player;
ItemStack itemstack = player.getHeldItemOffhand();
EnumHandSide enumhandside = player.getPrimaryHand().opposite();
int i = sr.getScaledWidth() / 2;
int j = 182;
int k = 91;
//
GlStateManager.enableRescaleNormal();
GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
RenderHelper.enableGUIStandardItemLighting();
if (!itemstack.isEmpty()) {
int l1 = sr.getScaledHeight() - 16 - 2;
if (enumhandside == EnumHandSide.LEFT) {
renderAPBarForItem(itemstack, i - 91 - 26, l1);
} else {
renderAPBarForItem(itemstack, i + 91 + 10, l1);
}
}
for (int l = 0; l < 9; ++l) {
int i1 = i - 90 + l * 20 + 2;
int j1 = sr.getScaledHeight() - 16 - 2;
renderAPBarForItem(player.inventory.mainInventory.get(l), i1, j1);
}
RenderHelper.disableStandardItemLighting();
GlStateManager.disableRescaleNormal();
GlStateManager.disableBlend();
GlStateManager.popMatrix();
}
use of net.minecraftforge.client.event.RenderGameOverlayEvent in project MinecraftForge by MinecraftForge.
the class ForgeIngameGui method render.
@Override
public void render(PoseStack pStack, float partialTicks) {
this.screenWidth = this.minecraft.getWindow().getGuiScaledWidth();
this.screenHeight = this.minecraft.getWindow().getGuiScaledHeight();
eventParent = new RenderGameOverlayEvent(pStack, partialTicks, this.minecraft.getWindow());
right_height = 39;
left_height = 39;
if (pre(ALL, pStack))
return;
font = minecraft.font;
this.random.setSeed(tickCount * 312871L);
OverlayRegistry.orderedEntries().forEach(entry -> {
try {
if (!entry.isEnabled())
return;
IIngameOverlay overlay = entry.getOverlay();
if (pre(overlay, pStack))
return;
overlay.render(this, pStack, partialTicks, screenWidth, screenHeight);
post(overlay, pStack);
} catch (Exception e) {
LOGGER.error("Error rendering overlay '{}'", entry.getDisplayName(), e);
}
});
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
post(ALL, pStack);
}
use of net.minecraftforge.client.event.RenderGameOverlayEvent in project MinecraftForge by MinecraftForge.
the class GuiIngameForge method renderGameOverlay.
@Override
public void renderGameOverlay(float partialTicks) {
res = new ScaledResolution(mc);
eventParent = new RenderGameOverlayEvent(partialTicks, res);
int width = res.getScaledWidth();
int height = res.getScaledHeight();
renderHealthMount = mc.player.getRidingEntity() instanceof EntityLivingBase;
renderFood = mc.player.getRidingEntity() == null;
renderJumpBar = mc.player.isRidingHorse();
right_height = 39;
left_height = 39;
if (pre(ALL))
return;
fontrenderer = mc.fontRendererObj;
mc.entityRenderer.setupOverlayRendering();
GlStateManager.enableBlend();
if (Minecraft.isFancyGraphicsEnabled()) {
renderVignette(mc.player.getBrightness(partialTicks), res);
} else {
GlStateManager.enableDepth();
GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
}
if (renderHelmet)
renderHelmet(res, partialTicks);
if (renderPortal && !mc.player.isPotionActive(MobEffects.NAUSEA)) {
renderPortal(res, partialTicks);
}
if (renderHotbar)
renderHotbar(res, partialTicks);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
zLevel = -90.0F;
rand.setSeed((long) (updateCounter * 312871));
if (renderCrosshairs)
renderCrosshairs(partialTicks);
if (renderBossHealth)
renderBossHealth();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
if (this.mc.playerController.shouldDrawHUD() && this.mc.getRenderViewEntity() instanceof EntityPlayer) {
if (renderHealth)
renderHealth(width, height);
if (renderArmor)
renderArmor(width, height);
if (renderFood)
renderFood(width, height);
if (renderHealthMount)
renderHealthMount(width, height);
if (renderAir)
renderAir(width, height);
}
renderSleepFade(width, height);
if (renderJumpBar) {
renderJumpBar(width, height);
} else if (renderExperiance) {
renderExperience(width, height);
}
renderToolHighlight(res);
renderHUDText(width, height);
renderFPSGraph();
renderPotionIcons(res);
renderRecordOverlay(width, height, partialTicks);
renderSubtitles(res);
renderTitle(width, height, partialTicks);
Scoreboard scoreboard = this.mc.world.getScoreboard();
ScoreObjective objective = null;
ScorePlayerTeam scoreplayerteam = scoreboard.getPlayersTeam(mc.player.getName());
if (scoreplayerteam != null) {
int slot = scoreplayerteam.getChatFormat().getColorIndex();
if (slot >= 0)
objective = scoreboard.getObjectiveInDisplaySlot(3 + slot);
}
ScoreObjective scoreobjective1 = objective != null ? objective : scoreboard.getObjectiveInDisplaySlot(1);
if (renderObjective && scoreobjective1 != null) {
this.renderScoreboard(scoreobjective1, res);
}
GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
GlStateManager.disableAlpha();
renderChat(width, height);
renderPlayerList(width, height);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.disableLighting();
GlStateManager.enableAlpha();
post(ALL);
}
use of net.minecraftforge.client.event.RenderGameOverlayEvent in project ct.js by ChatTriggers.
the class OnRenderTrigger method trigger.
@Override
public void trigger(Object... args) {
if (!(args[0] instanceof RenderGameOverlayEvent))
throw new IllegalArgumentException("Argument 0 must be a RenderGameOverlayEvent");
RenderGameOverlayEvent event = (RenderGameOverlayEvent) args[0];
if (!triggerIfCanceled && event.isCanceled())
return;
try {
GlStateManager.pushMatrix();
CTJS.getInstance().getModuleManager().invokeFunction(methodName, args);
GlStateManager.popMatrix();
} catch (ScriptException | NoSuchMethodException e) {
Console.getConsole().printStackTrace(e, this);
type.removeTrigger(this);
}
}
Aggregations