当前位置: 首页>>代码示例>>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;未经允许,请勿转载。