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.

Cospaia

Members
  • Joined

  • Last visited

  1. Found it. I needed to use TextFormatting.RED
  2. We got it working by using \u2764 instead of a literal heart in the code. Strange, but whatever works, works.
  3. Did I say the mod works? Well, it has a terrible flaw right now. When it is built as a jar package and used in the regular launcher, the heart is not rendered as it should, but instead as four strange looking characters. (Looks like a Unicode issue.) So, it works in the dev server, but not in the real one. Anyone have any clue what that could be about?
  4. Now I have gotten the mod to do what I want. But I'm not sure I am doing it right. So posting some code here for feedback. This is the event handler: @SubscribeEvent public void render(RenderLivingEvent.Pre event) { EntityLivingBase entity = event.getEntity(); RenderLivingBase baseRenderer = event.getRenderer(); if (entity instanceof EntityPlayer) { if (this.renderer == null) { this.renderer = new RenderPlayerHealthDisplay(baseRenderer.getRenderManager(), baseRenderer.getMainModel(), 1.0F); } String health = String.format("%.1f", event.getEntity().getHealth()) + " §c❤"; this.renderer.renderHealthDisplay((AbstractClientPlayer) entity, event.getX(), event.getY(), event.getZ(), health); } } Which uses this subclass of RenderLivingBase: @SideOnly(Side.CLIENT) public class RenderPlayerHealthDisplay extends RenderLivingBase<AbstractClientPlayer> { public RenderPlayerHealthDisplay(RenderManager renderManagerIn, ModelBase modelBaseIn, float shadowSizeIn) { super(renderManagerIn, modelBaseIn, shadowSizeIn); } public void renderHealthDisplay(AbstractClientPlayer entity, double x, double y, double z, String s) { double distanceSq = entity.getDistanceSq(this.renderManager.renderViewEntity); y += (double)((float)this.getFontRendererFromRenderManager().FONT_HEIGHT * 1.15F * 0.025F); if (distanceSq < 100.0D) { Scoreboard scoreboard = entity.getWorldScoreboard(); ScoreObjective scoreobjective = scoreboard.getObjectiveInDisplaySlot(2); if (scoreobjective != null) { y += (double)((float)this.getFontRendererFromRenderManager().FONT_HEIGHT * 1.15F * 0.025F); } } this.renderLivingLabel(entity, s, x, y, z, 64); } @Nullable @Override protected ResourceLocation getEntityTexture(AbstractClientPlayer entity) { return entity.getLocationSkin(); } } (The scoreboard handling is how it is done in RenderPlayer.) This displays the health above player's nametags. But should I be instantiating a full new renderer like this? It seems it would be more efficient to replace the render class being sent to the event. Don't know if that makes sense, but anyway.
  5. Thanks. but I couldn't figure out how to import EnumChatFormatting.
  6. Thanks. I am not sure I follow along, but I have this handler right now (before I posted this question, that is): @SubscribeEvent public void render(RenderLivingEvent.Pre event) { float health = event.getEntity().getHealth(); String name = event.getEntity().getDisplayName().getFormattedText(); //System.out.println(name + ", " + health); event.getEntity().setCustomNameTag("" + health + "§c❤"); event.getEntity().setAlwaysRenderNameTag(true); return; } Which adds a health display for living entities, except for players. The event has a RenderLivingEntity instance, according to : http://takahikokawasaki.github.io/minecraft-resources/javadoc/forge/1.7.10-10.13.2.1291/index.html?net/minecraft/util/package-summary.html I want the health display to render like a below name objective in vanilla, which seems to require that I somehow can modify the behaviour of this renderer. Am I taking the wrong approach thinking like this?
  7. I want to render some data below the name tag on player entities. Searching this forum I get that I need to create a custom renderer for doing this. But, I'm new to modding and don't know how to go about it. Is there a particular tutorial I could look at or could someone give some pointers? Thanks in advance!
  8. Thanks, both of you. I'm out for tweaking all glint. But I want the player to be able to adjust it in-game. There was a mod for 1.8.9 that did this, Glint Colorizer, which you can see in action here: It would have been cool to make one for 1.12.2 as well, but it might be a bit too large of a bite for me. =)
  9. I want to change the glint color of enchanted items (like if the sword is enchanted, I want to render the glint in a different color). I'm new to minecraft modding and have a hard time figuring out where to begin looking. Is there an event I should hook into when the item is setup or maybe when it is rendered? Any hints would be appreciated. Thanks!

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.