net.minecraftforge.client.event.RenderGameOverlayEvent Java Examples

The following examples show how to use net.minecraftforge.client.event.RenderGameOverlayEvent. 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: RenderListener.java    From SkyblockAddons with MIT License 6 votes vote down vote up
@SubscribeEvent()
public void onRenderRemoveBars(RenderGameOverlayEvent.Pre e) {
    if (e.type == RenderGameOverlayEvent.ElementType.ALL) {
        if (main.getUtils().isOnSkyblock()) {
            if (main.getConfigValues().isEnabled(Feature.HIDE_FOOD_ARMOR_BAR)) {
                GuiIngameForge.renderFood = false;
                GuiIngameForge.renderArmor = false;
            }
            if (main.getConfigValues().isEnabled(Feature.HIDE_HEALTH_BAR)) {
                GuiIngameForge.renderHealth = false;
            }
            if (main.getConfigValues().isEnabled(Feature.HIDE_PET_HEALTH_BAR)) {
                GuiIngameForge.renderHealthMount = false;
            }
        } else {
            if (main.getConfigValues().isEnabled(Feature.HIDE_HEALTH_BAR)) {
                GuiIngameForge.renderHealth = true;
            }
            if (main.getConfigValues().isEnabled(Feature.HIDE_FOOD_ARMOR_BAR)) {
                GuiIngameForge.renderArmor = true;
            }
        }
    }
}
 
Example #2
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 #3
Source File: TacoCmd.java    From ForgeWurst with GNU General Public License v3.0 6 votes vote down vote up
@SubscribeEvent
public void onRenderGUI(RenderGameOverlayEvent.Post event)
{
	if(event.getType() != ElementType.ALL || mc.gameSettings.showDebugInfo)
		return;
	
	if(wurst.getHax().rainbowUiHack.isEnabled())
	{
		float[] acColor = wurst.getGui().getAcColor();
		GL11.glColor4f(acColor[0], acColor[1], acColor[2], 1);
	}else
		GL11.glColor4f(1, 1, 1, 1);
	
	int tacoId = WMinecraft.getPlayer().ticksExisted % 32 / 8;
	ResourceLocation tacoLocation = tacos[tacoId];
	mc.getTextureManager().bindTexture(tacoLocation);
	
	ScaledResolution sr = new ScaledResolution(mc);
	int x = sr.getScaledWidth() / 2 + 44;
	int y = sr.getScaledHeight() - 51;
	int w = 64;
	int h = 32;
	Gui.drawModalRectWithCustomSizedTexture(x, y, 0, 0, w, h, w, h);
}
 
Example #4
Source File: OverlayRenderer.java    From YouTubeModdingTutorial with MIT License 6 votes vote down vote up
@SubscribeEvent
public void renderGameOverlayEvent(RenderGameOverlayEvent event) {
    if (event.isCancelable() || event.getType() != RenderGameOverlayEvent.ElementType.EXPERIENCE) {
        return;
    }

    if (Minecraft.getMinecraft().player.getHeldItem(EnumHand.MAIN_HAND).getItem() != ModItems.itemWand) {
        return;
    }

    GlStateManager.disableLighting();

    FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;

    int x = 200;
    int y = 10;
    x = fontRenderer.drawString("Mana ", x, y, 0xffffffff);
    x = fontRenderer.drawString("" + mana, x, y, 0xffff0000);
    x = fontRenderer.drawString("  Influence ", x, y, 0xffffffff);
    x = fontRenderer.drawString("" + manaInfluence, x, y, 0xffff0000);
    y += 10;
    x = 200;
    x = fontRenderer.drawString("Player ", x, y, 0xffffffff);
    x = fontRenderer.drawString("" + (playerMana), x, y, 0xffff0000);
}
 
Example #5
Source File: ControlEventsClient.java    From Valkyrien-Skies with Apache License 2.0 6 votes vote down vote up
@SubscribeEvent
public void render(RenderGameOverlayEvent.Post event) {
    Minecraft minecraft = Minecraft.getMinecraft();
    EntityPlayer player = Minecraft.getMinecraft().player;
    FontRenderer fontRenderer = minecraft.fontRenderer;
    if (fontRenderer != null && player != null && event.getType()
        == net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType.TEXT) {
        IShipPilot playerPilot = (IShipPilot) player;
        if (playerPilot.isPiloting()) {
            BlockPos tilePilotedPos = playerPilot.getPosBeingControlled();
            TileEntity pilotedTile = player.getEntityWorld().getTileEntity(tilePilotedPos);
            if (pilotedTile instanceof TileEntityPilotableImpl) {
                TileEntityPilotableImpl pilotedControlEntity = (TileEntityPilotableImpl) pilotedTile;
                ScaledResolution scaledresolution = new ScaledResolution(
                    Minecraft.getMinecraft());
                pilotedControlEntity.renderPilotText(fontRenderer, scaledresolution);
            }
        }
    }
}
 
Example #6
Source File: ItemCybereyes.java    From Cyberware with MIT License 6 votes vote down vote up
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void overlayPre(RenderGameOverlayEvent.Pre event)
{
	if (event.getType() == ElementType.ALL)
	{
		EntityPlayer e = Minecraft.getMinecraft().thePlayer;
		
		if (isBlind && !e.isCreative())
		{
			GlStateManager.pushMatrix();
			GlStateManager.enableBlend();
			GlStateManager.color(1F, 1F, 1F, .9F);
			Minecraft.getMinecraft().getTextureManager().bindTexture(EssentialsMissingHandler.BLACK_PX);
			ClientUtils.drawTexturedModalRect(0, 0, 0, 0, Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight);
			GlStateManager.popMatrix();
		}
	}
}
 
Example #7
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 #8
Source File: RenderListener.java    From SkyblockAddons with MIT License 5 votes vote down vote up
/**
 * Render overlays and warnings for clients with labymod.
 * Labymod creates its own ingame gui and replaces the forge one, and changes the events that are called.
 * This is why the above method can't work for both.
 */
@SubscribeEvent()
public void onRenderLabyMod(RenderGameOverlayEvent e) {
    if (e.type == null && main.isUsingLabymod()) {
        if (main.getUtils().isOnSkyblock()) {
            renderOverlays();
            renderWarnings(e.resolution);
        } else {
            renderTimersOnly();
        }
        drawUpdateMessage();
    }
}
 
Example #9
Source File: TerminalManagerClient.java    From OpenPeripheral-Addons with MIT License 5 votes vote down vote up
@SubscribeEvent
public void onRenderGameOverlay(RenderGameOverlayEvent.Post evt) {
	if (evt.type == ElementType.HELMET) {
		if (terminalGuid.isPresent()) {
			final long guid = terminalGuid.get();
			tryDrawSurface(guid, SurfaceType.PRIVATE, evt.partialTicks, evt.resolution);
			tryDrawSurface(guid, SurfaceType.GLOBAL, evt.partialTicks, evt.resolution);
		}
	}
}
 
Example #10
Source File: TerminalManagerClient.java    From OpenPeripheral-Addons with MIT License 5 votes vote down vote up
@SubscribeEvent
public void onRenderGameOverlay(RenderGameOverlayEvent.Pre evt) {
	if (evt.type == ElementType.ALL) {
		GuiScreen gui = FMLClientHandler.instance().getClient().currentScreen;

		if (gui instanceof GuiCapture) {
			final GuiCapture capture = (GuiCapture)gui;
			// this must be here, since there are some elements (like food bar) that are overriden every tick
			capture.forceGuiElementsState();
		}
	}
}
 
Example #11
Source File: RenderEventHandler.java    From enderutilities with GNU Lesser General Public License v3.0 5 votes vote down vote up
@SubscribeEvent
public void onRenderGameOverlay(RenderGameOverlayEvent.Post event)
{
    if (event.getType() != ElementType.ALL)
    {
        return;
    }

    if ((this.mc.currentScreen instanceof GuiChat) == false && this.mc.player != null)
    {
        this.buildersWandRenderer.renderHud(this.mc.player);
        this.rulerRenderer.renderHud();
        this.renderPlacementPropertiesHud(this.mc.player);
    }
}
 
Example #12
Source File: ItemBeaconFinder.java    From AdvancedRocketry with MIT License 5 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
public void renderScreen(ItemStack componentStack, List<ItemStack> modules,
		RenderGameOverlayEvent event, Gui gui) {
	
	int dimid = Minecraft.getMinecraft().world.provider.getDimension();
	
	if(DimensionManager.getInstance().isDimensionCreated(dimid)) {
		for(HashedBlockPosition pos : DimensionManager.getInstance().getDimensionProperties(dimid).getBeacons()) {
			
			GL11.glPushMatrix();
			
			double deltaX = Minecraft.getMinecraft().player.posX - pos.x;
			double deltaZ = Minecraft.getMinecraft().player.posZ - pos.z;
			
			double angle = MathHelper.wrapDegrees(MathHelper.atan2(deltaZ, deltaX)*180/Math.PI + 90 - Minecraft.getMinecraft().player.rotationYawHead);
			
			//GL11.glTranslatef(pos.x, pos.y, pos.z);
			GL11.glTranslated((event.getResolution().getScaledWidth_double()*angle/180f) + event.getResolution().getScaledWidth()/2,0,5);
			//GL11.glDepthMask(false);
			//GL11.glDisable(GL11.GL_TEXTURE_2D);
			Minecraft.getMinecraft().renderEngine.bindTexture(TextureResources.buttonDown[0]);
			
			GlStateManager.color(0.5f, 0.5f, 1, 1);
			
	        Tessellator tessellator = Tessellator.getInstance();
	        BufferBuilder vertexbuffer = tessellator.getBuffer();
	        
	        vertexbuffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
	        RenderHelper.renderNorthFaceWithUV(vertexbuffer, -1000, -10, 0, 10, 20, 0, 1, 0, 1);
			tessellator.draw();
			
			//GL11.glDepthMask(true);
			//GL11.glEnable(GL11.GL_TEXTURE_2D);
			GlStateManager.color(1, 1, 1, 1);
			GL11.glPopMatrix();
			
		}
	}
}
 
Example #13
Source File: ItemAtmosphereAnalzer.java    From AdvancedRocketry with MIT License 5 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
public void renderScreen(ItemStack componentStack, List<ItemStack> modules,
		RenderGameOverlayEvent event, Gui gui) {
	
	FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
	
	int screenX = RocketEventHandler.atmBar.getRenderX();//8;
	int screenY = RocketEventHandler.atmBar.getRenderY();//event.getResolution().getScaledHeight() - fontRenderer.FONT_HEIGHT*3;

	String str[] = getAtmosphereReadout(componentStack, (AtmosphereType) AtmosphereHandler.currentAtm, Minecraft.getMinecraft().world);
	//Draw BG
	gui.drawString(fontRenderer, str[0], screenX, screenY, 0xaaffff);
	gui.drawString(fontRenderer, str[1], screenX, screenY + fontRenderer.FONT_HEIGHT*4/3, 0xaaffff);

	//Render Eyecandy
	GL11.glColor3f(1f, 1f, 1f);
	GL11.glPushMatrix();
	Minecraft.getMinecraft().renderEngine.bindTexture(eyeCandySpinner);
	GL11.glTranslatef(screenX + 12, screenY + 8, 0);
	GL11.glRotatef(( System.currentTimeMillis() / 100 ) % 360, 0, 0, 1);
	
	BufferBuilder buffer = Tessellator.getInstance().getBuffer();
	
	buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
	RenderHelper.renderNorthFaceWithUV(buffer, -1, -16,  -16, 16,  16, 0, 1, 0, 1);
	Tessellator.getInstance().draw();
	GL11.glPopMatrix();
	
	
	Minecraft.getMinecraft().renderEngine.bindTexture(TextureResources.frameHUDBG);
	buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
	RenderHelper.renderNorthFaceWithUV(buffer, -1, screenX - 8,  screenY - 12, screenX + 8,  screenY + 26, 0, 0.25f, 0, 1);
	RenderHelper.renderNorthFaceWithUV(buffer, -1, screenX + 8,  screenY - 12, screenX + 212,  screenY + 26, 0.5f, 0.5f, 0, 1);
	RenderHelper.renderNorthFaceWithUV(buffer, -1, screenX + 212,  screenY - 12, screenX + 228,  screenY + 26, 0.75f, 1f, 0, 1);
	Tessellator.getInstance().draw();
}
 
Example #14
Source File: GuiOverlay.java    From XRay-Mod with GNU General Public License v3.0 5 votes vote down vote up
@OnlyIn(Dist.CLIENT)
@SubscribeEvent(priority = EventPriority.LOWEST)
public static void RenderGameOverlayEvent(RenderGameOverlayEvent event) {
    // Draw Indicator
    if(!Controller.isXRayActive() || !Configuration.general.showOverlay.get() || event.isCanceled() || event.getType() != RenderGameOverlayEvent.ElementType.TEXT )
        return;

    RenderSystem.color3f(0, 255, 0);
    XRay.mc.getTextureManager().bindTexture(circle);
    Screen.func_238463_a_(event.getMatrixStack(), 5, 5, 0f, 0f, 5, 5, 5, 5); // @mcp: func_238463_a_ = blit (7 parms) =

    // @mcp: func_238405_a_ = drawStringWithShadow
    XRay.mc.fontRenderer.func_238405_a_(event.getMatrixStack(), I18n.format("xray.overlay"), 15, 4, 0xffffffff);
}
 
Example #15
Source File: VanillaWares.java    From Cyberware with MIT License 5 votes vote down vote up
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onDrawScreenPost(RenderGameOverlayEvent.Post event)
{
	if (event.getType() == ElementType.CROSSHAIRS)
	{
		EntityPlayer p = Minecraft.getMinecraft().thePlayer;
		if (CyberwareAPI.isCyberwareInstalled(p, new ItemStack(Items.SPIDER_EYE)))
		{
			GlStateManager.translate(0, -event.getResolution().getScaledHeight() / 5, 0);
		}
	}
}
 
Example #16
Source File: VanillaWares.java    From Cyberware with MIT License 5 votes vote down vote up
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onDrawScreenPost(RenderGameOverlayEvent.Pre event)
{
	if (event.getType() == ElementType.CROSSHAIRS)
	{
		EntityPlayer p = Minecraft.getMinecraft().thePlayer;
		if (CyberwareAPI.isCyberwareInstalled(p, new ItemStack(Items.SPIDER_EYE)))
		{
			GlStateManager.translate(0, event.getResolution().getScaledHeight() / 5, 0);
		}
	}
}
 
Example #17
Source File: CivilizationClientHandlers.java    From ToroQuest with GNU General Public License v3.0 5 votes vote down vote up
@SubscribeEvent
public void onPostRenderOverlay(RenderGameOverlayEvent.Pre event) {
	if (event.getType() != ElementType.HOTBAR) {
		return;
	}
	ScaledResolution resolution = event.getResolution();

	if (hud == null) {
		hud = new CivilizationOverlayHandler(Minecraft.getMinecraft());
	}

	hud.render(resolution.getScaledWidth(), resolution.getScaledHeight());
}
 
Example #18
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 #19
Source File: AntiOverlayMod.java    From ForgeHax with MIT License 5 votes vote down vote up
@SubscribeEvent
public void onRenderGameOverlay(RenderGameOverlayEvent event) {
  if (event.getType().equals(RenderGameOverlayEvent.ElementType.HELMET)
      || event.getType().equals(RenderGameOverlayEvent.ElementType.PORTAL)) {
    event.setCanceled(true);
  }
}
 
Example #20
Source File: ItemManaLens.java    From Cyberware with MIT License 5 votes vote down vote up
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onDrawScreenPost(RenderGameOverlayEvent.Post event)
{
	EntityPlayer p = Minecraft.getMinecraft().thePlayer;
	
	if (hasLensNotMonocle(p))
	{
		//ItemMonocle.renderHUD(event.getResolution(), p);
	}
}
 
Example #21
Source File: RenderListener.java    From SkyblockAddons with MIT License 5 votes vote down vote up
/**
 * Render overlays and warnings for clients without labymod.
 */
@SubscribeEvent()
public void onRenderRegular(RenderGameOverlayEvent.Post e) {
    if ((!main.isUsingLabymod() || Minecraft.getMinecraft().ingameGUI instanceof GuiIngameForge)) {
        if (e.type == RenderGameOverlayEvent.ElementType.EXPERIENCE || e.type == RenderGameOverlayEvent.ElementType.JUMPBAR) {
            if (main.getUtils().isOnSkyblock()) {
                renderOverlays();
                renderWarnings(e.resolution);
            } else {
                renderTimersOnly();
            }
            drawUpdateMessage();
        }
    }
}
 
Example #22
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 #23
Source File: ChatMsgHandler.java    From BakaDanmaku with MIT License 5 votes vote down vote up
/**
 * 游戏界面显示人气值
 * TODO: 取消人气值与单独 Handler 的关联
 *
 * @param e 渲染游戏界面事件
 */
@SubscribeEvent
public static void showPopularityCount(RenderGameOverlayEvent.Post e) {
    GuiIngame gui = Minecraft.getMinecraft().ingameGUI; // 获取 Minecraft 实例中的 GUI
    FontRenderer renderer = Minecraft.getMinecraft().fontRenderer; // 获取 Minecraft 原版字体渲染器

    // 当渲染快捷栏时候进行显示,意味着 F1 会隐藏
    if (e.getType() == RenderGameOverlayEvent.ElementType.HOTBAR && gui != null && BakaDanmakuConfig.general.showPopularity) {
        double x = (Minecraft.getMinecraft().displayWidth * BakaDanmakuConfig.general.posX) / 100; // 获取的配置宽度百分比
        double y = (Minecraft.getMinecraft().displayHeight * BakaDanmakuConfig.general.posY) / 100; // 获取的配置高度百分比

        gui.drawString(renderer, String.format(BakaDanmakuConfig.general.popularityStyle, String.valueOf(tmpPopularityCount)),
                (int) x, (int) y, BakaDanmakuConfig.general.color);
    }
}
 
Example #24
Source File: ShowNoticeFirst.java    From I18nUpdateMod with MIT License 5 votes vote down vote up
@SubscribeEvent
public static void onPlayerFirstJoin(RenderGameOverlayEvent.Post event) {
    if (shouldShowNotice && event.getType() != RenderGameOverlayEvent.ElementType.HELMET && I18nConfig.notice.showNoticeConfig) {
        shouldShowNotice = false;
        new NoticeShower();
    }
}
 
Example #25
Source File: MwForge.java    From mapwriter with MIT License 4 votes vote down vote up
@SubscribeEvent
public void renderMap(RenderGameOverlayEvent.Post event){
    if(event.type == RenderGameOverlayEvent.ElementType.ALL){
        Mw.instance.onTick();
    }
}
 
Example #26
Source File: PlayerOverlay.java    From MediaMod with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Fired when a game overlay is being rendered
 *
 * @param event - RenderGameOverlayEvent
 * @see RenderGameOverlayEvent
 */
@SubscribeEvent
public void onRender(RenderGameOverlayEvent.Post event) {
    // Get a Minecraft Instance
    Minecraft mc = FMLClientHandler.instance().getClient();

    if (event.type.equals(RenderGameOverlayEvent.ElementType.EXPERIENCE) && Settings.SHOW_PLAYER && Settings.ENABLED) {
        if (this.first) {
            // Make sure that this is never ran again
            this.first = false;

            // Setup a ScheduledExecutorService to run every 3 seconds
            ScheduledExecutorService exec = Executors.newSingleThreadScheduledExecutor();
            exec.scheduleAtFixedRate(() -> {
                try {
                    // Check if we are ready
                    if (ServiceHandler.INSTANCE.getCurrentMediaHandler() != null) {
                        if (ServiceHandler.INSTANCE.getCurrentMediaHandler().handlerReady()) {
                            this.currentlyPlayingObject = ServiceHandler.INSTANCE.getCurrentMediaHandler().getCurrentTrack();
                            if(this.previousPlayingObject == null || !this.previousPlayingObject.item.name.equals(this.currentlyPlayingObject.item.name)) {
                                this.previousPlayingObject = this.currentlyPlayingObject;
                                MinecraftForge.EVENT_BUS.post(new SongChangeEvent(this.currentlyPlayingObject));
                                if(Settings.ANNOUNCE_TRACKS) PlayerMessager.sendMessage(ChatColor.GRAY + "Current track: " + this.currentlyPlayingObject.item.name + " by "  + this.currentlyPlayingObject.item.album.artists[0].name, true);
                            }
                        }
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }, 0, 3, TimeUnit.SECONDS);
        }

        // Make sure that a MediaHandler exists and is ready
        IMediaHandler currentHandler = ServiceHandler.INSTANCE.getCurrentMediaHandler();
        if (currentHandler != null && currentHandler.handlerReady() && currentlyPlayingObject != null) {
            // Make sure there's no GUI screen being displayed
            if (mc.currentScreen == null && !mc.gameSettings.showDebugInfo) {
                this.drawPlayer(Settings.PLAYER_X, Settings.PLAYER_Y, Settings.MODERN_PLAYER_STYLE, false, Settings.PLAYER_ZOOM);
            }
        }
    }
}
 
Example #27
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());
			}
		}
	}
}
 
Example #28
Source File: RocketEventHandler.java    From AdvancedRocketry with MIT License 4 votes vote down vote up
private void renderModuleSlots(ItemStack armorStack, int slot, RenderGameOverlayEvent event) {
	int index = 1;
	float color = 0.85f + 0.15F*MathHelper.sin( 2f*(float)Math.PI*((Minecraft.getMinecraft().world.getTotalWorldTime()) % 60)/60f );
	BufferBuilder buffer = Tessellator.getInstance().getBuffer();
	GlStateManager.enableBlend();
	GlStateManager.enableAlpha();
	GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
	float alpha = 0.6f;


	if( armorStack != null ) {

		boolean modularArmorFlag = armorStack.getItem() instanceof IModularArmor;

		if(modularArmorFlag || ItemAirUtils.INSTANCE.isStackValidAirContainer(armorStack)) {

			int size = 24;
			int screenY = suitPanel.getRenderY() + (slot-1)*(size + 8);
			int screenX = suitPanel.getRenderX();

			//Draw BG
			GL11.glColor4f(1f,1f,1f, 1f);
			Minecraft.getMinecraft().renderEngine.bindTexture(TextureResources.frameHUDBG);
			buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
			RenderHelper.renderNorthFaceWithUV(buffer, this.zLevel-1, screenX - 4, screenY - 4, screenX + size, screenY + size + 4,0d,0.5d,0d,1d);
			Tessellator.getInstance().draw();

			Minecraft.getMinecraft().renderEngine.bindTexture(TextureResources.frameHUDBG);
			buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
			RenderHelper.renderNorthFaceWithUV(buffer, this.zLevel-1, screenX + size, screenY - 3, screenX + 2 + size, screenY + size + 3,0.5d,0.5d,0d,0d);
			Tessellator.getInstance().draw();

			//Draw Icon
			GlStateManager.color(color,color,color, color);
			Minecraft.getMinecraft().renderEngine.bindTexture(TextureResources.armorSlots[slot-1]);
			buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
			RenderHelper.renderNorthFaceWithUV(buffer, this.zLevel-1, screenX, screenY, screenX + size, screenY + size,0d,1d,1d,0d);
			Tessellator.getInstance().draw();

			if(modularArmorFlag) {
				List<ItemStack> stacks = ((IModularArmor)armorStack.getItem()).getComponents(armorStack);
				for(ItemStack stack : stacks) {
					GL11.glColor4f(1f, 1f, 1f, 1f);
					((IArmorComponent)stack.getItem()).renderScreen(stack, stacks, event, this);

					ResourceIcon icon = ((IArmorComponent)stack.getItem()).getComponentIcon(stack);
					ResourceLocation texture = null; 
					if(icon != null) 
						texture= icon.getResourceLocation();

					//if(texture != null) {

					screenX = suitPanel.getRenderX() + 4 + index*(size+2);

					//Draw BG

					Minecraft.getMinecraft().renderEngine.bindTexture(TextureResources.frameHUDBG);
					buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
					RenderHelper.renderNorthFaceWithUV(buffer, this.zLevel -1, screenX - 4, screenY - 4, screenX + size - 2, screenY + size + 4,0.5d,0.5d,0d,1d);
					Tessellator.getInstance().draw();




					if(texture != null) {
						//Draw Icon
						Minecraft.getMinecraft().renderEngine.bindTexture(texture);
						GlStateManager.color(color,color,color, alpha);
						buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
						RenderHelper.renderNorthFaceWithUV(buffer, this.zLevel-1, screenX, screenY, screenX + size, screenY + size, icon.getMinU(),icon.getMaxU(), icon.getMaxV(),icon.getMinV());
						Tessellator.getInstance().draw();
					}
					else {
						GL11.glPushMatrix();
						GlStateManager.translate(screenX , screenY, 0);
						GlStateManager.scale(1.5f, 1.5f, 1.5f);
						Minecraft.getMinecraft().getRenderItem().renderItemIntoGUI(stack,  0,0);
						GL11.glPopMatrix();
					}

					index++;
					//}
				}
			}

			screenX = (index)*(size+2) + suitPanel.getRenderX() - 12;
			//Draw BG
			GlStateManager.color(1,1,1, 1f);
			Minecraft.getMinecraft().renderEngine.bindTexture(TextureResources.frameHUDBG);
			buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
			RenderHelper.renderNorthFaceWithUV(buffer, this.zLevel-1, screenX + 12, screenY - 4, screenX + size, screenY + size + 4,0.75d,1d,0d,1d);
			Tessellator.getInstance().draw();
		}
	}

	GlStateManager.disableAlpha();
}
 
Example #29
Source File: ItemPressureTank.java    From AdvancedRocketry with MIT License 4 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
public void renderScreen(ItemStack componentStack, List<ItemStack> modules, RenderGameOverlayEvent event, Gui gui) {
	// TODO Auto-generated method stub
	
}
 
Example #30
Source File: ItemUpgrade.java    From AdvancedRocketry with MIT License 4 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
public void renderScreen(ItemStack componentStack, List<ItemStack> modules, RenderGameOverlayEvent event, Gui gui) {
	// TODO Auto-generated method stub
	
}