本文整理匯總了Java中net.minecraftforge.client.event.RenderGameOverlayEvent.Post方法的典型用法代碼示例。如果您正苦於以下問題:Java RenderGameOverlayEvent.Post方法的具體用法?Java RenderGameOverlayEvent.Post怎麽用?Java RenderGameOverlayEvent.Post使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraftforge.client.event.RenderGameOverlayEvent
的用法示例。
在下文中一共展示了RenderGameOverlayEvent.Post方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onRenderOverlay
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的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: onGameOverlay
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onGameOverlay(RenderGameOverlayEvent.Post event)
{
if(event.getType() == RenderGameOverlayEvent.ElementType.ALL && Minecraft.getMinecraft().currentScreen == null)
{
Minecraft minecraft = Minecraft.getMinecraft();
EntityPlayer player = minecraft.player;
RayTraceResult posHit = minecraft.objectMouseOver;
if(posHit != null && posHit.getBlockPos() != null)
{
Block blockHit = minecraft.world.getBlockState(posHit.getBlockPos()).getBlock();
if(blockHit instanceof IHudDisplay)
((IHudDisplay)blockHit).displayHud(minecraft, player, posHit, event.getResolution());
TileEntity tileHit = minecraft.world.getTileEntity(posHit.getBlockPos());
if(tileHit instanceof IHudDisplay)
((IHudDisplay)tileHit).displayHud(minecraft, player, posHit, event.getResolution());
}
}
}
示例3: onIngameOverlay
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
@SubscribeEvent
public static void onIngameOverlay(RenderGameOverlayEvent.Post event)
{
if(event.getType() != RenderGameOverlayEvent.ElementType.ALL)
{
return;
}
if(!EntityUtil.getActivePlayerShield(Minecraft.getMinecraft().player).isEmpty())
{
if(gui == null)
{
gui = new GuiShield();
}
gui.drawGui(event.getPartialTicks());
}
else
{
gui = null;
}
}
示例4: renderOverlay
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void renderOverlay(RenderGameOverlayEvent.Post event) {
if (event.type == RenderGameOverlayEvent.ElementType.ALL) {
updateRenderer();
int layers = getMaxLayer();
int mouseX = -1, mouseY = -1;
if (mouseVisible) {
Point mouse = MouseUtils.getMousePos();
mouseX = mouse.getX();
mouseY = mouse.getY();
}
for (int layer = 0; layer <= layers; layer++) {
draw(renderer, screenSize, new RenderInfo(event.partialTicks, mouseX, mouseY, layer));
}
}
}
示例5: renderOverlay
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void renderOverlay(RenderGameOverlayEvent.Post event) {
if (Config.keyOverlay) {
if (/*event.isCanceled() || */event.type != RenderGameOverlayEvent.ElementType.HOTBAR)
return;
int x = 1;
ConcurrentLinkedDeque<Object[]> newKeys = new ConcurrentLinkedDeque<Object[]>();
while (!keys.isEmpty()) {
Object[] key = keys.pop();
String s = (String)key[0];
int ticksLived = (Integer)key[1];
Color color = Color.WHITE;
for (int i = 0; i < KEY_LIFE_LENGTH/(ticksLived*2); i++)
color = color.darker();
Minecraft.getMinecraft().fontRenderer.drawString(s, x, 1, color.getRGB());
x += Minecraft.getMinecraft().fontRenderer.getStringWidth(s)+3;
if (ticksLived > 1)
newKeys.add(new Object[]{s, --ticksLived});
}
keys.addAll(newKeys);
}
}
示例6: onRenderExperienceBar
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的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();
}
}
示例7: onRender
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的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);
}
}
}
示例8: onRender
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的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);
}
}
示例9: renderOverlay
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void renderOverlay(RenderGameOverlayEvent.Post event) {
if (Config.showKeysOnHUD) {
if (/*event.isCanceled() || */event.type != RenderGameOverlayEvent.ElementType.HOTBAR)
return;
int x = 1;
ConcurrentLinkedDeque<Object[]> newKeys = new ConcurrentLinkedDeque<Object[]>();
while (!keys.isEmpty()) {
Object[] key = keys.pop();
String s = (String)key[0];
int ticksLived = (Integer)key[1];
Color color = Color.WHITE;
for (int i = 0; i < KEY_LIFE_LENGTH/(ticksLived*2); i++)
color = color.darker();
Minecraft.getMinecraft().fontRenderer.drawString(s, x, 1, color.getRGB());
x += Minecraft.getMinecraft().fontRenderer.getStringWidth(s)+3;
if (ticksLived > 1)
newKeys.add(new Object[]{s, --ticksLived});
}
keys.addAll(newKeys);
}
}
示例10: onRenderGUI
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onRenderGUI(final RenderGameOverlayEvent.Post event)
{
if (event.getType() == RenderGameOverlayEvent.ElementType.HOTBAR)
{
final Minecraft mc = Minecraft.getMinecraft();
final ScaledResolution res = event.getResolution();
if (!mc.player.isSpectator())
{
for (int slot = 0; slot < 9; ++slot)
{
final ItemStack stack = mc.player.inventory.mainInventory.get(slot);
if (!stack.isEmpty() && stack.getItem() == ItemBlacklisted.I)
{
final int x = res.getScaledWidth() / 2 - 90 + slot * 20 + 2;
final int y = res.getScaledHeight() - 16 - 3;
if (!ItemBlacklisted.canUnpack(stack)) continue;
ItemStack unpacked = ItemBlacklisted.unpack(stack);
mc.getRenderItem().renderItemIntoGUI(unpacked, x, y);
}
}
}
}
}
示例11: onRenderOverlay
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
@SubscribeEvent
public void onRenderOverlay(RenderGameOverlayEvent.Post event)
{
if(event.type.equals(RenderGameOverlayEvent.ElementType.FOOD)) //Render after food bar (no particular reason).
{
for(int n = 0; n < ClientProxy.overlayRenderers.size(); n++)
{
OverlayRenderData renderer = ClientProxy.overlayRenderers.get(n);
if(renderer.item != null)
{
renderItem.renderItemIntoGUI(Minecraft.getMinecraft().fontRenderer, Minecraft.getMinecraft().getTextureManager(), renderer.item, 2 + (n % 10) * 18, 2 + (n / 10) * 18);
renderItem.renderItemOverlayIntoGUI(Minecraft.getMinecraft().fontRenderer, Minecraft.getMinecraft().getTextureManager(), renderer.item, 2 + (n % 10) * 18, 2 + (n / 10) * 18);
GL11.glDisable(GL11.GL_LIGHTING);
if(renderer.numberToRender > 0)
{
Minecraft.getMinecraft().fontRenderer.drawString(String.valueOf(renderer.numberToRender), (2 + (n % 10) * 18) + 9 - Minecraft.getMinecraft().fontRenderer.getStringWidth(String.valueOf(renderer.numberToRender)) / 2, (2 + (n / 10) * 18) + Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT / 2, 16777215);
GL11.glDisable(GL11.GL_LIGHTING);
}
}
}
Minecraft.getMinecraft().renderEngine.bindTexture(Textures.VANILLA_ICONS);
}
}
示例12: renderFramebuffersOverlay
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的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();
}
}
}
}
示例13: afterDraw
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的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));
}
}
示例14: drawOverlay
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
@ForgeSubscribe
public void drawOverlay(final RenderGameOverlayEvent.Post event)
{
if (!Loader.isModLoaded("tukmc_Vz"))
{
if (event.type == ElementType.FOOD)
{
final Minecraft client = Minecraft.getMinecraft();
client.renderEngine.bindTexture(texture);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
final int bars = (int) (9 * HungerSystem.getPercentage(client.thePlayer));
// int bars = 4;
for (int x = bars; x > 0; x--)
{
drawTexturedModalRect(event.resolution.getScaledWidth() / 2 + width + -x * 8 + 9 * width, event.resolution.getScaledHeight() - 39, u, v, width, height);
}
client.renderEngine.bindTexture(HungerOverlay.icons);
}
}
}
示例15: onRenderOverlay
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入方法依賴的package包/類
@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);
//}
}
}
}
}
}