本文整理汇总了Java中net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType.EXPERIENCE属性的典型用法代码示例。如果您正苦于以下问题:Java ElementType.EXPERIENCE属性的具体用法?Java ElementType.EXPERIENCE怎么用?Java ElementType.EXPERIENCE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType
的用法示例。
在下文中一共展示了ElementType.EXPERIENCE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onRenderOverlay
@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);
}
}
}
示例2: 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);
}
}
示例3: onRenderExperienceBar
@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();
}
}
示例4: onRender
@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);
}
}
}
示例5: onRender
@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);
}
}
示例6: onRenderExperienceBar
@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);
}
}
示例7: onRenderMountHealth
@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);
}
}
}
示例8: onRenderGameOverlay
@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();
}
示例9: onRenderOfOverlay
@SubscribeEvent
public void onRenderOfOverlay(RenderGameOverlayEvent event) {
// Check the event is not cancellable
if (event.isCancelable()) {
return;
}
// Check it's not for experience
if (event.type != ElementType.EXPERIENCE) {
return;
}
// Check if hud enabled
if (!RadioUtils.inProgress) {
return;
}
// Otherwise, proceed to render icon
ScaledResolution screenResolution = new ScaledResolution(mc,
mc.displayWidth, mc.displayHeight);
int height = screenResolution.getScaledHeight();
height = height - mc.fontRendererObj.FONT_HEIGHT;
mc.fontRendererObj.drawString(statusIndicator, 1, height,
0xFFFFFF);
}
示例10: onRenderOverlay
@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);
//}
}
}
}
}
}
示例11: showProgressUpdate
@SubscribeEvent
public void showProgressUpdate(RenderGameOverlayEvent.Post event) {
if (quest == null || Minecraft.getSystemTime() - activationTime > TTL) {
quest = null;
return;
}
if (event.isCancelable() || event.getType() != ElementType.EXPERIENCE) {
return;
}
ScaledResolution viewport = new ScaledResolution(mc);
new GuiDailyBadge(quest, mc, viewport.getScaledWidth() - 122, (viewport.getScaledHeight() / 4));
}
示例12: renderHud
@SubscribeEvent
public void renderHud(Post event) {
ScaledResolution resolution = event.getResolution();
int width = resolution.getScaledWidth();
int height = resolution.getScaledHeight();
EntityPlayer player = Minecraft.getMinecraft().player;
ItemStack stack = BaublesSupport.getItem(player, ModItems.FAKE_HALO, ModItems.CREATIVE_HALO, ModItems.REAL_HALO);
if (stack == null || stack.isEmpty()) return;
if (event.getType() == ElementType.EXPERIENCE) {
HUD_TEXTURE.bind();
GlStateManager.pushMatrix();
GlStateManager.color(1.0F, 1.0F, 1.0F);
int right = ((width / 2) - (100 / 2)) + 145;
int top = height - 17;
emptyManaBar.draw(ClientTickHandler.getTicks(), right, top);
emptyBurnoutBar.draw(ClientTickHandler.getTicks(), right, top + 6);
GlStateManager.popMatrix();
CapManager manager = new CapManager(player);
GlStateManager.pushMatrix();
GlStateManager.color(1.0F, 1.0F, 1.0F);
int visualManaLength = 0;
if (manager.getMana() > 0)
visualManaLength = (int) (((manager.getMana() * 100) / manager.getMaxMana()) % 101);
fullManaBar.drawClipped(ClientTickHandler.getTicks(), right, top, visualManaLength, 5);
GlStateManager.color(1.0F, 1.0F, 1.0F);
int visualBurnoutLength = 0;
if (manager.getBurnout() > 0)
visualBurnoutLength = (int) (((manager.getBurnout() * 100) / manager.getMaxBurnout()) % 101);
fullBurnoutBar.drawClipped(ClientTickHandler.getTicks(), right, top + 6, visualBurnoutLength, 5);
GlStateManager.popMatrix();
}
}
示例13: onDraw
@CoreEvent
public void onDraw(final @Nonnull RenderGameOverlayEvent.Post event) {
if (event.type==ElementType.EXPERIENCE)
if (CurrentMode.instance.isMode())
if ((int) (System.currentTimeMillis()/500)%2==0) {
final FontRenderer fontrenderer = font();
WRenderer.startTexture();
OpenGL.glPushMatrix();
OpenGL.glTranslatef(5f, 5f, 0f);
OpenGL.glScalef(2f, 2f, 1f);
OpenGL.glPushMatrix();
OpenGL.glScalef(fontrenderer.FONT_HEIGHT, fontrenderer.FONT_HEIGHT, 1f);
OpenGL.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
texture().bindTexture(resSign);
WRenderer.startTexture();
RenderHelper.drawRectTexture(GL_QUADS);
OpenGL.glPopMatrix();
OpenGL.glTranslatef(fontrenderer.FONT_HEIGHT, 0f, 0f);
final String str = I18n.format(CurrentMode.instance.getMode().message);
fontrenderer.drawStringWithShadow(str, 0, 0, 0xffffff);
OpenGL.glPopMatrix();
}
}
示例14: onRenderGui
@SubscribeEvent
public void onRenderGui(RenderGameOverlayEvent.Post event) {
if (event.getType() != ElementType.EXPERIENCE)
return;
new GUIToolDurability(Minecraft.getMinecraft());
new GUILookAt(Minecraft.getMinecraft());
//new GUIArmorDurability(Minecraft.getMinecraft());
}
示例15: onRenderExperienceBar
@SubscribeEvent(priority=EventPriority.NORMAL)
public void onRenderExperienceBar(RenderGameOverlayEvent.Post event) {
if (event.getType() != ElementType.EXPERIENCE) {
return;
}
CapabilityMana.IMana props = mc.player.getCapability(CapabilityMana.MANA, null);
if (props == null || props.getMaxMana() == 0) {
return;
}
int xPos = 2;
int yPos = 2;
this.mc.getTextureManager().bindTexture(texture);
// Add this block of code before you draw the section of your texture containing transparency
GlStateManager.pushAttrib();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.disableLighting();
// alpha test and blend needed due to vanilla or Forge rendering bug
GlStateManager.enableAlpha();
GlStateManager.enableBlend();
// Here we draw the background bar which contains a transparent section; note the new size
drawTexturedModalRect(xPos, yPos, 0, 0, 56, 9);
// You can keep drawing without changing anything
int manabarwidth = (int)(((float) props.getMana() / props.getMaxMana()) * 49);
drawTexturedModalRect(xPos + 3, yPos + 3, 0, 9, manabarwidth, 3);
String s = Utils.translateToLocal("gui.manaBar.mana") + " " + props.getMana() + "/" + props.getMaxMana();
yPos += 10;
this.mc.fontRenderer.drawString(s, xPos + 1, yPos, 0);
this.mc.fontRenderer.drawString(s, xPos - 1, yPos, 0);
this.mc.fontRenderer.drawString(s, xPos, yPos + 1, 0);
this.mc.fontRenderer.drawString(s, xPos, yPos - 1, 0);
this.mc.fontRenderer.drawString(s, xPos, yPos, 8453920);
GlStateManager.popAttrib();
}