Java 类net.minecraftforge.client.event.RenderGameOverlayEvent 实例源码

项目:4Space-5    文件:TickHandlerClient.java   
@SubscribeEvent
public void onPreGuiRender(RenderGameOverlayEvent.Pre event)
{
    final Minecraft minecraft = FMLClientHandler.instance().getClient();
    final EntityClientPlayerMP player = minecraft.thePlayer;

    if (event.type == RenderGameOverlayEvent.ElementType.ALL)
    {
        if (player != null && player.ridingEntity != null && player.ridingEntity instanceof IIgnoreShift && ((IIgnoreShift) player.ridingEntity).shouldIgnoreShiftExit())
        {
            // Remove "Press shift to dismount" message when shift-exiting is disabled (not ideal, but the only option)
            String str = I18n.format("mount.onboard", new Object[] { GameSettings.getKeyDisplayString(minecraft.gameSettings.keyBindSneak.getKeyCode()) });
            if (minecraft.ingameGUI.recordPlaying.equals(str))
            {
                minecraft.ingameGUI.recordPlaying = "";
            }
        }
    }
}
项目:Loot-Slash-Conquer    文件:GuiMana.java   
@SubscribeEvent
public void onRenderOverlayText(RenderGameOverlayEvent.Text event)
{
    ScaledResolution sr = event.getResolution();
    EntityPlayer player = Minecraft.getMinecraft().player;
    Stats statsCap = (Stats) player.getCapability(CapabilityPlayerStats.STATS, null);

    if (!player.capabilities.isCreativeMode && statsCap != null)
    {
        String mana = statsCap.getMana() + " / " + statsCap.getMaxMana();

        GL11.glPushMatrix();
        GL11.glScalef(0.5F, 0.5F, 0.5F);
        Minecraft.getMinecraft().fontRenderer.drawStringWithShadow(mana, (sr.getScaledWidth() / 2 + 37) * 2, (sr.getScaledHeight() - 37) * 2, 0xFFFFFF);
        GL11.glPopMatrix();
    }
}
项目:Loot-Slash-Conquer    文件:GuiHealth.java   
@SubscribeEvent
public void onRenderOverlay(RenderGameOverlayEvent.Post event)
{   
    if (event.getType() != ElementType.EXPERIENCE) return;
    else
    {   
        ScaledResolution sr = event.getResolution();
        EntityPlayer player = Minecraft.getMinecraft().player;

        if (!player.capabilities.isCreativeMode)
        {
            double healthBarWidth = (double) player.getHealth() / player.getMaxHealth() * 81.0;
            int xPos = sr.getScaledWidth() / 2 - 91;
            int yPos = sr.getScaledHeight() - 39;

            mc.renderEngine.bindTexture(location);

            this.drawTexturedModalRect(xPos, yPos, 0, 0, 81, 9);
            this.drawTexturedModalRect(xPos, yPos, 0, 9, (int) healthBarWidth, 8);  
        }
    }
}
项目:Loot-Slash-Conquer    文件:GuiHealth.java   
@SubscribeEvent
public void onRenderOverlayText(RenderGameOverlayEvent.Text event)
{
    ScaledResolution sr = event.getResolution();
    EntityPlayer player = Minecraft.getMinecraft().player;

    if (!player.capabilities.isCreativeMode)
    {
        String health = (int) player.getHealth() + " / " + (int) player.getMaxHealth();

        GL11.glPushMatrix();
        GL11.glScalef(0.5F, 0.5F, 0.5F);
        Minecraft.getMinecraft().fontRenderer.drawStringWithShadow(health, (sr.getScaledWidth() / 2 - 60) * 2, (sr.getScaledHeight() - 36) * 2, 0xFFFFFF);
        GL11.glPopMatrix();
    }
}
项目:ThermionicsWorld    文件:ThermionicsWorld.java   
/**
 * When possible, presents corrected biome information in the F3 overlay for Neo-Hell
 * @param event
 */
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void renderGameOverlayEvent(RenderGameOverlayEvent.Text event) {
    if (!Minecraft.getMinecraft().gameSettings.showDebugInfo) return;

    if (Minecraft.getMinecraft().world.provider.getDimension()!=-1) return;


    ArrayList<String> left = event.getLeft();
    final int LINE_BIOME = 11;
    if (left.size()<=LINE_BIOME || !left.get(LINE_BIOME).startsWith("Biome:")) return; //Someone's already tampered


    String biomeName = "MEMES(NULL)";
    BlockPos pos = Minecraft.getMinecraft().player.getPosition();
    Chunk chunk = Minecraft.getMinecraft().world.getChunkFromBlockCoords(pos);
    byte[] biomeArray = chunk.getBiomeArray();
    int x = pos.getX() & 15;
    int z = pos.getZ() & 15;
    int biomeId = biomeArray[z*16+x];
    NeoBiome biome = BiomeRegistry.NEO_HELL.getObjectById(biomeId);
    if (biome!=null) biomeName = biome.getBiomeName();

    left.set(LINE_BIOME, "Biome: "+biomeId+" ("+biomeName+")");
}
项目:harshencastle    文件:HarshenUtils.java   
public static EntityPlayer getPlayer(Event event)
{
    if(event instanceof LivingEvent && ((LivingEvent)event).getEntity() instanceof EntityPlayer)
        return (EntityPlayer)((LivingEvent)event).getEntity();
    if(event instanceof RenderGameOverlayEvent || event instanceof RenderWorldLastEvent || event instanceof ClientTickEvent)
        return HarshenCastle.proxy.getPlayer();
    if(event instanceof PlayerTickEvent)
        return ((PlayerTickEvent)event).player;
    if(event instanceof PlayerEvent)
        return ((PlayerEvent)event).player;
    if(event instanceof net.minecraftforge.event.entity.player.PlayerEvent)
        return ((net.minecraftforge.event.entity.player.PlayerEvent)event).getEntityPlayer();
    if(event instanceof PlayerPunchedEvent)
        return ((PlayerPunchedEvent)event).attacker;
    if(event instanceof LivingDropsEvent && isSourceFromPlayer(((LivingDropsEvent)event).getSource()))
        return getPlayerFromSource(((LivingDropsEvent)event).getSource());
    return null;
}
项目:harshencastle    文件:HandlerGameOverlay.java   
@SubscribeEvent
public void onGameOverlay(RenderGameOverlayEvent.Post event)
{
    if(event.getType() == RenderGameOverlayEvent.ElementType.ALL && Minecraft.getMinecraft().currentScreen == null)
    {
           Minecraft minecraft = Minecraft.getMinecraft();
           EntityPlayer player = minecraft.player;
           RayTraceResult posHit = minecraft.objectMouseOver;
           if(posHit != null && posHit.getBlockPos() != null)
           {
               Block blockHit = minecraft.world.getBlockState(posHit.getBlockPos()).getBlock();
               if(blockHit instanceof IHudDisplay)
                   ((IHudDisplay)blockHit).displayHud(minecraft, player, posHit, event.getResolution());
               TileEntity tileHit = minecraft.world.getTileEntity(posHit.getBlockPos());
               if(tileHit instanceof IHudDisplay)
                ((IHudDisplay)tileHit).displayHud(minecraft, player, posHit, event.getResolution());
           }
    }
}
项目:CreeperHostGui    文件:EventHandler.java   
@SubscribeEvent
public void onRenderGameOverlay(RenderGameOverlayEvent event)
{
    if (!Config.getInstance().isSivIntegration())
        return;
    if (event.type != RenderGameOverlayEvent.ElementType.PLAYER_LIST)
    {
        return;
    }
    if (!(Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL)) || Minecraft.getMinecraft().isIntegratedServerRunning() || !guiServerInfo.getIsPlayerOpped())
    {
        return;
    }

    Minecraft mc = Minecraft.getMinecraft();

    ScaledResolution resolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
    guiServerInfo.setWorldAndResolution(mc, resolution.getScaledWidth(), resolution.getScaledHeight());
    if (guiServerInfo.renderServerInfo())
    {
        event.setCanceled(true);
    }
}
项目:CreeperHostGui    文件:EventHandler.java   
@SubscribeEvent
public void onRenderGameOverlay(RenderGameOverlayEvent event)
{
    if (!Config.getInstance().isSivIntegration())
        return;
    if (event.getType() != RenderGameOverlayEvent.ElementType.PLAYER_LIST)
    {
        return;
    }
    if (!(Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL)) || Minecraft.getMinecraft().isIntegratedServerRunning() || !guiServerInfo.getIsPlayerOpped())
    {
        return;
    }

    Minecraft mc = Minecraft.getMinecraft();

    ScaledResolution resolution = new ScaledResolution(mc);
    guiServerInfo.setWorldAndResolution(mc, resolution.getScaledWidth(), resolution.getScaledHeight());
    if (guiServerInfo.renderServerInfo())
    {
        event.setCanceled(true);
    }
}
项目:ForgeHax    文件:ActiveModList.java   
@SubscribeEvent
public void onRenderScreen(RenderGameOverlayEvent.Text event) {
    int posX = 1;
    int posY = 1;
    SurfaceHelper.drawTextShadow(generateTickRateText(), posX, posY, Utils.Colors.WHITE);
    posY += SurfaceHelper.getTextHeight() + 1;
    for(BaseMod mod : getModManager().getMods()) {
        if(mod.isEnabled() && !mod.isHidden()) {
            SurfaceHelper.drawTextShadow(">" + mod.getDisplayText(), posX, posY, Utils.Colors.WHITE);
            posY += SurfaceHelper.getTextHeight() + 1;
        }
    }
    /*
    posY += (Render2DUtils.getTextHeight() + 1) * 2;
    Render2DUtils.drawTextShadow(String.format("Pitch: %.4f", MC.thePlayer.rotationPitch), posX, posY, Utils.toRGBA(255, 255, 255, 255));
    posY += Render2DUtils.getTextHeight() + 1;
    Render2DUtils.drawTextShadow(String.format("Yaw: %.4f", MC.thePlayer.rotationYaw), posX, posY, Utils.toRGBA(255, 255, 255, 255));*/
}
项目:Anima-Mundi    文件:GuiShield.java   
@SubscribeEvent
public static void onIngameOverlay(RenderGameOverlayEvent.Post event)
{
    if(event.getType() != RenderGameOverlayEvent.ElementType.ALL)
    {
        return;
    }

    if(!EntityUtil.getActivePlayerShield(Minecraft.getMinecraft().player).isEmpty())
    {
        if(gui == null)
        {
            gui = new GuiShield();
        }
        gui.drawGui(event.getPartialTicks());
    }
    else
    {
        gui = null;
    }
}
项目:modName    文件:EventHandlerCommon.java   
@SubscribeEvent
public void onDebugOverlay(RenderGameOverlayEvent.Text e)
{
 //if(e.getType() == RenderGameOverlayEvent.ElementType.DEBUG)
 {
     try {
         int playerx = Minecraft.getMinecraft().player.chunkCoordX;
         int playerz = Minecraft.getMinecraft().player.chunkCoordZ;
         ChunkPos chunkPos = new ChunkPos(playerx,playerz);
         TilePos tilePos = new TilePos(chunkPos);
         TileList tileList = TileList.get(Minecraft.getMinecraft().player.world);
         e.getRight().add("Chunk coords:"+playerx+" "+playerz);
         e.getRight().add("Tile information:");

         Tile currTile = tileList.getTileByPos(tilePos);

         e.getRight().add(currTile==null ? "Tile " +tilePos.x+" "+tilePos.z+ "not created properly" : tilePos.x+" "+tilePos.z);
         e.getRight().add("Tile biome: "+currTile.getTileBiome().name());
     }
     catch (Exception e1) {}

 }
}
项目:CustomWorldGen    文件:GuiIngameForge.java   
protected void renderChat(int width, int height)
{
    mc.mcProfiler.startSection("chat");

    RenderGameOverlayEvent.Chat event = new RenderGameOverlayEvent.Chat(eventParent, 0, height - 48);
    if (MinecraftForge.EVENT_BUS.post(event)) return;

    GlStateManager.pushMatrix();
    GlStateManager.translate((float) event.getPosX(), (float) event.getPosY(), 0.0F);
    persistantChatGUI.drawChat(updateCounter);
    GlStateManager.popMatrix();

    post(CHAT);

    mc.mcProfiler.endSection();
}
项目:TRHS_Club_Mod_2016    文件:GuiIngameForge.java   
protected void renderChat(int width, int height)
{
    field_73839_d.field_71424_I.func_76320_a("chat");

    RenderGameOverlayEvent.Chat event = new RenderGameOverlayEvent.Chat(eventParent, 0, height - 48);
    if (MinecraftForge.EVENT_BUS.post(event)) return;

    GL11.glPushMatrix();
    GL11.glTranslatef((float)event.posX, (float)event.posY, 0.0F);
    field_73840_e.func_146230_a(field_73837_f);
    GL11.glPopMatrix();

    post(CHAT);

    field_73839_d.field_71424_I.func_76319_b();
}
项目:metamorph    文件:RenderingHandler.java   
/**
 * Draw HUD additions 
 */
@SubscribeEvent
public void onHUDRender(RenderGameOverlayEvent.Post event)
{
    ScaledResolution resolution = event.getResolution();

    if (event.getType() == RenderGameOverlayEvent.ElementType.ALL)
    {
        if (this.overlay.inGUI == false)
        {
            this.overlay.render(resolution.getScaledWidth(), resolution.getScaledHeight());
        }

        this.morphOverlay.render(resolution.getScaledWidth(), resolution.getScaledHeight());
    }
}
项目:jGui    文件:AbstractGuiOverlay.java   
@SubscribeEvent
public void renderOverlay(RenderGameOverlayEvent.Post event) {
    if (event.type == RenderGameOverlayEvent.ElementType.ALL) {
        updateRenderer();
        int layers = getMaxLayer();
        int mouseX = -1, mouseY = -1;
        if (mouseVisible) {
            Point mouse = MouseUtils.getMousePos();
            mouseX = mouse.getX();
            mouseY = mouse.getY();
        }
        for (int layer = 0; layer <= layers; layer++) {
            draw(renderer, screenSize, new RenderInfo(event.partialTicks, mouseX, mouseY, layer));
        }
    }
}
项目:ModLibary    文件:UpdaterInformation.java   
@SubscribeEvent
public void firstRender(RenderGameOverlayEvent event) {
    Minecraft mc = Minecraft.getMinecraft();
    if (!mc.inGameHasFocus || mc.thePlayer == null) {
        return;
    }
    if (!show) {
        show = true;
        for (ModContainer container : Loader.instance().getActiveModList()) {
            if (!container.getModId().startsWith("mcp") && !container.getModId().equalsIgnoreCase("mcp") && !container.getModId().equalsIgnoreCase("FML") && !container.getModId().equalsIgnoreCase("Forge")) {
                CheckResult res = ForgeVersion.getResult(container);
                if ((res != null && res.status != Status.PENDING) && res.status == Status.BETA_OUTDATED || res.status == Status.OUTDATED) {
                    IChatComponent comp = new ChatComponentText("\u00a7eNew version (\u00a77" + res.target + "\u00a7e) for\u00a7a " + container.getName() + " \u00a7eis available for Minecraft " + ForgeVersion.mcVersion + "!\n\u00a7bDownload at: \u00a7a" + res.url);
                    ChatStyle style = comp.getChatStyle();
                    style.setColor(EnumChatFormatting.YELLOW);
                    style.setChatHoverEvent(new HoverEvent(net.minecraft.event.HoverEvent.Action.SHOW_TEXT, new ChatComponentText("\u00a7cClick to open download page.")));
                    style.setChatClickEvent(new ClickEvent(net.minecraft.event.ClickEvent.Action.OPEN_URL, res.url));
                    comp.setChatStyle(style);
                    mc.thePlayer.addChatComponentMessage(comp);
                }
            }
        }
    }
}
项目:Gravestone-mod-Extended    文件:GSEventsHandler.java   
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void onTick(RenderGameOverlayEvent.Pre event) {
    if (event.getType() == RenderGameOverlayEvent.ElementType.AIR) {

        EntityPlayer player = FMLClientHandler.instance().getClient().player;
        IChoke choke = player.getCapability(ChokeProvider.AIR_CAP, null);
        int air = choke.getAir();

        if (choke.isActive() && !player.isInsideOfMaterial(Material.WATER)) {
            final ScaledResolution res = new ScaledResolution(FMLClientHandler.instance().getClient());
            GL11.glEnable(GL11.GL_BLEND);

            final int left = res.getScaledWidth() / 2 + 91;
            final int top = res.getScaledHeight() - 49;
            final int full = MathHelper.ceil((air - 2) * 10 / 300D);
            final int partial = MathHelper.ceil(air * 10 / 300D) - full;

            for (int i = 0; i < full + partial; i++) {
                FMLClientHandler.instance().getClient().ingameGUI.drawTexturedModalRect(left - i * 8 - 9, top, (i < full ? 16 : 25), 18, 9, 9);
            }
            GL11.glDisable(GL11.GL_BLEND);
        }
    }
}
项目:blockbuster    文件:RenderingHandler.java   
/**
 * Add Blockbuster debug strings, such as length of client records and
 * recording information, to the debug overlay.
 */
@SubscribeEvent
public void onHUDRender(RenderGameOverlayEvent.Text event)
{
    if (!Minecraft.getMinecraft().gameSettings.showDebugInfo)
    {
        return;
    }

    List<String> list = event.getLeft();

    list.add("");
    list.add(ClientProxy.manager.records.size() + " client records");

    RecordRecorder recorder = ClientProxy.manager.recorders.get(Minecraft.getMinecraft().thePlayer);

    if (recorder != null)
    {
        list.add("Recording frame " + recorder.tick + " (delay: " + recorder.delay + ")");
    }
}
项目:multi-hotbar    文件:HotBarRenderer.java   
private void shiftOverlayUp(RenderGameOverlayEvent.Pre event) {
    // If events preceding the hotbar are cancelled pop the maxtrix before the hotbar in rendered
    if (event.getType().equals(RenderGameOverlayEvent.ElementType.HOTBAR) && (!renderPosted)) {
        GL11.glPopMatrix();
        renderPosted = true;
    }
    // Apply the translation
    if (shouldShift(event.getType())) {
        if (!renderPosted)
            GL11.glPopMatrix();
        renderPosted = false;
        GL11.glPushMatrix();
        int y = Config.stackedHotbars ? -HOTBAR_HEIGHT * (Config.numberOfHotbars - 1) : -HOTBAR_HEIGHT;
        GL11.glTranslatef(0, y, 0);
    }
}
项目:Fallout_Equestria    文件:EventHandlerOverlayAEM.java   
@SubscribeEvent(receiveCanceled = true)
public void onEvent(RenderGameOverlayEvent.Pre event) {
    EntityPlayerSP entityPlayerSP = Minecraft.getMinecraft().player;
    if (entityPlayerSP == null) return;  // just in case
    if (!entityPlayerSP.isCreative()) {
        boolean foundInHotbar = false;
        for (int i = 1; i < 5; i++) {
            if (entityPlayerSP.getCapability(IAdvProvider.Adv_Inv, null).getStackInSlot(i).getItem() == ItemInit.aem &&
                    entityPlayerSP.getCapability(IAdvProvider.Adv_Inv, null).getStackInSlot(0).getItem() != ItemInit.pipbuck) {
                foundInHotbar = true;
            }
        }
        if (!foundInHotbar) return;
    }
    switch (event.getType()) {
        case HEALTH:
            new RadsOverlay(Minecraft.getMinecraft());
            event.setCanceled(true);
            break;
        default: // If it's not one of the above cases, do nothing
            break;
    }
}
项目:Fallout_Equestria    文件:EventHandlerOverlayPipBuck.java   
@SubscribeEvent(receiveCanceled = true)
public void onEvent(RenderGameOverlayEvent.Pre event) {
    EntityPlayerSP entityPlayerSP = Minecraft.getMinecraft().player;
    if (entityPlayerSP == null) return;  // just in case
    if (!entityPlayerSP.isCreative()) {
        // look for the ItemHUDactivator in the hotbar.  If not present, return without changing the HUD.
        boolean foundInHotbar = false;
        if (entityPlayerSP.getCapability(IAdvProvider.Adv_Inv, null).getStackInSlot(0).getItem() == ItemInit.pipbuck) {
            foundInHotbar = true;
        }
        if (!foundInHotbar) return;
    }
    switch (event.getType()) {
        case HEALTH:
            new PipBuckOverlay(Minecraft.getMinecraft(), event.getResolution().getScaledWidth(), event.getResolution().getScaledHeight());
            //statusBarRenderer.renderStatusBar(event.getResolution().getScaledWidth(), event.getResolution().getScaledHeight());        /* Call a helper method so that this method stays organized */
            new RadsOverlay(Minecraft.getMinecraft());
            new APBar(Minecraft.getMinecraft());
            new Compass_Overlay(Minecraft.getMinecraft());
            event.setCanceled(true);
            break;
        default: // If it's not one of the above cases, do nothing
            break;
    }
}
项目:Pipeline    文件:GuiRenderHook.java   
@SubscribeEvent
public void renderOverlay(RenderGameOverlayEvent evt) {
    if (activated && evt.type == ElementType.CROSSHAIRS) {
        glEnable(GL_BLEND);

        mat.setUniforms(mat.newUniformBlock().setFloat("aspect",
                (float) evt.resolution.getScaledWidth() / evt.resolution.getScaledHeight()));

        Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
        for (Instance i : instances) {
            pipeline.draw(mat, mesh, i, 0);
        }
        pipeline.flush();

        evt.setCanceled(true);
    }
}
项目:Factorization    文件:MiscClientProxy.java   
@SubscribeEvent(priority = EventPriority.HIGH)
public void addDirectionInfoToDebugScreen(RenderGameOverlayEvent.Text event) {
    Minecraft mc = Minecraft.getMinecraft();
    EntityPlayer player = mc.thePlayer;
    float t = 360;
    double yaw = ((player.rotationYaw % t) + t) % t;
    yaw = Math.toRadians(yaw);
    double x = -Math.sin(yaw);
    double z = Math.cos(yaw);

    for (int i = 0; i < event.left.size(); i++) {
        String line = event.left.get(i);
        if (line == null) continue;
        if (line.startsWith("f:")) {
            line += " (" + displ(x) + ", " + displ(z) + ")";
            event.left.set(i, line);
            break;
        }
    }
}
项目:FiveNightsAtFreddysUniverseMod    文件:GuiOverlay.java   
public void renderTime(RenderGameOverlayEvent.Pre event, int width, int height, EntityPlayer player)
    {
        GL11.glPushMatrix();
        float scale = 2.0F;
        GL11.glScalef(scale, scale, scale);
        long time = player.worldObj.getWorldTime() % 24000;
        int hours = (int)time / 1000 + 6 > 24 ? (int)time / 1000 + 6 - 24 : (int)time / 1000 + 6;
        String AM = hours + (hours == 12 ? " PM" : " AM");
        String PM = hours - 12 + (hours - 12 == 12 ? " AM" : " PM");
        String s = hours > 12 ? PM :AM;
        drawString(mc.fontRenderer, s, (int)(width / scale - mc.fontRenderer.getStringWidth(s) - 2), 2, 0xffffff);
        float scale1 = 0.75F;
        GL11.glScalef(scale1, scale1, scale1);
        int day = (int)player.worldObj.getWorldTime() / 24000 + 1;
//      String s1 = (hours == 24 || hours < 6 ? "Night" : "Day") + " " + day;
//      drawString(mc.fontRenderer, s1, (int)(width / scale / scale1 - mc.fontRenderer.getStringWidth(s1) - 2), 15, 0xffffff);
        GL11.glPopMatrix();
    }
项目:CollectiveFramework    文件:KeyOverlay.java   
@SubscribeEvent
public void renderOverlay(RenderGameOverlayEvent.Post event) {
    if (Config.keyOverlay) {
        if (/*event.isCanceled() || */event.type != RenderGameOverlayEvent.ElementType.HOTBAR)
            return;
        int x = 1;
        ConcurrentLinkedDeque<Object[]> newKeys = new ConcurrentLinkedDeque<Object[]>();
        while (!keys.isEmpty()) {
            Object[] key = keys.pop();
            String s = (String)key[0];
            int ticksLived = (Integer)key[1];
            Color color = Color.WHITE;
            for (int i = 0; i < KEY_LIFE_LENGTH/(ticksLived*2); i++)
                color = color.darker();
            Minecraft.getMinecraft().fontRenderer.drawString(s, x, 1, color.getRGB());
            x += Minecraft.getMinecraft().fontRenderer.getStringWidth(s)+3;
            if (ticksLived > 1)
                newKeys.add(new Object[]{s, --ticksLived});
        }
        keys.addAll(newKeys);
    }
}
项目:Coding    文件:DragonHudOverlay.java   
@SubscribeEvent
public void onRenderExperienceBar(RenderGameOverlayEvent.Post event) {
    if (event.type != ElementType.EXPERIENCE) {
        return;
    }
    if (!DragonPlayer.get(mc.thePlayer).isDragon())
        return;

    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glDisable(GL11.GL_LIGHTING);

    int level = DragonPlayer.get(mc.thePlayer).getLevel();

    if (mc.playerController.gameIsSurvivalOrAdventure() && level > 0) {
        mc.mcProfiler.startSection("dragonLevel");
        int color = Color.MAGENTA.getRGB();
        String text = "" + level;
        int x = (event.resolution.getScaledWidth() - mc.fontRenderer.getStringWidth(text)) / 2;
        int y = event.resolution.getScaledHeight() - 31 - 4 - 12;
        mc.fontRenderer.drawString(text, x, y, color);
        mc.mcProfiler.endSection();
    }
}
项目:CauldronGit    文件:GuiIngameForge.java   
protected void renderChat(int width, int height)
{
    mc.mcProfiler.startSection("chat");

    RenderGameOverlayEvent.Chat event = new RenderGameOverlayEvent.Chat(eventParent, 0, height - 48);
    if (MinecraftForge.EVENT_BUS.post(event)) return;

    GL11.glPushMatrix();
    GL11.glTranslatef((float)event.posX, (float)event.posY, 0.0F);
    persistantChatGUI.drawChat(updateCounter);
    GL11.glPopMatrix();

    post(CHAT);

    mc.mcProfiler.endSection();
}
项目:HorseDebugInfo    文件:ModScreenText.java   
@SideOnly(Side.CLIENT)
private void addHorseInfo(RenderGameOverlayEvent.Text event,    EntityPlayerSP player,EntityHorse horse) 
{ 
    double speed =  horse.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue() ;

    double jump = horse.getHorseJumpStrength() ;
    //convert from scale factor to blocks
    double jumpHeight = 0;
    double gravity = 0.98;
    while (jump > 0)
    {
        jumpHeight += jump;
        jump -= 0.08;
        jump *= gravity;
    }

    DecimalFormat df = new DecimalFormat("0.0000");

    event.left.add(ModScreenText.lang("debug.horsespeed")+"  "+ df.format(speed)   ); 

    df = new DecimalFormat("0.0");

    event.left.add(ModScreenText.lang("debug.horsejump") +"  "+ df.format(jumpHeight) );
}
项目:Cyclic    文件:ItemBuildSwapper.java   
@SideOnly(Side.CLIENT)
@SubscribeEvent(priority = EventPriority.LOWEST)
public void onRender(RenderGameOverlayEvent.Post event) {
  EntityPlayer player = Minecraft.getMinecraft().player;
  ItemStack held = player.getHeldItem(EnumHand.MAIN_HAND);
  if (event.isCanceled() || event.getType() != ElementType.EXPERIENCE) {
    return;
  }
  if (!held.isEmpty() && held.getItem() == this) {
    int slot = UtilPlayer.getFirstSlotWithBlock(player);
    if (slot >= 0) {
      ItemStack stack = player.inventory.getStackInSlot(slot);
      int leftOff = 0, rightOff = -18, topOff = 0, bottOff = 0;
      int xmain = RenderLoc.locToX(EventRender.renderLocation, leftOff, rightOff);
      int ymain = RenderLoc.locToY(EventRender.renderLocation, topOff, bottOff);
      if (!stack.isEmpty())
        ModCyclic.proxy.renderItemOnScreen(stack, xmain, ymain);
    }
  }
}
项目:Cyclic    文件:EventRender.java   
@SideOnly(Side.CLIENT)
@SubscribeEvent(priority = EventPriority.LOWEST)
public void onRender(RenderGameOverlayEvent.Post event) {
  if (event.isCanceled() || event.getType() != ElementType.EXPERIENCE) {
    return;
  }
  EntityPlayer effectivePlayer = ModCyclic.proxy.getClientPlayer();
  ItemStack heldWand = UtilSpellCaster.getPlayerWandIfHeld(effectivePlayer);
  if (heldWand.isEmpty()) {
    return;
  }
  int itemSlot = ItemCyclicWand.BuildType.getSlot(heldWand);
  ItemStack current = InventoryWand.getFromSlot(heldWand, itemSlot);
  if (!current.isEmpty()) {
    //THE ITEM INSIDE THE BUILDY WHEEL
    int leftOff = 7, rightOff = -26, topOff = 36, bottOff = -2;
    int xmain = RenderLoc.locToX(renderLocation, leftOff, rightOff);
    int ymain = RenderLoc.locToY(renderLocation, topOff, bottOff);
    ModCyclic.proxy.renderItemOnScreen(current, xmain, ymain);
    //      ModCyclic.proxy.renderItemOnScreen(current, RenderLoc.xoffset - 1, RenderLoc.ypadding + RenderLoc.spellSize * 2);
  }
}
项目:MacroMaker    文件:KeyOverlay.java   
@SubscribeEvent
public void renderOverlay(RenderGameOverlayEvent.Post event) {
    if (Config.showKeysOnHUD) {
        if (/*event.isCanceled() || */event.type != RenderGameOverlayEvent.ElementType.HOTBAR)
            return;
        int x = 1;
        ConcurrentLinkedDeque<Object[]> newKeys = new ConcurrentLinkedDeque<Object[]>();
        while (!keys.isEmpty()) {
            Object[] key = keys.pop();
            String s = (String)key[0];
            int ticksLived = (Integer)key[1];
            Color color = Color.WHITE;
            for (int i = 0; i < KEY_LIFE_LENGTH/(ticksLived*2); i++)
                color = color.darker();
            Minecraft.getMinecraft().fontRenderer.drawString(s, x, 1, color.getRGB());
            x += Minecraft.getMinecraft().fontRenderer.getStringWidth(s)+3;
            if (ticksLived > 1)
                newKeys.add(new Object[]{s, --ticksLived});
        }
        keys.addAll(newKeys);
    }
}
项目:HealthMod    文件:GuiSymptomOverlay.java   
@SubscribeEvent
public void onRenderGameOverlay(RenderGameOverlayEvent event) {
    List<AmplifiedSymptom> symptoms = PlayerSymptoms.getForPlayer(Minecraft.getMinecraft().thePlayer).symptoms;

    int totalHeight = symptoms.size() * (symptomBoxHeight + symptomBoxPadding);
    int screenY = event.resolution.getScaledHeight() / 2 - totalHeight / 2;
    int screenX = event.resolution.getScaledWidth() - symptomBoxWidth - symptomBoxPadding;
    for(AmplifiedSymptom as : symptoms) {
        Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation("textures/atlas/items.png"));
        this.drawTexturedModalRect(screenX, screenY,
                (int) symptomOverlay.getMinU(), (int) symptomOverlay.getMinV(),
                symptomBoxWidth, symptomBoxHeight, symptomBoxWidth/2, symptomBoxHeight, as.symptom.getDisplayColor());
        this.drawString(Minecraft.getMinecraft().fontRenderer, as.getFullName(),
                screenX + symptomBoxTextOffset, screenY + symptomBoxTextOffset , as.symptom.getDisplayColor());

        screenY += (symptomBoxHeight + symptomBoxPadding);
    }

}
项目:HorseFood    文件:ModHorseFood.java   
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void addHorseInfo(RenderGameOverlayEvent.Text event){

    EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
    if(Minecraft.getMinecraft().gameSettings.showDebugInfo){
        if(player.getRidingEntity() != null && player.getRidingEntity() instanceof EntityHorse){
            EntityHorse horse = (EntityHorse) player.getRidingEntity();

            double speed = getSpeedTranslated(horse.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).getAttributeValue());

            // double jump = horse.getHorseJumpStrength() ;
            // convert from scale factor to blocks
            double jumpHeight = getJumpTranslated(horse.getHorseJumpStrength());

            DecimalFormat df = new DecimalFormat("0.00");

            event.getLeft().add(I18n.translateToLocal("debug.horsespeed") + "  " + df.format(speed));

            df = new DecimalFormat("0.0");

            event.getLeft().add(I18n.translateToLocal("debug.horsejump") + "  " + df.format(jumpHeight));
        }
    }
}
项目:mcguimod    文件:InGameCustomGuiOverlay.java   
@SubscribeEvent(priority = EventPriority.LOW)
public void eventHandler(RenderGameOverlayEvent event) {
    if (event.isCancelable() || event.type == RenderGameOverlayEvent.ElementType.DEBUG) return; //NOT To draw when debug is open

    //Prepare rendering
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glDisable(GL11.GL_LIGHTING);

    if (GuiModMain.nightMode) color = 0xff5e5e5e;
    else color = 0xffdddddd;

    EntityPlayer player = mc.thePlayer;
    World world = player.worldObj;
    BlockPos blockpos = this.mc.objectMouseOver.getBlockPos();
    Block lookingblock;

    if (blockpos != null) lookingblock = world.getBlockState(blockpos).getBlock();
    else lookingblock = null;

    verPos = 3;

    drawLeft(world, player, blockpos, lookingblock);
}
项目:ItemBlacklist    文件:ClientEventHandlers.java   
@SubscribeEvent
public void onRenderGUI(final RenderGameOverlayEvent.Post event)
{
    if (event.getType() == RenderGameOverlayEvent.ElementType.HOTBAR)
    {
        final Minecraft mc = Minecraft.getMinecraft();
        final ScaledResolution res = event.getResolution();

        if (!mc.player.isSpectator())
        {
            for (int slot = 0; slot < 9; ++slot)
            {
                final ItemStack stack = mc.player.inventory.mainInventory.get(slot);
                if (!stack.isEmpty() && stack.getItem() == ItemBlacklisted.I)
                {
                    final int x = res.getScaledWidth() / 2 - 90 + slot * 20 + 2;
                    final int y = res.getScaledHeight() - 16 - 3;

                    if (!ItemBlacklisted.canUnpack(stack)) continue;
                    ItemStack unpacked = ItemBlacklisted.unpack(stack);
                    mc.getRenderItem().renderItemIntoGUI(unpacked, x, y);
                }
            }
        }
    }
}
项目:ARKCraft-Code    文件:ClientEventHandler.java   
@SubscribeEvent(priority = EventPriority.NORMAL)
public void onRender(RenderGameOverlayEvent evt)
{

    if (showScopeOverlap && (Minecraft.getMinecraft().thePlayer.getCurrentEquippedItem() != selected || !Mouse
            .isButtonDown(0)))
    {
        showScopeOverlap = false;
    }
    if (showScopeOverlap)
    {
        // Render scope
        if (evt.type == RenderGameOverlayEvent.ElementType.HELMET)
        {
            if (mc.gameSettings.thirdPersonView == 0)
            {
                evt.setCanceled(true);
                showScope();
            }
        }
        // Remove crosshairs
        else if (evt.type == RenderGameOverlayEvent.ElementType.CROSSHAIRS && showScopeOverlap) evt
                .setCanceled(true);
    }
}
项目:TheDarkEra    文件:GuiManaBar.java   
@SubscribeEvent(priority = EventPriority.NORMAL)
public void onRenderExperienceBar(RenderGameOverlayEvent event) {

    if (event.isCancelable() || event.type != ElementType.EXPERIENCE) {
        return;
    }
    if (!mc.thePlayer.capabilities.isCreativeMode) {
        int posX = event.resolution.getScaledWidth() / 2 + 10;
        int posY = event.resolution.getScaledHeight() - 48;
        ExtendedPlayer props = ExtendedPlayer.get((EntityPlayer) Minecraft.getMinecraft().thePlayer);
        float maxMana = props.getMaxMana();
        int manabarwidth = (int) ((float) props.getMana() / maxMana * 48);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glDisable(GL11.GL_LIGHTING);
        this.mc.getTextureManager().bindTexture(texturepath);
        mc.renderEngine.bindTexture(new ResourceLocation(TheDarkEra.MODID + ":textures/gui/SoulBar.png"));
        mc.ingameGUI.drawTexturedModalRect(posX, posY, 0, 0, 50, 5);
        mc.ingameGUI.drawTexturedModalRect(posX + 1, posY + 1, 0, 6, manabarwidth, 3);
        String a = ""+props.getMaxMana();
        String b = ""+props.getMana();
        mc.fontRenderer.drawStringWithShadow(a, posX, posY, 0xFFFFFF);
        mc.fontRenderer.drawStringWithShadow(b, posX, posY+8, 0xFFFFFF);
        System.out.println(maxMana);
    }
}
项目:Aura-Cascade    文件:OverlayRender.java   
@SubscribeEvent
public void onScreenRenderEvent(RenderGameOverlayEvent event) {
    if (event.getType() == RenderGameOverlayEvent.ElementType.TEXT) {
        World world = AuraCascade.proxy.getWorld();
        EntityPlayer player = AuraCascade.proxy.getPlayer();
        Vec3d vec3 = player.getPositionEyes(1.0F);
        Vec3d vec3a = player.getLook(1.0F);
        Vec3d vec3b = vec3.addVector(vec3a.xCoord * 3, vec3a.yCoord * 3, vec3a.zCoord * 3);
        RayTraceResult movingobjectposition = world.rayTraceBlocks(vec3, vec3b);
        if (movingobjectposition != null && movingobjectposition.typeOfHit == RayTraceResult.Type.BLOCK) {
            Block block = world.getBlockState(movingobjectposition.getBlockPos()).getBlock();

            ScaledResolution resolution = new ScaledResolution(Minecraft.getMinecraft());
            int centerX = (resolution.getScaledWidth() - Minecraft.getMinecraft().fontRendererObj.getStringWidth("hi")) / 2;

            int centerY = (resolution.getScaledHeight() - Minecraft.getMinecraft().fontRendererObj.FONT_HEIGHT) / 2;
            if (block instanceof IToolTip) {
                IToolTip toolTip = (IToolTip) block;
                VazkiiRenderHelper.renderTooltip(centerX, centerY, toolTip.getTooltipData(world, player, movingobjectposition.getBlockPos()), 0x5577ff, 0x505000ff);
            }
        }
    }
}
项目:SecureCraftProtect    文件:SCPGuiBlink.java   
@SubscribeEvent(priority = EventPriority.NORMAL)
public void onRenderExperienceBar(RenderGameOverlayEvent event)
{
    if (event.isCancelable() || event.type != EXPERIENCE) {
        return;
    }
    int width = event.resolution.getScaledWidth();
    int height = event.resolution.getScaledHeight();

    int k2 = height - 20;
    int blink = mc.thePlayer.getDataWatcher().getWatchableObjectInt(BLINK);
    int i4 = width / 2 + 91;
    int bar = MathHelper.ceiling_double_int((double) (blink + 2) * 10.0D
            / MAX_BLINK);
    glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    glDisable(GL_LIGHTING);
    mc.getTextureManager().bindTexture(icons);
    drawTexturedModalRect(i4 - 281, k2 - 1, 0, 18, 83, 11);
    drawTexturedModalRect(i4 - 301, k2 - 1, 83, 18, 17, 11);
    for (int i = 0; i < 10; ++i) {
        if (i < bar) {
            drawTexturedModalRect(i4 + i * 8 - 280, k2, 100, 18, 9, 9);
        }
    }
}