
New JourneyMap 1.21-6.0.0-beta.23 integration issue
mysticdrew opened this issue ยท 9 comments
JourneyMap dev here.
I got a crash report.
TeamJM/journeymap#785
your failing code is here.
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);
Looks like we need to get what you need in our API so that changes do not break your mod.
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.
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.
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.
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.
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.