当前位置: 首页>>代码示例>>Java>>正文


Java ElementType类代码示例

本文整理汇总了Java中net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType的典型用法代码示例。如果您正苦于以下问题:Java ElementType类的具体用法?Java ElementType怎么用?Java ElementType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ElementType类属于net.minecraftforge.client.event.RenderGameOverlayEvent包,在下文中一共展示了ElementType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onRenderOverlay

import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; //导入依赖的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: onHudRender

import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; //导入依赖的package包/类
@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,代码行数:17,代码来源:ExPHandlerClient.java

示例3: renderOverlay

import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; //导入依赖的package包/类
@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);
    }
}
 
开发者ID:LambdaInnovation,项目名称:Pipeline,代码行数:18,代码来源:GuiRenderHook.java

示例4: onRenderExperienceBar

import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; //导入依赖的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

示例5: onRender

import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; //导入依赖的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

示例6: onRender

import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; //导入依赖的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

示例7: onRenderExperienceBar

import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; //导入依赖的package包/类
@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);
	}
}
 
开发者ID:TheDarkEra,项目名称:TheDarkEra,代码行数:26,代码来源:GuiManaBar.java

示例8: onRenderGameOverlay

import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; //导入依赖的package包/类
@SubscribeEvent
public void onRenderGameOverlay(RenderGameOverlayEvent.Pre event) {

    if (event.type != ElementType.ALL)
        return;
    Minecraft mc = Minecraft.getMinecraft();
    ScaledResolution var5 = new ScaledResolution(Minecraft.getMinecraft(), Minecraft.getMinecraft().displayWidth,
            Minecraft.getMinecraft().displayHeight);
    int var6 = var5.getScaledWidth();
    int var7 = var5.getScaledHeight();
    mc.entityRenderer.setupOverlayRendering();
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glColor4f(0.5F, 0.5F, 0.5F, 1.0F);

    bindOverlayTexture();
    zLevel = -90f;
    this.drawTexturedModalRect(0, var7 / 6, 0, 0, 147, 182);

    fontRenderer.setUnicodeFlag(true);
    int i = 0;
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
}
 
开发者ID:AnDwHaT5,项目名称:PixelUtilities,代码行数:24,代码来源:PixelmonInfoGui.java

示例9: afterDraw

import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; //导入依赖的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

示例10: onRenderMountHealth

import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; //导入依赖的package包/类
@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);
        }
    }
}
 
开发者ID:DouweKoopmans,项目名称:BetterHorseHud,代码行数:24,代码来源:ModGui.java

示例11: onPreRenderGameOverlay

import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; //导入依赖的package包/类
@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,代码行数:25,代码来源:ClientProxy.java

示例12: render

import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; //导入依赖的package包/类
@Override
public void render(int x, int y, ScaledResolution resolution, ElementType type)
{
	Location location = PlayerHelper.getLookingAt();
	String tile = "";
	String blockName = "";
	if (!(location.getBlock() instanceof IDebugInfo))
	{
		if (location.getTile() != null)
			tile = "\\" + "tile";
		blockName = Block.blockRegistry.getNameForObject(location.getBlock()) + ":" + location.getMetadata() + tile;
		this.font.drawStringWithShadow("Looking At: " + blockName, x, y, 0xFFFFFF);
	} else {
		IDebugInfo info = (IDebugInfo)location.getBlock();
		List<String> lines = new ArrayList<String>();
		info.getInformation(Minecraft.getMinecraft().theWorld, location.getX(), location.getY(), location.getZ(), lines);
		int lastX = 0;
		for (String line : lines)
		{
			this.font.drawStringWithShadow(line, lastX, y, 0xFFFFFF);
			lastX += font.FONT_HEIGHT;
		}
	}
}
 
开发者ID:TeamCoderCraft,项目名称:EnergizedPower,代码行数:25,代码来源:OverlayDebug.java

示例13: onRenderGameOverlay

import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onRenderGameOverlay(RenderGameOverlayEvent event) {

    if (event.isCancelable() || event.getType() != ElementType.EXPERIENCE) {
        return;
    }
    if (!this.mc.inGameHasFocus) {
        return;
    }
    if (FMLClientHandler.instance().getClient().currentScreen != null ) {
        return;
    }

    drawMetalOverlay();

}
 
开发者ID:legobmw99,项目名称:Allomancy,代码行数:18,代码来源:ClientEventHandler.java

示例14: renderOverlay

import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; //导入依赖的package包/类
@SubscribeEvent
public void renderOverlay(RenderGameOverlayEvent.Post event)
{
	if (event.type == ElementType.ALL)
	{
		if (overlayFramebuffer == null)
		{
			overlayFramebuffer = new GXFramebuffer(128, 128);
		}
		if (gx == null)
		{
			return;
		}
		overlayFramebuffer.bind();
        gx.render((int)(128), (int)(128));
        overlayFramebuffer.unbind();
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        overlayFramebuffer.bindTexture();
        RenderUtils.setColor(255, 255, 255);
        RenderUtils.texturedRectangle(0, 0, 128, 128, 0F, 1F, 1F, 0F);
        overlayFramebuffer.unbindTexture();
	}
}
 
开发者ID:ds84182,项目名称:OpenGX,代码行数:24,代码来源:DebugOverlay.java

示例15: renderFramebuffersOverlay

import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; //导入依赖的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


注:本文中的net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。