Posted June 30, 20214 yr I want to display a texture like a name tag. Specifically, it displays the texture on a black background of nametag with the same transparency as the characters on the name tag. I've just looked at the vanilla code that displays the name tag, but I'm running into a problem. Textures appear semi-transparent when they overlap clouds or the ocean. To be honest, I don't understand the rendering system. I've followed the method that vanilla displays the characters in a name tag, but it's too complicated. I understand that MatrixStack is a class for rotating and moving objects to display, but Buffer? RenderSystem? Is there a tutorial to understand those rendering systems? Also, which vanilla method is used to set the transparency etc. to display 1. characters, 2. black translucent background of the name tag? Current code: public void renderFocusedHealth(MatrixStack matrixStack, EntityRenderer<?> entityRenderer, Entity entity) { double d0 = entityRenderer.getRenderManager().squareDistanceTo(entity); if (net.minecraftforge.client.ForgeHooksClient.isNameplateInRenderDistance(entity, d0) && this.minecraft.pointedEntity == entity) { float f = entity.getHeight() + 0.5F; matrixStack.push(); matrixStack.translate(0.0D, (double) f, 0.0D); matrixStack.rotate(entityRenderer.getRenderManager().getCameraOrientation()); matrixStack.scale(-0.025F, -0.025F, 0.025F); this.minecraft.getTextureManager().bindTexture(UMUClientIngameGUI.GUI_ICONS_LOCATION); blit(matrixStack, 0, 0, 87, 0, 9, 9); matrixStack.pop(); } } @SubscribeEvent public void onRenderNameplate(RenderNameplateEvent event) { renderFocusedHealth(event.getMatrixStack(), event.getEntityRenderer(), event.getEntity()); }
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.