Jump to content

Recommended Posts

Posted

I just want to render a overlay (i have creat a spyglass likt that from 1.17) and now i want to render the Overlay

this is the code of the event i used:

	@SubscribeEvent(priority = EventPriority.HIGHEST)
	public static void RenderSpyglassOverlay(RenderGameOverlayEvent event) {
		
		PlayerEntity player = Minecraft.getInstance().player;
		int posX = event.getWindow().getScaledWidth() / 2;
		int posY = event.getWindow().getScaledHeight() / 2;

		if (player.getActiveItemStack().getItem() == CaveItems.SPYGLASS.get()) {
			
			RenderSystem.disableDepthTest();
			RenderSystem.depthMask(false);
			RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
			RenderSystem.disableAlphaTest();
			Minecraft.getInstance().getTextureManager().bindTexture(new ResourceLocation("cave:textures/misc/spyglass_scope.png"));
			Minecraft.getInstance().ingameGUI.blit(event.getMatrixStack(), posX - 128, posY - 128, 0, 0, posX * 2, posY * 2, 256, 256);
			RenderSystem.depthMask(true);
			RenderSystem.enableDepthTest();
			RenderSystem.enableAlphaTest();
			RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);

			
		}
		
	}

but the overlay looks like this:

https://drive.google.com/file/d/15llZaiIqNWK7WRqcihIJY7oaAszkFKnn/view?usp=sharing


so my question:

1 .how to render the game overlay translucent

2. how to set the outside of the overlay to black

Posted
13 hours ago, poopoodice said:

1 You need to enable blend.

thank that fine work

 

13 hours ago, poopoodice said:

2 I think you should be able to just use fill and fill the whole bg.

there is no fill method

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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