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