本文整理匯總了Java中net.minecraftforge.client.event.RenderGameOverlayEvent類的典型用法代碼示例。如果您正苦於以下問題:Java RenderGameOverlayEvent類的具體用法?Java RenderGameOverlayEvent怎麽用?Java RenderGameOverlayEvent使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
RenderGameOverlayEvent類屬於net.minecraftforge.client.event包,在下文中一共展示了RenderGameOverlayEvent類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onPreGuiRender
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入依賴的package包/類
@SubscribeEvent
public void onPreGuiRender(RenderGameOverlayEvent.Pre event)
{
final Minecraft minecraft = FMLClientHandler.instance().getClient();
final EntityClientPlayerMP player = minecraft.thePlayer;
if (event.type == RenderGameOverlayEvent.ElementType.ALL)
{
if (player != null && player.ridingEntity != null && player.ridingEntity instanceof IIgnoreShift && ((IIgnoreShift) player.ridingEntity).shouldIgnoreShiftExit())
{
// Remove "Press shift to dismount" message when shift-exiting is disabled (not ideal, but the only option)
String str = I18n.format("mount.onboard", new Object[] { GameSettings.getKeyDisplayString(minecraft.gameSettings.keyBindSneak.getKeyCode()) });
if (minecraft.ingameGUI.recordPlaying.equals(str))
{
minecraft.ingameGUI.recordPlaying = "";
}
}
}
}
示例2: onRenderOverlayText
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入依賴的package包/類
@SubscribeEvent
public void onRenderOverlayText(RenderGameOverlayEvent.Text event)
{
ScaledResolution sr = event.getResolution();
EntityPlayer player = Minecraft.getMinecraft().player;
Stats statsCap = (Stats) player.getCapability(CapabilityPlayerStats.STATS, null);
if (!player.capabilities.isCreativeMode && statsCap != null)
{
String mana = statsCap.getMana() + " / " + statsCap.getMaxMana();
GL11.glPushMatrix();
GL11.glScalef(0.5F, 0.5F, 0.5F);
Minecraft.getMinecraft().fontRenderer.drawStringWithShadow(mana, (sr.getScaledWidth() / 2 + 37) * 2, (sr.getScaledHeight() - 37) * 2, 0xFFFFFF);
GL11.glPopMatrix();
}
}
示例3: 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);
}
}
}
示例4: onRenderOverlayText
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入依賴的package包/類
@SubscribeEvent
public void onRenderOverlayText(RenderGameOverlayEvent.Text event)
{
ScaledResolution sr = event.getResolution();
EntityPlayer player = Minecraft.getMinecraft().player;
if (!player.capabilities.isCreativeMode)
{
String health = (int) player.getHealth() + " / " + (int) player.getMaxHealth();
GL11.glPushMatrix();
GL11.glScalef(0.5F, 0.5F, 0.5F);
Minecraft.getMinecraft().fontRenderer.drawStringWithShadow(health, (sr.getScaledWidth() / 2 - 60) * 2, (sr.getScaledHeight() - 36) * 2, 0xFFFFFF);
GL11.glPopMatrix();
}
}
示例5: renderGameOverlayEvent
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入依賴的package包/類
/**
* When possible, presents corrected biome information in the F3 overlay for Neo-Hell
* @param event
*/
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void renderGameOverlayEvent(RenderGameOverlayEvent.Text event) {
if (!Minecraft.getMinecraft().gameSettings.showDebugInfo) return;
if (Minecraft.getMinecraft().world.provider.getDimension()!=-1) return;
ArrayList<String> left = event.getLeft();
final int LINE_BIOME = 11;
if (left.size()<=LINE_BIOME || !left.get(LINE_BIOME).startsWith("Biome:")) return; //Someone's already tampered
String biomeName = "MEMES(NULL)";
BlockPos pos = Minecraft.getMinecraft().player.getPosition();
Chunk chunk = Minecraft.getMinecraft().world.getChunkFromBlockCoords(pos);
byte[] biomeArray = chunk.getBiomeArray();
int x = pos.getX() & 15;
int z = pos.getZ() & 15;
int biomeId = biomeArray[z*16+x];
NeoBiome biome = BiomeRegistry.NEO_HELL.getObjectById(biomeId);
if (biome!=null) biomeName = biome.getBiomeName();
left.set(LINE_BIOME, "Biome: "+biomeId+" ("+biomeName+")");
}
示例6: getPlayer
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入依賴的package包/類
public static EntityPlayer getPlayer(Event event)
{
if(event instanceof LivingEvent && ((LivingEvent)event).getEntity() instanceof EntityPlayer)
return (EntityPlayer)((LivingEvent)event).getEntity();
if(event instanceof RenderGameOverlayEvent || event instanceof RenderWorldLastEvent || event instanceof ClientTickEvent)
return HarshenCastle.proxy.getPlayer();
if(event instanceof PlayerTickEvent)
return ((PlayerTickEvent)event).player;
if(event instanceof PlayerEvent)
return ((PlayerEvent)event).player;
if(event instanceof net.minecraftforge.event.entity.player.PlayerEvent)
return ((net.minecraftforge.event.entity.player.PlayerEvent)event).getEntityPlayer();
if(event instanceof PlayerPunchedEvent)
return ((PlayerPunchedEvent)event).attacker;
if(event instanceof LivingDropsEvent && isSourceFromPlayer(((LivingDropsEvent)event).getSource()))
return getPlayerFromSource(((LivingDropsEvent)event).getSource());
return null;
}
示例7: 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());
}
}
}
示例8: onRenderGameOverlay
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入依賴的package包/類
@SubscribeEvent
public void onRenderGameOverlay(RenderGameOverlayEvent event)
{
if (!Config.getInstance().isSivIntegration())
return;
if (event.type != RenderGameOverlayEvent.ElementType.PLAYER_LIST)
{
return;
}
if (!(Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL)) || Minecraft.getMinecraft().isIntegratedServerRunning() || !guiServerInfo.getIsPlayerOpped())
{
return;
}
Minecraft mc = Minecraft.getMinecraft();
ScaledResolution resolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
guiServerInfo.setWorldAndResolution(mc, resolution.getScaledWidth(), resolution.getScaledHeight());
if (guiServerInfo.renderServerInfo())
{
event.setCanceled(true);
}
}
示例9: onRenderGameOverlay
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入依賴的package包/類
@SubscribeEvent
public void onRenderGameOverlay(RenderGameOverlayEvent event)
{
if (!Config.getInstance().isSivIntegration())
return;
if (event.getType() != RenderGameOverlayEvent.ElementType.PLAYER_LIST)
{
return;
}
if (!(Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL)) || Minecraft.getMinecraft().isIntegratedServerRunning() || !guiServerInfo.getIsPlayerOpped())
{
return;
}
Minecraft mc = Minecraft.getMinecraft();
ScaledResolution resolution = new ScaledResolution(mc);
guiServerInfo.setWorldAndResolution(mc, resolution.getScaledWidth(), resolution.getScaledHeight());
if (guiServerInfo.renderServerInfo())
{
event.setCanceled(true);
}
}
示例10: onRenderScreen
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入依賴的package包/類
@SubscribeEvent
public void onRenderScreen(RenderGameOverlayEvent.Text event) {
int posX = 1;
int posY = 1;
SurfaceHelper.drawTextShadow(generateTickRateText(), posX, posY, Utils.Colors.WHITE);
posY += SurfaceHelper.getTextHeight() + 1;
for(BaseMod mod : getModManager().getMods()) {
if(mod.isEnabled() && !mod.isHidden()) {
SurfaceHelper.drawTextShadow(">" + mod.getDisplayText(), posX, posY, Utils.Colors.WHITE);
posY += SurfaceHelper.getTextHeight() + 1;
}
}
/*
posY += (Render2DUtils.getTextHeight() + 1) * 2;
Render2DUtils.drawTextShadow(String.format("Pitch: %.4f", MC.thePlayer.rotationPitch), posX, posY, Utils.toRGBA(255, 255, 255, 255));
posY += Render2DUtils.getTextHeight() + 1;
Render2DUtils.drawTextShadow(String.format("Yaw: %.4f", MC.thePlayer.rotationYaw), posX, posY, Utils.toRGBA(255, 255, 255, 255));*/
}
示例11: 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;
}
}
示例12: onDebugOverlay
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入依賴的package包/類
@SubscribeEvent
public void onDebugOverlay(RenderGameOverlayEvent.Text e)
{
//if(e.getType() == RenderGameOverlayEvent.ElementType.DEBUG)
{
try {
int playerx = Minecraft.getMinecraft().player.chunkCoordX;
int playerz = Minecraft.getMinecraft().player.chunkCoordZ;
ChunkPos chunkPos = new ChunkPos(playerx,playerz);
TilePos tilePos = new TilePos(chunkPos);
TileList tileList = TileList.get(Minecraft.getMinecraft().player.world);
e.getRight().add("Chunk coords:"+playerx+" "+playerz);
e.getRight().add("Tile information:");
Tile currTile = tileList.getTileByPos(tilePos);
e.getRight().add(currTile==null ? "Tile " +tilePos.x+" "+tilePos.z+ "not created properly" : tilePos.x+" "+tilePos.z);
e.getRight().add("Tile biome: "+currTile.getTileBiome().name());
}
catch (Exception e1) {}
}
}
示例13: renderChat
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入依賴的package包/類
protected void renderChat(int width, int height)
{
mc.mcProfiler.startSection("chat");
RenderGameOverlayEvent.Chat event = new RenderGameOverlayEvent.Chat(eventParent, 0, height - 48);
if (MinecraftForge.EVENT_BUS.post(event)) return;
GlStateManager.pushMatrix();
GlStateManager.translate((float) event.getPosX(), (float) event.getPosY(), 0.0F);
persistantChatGUI.drawChat(updateCounter);
GlStateManager.popMatrix();
post(CHAT);
mc.mcProfiler.endSection();
}
示例14: renderChat
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入依賴的package包/類
protected void renderChat(int width, int height)
{
field_73839_d.field_71424_I.func_76320_a("chat");
RenderGameOverlayEvent.Chat event = new RenderGameOverlayEvent.Chat(eventParent, 0, height - 48);
if (MinecraftForge.EVENT_BUS.post(event)) return;
GL11.glPushMatrix();
GL11.glTranslatef((float)event.posX, (float)event.posY, 0.0F);
field_73840_e.func_146230_a(field_73837_f);
GL11.glPopMatrix();
post(CHAT);
field_73839_d.field_71424_I.func_76319_b();
}
示例15: onHUDRender
import net.minecraftforge.client.event.RenderGameOverlayEvent; //導入依賴的package包/類
/**
* Draw HUD additions
*/
@SubscribeEvent
public void onHUDRender(RenderGameOverlayEvent.Post event)
{
ScaledResolution resolution = event.getResolution();
if (event.getType() == RenderGameOverlayEvent.ElementType.ALL)
{
if (this.overlay.inGUI == false)
{
this.overlay.render(resolution.getScaledWidth(), resolution.getScaledHeight());
}
this.morphOverlay.render(resolution.getScaledWidth(), resolution.getScaledHeight());
}
}