本文整理匯總了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);
}
}
}
示例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);
}
}
示例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);
}
}
示例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();
}
}
示例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);
}
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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));
}
}
示例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);
}
}
}
示例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);
}
}
}
}
}
示例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;
}
}
}
示例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();
}
示例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();
}
}
示例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();
}
}
}
}