Jump to content

uSkizzik

Members
  • Posts

    222
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by uSkizzik

  1. I was looking at the one that BossHealthOverlay uses and didn't see the other ones... I'll try it out
  2. I need an instance of BossHealthOverlay to actually call the blit method. Yea I actually noticed that but thought it's supposed to be like that. I'll stick with the getType method. I just have to check if it's RenderGameOverlayEvent.ElementType.BOSSINFO, right?
  3. In 1.17 you need to subscribe to EntityRenderersEvent.RegisterRenderers and then use the registerEntityRenderer method. You'll also need to subscribe to EntityRenderersEvent.RegisterLayerDefinitions and then use the registerLayerDefinition method to register a layer. You can find more on that here.
  4. Alright, I finally got something! The text is finally rendering (Don't know how, but it works without any errors). What I need now is the actual bar rendering. I see that vanilla BossHealthOverlay has a method called "drawBar" which uses GuiComponent#blit to draw the bar. How would I do that in my class? Here's what I currently have: @Mod.EventBusSubscriber(modid = ProjectApple.MOD_ID, bus = Mod.EventBusSubscriber.Bus.FORGE) public class PA_RenderGameOverlayEvent { private static final ResourceLocation GUI_BARS_LOCATION = new ResourceLocation("textures/gui/bars.png"); private static final Minecraft minecraft = Minecraft.getInstance(); @SubscribeEvent public static void registerBossBarRendering(RenderGameOverlayEvent.Pre event) { Map<UUID, PA_LerpingBossEvent> events = PA_BossEventPacket.getEvents(); if (!events.isEmpty()) { int i = minecraft.getWindow().getGuiScaledWidth(); int j = 12; for(PA_LerpingBossEvent lerpingEvent : events.values()) { int k = i / 2 - 91; if (!event.isCanceled()) { RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.setShaderTexture(0, GUI_BARS_LOCATION); Component component = lerpingEvent.getName(); int l = minecraft.font.width(component); int i1 = i / 2 - l / 2; int j1 = j - 9; minecraft.font.drawShadow(event.getMatrixStack(), component, (float)i1, (float)j1, 16777215); } if (j >= minecraft.getWindow().getGuiScaledHeight() / 3) { break; } } } } } P.S.: I know that I need a custom bars texture. I'm using the vanilla one as a placeholder until I get the rendering done.
  5. Alright, I'm running into issues with having a custom LerpingBossEvent because the vanilla events field requires a vanilla LerpingBossEvent. I can't extend it because it itself extends BossEvent and I need it to extend my custom BossEvent. I also can't make my own events field because then I'll have to call ForgeHooksClient#bossBarRenderPre myself and it also requires a vanilla LerpingBossEvent. I have no idea what I'm doing and I might just give up...
  6. Well, I need to change the BossEvent.BossBarColor to ChatFormatting. I subscribe to the event, then what?
  7. Vanilla LerpingBossEvent extends vanilla BossBar which isn't what I want. How would I render it via RenderOverlayEvent?
  8. It isn't about the runData. It's about where your texture is placed. Data generation seems to be working perfectly fine. Please check if the path to your texture is the following: "src/main/resources/assets/tritia/textures/item/". Make sure there is no misspellings!
  9. Please read the rules and the pins (the three boxes above the title) before posting anything. 1.7.10 is no longer supported on this forum. Please update to a modern version of Minecraft to receive support.
  10. And what do I do with it? You told me to add it to the events field but it only accepts vanilla LerpingBossEvent
  11. My issue is that I need to call this event in my custom version of BossHealthOverlay but I can't because it requires a LerpingBossEvent and I'm using a custom version of that class too.
  12. Take a look at the render method of the BossHealthOverlay. It sets a variable called event that is ForgeHooksClient.bossBarRenderPre. That's on lines 37 and 38.
  13. New Question: How do I call the ForgeHook with an instance of a custom LerpingBossEvent?
  14. I still don't understand how that makes the game use my custom BossHealthOverlay. The Gui class still makes an instance of the vanilla class and uses only the vanilla class. Edit: Does the Gui class even need to use my custom class?
  15. How would I make the game use my custom version of the BossHealthOverlay class tho?
  16. Yes, I already have a custom packet but what I don't understand is how exactly I'm supposed to handle it. Currently I'm using this line: Minecraft.getInstance().gui.getBossOverlay().update(this); But getBossOverlay returns an instance of BossHealthOverlay which, as you said, won't do the job.
  17. Well, how am I supposed to handle the custom boss event packet then? As I said, in vanilla it gets the boss overlay from the GUI and then updates it.
  18. My question is do I need a custom version of BossHealthOverlay that uses ChatFormatting instead of the BossBarColor or no?
  19. Wait, don't I actually need a custom BossHealthOverlay class because most of it uses vanilla BossEvent and BossBarColor?
  20. How exactly can I render my custom boss bar? Vanilla seems to be handling the boss event packet by calling Gui.getBossOverlay().update(). Do I need a custom packet (which I already made) or I need to somehow use the vanilla packet? The issue with a custom packet is that the update method requires an instance of the vanilla boss event packet.
×
×
  • Create New...

Important Information

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