SeasonHUD

SeasonHUD

3M Downloads

New JourneyMap 1.21-6.0.0-beta.23 integration issue

mysticdrew opened this issue ยท 9 comments

commented

JourneyMap dev here.
I got a crash report.
TeamJM/journeymap#785

your failing code is here.

this.topLabelHeight = vars.getInfoLabelAreaHeight(fontRenderer, currentTheme,

I recently changed getInfoLabelAreaHeight to take a list instead of an array to support letting users move the info slots around. They are no longer static to top and bottom. You can set which ever ones you want to the top or bottom, include all 4 on top, or all 4 on bottom.

New signature
public int getInfoLabelAreaHeight(Font fontRenderer, Theme.LabelSpec labelSpec, List<ThemeLabelSource.InfoSlot> themeLabelSources)

You can now change your code to this to get the variable heights, this is how I do it in journeymap.
Calling getInforSlotLabels returns a tuple, A is top labels, B is bottom labels, it is a public method.

        var tuple = getInfoSlotLabels(miniMapProperties);
        var topLabels = tuple.a();
        var bottomLabels = tuple.b();
        
        // Calculate areas reserved for info labels
        int topInfoLabelsHeight = getInfoLabelAreaHeight(fontRenderer, minimapSpec.labelTop, topLabels);
        int bottomInfoLabelsHeight = getInfoLabelAreaHeight(fontRenderer, minimapSpec.labelBottom, bottomLabels);
commented

Looks like we need to get what you need in our API so that changes do not break your mod.

commented

Thanks, should be fixed in version 1.10.3, that is currently uploading

commented

I am not familiar with your mod and what exactly you do with JM interaction. Are you just displaying a new text line above the top infoslot or below the bottom infoslot?

If that is the case, I could look into adding an event to our API you can listen to, to display your custom infoslot. Also our API allows addons to add infoslots to the list, but it does not force display it. The user still needs to select it.

commented

Yeah basically just finding where the last info slot was drawn, and then using you're drawBatchLabel() method to draw and additional one above/below the others. Basically how you draw them in the LabelVars class.

I tried to use a custom infoslot originally , but it looks like it only accepts a string. I use a custom font for the season icon, and recolor the text based on the season, so I would need it to accept a component.

commented

Ahh yea, I can do that.

commented

With beta.24 and the latest snapshot api, infoslot registration now supports Component, I did not get the event in yet, I had a crash I had get a fix out.

commented

image
image

Will that work for you? This will be in beta.25

commented

Awesome, I switched over to just using the InfoSlotRegistryEvent instead and it appears to be working, just need to test it a bit.

I was also able to use new InfoSlotDisplayEvent to optionally add it to the top or bottom set instead, incase all the infoslots are in use already.

commented

Awesome, I switched over to just using the InfoSlotRegistryEvent instead and it appears to be working, just need to test it a bit.

I was also able to use new InfoSlotDisplayEvent to optionally add it to the top or bottom set instead, incase all the infoslots are in use already.

That's great to hear! Glad to make things a bit simpler and less risk for breakage! Let me know if you need anymore hooks that do not exist in the API.