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


Java ElementType.HOTBAR屬性代碼示例

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


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

示例1: onHudRender

@SubscribeEvent
public static void onHudRender(RenderGameOverlayEvent.Pre event)
{
	if (event.getType() == ElementType.ALL)
	{
		PlayerHUDRenderer.render(event.getPartialTicks());
	}
	
	if (	event.getType() == ElementType.HOTBAR || 
			event.getType() == ElementType.FOOD || 
			event.getType() == ElementType.HEALTH ||
			event.getType() == ElementType.EXPERIENCE)
	{
		event.setCanceled(true);
	}
}
 
開發者ID:V0idWa1k3r,項目名稱:ExPetrum,代碼行數:16,代碼來源:ExPHandlerClient.java

示例2: onPreRenderGameOverlay

@SubscribeEvent
public void onPreRenderGameOverlay(RenderGameOverlayEvent.Pre e) {
	Minecraft mc = Minecraft.getMinecraft();
	if (mc.thePlayer != null) {
		if (e.type == ElementType.CROSSHAIRS) {
			if (mc.thePlayer.getHeldItem() != null) {
				ItemStack held = mc.thePlayer.getHeldItem();
				if (held.getItem() == FarragoMod.RIFLE) {
					RifleRenderer.renderCrosshairs(mc, held, e.partialTicks, e.resolution.getScaledWidth(), e.resolution.getScaledHeight());
					RifleRenderer.renderHotbar(mc, held, e.partialTicks, e.resolution.getScaledWidth(), e.resolution.getScaledHeight());
					e.setCanceled(true);
				}
			}
		} else if (e.type == ElementType.HOTBAR) {
			if (mc.thePlayer.inventory.armorInventory[1] != null) {
				ItemStack legs = mc.thePlayer.inventory.armorInventory[1];
				if (legs.getItem() == FarragoMod.UTILITY_BELT) {
					UtilityBeltRenderer.render(mc, legs, e.partialTicks, e.resolution.getScaledWidth(), e.resolution.getScaledHeight());
					e.setCanceled(true);
				}
			}
		}
	}
}
 
開發者ID:unascribed,項目名稱:Farrago,代碼行數:24,代碼來源:ClientProxy.java

示例3: renderOverlayPost

@SubscribeEvent
public void renderOverlayPost(RenderGameOverlayEvent.Post event) {

	if (event.getType() == ElementType.HOTBAR) {
		ItemWeapon.inHand = true;
	}
}
 
開發者ID:rafradek,項目名稱:Mods,代碼行數:7,代碼來源:TF2EventsClient.java

示例4: onPostRenderOverlay

@SubscribeEvent
public void onPostRenderOverlay(RenderGameOverlayEvent.Pre event) {
	if (event.getType() != ElementType.HOTBAR) {
		return;
	}
	ScaledResolution resolution = event.getResolution();

	if (hud == null) {
		hud = new CivilizationOverlayHandler(Minecraft.getMinecraft());
	}

	hud.render(resolution.getScaledWidth(), resolution.getScaledHeight());
}
 
開發者ID:ToroCraft,項目名稱:ToroQuest,代碼行數:13,代碼來源:CivilizationClientHandlers.java

示例5: renderGameOverlay

/** Alters HUD rendering. */
@SubscribeEvent
public void renderGameOverlay(RenderGameOverlayEvent.Pre event) {
    
    EntityPlayer player = Geomastery.proxy.getClientPlayer();
    int centreX = event.getResolution().getScaledWidth() / 2;
    int resHeight = event.getResolution().getScaledHeight();
    
    if (event.getType() == ElementType.HOTBAR &&
            GeoConfig.gameplay.temperature) {
        
        drawTempIcon(player, centreX, resHeight);
    }
    
    if (event.getType() == ElementType.AIR) {

        if (player.isInsideOfMaterial(Material.WATER)) {
            
            drawAirBubbles(player, centreX, resHeight);
        }
        
        event.setCanceled(true);
    }
    
    if (event.getType() == ElementType.FOOD && GeoConfig.gameplay.food) {

        drawFoodBars(player, centreX, resHeight);
        event.setCanceled(true);
    }
}
 
開發者ID:JayAvery,項目名稱:geomastery,代碼行數:30,代碼來源:ClientEvents.java

示例6: onRenderHotBar

@SubscribeEvent
(priority = EventPriority.NORMAL)
public void onRenderHotBar(RenderGameOverlayEvent event) {
	FontRenderer fontRender = this.mc.fontRenderer;

	if (event.isCancelable() || event.type != ElementType.HOTBAR || mc.gameSettings.showDebugInfo) return;

	fontRender.drawStringWithShadow(Temperature.getTemp(mc.theWorld, mc.thePlayer), ConfigHandler.xPos_actual, ConfigHandler.yPos_actual, ConfigHandler.color_actual);
}
 
開發者ID:Konlii,項目名稱:FingerInTheWind,代碼行數:9,代碼來源:FITWGUI.java

示例7: onRenderHotBar

@ForgeSubscribe
public void onRenderHotBar(RenderGameOverlayEvent event) {
	// Only interested in Post-HotBar events ((almost) the end of overlay rendering)
	if (event.isCancelable() || event.type != ElementType.HOTBAR || mc.thePlayer.capabilities.isCreativeMode) {
		return;
	}
	int width = event.resolution.getScaledWidth();
	int height = event.resolution.getScaledHeight();
	
	//TODO make text positioning configurable; add an option to show Dota-like HP and mana bars.
	//NOTE I could make a sheet for smaller font size, if it's only 0123456789/+
	
	EntityStats stats = Dota2Items.stats.getOrCreateEntityStats(mc.thePlayer);
	int left = width / 2 - 91;
	int top = height - 38;
	String hp = stats.getHealth(mc.thePlayer) + "/" + stats.getMaxHealth();
	int strlen = fontRenderer.getStringWidth(hp);
	fontRenderer.drawStringWithShadow(hp, left - strlen - 1, top, 0xFF1313);
	if (BaseStatsUpdater.shouldHeal(stats)) {
		String hpRegen = String.format("+%.2f", stats.getHealthRegen());
		fontRenderer.drawStringWithShadow(hpRegen, left + HP_BAR_WIDTH + 1, top, 0xFF6C6C);
	}
	
	int curMana = stats.getMana();
	int maxMana = stats.getMaxMana();
	if (maxMana > 0) {
		boolean renderArmor = ForgeHooks.getTotalArmorValue(mc.thePlayer) > 0;
		top = GuiManaBar.yPos + 1;
		String mana = curMana + "/" + maxMana;
		strlen = fontRenderer.getStringWidth(mana);
		fontRenderer.drawStringWithShadow(mana, left - strlen - 1, top, 0x2162F8);
		if (curMana < maxMana) {
			String manaRegen = String.format("+%.2f", stats.getManaRegen());
			fontRenderer.drawStringWithShadow(manaRegen, left + HP_BAR_WIDTH + 1, top, 0x4893D4);
		}
	}
}
 
開發者ID:Hunternif,項目名稱:Dota2Items,代碼行數:37,代碼來源:GuiHealthAndMana.java

示例8: renderGameOverlay

@SubscribeEvent
@SideOnly(Side.CLIENT)
public void renderGameOverlay(RenderGameOverlayEvent event) {
	if(Minecraft.getMinecraft().thePlayer != null && PlayerUtils.isPlayerMountedOnCamera(Minecraft.getMinecraft().thePlayer)){
		if(event.getType() == RenderGameOverlayEvent.ElementType.EXPERIENCE && ((BlockUtils.getBlock(Minecraft.getMinecraft().theWorld, BlockUtils.toPos((int)Math.floor(Minecraft.getMinecraft().thePlayer.getRidingEntity().posX), (int)(Minecraft.getMinecraft().thePlayer.getRidingEntity().posY - 1.0D), (int)Math.floor(Minecraft.getMinecraft().thePlayer.getRidingEntity().posZ))) instanceof BlockSecurityCamera)))
			GuiUtils.drawCameraOverlay(Minecraft.getMinecraft(), Minecraft.getMinecraft().ingameGUI, event.getResolution(), Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().theWorld, BlockUtils.toPos((int)Math.floor(Minecraft.getMinecraft().thePlayer.getRidingEntity().posX), (int)(Minecraft.getMinecraft().thePlayer.getRidingEntity().posY - 1.0D), (int)Math.floor(Minecraft.getMinecraft().thePlayer.getRidingEntity().posZ)));
	}
	else if(event.getType() == ElementType.HOTBAR)
	{
		Minecraft mc = Minecraft.getMinecraft();
		EntityPlayerSP player = mc.thePlayer;
		World world = player.getEntityWorld();
		int held = player.inventory.currentItem;

		if(held < 0 || held >= player.inventory.mainInventory.length)
			return;

		ItemStack monitor = player.inventory.mainInventory[held];

		if(monitor != null && monitor.getItem() == SCContent.cameraMonitor)
		{
			String textureToUse = "cameraNotBound";
			double eyeHeight = player.getEyeHeight();
			Vec3d lookVec = new Vec3d((player.posX + (player.getLookVec().xCoord * 5)), ((eyeHeight + player.posY) + (player.getLookVec().yCoord * 5)), (player.posZ + (player.getLookVec().zCoord * 5)));
			RayTraceResult mop = world.rayTraceBlocks(new Vec3d(player.posX, player.posY + player.getEyeHeight(), player.posZ), lookVec);

			if(mop != null && mop.typeOfHit == Type.BLOCK && world.getTileEntity(mop.getBlockPos()) instanceof TileEntitySecurityCamera)
			{
				NBTTagCompound cameras = monitor.getTagCompound();

				if(cameras != null)
					for(int i = 1; i < 31; i++)
					{
						if(!cameras.hasKey("Camera" + i))
							continue;

						String[] coords = cameras.getString("Camera" + i).split(" ");

						if(Integer.parseInt(coords[0]) == mop.getBlockPos().getX() && Integer.parseInt(coords[1]) == mop.getBlockPos().getY() && Integer.parseInt(coords[2]) == mop.getBlockPos().getZ())
						{
							textureToUse = "cameraBound";
							break;
						}
					}

				GlStateManager.enableAlpha();
				Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation(SecurityCraft.MODID, "textures/gui/" + textureToUse + ".png"));
				drawNonStandardTexturedRect(event.getResolution().getScaledWidth() / 2 - 90 + held * 20 + 2, event.getResolution().getScaledHeight() - 16 - 3, 0, 0, 16, 16, 16, 16);
				GlStateManager.disableAlpha();
			}
		}
	}
}
 
開發者ID:Geforce132,項目名稱:SecurityCraft,代碼行數:53,代碼來源:SCEventHandler.java

示例9: renderGameOverlay

@SubscribeEvent
@SideOnly(Side.CLIENT)
public void renderGameOverlay(RenderGameOverlayEvent.Post event) {
	if(Minecraft.getMinecraft().thePlayer != null && PlayerUtils.isPlayerMountedOnCamera(Minecraft.getMinecraft().thePlayer)){
		if(event.type == RenderGameOverlayEvent.ElementType.EXPERIENCE && ((BlockUtils.getBlock(Minecraft.getMinecraft().theWorld, BlockUtils.toPos((int)Math.floor(Minecraft.getMinecraft().thePlayer.ridingEntity.posX), (int)(Minecraft.getMinecraft().thePlayer.ridingEntity.posY - 1.0D), (int)Math.floor(Minecraft.getMinecraft().thePlayer.ridingEntity.posZ))) instanceof BlockSecurityCamera)))
			GuiUtils.drawCameraOverlay(Minecraft.getMinecraft(), Minecraft.getMinecraft().ingameGUI, event.resolution, Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().theWorld, BlockUtils.toPos((int)Math.floor(Minecraft.getMinecraft().thePlayer.ridingEntity.posX), (int)(Minecraft.getMinecraft().thePlayer.ridingEntity.posY - 1.0D), (int)Math.floor(Minecraft.getMinecraft().thePlayer.ridingEntity.posZ)));
	}
	else if(event.type == ElementType.HOTBAR)
	{
		Minecraft mc = Minecraft.getMinecraft();
		EntityPlayerSP player = mc.thePlayer;
		World world = player.getEntityWorld();
		int held = player.inventory.currentItem;

		if(held < 0 || held >= player.inventory.mainInventory.length)
			return;

		ItemStack monitor = player.inventory.mainInventory[held];

		if(monitor != null && monitor.getItem() == SCContent.cameraMonitor)
		{
			String textureToUse = "cameraNotBound";
			double eyeHeight = player.getEyeHeight();
			Vec3 lookVec = new Vec3((player.posX + (player.getLookVec().xCoord * 5)), ((eyeHeight + player.posY) + (player.getLookVec().yCoord * 5)), (player.posZ + (player.getLookVec().zCoord * 5)));
			MovingObjectPosition mop = world.rayTraceBlocks(new Vec3(player.posX, player.posY + player.getEyeHeight(), player.posZ), lookVec);

			if(mop != null && mop.typeOfHit == MovingObjectType.BLOCK && world.getTileEntity(mop.getBlockPos()) instanceof TileEntitySecurityCamera)
			{
				NBTTagCompound cameras = monitor.getTagCompound();

				if(cameras != null)
					for(int i = 1; i < 31; i++)
					{
						if(!cameras.hasKey("Camera" + i))
							continue;

						String[] coords = cameras.getString("Camera" + i).split(" ");

						if(Integer.parseInt(coords[0]) == mop.getBlockPos().getX() && Integer.parseInt(coords[1]) == mop.getBlockPos().getY() && Integer.parseInt(coords[2]) == mop.getBlockPos().getZ())
						{
							textureToUse = "cameraBound";
							break;
						}
					}

				GlStateManager.enableBlend();
				Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation(SecurityCraft.MODID, "textures/gui/" + textureToUse + ".png"));
				drawNonStandardTexturedRect(event.resolution.getScaledWidth() / 2 - 90 + held * 20 + 2, event.resolution.getScaledHeight() - 16 - 3, 0, 0, 16, 16, 16, 16);
				GlStateManager.disableBlend();
			}
		}
	}
}
 
開發者ID:Geforce132,項目名稱:SecurityCraft,代碼行數:53,代碼來源:SCEventHandler.java

示例10: renderGameOverlay

@SubscribeEvent
@SideOnly(Side.CLIENT)
public void renderGameOverlay(RenderGameOverlayEvent.Post event){
	if(Minecraft.getMinecraft().thePlayer != null && PlayerUtils.isPlayerMountedOnCamera(Minecraft.getMinecraft().thePlayer)){
		if(event.type == RenderGameOverlayEvent.ElementType.EXPERIENCE && Minecraft.getMinecraft().theWorld.getBlock((int)Math.floor(Minecraft.getMinecraft().thePlayer.ridingEntity.posX), (int)(Minecraft.getMinecraft().thePlayer.ridingEntity.posY - 1.0D), (int)Math.floor(Minecraft.getMinecraft().thePlayer.ridingEntity.posZ)) instanceof BlockSecurityCamera)
			GuiUtils.drawCameraOverlay(Minecraft.getMinecraft(), Minecraft.getMinecraft().ingameGUI, event.resolution, Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().theWorld, (int)Math.floor(Minecraft.getMinecraft().thePlayer.ridingEntity.posX), (int)(Minecraft.getMinecraft().thePlayer.ridingEntity.posY - 1.0D), (int)Math.floor(Minecraft.getMinecraft().thePlayer.ridingEntity.posZ), event.mouseX, event.mouseY);
	}
	else if(event.type == ElementType.HOTBAR)
	{
		Minecraft mc = Minecraft.getMinecraft();
		EntityClientPlayerMP player = mc.thePlayer;
		World world = player.getEntityWorld();
		int held = player.inventory.currentItem;

		if(held < 0 || held >= player.inventory.mainInventory.length)
			return;

		ItemStack monitor = player.inventory.mainInventory[held];

		if(monitor != null && monitor.getItem() == SCContent.cameraMonitor)
		{
			String textureToUse = "cameraNotBound";
			double eyeHeight = player.getEyeHeight();
			Vec3 lookVec = Vec3.createVectorHelper((player.posX + (player.getLookVec().xCoord * 5)), ((eyeHeight + player.posY) + (player.getLookVec().yCoord * 5)), (player.posZ + (player.getLookVec().zCoord * 5)));
			MovingObjectPosition mop = world.rayTraceBlocks(Vec3.createVectorHelper(player.posX, player.posY + player.getEyeHeight(), player.posZ), lookVec);

			if(mop != null && mop.typeOfHit == MovingObjectType.BLOCK && world.getTileEntity(mop.blockX, mop.blockY, mop.blockZ) instanceof TileEntitySecurityCamera)
			{
				NBTTagCompound cameras = monitor.getTagCompound();

				if(cameras != null)
					for(int i = 1; i < 31; i++)
					{
						if(!cameras.hasKey("Camera" + i))
							continue;

						String[] coords = cameras.getString("Camera" + i).split(" ");

						if(Integer.parseInt(coords[0]) == mop.blockX && Integer.parseInt(coords[1]) == mop.blockY && Integer.parseInt(coords[2]) == mop.blockZ)
						{
							textureToUse = "cameraBound";
							break;
						}
					}

				GL11.glEnable(GL11.GL_BLEND);
				Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation(SecurityCraft.MODID, "textures/gui/" + textureToUse + ".png"));
				drawNonStandardTexturedRect(event.resolution.getScaledWidth() / 2 - 90 + held * 20 + 2, event.resolution.getScaledHeight() - 16 - 3, 0, 0, 16, 16, 16, 16);
				GL11.glDisable(GL11.GL_BLEND);
			}
		}
	}
}
 
開發者ID:Geforce132,項目名稱:SecurityCraft,代碼行數:53,代碼來源:SCEventHandler.java

示例11: renderGUIOverlay

@SubscribeEvent
public void renderGUIOverlay(RenderGameOverlayEvent e)
{
	if (e instanceof RenderGameOverlayEvent.Post || e.type != ElementType.HOTBAR)
	{
		return;
	}
	
	EntityPlayer p = mc.thePlayer;
	if (p != null)
	{
		ItemStack is = p.getCurrentEquippedItem();
		if (is != null && is.getItem() instanceof IItemWeapon && ((IItemWeapon) is.getItem()).getRangedComponent() != null)
		{
			RangedComponent rc = ((IItemWeapon) is.getItem()).getRangedComponent();
			boolean rld = RangedComponent.isReloaded(is);
			//RangedComponent rc = ((IItemWeapon) is.getItem()).getRangedComponent();
			GL11.glColor4f(1F, 1F, 1F, 1F);
			GL11.glDisable(GL11.GL_LIGHTING);
			
			float f;
			
			int color;
			if (rld)
			{
				f = 1F;
				if (p.getItemInUse() == is && RangedComponent.isReadyToFire(is))
				{
					color = 0x60C60000;
				} else
				{
					color = 0x60348E00;
				}
			} else if (p.getItemInUse() == is)
			{
				f = Math.min((float) p.getItemInUseDuration() / rc.getReloadDuration(is), 1F);
				color = 0x60EAA800;
			} else
			{
				f = 0F;
				color = 0;
			}
			
			int i;
			for (i = 0; i < 9; i++)
			{
				if (p.inventory.getStackInSlot(i) == is)
				{
					break;
				}
			}
			
			int x0 = e.resolution.getScaledWidth() / 2 - 88 + i * 20;
			int y0 = e.resolution.getScaledHeight() - 3;
			drawRect(x0, y0, x0 + 16, y0 - (int) (f * 16), color);
		}
	}
}
 
開發者ID:Ckathode,項目名稱:balkons-weaponmod,代碼行數:58,代碼來源:GuiOverlayReloaded.java

示例12: onRenderHotBar

@ForgeSubscribe
public void onRenderHotBar(RenderGameOverlayEvent event) {
	// Only interested in Post-HotBar events ((almost) the end of overlay rendering)
	if (event.isCancelable() || event.type != ElementType.HOTBAR || mc.thePlayer.capabilities.isCreativeMode) {
		return;
	}
	EntityStats stats = Dota2Items.stats.getOrCreateEntityStats(mc.thePlayer);
	if (stats.getMaxMana() == 0) {
		return;
	}
	float halfDrop = (float)stats.getMaxMana() / (float)HALF_DROPS_COUNT;
	int mana = MathHelper.floor_float((float)stats.getMana() / halfDrop);
	long ticksSinceLastChange = mc.thePlayer.ticksExisted - lastChange;
	boolean highlight = ticksSinceLastChange <= HIGHLIGHT_TIME && ticksSinceLastChange / 3 % 2 == 1;
	
	GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
	GL11.glDisable(GL11.GL_LIGHTING);
	mc.renderEngine.bindTexture(texture);
	
	int width = event.resolution.getScaledWidth();
	int height = event.resolution.getScaledHeight();

	int left = width / 2 - 91;
	int top = height - 39;
	
	// Account for health bars:
	AttributeInstance attrMaxHealth = this.mc.thePlayer.getEntityAttribute(SharedMonsterAttributes.maxHealth);
	float healthMax = (float)attrMaxHealth.getAttributeValue();
	float absorb = this.mc.thePlayer.getAbsorptionAmount();
	int healthRows = MathHelper.ceiling_float_int((healthMax + absorb) / 2.0F / 10.0F);
	int rowHeight = Math.max(10 - (healthRows - 2), 3);
	top -= healthRows * rowHeight;

	// Account for armor:
	if (ForgeHooks.getTotalArmorValue(mc.thePlayer) > 0) {
		top -= 10;
	}
	yPos = top;

	int regen = -1;

	for (int i = 0; i < 10; ++i) {
		int idx = i * 2 + 1;

		int x = left + i * 8;
		int y = top;
		if (i == regen) {
			y -= 2;
		}

		drawTexturedModalRect(x, y, (highlight ? 9 : 0), 0, 9, 9);

		if (highlight) {
			if (idx < prevMana) {
				drawTexturedModalRect(x, y, 54, 0, 9, 9);
			} else if (idx == prevMana) {
				drawTexturedModalRect(x, y, 63, 0, 9, 9);
			}
		}

		if (idx < mana) {
			drawTexturedModalRect(x, y, 36, 0, 9, 9);
		} else if (idx == mana) {
			drawTexturedModalRect(x, y, 45, 0, 9, 9);
		}
	}
	
	if (prevMana != mana) {
		lastChange = mc.thePlayer.ticksExisted;
	}
	prevMana = mana;
}
 
開發者ID:Hunternif,項目名稱:Dota2Items,代碼行數:72,代碼來源:GuiManaBar.java


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