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


Java RenderGameOverlayEvent.Text方法代码示例

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


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

示例1: 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();
	}
}
 
开发者ID:TheXFactor117,项目名称:Loot-Slash-Conquer,代码行数:18,代码来源:GuiMana.java

示例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;
	
	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();
	}
}
 
开发者ID:TheXFactor117,项目名称:Loot-Slash-Conquer,代码行数:17,代码来源:GuiHealth.java

示例3: 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+")");
}
 
开发者ID:elytra,项目名称:ThermionicsWorld,代码行数:30,代码来源:ThermionicsWorld.java

示例4: 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));*/
}
 
开发者ID:fr1kin,项目名称:ForgeHax,代码行数:19,代码来源:ActiveModList.java

示例5: 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) {}
		 
 }
}
 
开发者ID:stuebz88,项目名称:modName,代码行数:24,代码来源:EventHandlerCommon.java

示例6: onHUDRender

import net.minecraftforge.client.event.RenderGameOverlayEvent; //导入方法依赖的package包/类
/**
 * Add Blockbuster debug strings, such as length of client records and
 * recording information, to the debug overlay.
 */
@SubscribeEvent
public void onHUDRender(RenderGameOverlayEvent.Text event)
{
    if (!Minecraft.getMinecraft().gameSettings.showDebugInfo)
    {
        return;
    }

    List<String> list = event.getLeft();

    list.add("");
    list.add(ClientProxy.manager.records.size() + " client records");

    RecordRecorder recorder = ClientProxy.manager.recorders.get(Minecraft.getMinecraft().thePlayer);

    if (recorder != null)
    {
        list.add("Recording frame " + recorder.tick + " (delay: " + recorder.delay + ")");
    }
}
 
开发者ID:mchorse,项目名称:blockbuster,代码行数:25,代码来源:RenderingHandler.java

示例7: addDirectionInfoToDebugScreen

import net.minecraftforge.client.event.RenderGameOverlayEvent; //导入方法依赖的package包/类
@SubscribeEvent(priority = EventPriority.HIGH)
public void addDirectionInfoToDebugScreen(RenderGameOverlayEvent.Text event) {
    Minecraft mc = Minecraft.getMinecraft();
    EntityPlayer player = mc.thePlayer;
    float t = 360;
    double yaw = ((player.rotationYaw % t) + t) % t;
    yaw = Math.toRadians(yaw);
    double x = -Math.sin(yaw);
    double z = Math.cos(yaw);
    
    for (int i = 0; i < event.left.size(); i++) {
        String line = event.left.get(i);
        if (line == null) continue;
        if (line.startsWith("f:")) {
            line += " (" + displ(x) + ", " + displ(z) + ")";
            event.left.set(i, line);
            break;
        }
    }
}
 
开发者ID:purpleposeidon,项目名称:Factorization,代码行数:21,代码来源:MiscClientProxy.java

示例8: addHorseInfo

import net.minecraftforge.client.event.RenderGameOverlayEvent; //导入方法依赖的package包/类
@SideOnly(Side.CLIENT)
private void addHorseInfo(RenderGameOverlayEvent.Text event,	EntityPlayerSP player,EntityHorse horse) 
{ 
	double speed =  horse.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue() ;

	double jump = horse.getHorseJumpStrength() ;
	//convert from scale factor to blocks
	double jumpHeight = 0;
	double gravity = 0.98;
	while (jump > 0)
	{
		jumpHeight += jump;
		jump -= 0.08;
		jump *= gravity;
	}
	
	DecimalFormat df = new DecimalFormat("0.0000");
	
	event.left.add(ModScreenText.lang("debug.horsespeed")+"  "+ df.format(speed)   ); 
	
	df = new DecimalFormat("0.0");
	
	event.left.add(ModScreenText.lang("debug.horsejump") +"  "+ df.format(jumpHeight) );
}
 
开发者ID:LothrazarMinecraftMods,项目名称:HorseDebugInfo,代码行数:25,代码来源:ModScreenText.java

示例9: addHorseInfo

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

	EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
	if(Minecraft.getMinecraft().gameSettings.showDebugInfo){
		if(player.getRidingEntity() != null && player.getRidingEntity() instanceof EntityHorse){
			EntityHorse horse = (EntityHorse) player.getRidingEntity();

			double speed = getSpeedTranslated(horse.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).getAttributeValue());

			// double jump = horse.getHorseJumpStrength() ;
			// convert from scale factor to blocks
			double jumpHeight = getJumpTranslated(horse.getHorseJumpStrength());

			DecimalFormat df = new DecimalFormat("0.00");
 
			event.getLeft().add(I18n.translateToLocal("debug.horsespeed") + "  " + df.format(speed));

			df = new DecimalFormat("0.0");

			event.getLeft().add(I18n.translateToLocal("debug.horsejump") + "  " + df.format(jumpHeight));
		}
	}
}
 
开发者ID:LothrazarMinecraftMods,项目名称:HorseFood,代码行数:26,代码来源:ModHorseFood.java

示例10: textRenderEvent

import net.minecraftforge.client.event.RenderGameOverlayEvent; //导入方法依赖的package包/类
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void textRenderEvent(RenderGameOverlayEvent.Text event)
{
    if (keyBinding == null) return;
    if (Minecraft.getMinecraft().currentScreen instanceof GuiMainMenu)
    {
        event.getLeft().add(NAME + " paused. Main menu open. If you want to AFK, use ALT+TAB.");
    }
    else if (Minecraft.getMinecraft().currentScreen instanceof GuiChat)
    {
        event.getLeft().add(NAME + " paused. Chat GUI open. If you want to AFK, use ALT+TAB.");
    }
    else
    {
        event.getLeft().add(NAME + " active: " + keyBinding.getDisplayName() + " (" + keyBinding.getKeyDescription().replaceFirst("^key\\.", "") + ')');
        event.getLeft().add("Delay: " + i + " / " + delay);
    }
}
 
开发者ID:dries007,项目名称:TapeMouse,代码行数:19,代码来源:TapeMouse.java

示例11: onRenderOverlayText

import net.minecraftforge.client.event.RenderGameOverlayEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onRenderOverlayText(RenderGameOverlayEvent.Text event)
{
	EntityPlayer player = Minecraft.getMinecraft().player;
	World world = Minecraft.getMinecraft().world;
	IChunkLevelHolder chunkLevelHolder = world.getCapability(CapabilityChunkLevel.CHUNK_LEVEL, null);
	IChunkLevel chunkLevel = chunkLevelHolder.getChunkLevel(new ChunkPos(player.getPosition()));
	
	if (chunkLevelHolder != null && chunkLevel != null)
	{
		Minecraft.getMinecraft().fontRenderer.drawStringWithShadow("Area Level: " + chunkLevel.getChunkLevel(), 10, 10, 0xFFFFFF);
	}
}
 
开发者ID:TheXFactor117,项目名称:Loot-Slash-Conquer,代码行数:14,代码来源:EventRenderOverlayText.java

示例12: onRenderGameOverlayEvent

import net.minecraftforge.client.event.RenderGameOverlayEvent; //导入方法依赖的package包/类
@SubscribeEvent(priority = EventPriority.LOW)
public void onRenderGameOverlayEvent(RenderGameOverlayEvent.Text event) {
    if (renderPosition.getAsBoolean())
    if (event.getType().equals(RenderGameOverlayEvent.ElementType.TEXT)) {
        for (logoutPos pos : Lists.newArrayList(logoutPositions)) {
            Vec3d topVec = new Vec3d((pos.pos[0].x+pos.pos[1].x)/2, pos.pos[1].y, (pos.pos[0].z+pos.pos[1].z)/2); // position where to place the text in the world
            VectorUtils.ScreenPos textPos = VectorUtils._toScreen(topVec.x, topVec.y, topVec.z); // where to place the text on the screen
            double distance = MC.player.getDistance((pos.pos[0].x+pos.pos[1].x)/2, pos.pos[0].y, (pos.pos[0].z+pos.pos[1].z)/2); // distance from player to logout spot
            if (textPos.isVisible) {
                String name = pos.name + String.format((" (%.1f)"), distance);
                SurfaceHelper.drawTextShadow(name, textPos.x - (SurfaceHelper.getTextWidth(name) / 2), textPos.y - (SurfaceHelper.getTextHeight() + 1), Utils.toRGBA(255,0,0,0));
            }
        }
    }
}
 
开发者ID:fr1kin,项目名称:ForgeHax,代码行数:16,代码来源:LogoutSpot.java

示例13: renderGUI

import net.minecraftforge.client.event.RenderGameOverlayEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void renderGUI(RenderGameOverlayEvent.Text e) {
    if(Reference.DEVENV) {
        if((e.getType() == RenderGameOverlayEvent.ElementType.CROSSHAIRS) || (e.getType() == RenderGameOverlayEvent.ElementType.TEXT)) {
    
            Minecraft.getMinecraft().fontRendererObj.drawString("FPS: " + Minecraft.getDebugFPS(), 50, 50, 0xFF55FF);
            if(FMLCommonHandler.instance().getMinecraftServerInstance() != null)
                Minecraft.getMinecraft().fontRendererObj.drawString(getTPS(FMLCommonHandler.instance().getMinecraftServerInstance(), Minecraft.getMinecraft().player), 50, 70, 0xFF55FF);
    
        }
    }
}
 
开发者ID:jaredlll08,项目名称:Machines-and-Stuff,代码行数:13,代码来源:ClientEvents.java

示例14: onTextOverlay

import net.minecraftforge.client.event.RenderGameOverlayEvent; //导入方法依赖的package包/类
@SubscribeEvent(priority = EventPriority.HIGH)
public void onTextOverlay(RenderGameOverlayEvent.Text event) {
    Minecraft mc = Minecraft.getMinecraft();
    if(mc.gameSettings.showDebugInfo && !event.getRight().isEmpty()) {
        if (mc.objectMouseOver != null && mc.objectMouseOver.typeOfHit == RayTraceResult.Type.BLOCK && mc.objectMouseOver.getBlockPos() != null) {
            BlockPos pos = mc.objectMouseOver.getBlockPos();
            IBlockState state = mc.world.getBlockState(pos);
            try {
                int meta = state.getBlock().getMetaFromState(state);
                event.getRight().add("");
                event.getRight().add("serialized as metadata: " + meta);
            } catch (Exception ignored) {}
        }
    }
}
 
开发者ID:HellFirePvP,项目名称:ModularMachinery,代码行数:16,代码来源:DebugOverlayHelper.java

示例15: onText

import net.minecraftforge.client.event.RenderGameOverlayEvent; //导入方法依赖的package包/类
@CoreEvent
public void onText(final @Nonnull RenderGameOverlayEvent.Text event) {
	if (Client.mc.gameSettings.showDebugInfo) {
		final TileEntitySign tilesign = Client.getTileSignLooking();
		if (tilesign!=null) {
			final Entry entry = SignEntryId.fromTile(tilesign).entry();
			if (entry.isValid()) {
				final AttrReaders meta = entry.getMeta();
				final SizeData signsize = meta.sizes.getMovie().get();

				event.left.add("");
				event.left.add(I18n.format("signpic.over.sign", entry.id.id()));
				if (entry.contentId!=null)
					event.left.add(I18n.format("signpic.over.id", entry.contentId.getURI()));
				final Content content = entry.getContent();
				final SizeData imagesize = content!=null ? content.image.getSize() : SizeData.UnknownSize;
				final SizeData viewsize = signsize.aspectSize(imagesize);
				event.left.add(I18n.format("signpic.over.size", signsize, signsize.getWidth(), signsize.getHeight(), imagesize.getWidth(), imagesize.getHeight(), viewsize.getWidth(), viewsize.getHeight()));
				if (content!=null)
					event.left.add(I18n.format("signpic.over.status", content.state.getStateMessage()));
				if (entry.isNotSupported())
					event.left.add(I18n.format("signpic.over.advmsg", I18n.format("signpic.state.format.unsupported")));
				else if (content!=null) {
					final String advmsg = content.state.getMessage();
					event.left.add(I18n.format("signpic.over.advmsg", advmsg));
				}
				if (tilesign.signText!=null)
					event.left.add(I18n.format("signpic.over.raw", tilesign.signText[0], tilesign.signText[1], tilesign.signText[2], tilesign.signText[3]));
				if (content!=null)
					event.left.add(I18n.format("signpic.over.local", content.image.getLocal()));
			}
		}
	}
}
 
开发者ID:Team-Fruit,项目名称:SignPicture,代码行数:35,代码来源:SignPicRender.java


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