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

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);
    }
}

12.png

13.png

Edited by idev

  • 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

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 by kiou.23

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

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.