Posted March 28, 20214 yr Hello, I have been suffering for 6 hours and cannot find a good, working solution. I need the text above the creature to always face the camera. I went through a lot of code examples and even tried to find the source code of the tag item in the game and render it. But I didn't find anything I needed. As far as I understand, the new version does not have MatrixStack.rotate, I need it judging by the examples. I tried GlStateManager and don't know how to pass the required matrixStack to fontRenderer.draw (matrixStack, ...) What should I do? Now I stopped at the option that is shown in the code below, but it does not do what I need. @Mod.EventBusSubscriber(modid = XCraft.MODID, value = Dist.CLIENT) public class ClientEventHandler { @SubscribeEvent public static void potion(RenderLivingEvent.Post<? extends LivingEntity, ? extends EntityModel<?>> event) { HealthBar.renderInWorld(event.getMatrixStack(), event.getEntity()); } } public class HealthBar { public static void renderInWorld(MatrixStack matrixStack, LivingEntity entity) { ClientPlayerEntity playerEntity = Minecraft.getInstance().player; assert playerEntity != null; FontRenderer fontRenderer = Minecraft.getInstance().font; assert fontRenderer != null; ITextComponent name = entity.getName(); fontRenderer.draw(matrixStack, name, 0, 0, 0xffffff); } } Edited March 28, 20214 yr by idev
March 28, 20214 yr Author Is this even possible with forge? Maybe I'm waiting in vain for an answer and I need to come up with a workaround
March 28, 20214 yr when you name an entity with a nametag, it has a name that shows up on top of the entity, that name is a text that always faces the player if you look into the code for that, you'll see how to do it Edited March 28, 20214 yr by kiou.23
March 28, 20214 yr Author I don't know how, but setting: mappings channel: 'snapshot', version: '20210309-1.16.5' build.gradlew helped me. In short, I deployed the project on a new one and it all worked. I thought it was a bug or a flaw, maybe it is
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.