Java 类net.minecraftforge.client.GuiIngameForge 实例源码

项目:SAO-UI---1.8    文件:RenderHandler.java   
static void checkingameGUI() {
    boolean b = mc.ingameGUI instanceof IngameGUI;
    if (mc.ingameGUI != null && OptionCore.VANILLA_UI.getValue() == b)
        mc.ingameGUI = b ? new GuiIngameForge(mc) : new IngameGUI(mc);
    deadHandlers.forEach(ent -> {
        if (ent != null) {
            final boolean deadStart = (ent.deathTime == 1);
            final boolean deadExactly = (ent.deathTime >= 18);
            if (deadStart) {
                ent.deathTime++;
                SoundCore.playAtEntity(ent, SoundCore.PARTICLES_DEATH);
            }

            if (deadExactly) {
                StaticRenderer.doSpawnDeathParticles(mc, ent);
                ent.setDead();
            }
        }
    });
    deadHandlers.removeIf(ent -> ent.isDead);
}
项目:wig    文件:BarSelectInputHandler.java   
@SubscribeEvent
public void onKeyInput(InputEvent.KeyInputEvent event) {
    Minecraft mc = Minecraft.getMinecraft();

    for(ToolPage page : WigMod.Pages) {
        if (page.shouldToggle()) {
            if (page == WigMod.ActivePage) {
                if (WigMod.ActiveTool == null) {
                    WigMod.ActivePage = null;
                    GuiIngameForge.renderHotbar = true;
                    mc.ingameGUI.remainingHighlightTicks = 40;
                } else {
                    WigMod.ActiveTool = null;
                }
            } else {
                WigMod.ActivePage = page;
                GuiIngameForge.renderHotbar = false;
                mc.ingameGUI.remainingHighlightTicks = 0;
            }
        }
    }
}
项目:wig    文件:SingleBarInputHandler.java   
@SubscribeEvent
public void onMouseInput(MouseEvent event) {
    if (WigMod.ActivePage == null || WigMod.ActiveTool != null) {
        return;
    }

    event.setCanceled(true);

    Minecraft mc = Minecraft.getMinecraft();

    if (event.dwheel != 0) {
        int diff = (event.dwheel > 0)?-1:1;
        WigMod.ActivePage.setToolIndex(Math.floorMod(WigMod.ActivePage.getToolIndex() + diff, 9));
    } else if (event.button == 0 && WigMod.ActivePage.getSelectedTool() != null && event.buttonstate) {
        WigMod.ActiveTool = WigMod.ActivePage.getSelectedTool();
    } else if (event.button == 1 && event.buttonstate) {
        WigMod.ActivePage = null;
        GuiIngameForge.renderHotbar = true;
        mc.ingameGUI.remainingHighlightTicks = 40;
    }
}
项目:TFC2    文件:ClientProxy.java   
@Override
public void init(FMLInitializationEvent event)
{
    super.init(event);
    MinecraftForge.EVENT_BUS.register(new RenderOverlayHandler());
    MinecraftForge.EVENT_BUS.register(new ClientRenderHandler());
    MinecraftForge.EVENT_BUS.register(new BackgroundMusicHandler());
    MinecraftForge.EVENT_BUS.register(new AnvilHighlightHandler());

    setupBlockColors();

    //Disable vanilla UI elements
    GuiIngameForge.renderHealth = false;
    GuiIngameForge.renderArmor = false;
    GuiIngameForge.renderExperiance = false;
}
项目:SAO-UI---1.8    文件:RenderHandler.java   
static void checkingameGUI() {
    boolean b = mc.ingameGUI instanceof IngameGUI;
    if (mc.ingameGUI != null && OptionCore.VANILLA_UI.getValue() == b)
        mc.ingameGUI = b ? new GuiIngameForge(mc) : new IngameGUI(mc);
    deadHandlers.forEach(ent -> {
        if (ent != null) {
            final boolean deadStart = (ent.deathTime == 1);
            final boolean deadExactly = (ent.deathTime >= 18);
            if (deadStart) {
                ent.deathTime++;
                SoundCore.playAtEntity(ent, SoundCore.PARTICLES_DEATH);
            }

            if (deadExactly) {
                StaticRenderer.doSpawnDeathParticles(mc, ent);
                ent.setDead();
            }
        }
    });
    deadHandlers.removeIf(ent -> ent.isDead);
}
项目:TFC2    文件:ClientProxy.java   
@Override
public void init(FMLInitializationEvent event)
{
    super.init(event);
    MinecraftForge.EVENT_BUS.register(new RenderOverlayHandler());
    MinecraftForge.EVENT_BUS.register(new ClientRenderHandler());
    MinecraftForge.EVENT_BUS.register(new BackgroundMusicHandler());
    MinecraftForge.EVENT_BUS.register(new AnvilHighlightHandler());

    setupBlockColors();

    //Disable vanilla UI elements
    GuiIngameForge.renderHealth = false;
    GuiIngameForge.renderArmor = false;
    GuiIngameForge.renderExperiance = false;
}
项目:BetterHorseHud    文件:ModGui.java   
@SubscribeEvent(priority = EventPriority.NORMAL)
public void onRenderMountHealth(RenderGameOverlayEvent event)
{
    if (event.type == ElementType.EXPERIENCE || event.type == ElementType.FOOD || event.type == ElementType.JUMPBAR )
    {
        YesOrNo = true;
    }

    if (!event.isCancelable() || !YesOrNo)return;

    if(this.mc.thePlayer.ridingEntity != null)
    {
        GuiIngameForge.renderFood = true;
    }

    if(GuiIngameForge.renderExperiance)
    {
        if(this.mc.thePlayer.ridingEntity instanceof EntityHorse)
        {
            GuiIngameForge.renderJumpBar = Keyboard.isKeyDown(Keyboard.KEY_SPACE);
        }
    }
}
项目:PerFabricaAdAstra    文件:RespirationHandler.java   
@SideOnly(Side.CLIENT)
private void renderAirBar(ScaledResolution res) {
       GL11.glEnable(GL11.GL_BLEND);
       int width = res.getScaledWidth();
       int height = res.getScaledHeight();
       int left = width / 2 + 91;
       int top = height - GuiIngameForge.right_height;

       Minecraft mc = Minecraft.getMinecraft();
       int air = getAirLevel(mc.thePlayer);
       int full = MathHelper.ceiling_double_int((double)(air - 2) * 10.0D / 300.0D);
       int partial = MathHelper.ceiling_double_int((double)air * 10.0D / 300.0D) - full;

       for (int i = 0; i < full + partial; ++i)
       {
        mc.ingameGUI.drawTexturedModalRect(left - i * 8 - 9, top, (i < full ? 16 : 25), 18, 9, 9);
       }
       GuiIngameForge.right_height += 10;

       GL11.glDisable(GL11.GL_BLEND);
}
项目:Loot-Slash-Conquer    文件:GuiHealth.java   
@SubscribeEvent
public void onRenderOverlay(RenderGameOverlayEvent.Pre event)
{   
    if (event.getType() == ElementType.HEALTH)
    {
        event.setCanceled(true);
    }

    /*
     * Repositions other Gui elements. 
     */

    if (event.getType() == ElementType.ARMOR)
    {
        GuiIngameForge.left_height = 49;
    }

    if (event.getType() == ElementType.FOOD)
    {
        GuiIngameForge.right_height = 49;
    }

    if (event.getType() == ElementType.AIR)
    {
        GuiIngameForge.right_height = 59;
    }
}
项目:FirstAid    文件:ClientEventHandler.java   
@SubscribeEvent
public static void renderOverlay(RenderGameOverlayEvent.Post event) {
    RenderGameOverlayEvent.ElementType type = event.getType();
    if (type == RenderGameOverlayEvent.ElementType.ALL || (type == RenderGameOverlayEvent.ElementType.TEXT && FirstAidConfig.overlay.position == 2)) {
        GuiIngameForge.renderHealth = FirstAidConfig.overlay.showVanillaHealthBar;
        HUDHandler.renderOverlay(event.getResolution());
    }
}
项目:FirstAid    文件:ClientProxy.java   
@Override
public void init() {
    FirstAid.logger.debug("Loading ClientProxy");
    MinecraftForge.EVENT_BUS.register(ClientEventHandler.class);
    ClientRegistry.registerKeyBinding(showWounds);
    GuiIngameForge.renderHealth = FirstAidConfig.overlay.showVanillaHealthBar;
    ((IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager()).registerReloadListener(manager -> HUDHandler.rebuildTranslationTable());
    EventCalendar.checkDate();
}
项目:metamorph    文件:WaterBreath.java   
/**
 * On morph, hide air bar in HUD
 * 
 * SideOnly annotation needed to remove this method from server (since 
 * it will likely cause {@link NoClassDefFoundError} on dedicated server.
 */
@Override
@SideOnly(Side.CLIENT)
public void onMorph(EntityLivingBase target)
{
    if (target.worldObj.isRemote && target == Minecraft.getMinecraft().thePlayer)
    {
        GuiIngameForge.renderAir = false;
    }
}
项目:metamorph    文件:WaterBreath.java   
/**
 * On demorph, show back air bar in HUD
 * 
 * SideOnly annotation needed to remove this method from server (since 
 * it will likely cause {@link NoClassDefFoundError} on dedicated server.
 */
@Override
@SideOnly(Side.CLIENT)
public void onDemorph(EntityLivingBase target)
{
    if (target.worldObj.isRemote && target == Minecraft.getMinecraft().thePlayer)
    {
        GuiIngameForge.renderAir = true;
    }
}
项目:armor-chroma    文件:GuiArmor.java   
/** Render the bar as a full replacement for {@link GuiIngameForge#renderArmor(int, int)} */
public void draw(int width, int height) {
    MINECRAFT.mcProfiler.startSection("armor");
    int left = width / 2 - 91;
    int top = height - GuiIngameForge.left_height;

    MINECRAFT.getTextureManager().bindTexture(ARMOR_ICONS);
    glEnable(GL_BLEND);

    // Total points in all rows so far
    int barPoints = 0;
    int[] armorPoints = getBarPoints(MINECRAFT.player);

    zLevel = -7;
    for(int i = 0; i < MINECRAFT.player.inventory.armorInventory.size(); i++) {
        if(armorPoints[i] > 0) {
            if(barPoints == 0) { // Draw background
                drawBackground(left, top, armorPoints[4]); // levels
                ++zLevel;
            }

            drawPiece(left, top, barPoints, armorPoints[i], MINECRAFT.player.inventory.armorItemInSlot(i));
            barPoints += armorPoints[i];

            ++zLevel; // Make sure blending works with GL_EQUAL
        }
    }

    // Let other bars draw in the correct position
    GuiIngameForge.left_height += (barPoints-1) / 20 * ROW_SPACING + 10;

    MINECRAFT.getTextureManager().bindTexture(ICONS);
    MINECRAFT.mcProfiler.endSection();
}
项目:Cyclic    文件:MountedTweaksModule.java   
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onRenderOverlay(RenderGameOverlayEvent event) {
  // https://github.com/LothrazarMinecraftMods/OverpoweredInventory/blob/8a7459161837b930c5417f774676504bce970e66/src/main/java/com/lothrazar/powerinventory/EventHandler.java
  if (showHungerMounted) {
    GuiIngameForge.renderFood = true;
  } //else config is false, so leave it alone
}
项目:dragon-mounts    文件:GuiDragonDebug.java   
@SubscribeEvent
    public void onRenderOverlay(RenderGameOverlayEvent event) {
        if (!enabled || event.isCancelable() || event.getType() != ElementType.TEXT) {
            return;
        }

        getClientDragon();
        getServerDragon();

        if (dragonClient != null) {
            GuiIngameForge ingameGUI = (GuiIngameForge) mc.ingameGUI;
            res = ingameGUI.getResolution();

            renderTitle();

            try {
                if (Keyboard.isKeyDown(Keyboard.KEY_LCONTROL)) {
                    renderNavigation();
                    renderAttributes();
                    renderBreedPoints();
                } else {
                    renderEntityInfo();
                    renderAITasks();
//                    renderWatchedObjects();
                }

                renderProbe();
            } catch (Exception ex) {
                renderException(ex);
            }

            if (dragonClient.isDead) {
                dragonClient = null;
                dragonServer = null;
            }
        }

    }
项目:OpenPeripheral-Addons    文件:GuiUtils.java   
public static boolean getGuiElementState(GuiElements element) {
    switch (element) {
        case OVERLAY:
            return GuiIngameForge.renderHelmet;
        case PORTAL:
            return GuiIngameForge.renderPortal;
        case HOTBAR:
            return GuiIngameForge.renderHotbar;
        case CROSSHAIRS:
            return GuiIngameForge.renderCrosshairs;
        case BOSS_HEALTH:
            return GuiIngameForge.renderBossHealth;
        case HEALTH:
            return GuiIngameForge.renderHealth;
        case ARMOR:
            return GuiIngameForge.renderArmor;
        case FOOD:
            return GuiIngameForge.renderFood;
        case MOUNT_HEALTH:
            return GuiIngameForge.renderHealthMount;
        case AIR:
            return GuiIngameForge.renderAir;
        case EXPERIENCE:
            return GuiIngameForge.renderExperiance;
        case JUMP_BAR:
            return GuiIngameForge.renderJumpBar;
        case OBJECTIVES:
            return GuiIngameForge.renderObjective;
        default:
            return false;
    }
}
项目:Morph    文件:AbilitySwim.java   
@Override
public void kill() 
{
    if(getParent().worldObj.isRemote)
    {
        if(!GuiIngameForge.renderAir)
        {
            GuiIngameForge.renderAir = true;
        }
    }
}
项目:SimpleMenu    文件:GameOverlayRenderHandler.java   
@ForgeSubscribe
public void renderOverlay(RenderGameOverlayEvent ev) {
    if (guiHidden) {
        GuiIngameForge.renderHelmet = false;
        GuiIngameForge.renderPortal = false;
        GuiIngameForge.renderHotbar = false;
        GuiIngameForge.renderCrosshairs = false;
        GuiIngameForge.renderBossHealth = false;
        GuiIngameForge.renderHealth = false;
        GuiIngameForge.renderArmor = false;
        GuiIngameForge.renderFood = false;
        GuiIngameForge.renderHealthMount = false;
        GuiIngameForge.renderAir = false;
        GuiIngameForge.renderExperiance = false;
        GuiIngameForge.renderJumpBar = false;
        GuiIngameForge.renderObjective = false;
    }
    if (shouldUnhideGui) {
        GuiIngameForge.renderHelmet = true;
        GuiIngameForge.renderPortal = true;
        GuiIngameForge.renderHotbar = true;
        GuiIngameForge.renderCrosshairs = true;
        GuiIngameForge.renderBossHealth = true;
        GuiIngameForge.renderHealth = true;
        GuiIngameForge.renderArmor = true;
        GuiIngameForge.renderFood = true;
        GuiIngameForge.renderHealthMount = true;
        GuiIngameForge.renderAir = true;
        GuiIngameForge.renderExperiance = true;
        GuiIngameForge.renderJumpBar = true;
        GuiIngameForge.renderObjective = true;
        shouldUnhideGui = false;
        guiHidden = false;
    }
}
项目:OpenPeripheral-Addons    文件:GuiUtils.java   
public static void setGuiElementState(GuiElements element, boolean isVisible) {
    switch (element) {
        case OVERLAY:
            GuiIngameForge.renderHelmet = isVisible;
            break;
        case PORTAL:
            GuiIngameForge.renderPortal = isVisible;
            break;
        case HOTBAR:
            GuiIngameForge.renderHotbar = isVisible;
            break;
        case CROSSHAIRS:
            GuiIngameForge.renderCrosshairs = isVisible;
            break;
        case BOSS_HEALTH:
            GuiIngameForge.renderBossHealth = isVisible;
            break;
        case HEALTH:
            GuiIngameForge.renderHealth = isVisible;
            break;
        case ARMOR:
            GuiIngameForge.renderArmor = isVisible;
            break;
        case FOOD:
            GuiIngameForge.renderFood = isVisible;
            break;
        case MOUNT_HEALTH:
            GuiIngameForge.renderHealthMount = isVisible;
            break;
        case AIR:
            GuiIngameForge.renderAir = isVisible;
            break;
        case EXPERIENCE:
            GuiIngameForge.renderExperiance = isVisible;
            break;
        case JUMP_BAR:
            GuiIngameForge.renderJumpBar = isVisible;
            break;
        case OBJECTIVES:
            GuiIngameForge.renderObjective = isVisible;
            break;
    }
}
项目:Morph    文件:AbilitySwim.java   
@Override
public void tick() 
{
    if(air == 8008135)
    {
        air = getParent().getAir();
    }
    boolean flying = false;
    if(getParent().isInWater())
    {
        if(getParent().worldObj.isRemote)
        {
            if(GuiIngameForge.renderAir)
            {
                GuiIngameForge.renderAir = false;
            }
        }
        getParent().setAir(300);
        air = 300;
        if(swimSpeed != 1f && !(getParent() instanceof EntityPlayer && ((EntityPlayer)getParent()).capabilities.isFlying))
        {
            if(getParent().motionX > -swimSpeed && getParent().motionX < swimSpeed)
            {
                getParent().motionX *= swimSpeed * 0.995F;
            }
            if(getParent().motionZ > -swimSpeed && getParent().motionZ < swimSpeed)
            {
                getParent().motionZ *= swimSpeed * 0.995F;
            }
        }
        if(canMaintainDepth)
        {
            boolean isJumping = getParent().isJumping;
            if(!getParent().isSneaking() && !isJumping && getParent().isInsideOfMaterial(Material.water))
            {
                getParent().motionY = 0f;
            }else{
                if(isJumping)
                {
                    getParent().motionY *= swimSpeed;
                }
            }
        }
    }
    else if(!canSurviveOutOfWater)
    {
        int j = EnchantmentHelper.getRespiration(getParent());
        air = j > 0 && getParent().getRNG().nextInt(j + 1) > 0 ? air : air - 1;

        if (air == -20)
        {
            air = 0;
            getParent().attackEntityFrom(DamageSource.drown, 2.0F);
        }

        if(!(getParent() instanceof EntityPlayer && ((EntityPlayer)getParent()).capabilities.isFlying) && landSpeed != 1f && air < 285)
        {
            if(getParent().motionX > -landSpeed && getParent().motionX < landSpeed)
            {
                getParent().motionX *= landSpeed;
            }
            if(getParent().motionZ > -landSpeed && getParent().motionZ < landSpeed)
            {
                getParent().motionZ *= landSpeed;
            }
        }
    }
}