當前位置: 首頁>>代碼示例>>Java>>正文


Java RenderGameOverlayEvent.Post方法代碼示例

本文整理匯總了Java中net.minecraftforge.client.event.RenderGameOverlayEvent.Post方法的典型用法代碼示例。如果您正苦於以下問題:Java RenderGameOverlayEvent.Post方法的具體用法?Java RenderGameOverlayEvent.Post怎麽用?Java RenderGameOverlayEvent.Post使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraftforge.client.event.RenderGameOverlayEvent的用法示例。


在下文中一共展示了RenderGameOverlayEvent.Post方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onRenderOverlay

import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
@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);	
		}
	}
}
 
開發者ID:TheXFactor117,項目名稱:Loot-Slash-Conquer,代碼行數:23,代碼來源:GuiHealth.java

示例2: onGameOverlay

import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
@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());
           }
	}
}
 
開發者ID:kenijey,項目名稱:harshencastle,代碼行數:20,代碼來源:HandlerGameOverlay.java

示例3: onIngameOverlay

import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
@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;
	}
}
 
開發者ID:Lemonszz,項目名稱:Anima-Mundi,代碼行數:22,代碼來源:GuiShield.java

示例4: renderOverlay

import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
@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));
        }
    }
}
 
開發者ID:ReplayMod,項目名稱:jGui,代碼行數:17,代碼來源:AbstractGuiOverlay.java

示例5: renderOverlay

import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
@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);
	}
}
 
開發者ID:austinv11,項目名稱:CollectiveFramework,代碼行數:23,代碼來源:KeyOverlay.java

示例6: onRenderExperienceBar

import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
@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();
	}
}
 
開發者ID:DracoAnimus,項目名稱:Coding,代碼行數:24,代碼來源:DragonHudOverlay.java

示例7: onRender

import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
@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);
    }
  }
}
 
開發者ID:PrinceOfAmber,項目名稱:Cyclic,代碼行數:21,代碼來源:ItemBuildSwapper.java

示例8: onRender

import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
@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);
  }
}
 
開發者ID:PrinceOfAmber,項目名稱:Cyclic,代碼行數:23,代碼來源:EventRender.java

示例9: renderOverlay

import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
@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);
	}
}
 
開發者ID:austinv11,項目名稱:MacroMaker,代碼行數:23,代碼來源:KeyOverlay.java

示例10: onRenderGUI

import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
@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);
                }
            }
        }
    }
}
 
開發者ID:DoubleDoorDevelopment,項目名稱:ItemBlacklist,代碼行數:27,代碼來源:ClientEventHandlers.java

示例11: onRenderOverlay

import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onRenderOverlay(RenderGameOverlayEvent.Post event)
{
    if(event.type.equals(RenderGameOverlayEvent.ElementType.FOOD)) //Render after food bar (no particular reason).
    {
        for(int n = 0; n < ClientProxy.overlayRenderers.size(); n++)
        {
            OverlayRenderData renderer = ClientProxy.overlayRenderers.get(n);
            if(renderer.item != null)
            {
                renderItem.renderItemIntoGUI(Minecraft.getMinecraft().fontRenderer, Minecraft.getMinecraft().getTextureManager(), renderer.item, 2 + (n % 10) * 18, 2 + (n / 10) * 18);
                renderItem.renderItemOverlayIntoGUI(Minecraft.getMinecraft().fontRenderer, Minecraft.getMinecraft().getTextureManager(), renderer.item, 2 + (n % 10) * 18, 2 + (n / 10) * 18);
                GL11.glDisable(GL11.GL_LIGHTING);

                if(renderer.numberToRender > 0)
                {
                    Minecraft.getMinecraft().fontRenderer.drawString(String.valueOf(renderer.numberToRender), (2 + (n % 10) * 18) + 9 - Minecraft.getMinecraft().fontRenderer.getStringWidth(String.valueOf(renderer.numberToRender)) / 2, (2 + (n / 10) * 18) + Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT / 2, 16777215);
                    GL11.glDisable(GL11.GL_LIGHTING);
                }
            }
        }
        Minecraft.getMinecraft().renderEngine.bindTexture(Textures.VANILLA_ICONS);
    }
}
 
開發者ID:Lumaceon,項目名稱:ClockworkPhase,代碼行數:25,代碼來源:RenderHandler.java

示例12: renderFramebuffersOverlay

import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void renderFramebuffersOverlay(RenderGameOverlayEvent.Post event)
{
	if (event.type != ElementType.ALL) return;
	//cleanse monitor list
	Iterator<WeakReference<ComponentMonitor>> iter = monitors.iterator();
	while (iter.hasNext())
	{
		WeakReference<ComponentMonitor> w = iter.next();
		if (w.get() == null)
		{
			iter.remove();
		}
		else
		{
			ComponentMonitor ex = (ComponentMonitor) w.get();
			if (ex.fb != null && ex.owner != null)
			{
				ex.fb.bind();
				ex.owner.gx.render(ex.width, ex.height);
				ex.fb.unbind();
			}
		}
	}
}
 
開發者ID:ds84182,項目名稱:OpenGX,代碼行數:26,代碼來源:ClientEvents.java

示例13: afterDraw

import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void afterDraw (RenderGameOverlayEvent.Post event) {

	if (event.getType() != ElementType.ALL) return;
	if (ZTS.displayStatus() == 1) {
		computeDrawPosIfChanged();
		drawRect(rectX1, rectSnY1, rectX2, rectSnY2, ZTS.toggleSneak?colorPack(0,0,196,196):colorPack(196,196,196,64));	    	
		drawString(mc.fontRendererObj, sneakTxt, rectX1 + 2, rectSnY1 + 2,
				MIM.sneak?colorPack(255,255,0,96):colorPack(64,64,64,128));
		drawRect(rectX1, rectSpY1, rectX2, rectSpY2, ZTS.toggleSprint?colorPack(0,0,196,196):colorPack(196,196,196,64));	    	
		drawString(mc.fontRendererObj, sprintTxt, rectX1 + 2, rectSpY1 + 2,
				MIM.sprint?colorPack(255,255,0,96):colorPack(64,64,64,128));
	} else if (ZTS.displayStatus() == 2) {
		// no optimization here - I don't like the text only display anyway
        computeTextPos(onlyTxt = MIM.displayText());
		drawString(mc.fontRendererObj, onlyTxt, rectX1, rectSnY1, colorPack(255,255,255,192));
	}
}
 
開發者ID:BlueAnanas,項目名稱:ZebrasToggleSneak,代碼行數:19,代碼來源:GuiDrawer.java

示例14: drawOverlay

import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
@ForgeSubscribe
public void drawOverlay(final RenderGameOverlayEvent.Post event)
{
    if (!Loader.isModLoaded("tukmc_Vz"))
    {
        if (event.type == ElementType.FOOD)
        {
            final Minecraft client = Minecraft.getMinecraft();

            client.renderEngine.bindTexture(texture);
            GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

            final int bars = (int) (9 * HungerSystem.getPercentage(client.thePlayer));
            // int bars = 4;

            for (int x = bars; x > 0; x--)
            {
                drawTexturedModalRect(event.resolution.getScaledWidth() / 2 + width + -x * 8 + 9 * width, event.resolution.getScaledHeight() - 39, u, v, width, height);
            }
            client.renderEngine.bindTexture(HungerOverlay.icons);
        }
    }
}
 
開發者ID:TeamMetallurgy,項目名稱:Agriculture,代碼行數:24,代碼來源:HungerOverlay.java

示例15: onRenderOverlay

import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onRenderOverlay(RenderGameOverlayEvent.Post event)
{
	if (event.getType() != ElementType.EXPERIENCE) return;
	else
	{
		ScaledResolution sr = event.getResolution();
		EntityPlayer player = mc.player;
		
		if (!player.capabilities.isCreativeMode)
		{
			Stats statsCap = (Stats) player.getCapability(CapabilityPlayerStats.STATS, null);
			
			if (statsCap != null)
			{
				if (statsCap.getMaxMana() != 0)
				{
					double manaBarWidth = (double) statsCap.getMana() / statsCap.getMaxMana() * 81.0;
					int xPos = sr.getScaledWidth() / 2 + 10;
					int yPos = sr.getScaledHeight() - 38;
					
					mc.renderEngine.bindTexture(location);

					//if (capMana.getMana() != capMana.getMaxMana())
					//{
						this.drawTexturedModalRect(xPos, yPos, 0, 18, 81, 6);
						this.drawTexturedModalRect(xPos, yPos, 0, 24, (int) manaBarWidth, 5);
					//}
				}
			}
		}
	}
}
 
開發者ID:TheXFactor117,項目名稱:Loot-Slash-Conquer,代碼行數:34,代碼來源:GuiMana.java


注:本文中的net.minecraftforge.client.event.RenderGameOverlayEvent.Post方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。