Java Code Examples for net.minecraftforge.client.event.RenderGameOverlayEvent#Text

The following examples show how to use net.minecraftforge.client.event.RenderGameOverlayEvent#Text . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Events.java    From ehacks-pro with GNU General Public License v3.0 6 votes vote down vote up
@SubscribeEvent
public void onGameOverlay(RenderGameOverlayEvent.Text event) {
    if (!cheatEnabled) {
        return;
    }
    GLUtils.hasClearedDepth = false;
    ModuleController.INSTANCE.modules.stream().filter((mod) -> !(!mod.isActive() || Wrapper.INSTANCE.world() == null)).forEachOrdered((mod) -> {
        mod.onGameOverlay(event);
    });
    if (Wrapper.INSTANCE.mc().currentScreen == null) {
        int x2 = 8;
        int y2 = 7;
        GL11.glPushMatrix();
        GL11.glScalef(1f, 1f, 1f);
        String Copyright1 = "EHacks Pro v" + Main.version;
        String Copyright2 = "by radioegor146";
        ScaledResolution get = new ScaledResolution(Wrapper.INSTANCE.mc(), Wrapper.INSTANCE.mc().displayWidth, Wrapper.INSTANCE.mc().displayHeight);
        this.fontRender.drawString(Copyright1, 2, 2, Events.rainbowEffect_Text(9999999L, 1.0f).getRGB());
        this.fontRender.drawStringWithShadow(Copyright2, get.getScaledWidth() - 2 - this.fontRender.getStringWidth(Copyright2), get.getScaledHeight() - this.fontRender.FONT_HEIGHT - 2, GLUtils.getColor(255, 255, 255));
        GL11.glPopMatrix();
    }
    EHacksGui.clickGui.drawBack();
}
 
Example 2
Source File: CoordsHud.java    From ForgeHax with MIT License 6 votes vote down vote up
@SubscribeEvent
public void onRenderOverlay(RenderGameOverlayEvent.Text event) {
  List<String> text = new ArrayList<>();
  
  if (!translate.get() || (translate.get() && multiline.get())) {
    text.add(String.format("%01.1f, %01.0f, %01.1f", thisX, thisY, thisZ));
  }
  if (translate.get()) {
    if (multiline.get()) {
      text.add(String.format("(%01.1f, %01.1f)", otherX, otherZ));
    } else {
      text.add(String.format(
          "%01.1f, %01.0f, %01.1f (%01.1f, %01.1f)", thisX, thisY, thisZ, otherX, otherZ));
    }
  }
  
  SurfaceHelper.drawTextAlign(text, getPosX(0), getPosY(0),
      Colors.WHITE.toBuffer(), scale.get(), true, alignment.get().ordinal());
}
 
Example 3
Source File: ActiveModList.java    From ForgeHax with MIT License 5 votes vote down vote up
@SubscribeEvent
public void onRenderScreen(RenderGameOverlayEvent.Text event) {
  int align = alignment.get().ordinal();
  
  List<String> text = new ArrayList<>();
  
  if (tps_meter.get()) {
    text.add(generateTickRateText());
  }
  
  if (MC.currentScreen instanceof GuiChat || MC.gameSettings.showDebugInfo) {
    long enabledMods = getModManager()
        .getMods()
        .stream()
        .filter(BaseMod::isEnabled)
        .filter(mod -> !mod.isHidden())
        .count();
    text.add(enabledMods + " mods enabled");
  } else {
    getModManager()
        .getMods()
        .stream()
        .filter(BaseMod::isEnabled)
        .filter(mod -> !mod.isHidden())
        .map(mod -> debug.get() ? mod.getDebugDisplayText() : mod.getDisplayText())
        .sorted(sortMode.get().getComparator())
        .forEach(name -> text.add(AlignHelper.getFlowDirX2(align) == 1 ? ">" + name : name + "<"));
  }

  SurfaceHelper.drawTextAlign(text, getPosX(0), getPosY(0),
      Colors.WHITE.toBuffer(), scale.get(), true, align);
}
 
Example 4
Source File: RenderEventService.java    From ForgeHax with MIT License 5 votes vote down vote up
@SubscribeEvent(priority = EventPriority.LOW)
public void onRenderGameOverlayEvent(final RenderGameOverlayEvent.Text event) {
  if (event.getType().equals(RenderGameOverlayEvent.ElementType.TEXT)) {
    MinecraftForge.EVENT_BUS.post(new Render2DEvent(event.getPartialTicks()));
    GlStateManager.color(1.f, 1.f, 1.f, 1.f); // reset color
  }
}
 
Example 5
Source File: Module.java    From ehacks-pro with GNU General Public License v3.0 4 votes vote down vote up
public void onGameOverlay(RenderGameOverlayEvent.Text event) {
}
 
Example 6
Source File: RenderOverlayHandler.java    From TFC2 with GNU General Public License v3.0 4 votes vote down vote up
@SubscribeEvent
public void renderText(RenderGameOverlayEvent.Text event)
{
	Minecraft mc = Minecraft.getMinecraft();
	if(mc.world.provider.getDimension() == 0 && WorldGen.getInstance() != null && !mc.playerController.gameIsSurvivalOrAdventure())
	{
		int xM = ((int)(mc.player.posX) >> 12);
		int zM = ((int)(mc.player.posZ) >> 12);
		IslandMap map = WorldGen.getInstance().getIslandMap(xM, zM);
		Point islandCoord = new Point((int)Math.floor(mc.player.posX), (int)Math.floor(mc.player.posZ)).toIslandCoord();
		BlockPos pos = new BlockPos((int)(mc.player.posX), 0, (int)(mc.player.posZ));
		Center hex = map.getClosestCenter(islandCoord);
		event.getLeft().add(""+mc.world.getWorldTime());
		event.getLeft().add("Rain: "+WeatherManager.getInstance().getPrecipitation((int)mc.player.posX, (int)mc.player.posZ) +
				" / "  + " / " + mc.world.isRaining());
		event.getLeft().add("Temp: " + WeatherManager.getInstance().getTemperature((int)mc.player.posX, (int)mc.player.posY, (int)mc.player.posZ)+"C");
		event.getLeft().add("Date: " + Timekeeper.getInstance().getSeasonalPeriod() + " | Time: " + Timekeeper.getInstance().getClockTime());
		event.getLeft().add(TextFormatting.BOLD+""+TextFormatting.YELLOW+"--------Hex--------");
		event.getLeft().add("Index: "+hex.index);
		if(hex.biome != null)
			event.getLeft().add("Biome: "+hex.biome.name());
		event.getLeft().add("Elevation: "+hex.getElevation()+" ("+map.convertHeightToMC(hex.getElevation())+")");
		event.getLeft().add("Moisture: "+hex.getMoisture() + " | " + hex.getMoistureRaw());
		event.getLeft().add("Island Coord: "+islandCoord.getX() + "," + islandCoord.getY());
		event.getLeft().add("Markers: ");
		for(Marker m : Marker.values())
		{
			if(hex.hasMarker(m))
			{
				event.getLeft().add("  *"+m.name());
			}
		}


		//PrintImageMapCommand.drawMapImage((int)Math.floor(mc.player.posX), (int)Math.floor(mc.player.posZ), mc.world, "test2");
		/*if(hex.hasAttribute(Attribute.Lake))
			event.getLeft().add("IsLake");	
		RiverAttribute attrib = (RiverAttribute)hex.getAttribute(Attribute.River);
		if(attrib != null)
		{
			event.getLeft().add(TextFormatting.BOLD+""+TextFormatting.YELLOW+"-------River-------");
			event.getLeft().add("River: " + attrib.getRiver() + " | " + (attrib.upriver != null ?  attrib.upriver.size() : 0));	
			if(attrib.upriver != null && attrib.getDownRiver() != null)
				event.getLeft().add("Up :" + hex.getDirection(attrib.upriver.get(0)).toString() + " | Dn :" + hex.getDirection(attrib.getDownRiver()).toString());
		}

		LakeAttribute lattrib = (LakeAttribute)hex.getAttribute(Attribute.Lake);
		if(lattrib != null)
		{
			event.getLeft().add(TextFormatting.BOLD+""+TextFormatting.YELLOW+"-------Lake-------");
			event.getLeft().add("Border: "+lattrib.getBorderDistance());
		}

		CaveAttribute cattrib = (CaveAttribute)hex.getAttribute(Attribute.Cave);
		if(cattrib != null)
		{
			if(cattrib.nodes.size() > 0)
			{
				event.getLeft().add(TextFormatting.BOLD+""+TextFormatting.YELLOW+"-------Cave-------");
				event.getLeft().add("Cave: "+cattrib.nodes.size());	
				for(CaveAttrNode n : cattrib.nodes)
				{
					//event.getLeft().add("  *"+n.getOffset());	
				}
			}
		}

		OreAttribute oattrib = (OreAttribute)hex.getAttribute(Attribute.Ore);
		if(oattrib != null)
		{
			if(oattrib.nodes.size() > 0)
			{
				event.getLeft().add(TextFormatting.BOLD+""+TextFormatting.YELLOW+"-------Ore-------");
				for(OreAttrNode n : oattrib.nodes)
				{
					event.getLeft().add(n.getOreType());	
				}
			}
		}*/

		event.getRight().add(TextFormatting.BOLD+""+TextFormatting.YELLOW+"--Island Parmaters--");
		event.getRight().add("*Moisture: "+map.getParams().getIslandMoisture());
		event.getRight().add("*Temperature: "+map.getParams().getIslandTemp());
		event.getRight().add("*Seed: "+map.seed);

		event.getRight().add(TextFormatting.BOLD+""+TextFormatting.YELLOW+"---Island Features--");
		for(Feature f : Feature.values())
		{
			if(map.getParams().hasFeature(f))
			{
				event.getRight().add("*"+f.toString());
			}
		}
	}
}