Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

I have a custom overlay, it works fine,

but the xp bar and health and hunger are above the overlay so how to change that

or is there a way to disable the rendering of xp bar hunger and health?

2021-02-10_18_05_25.thumb.png.88f17606c0a598cb3b38abb1db5a21e3.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

this is the code of my event:

 

	@SubscribeEvent(priority = EventPriority.HIGHEST)
	@SuppressWarnings({ "resource", "static-access" })
	public static void RenderSpyglassOverlay(RenderGameOverlayEvent event) {
		
		if (event.getType() != ElementType.BOSSHEALTH) {
			
			return;
			
		}
		
		PlayerEntity player = Minecraft.getInstance().player;
		GameSettings settings = Minecraft.getInstance().gameSettings;
		int posX = event.getWindow().getScaledWidth();
		int posY = event.getWindow().getScaledHeight();
		
		if (player.getActiveItemStack().getItem() == ModItems.SPYGLASS.get()) {
			
			if (settings.getPointOfView()== PointOfView.FIRST_PERSON) {
				
				RenderSystem.disableDepthTest();
				RenderSystem.depthMask(false);
				RenderSystem.enableBlend();
				RenderSystem.blendFunc(770, 771);
				Minecraft.getInstance().getTextureManager().bindTexture(new ResourceLocation("cave:textures/misc/spyglass_scope.png"));
				Minecraft.getInstance().ingameGUI.blit(event.getMatrixStack(), 0, 0, 0, 0, posX, posY, 480, 270);
				RenderSystem.depthMask(true);
				RenderSystem.enableDepthTest();
				
			}
			
		}
		
	}

 

 

 

 

Edited by Luis_ST
add code

Use the check during the different element types to cancel the associated rendering. Also, subscribe to either $Pre or $Post, not both. Otherwise, you are just rendering the information twice.

  • Author
16 minutes ago, ChampionAsh5357 said:

Use the check during the different element types to cancel the associated rendering. Also, subscribe to either $Pre or $Post, not both. Otherwise, you are just rendering the information twice.

now i use this but it dosent work:

	@SubscribeEvent(priority = EventPriority.HIGHEST)
	@SuppressWarnings({ "resource", "static-access" })
	public static void RenderSpyglassOverlay(RenderGameOverlayEvent.Pre event) {
		
		ElementType type = event.getType();
		
		if (type != ElementType.BOSSHEALTH) {
			
			return;
			
		}
		
		switch (type) {
		case HEALTH: event.setCanceled(true);
		case FOOD: event.setCanceled(true);
		case ARMOR: event.setCanceled(true);
		case EXPERIENCE: event.setCanceled(true);
		default:
		}
		
		PlayerEntity player = Minecraft.getInstance().player;
		GameSettings settings = Minecraft.getInstance().gameSettings;
		int posX = event.getWindow().getScaledWidth();
		int posY = event.getWindow().getScaledHeight();
		
		if (player.getActiveItemStack().getItem() == ModItems.SPYGLASS.get()) {
			
			if (settings.getPointOfView()== PointOfView.FIRST_PERSON) {
				
				RenderSystem.disableDepthTest();
				RenderSystem.depthMask(false);
				RenderSystem.enableBlend();
				RenderSystem.blendFunc(770, 771);
				Minecraft.getInstance().getTextureManager().bindTexture(new ResourceLocation("cave:textures/misc/spyglass_scope.png"));
				Minecraft.getInstance().ingameGUI.blit(event.getMatrixStack(), 0, 0, 0, 0, posX, posY, 480, 270);
				RenderSystem.depthMask(true);
				RenderSystem.enableDepthTest();
				
			}
			
		}
		
	}

 

  • Author
15 hours ago, ChampionAsh5357 said:

Well, that would make sense. You check if the type is boss health and then check if the type is not boss health if it is boss health.

i just work thanks

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.