InGame Info XML

InGame Info XML

22M Downloads

Bold text background does not align correctly

Mersid opened this issue ยท 20 comments

commented

The further away from the corner that the text was aligned to, the more offset the background text is from the foretext.

The first image is fine, that is how it is supposed to look.
The second image has a noticeable unaligned effect, caused by being spaced out slightly by the large icon.
The third image is an example of a severe unalignment, when the text is nearly at the center of the screen.
normal
mild
major

commented

What version of the mod?

commented

igixml
lunacore

commented

I just tried it, running nothing but Forge, Lunatrius Core, and IGI. No difference, still causes the glitch.

commented

Can you test it with just those two mods and forge?

commented

Could you paste your XML config? The shadows seem to work just fine.

shadows

commented

Judging by that, I assume that you are positioning the commands <lines at "top[left/center/right]"> to position the text? I believe that explains why you do not have the issue. As seen by the images I posted above, that cannot always be the case. I placed an item icon before the text, which may be cause for the desynchronization. Try adding a few spaces (maybe six to eight) before the text, like so:

sampletext

Here is the file I use.
InGameInfo.xml.txt

commented

Also, on a wholly unrelated note, how do I use the icon function?

commented

Ok, managed to reproduce the issue, will check if this is a vanilla or Forge bug. the same code worked in previous versions of Minecraft.

What function?

commented

It's a vanilla bug. This will be tricky to fix on my side (if possible at all).

commented

The shadow renders properly, but you're not resetting the bold style, so the foreground text gets rendered with the bold style still applied, making all the spaces wider.

You can fix this by resetting the style on the end of the line by using $r.

commented

Text can't be offset vertically within a lines block other than adding empty lines to offset text by the amount of empty lines.

Where exactly does the snowman head come from? Is it an item in the inventory, the world or just a static image? There are specific tags for the first two options (search for equipped / mouseover in the tag list). The third option does indeed require the use of the icon function.

<!-- A simple example of a static dirt block image -->
<icon>
    <str>minecraft:dirt</str>
    <num>0</num>
</icon>

Also as you probably noticed, the format for the icon function is rather complex, which is why I haven't added it to the in-game documentation yet. I need a simpler representation.

commented

Despite the issue being caused by failing to add $r to the end, the item's name itself is in bold, rather than causing the bold effect via a command. The item in question is a helmet-slot item, on the Mineplex server.

Also, thanks for the icon example! However, how do I adjust the size of it correctly? How do I input an item with no metadata without it returning the black and purple "no texture" icon? It appears that I can simply adjust the width and height after filling in the x and y position fields, but that is after the metadata. Most items do not have metadata, and specifying 0 does not work.

commented

Mineplex should properly name that item in that case.

Metadata 0 is the default for all items and it should work without issues. To modify the size of the icon you'll have to replace the metadata parameter with extra information. The additional arguments required are listed here and are prefixed with final int.

The first 4 arguments control how the icon will be displayed, the next 6 arguments are only used in combination with a spritesheet (if you'll supply an item name you can ignore there).

<icon>
    <str>minecraft:dirt</str>
    <num>0</num> <!-- displayX -->
    <num>-4</num> <!-- displayY -->
    <num>16</num> <!-- displayWidth -->
    <num>16</num> <!-- displayHeight -->
</icon>
commented

These appear to be the documentation on the ICON function, but I cannot figure out how to use it to create an actual icon on screen. The instructions in the chart were unclear.
iconf

I am not sure which end the bug is on, but I know that bspkrs' mods, ArmorStatus, was able to display the information without issue:
bspkrs
Note that the info displayed is nearly identical to the other image, but does not have the offset shadow despite being in the near exact same position.

On another unrelated note, is there a way for me to shift text or images up or down by half a line? Note how in the image that the icon is halfway between the name, and the durability menu would have been underneath it had it existed. On the three images at the top, the icon is on the same line as the image, so the durability menu would have been offset slightly. Just a minor aesthetic thing.

commented

Also, the snowman head image is not bold by command choice, but because that is the default text in its actual name on the server that I took the image, so is there a workaround that you could suggest?
Take a look at the xml file pasted above, and note on the helmet section that there is no bold effect on it. It is from the actual name of the item itself.

EDIT: Appending $r to the end of each item name tag works to fix the issue. However, I still don't understand the icon command or if it is possible to shift text or images by half a line.

commented

This is what happened when I used the code pasted above... Am I doing something wrong?
noimage

commented

I didn't check if it still worked. Looks like you have to use the file name directly instead of the item's name.

An example: textures/gui/icons.png

commented

Can confirm it works. Thanks! However, it does not seem to render blocks correctly, for obvious reasons. Any way to fix that? Render blocks with custom size display?

commented

Also, how do I use the if, and, not, or tags?

commented

I don't think that it's possible right now, I'll have to check.

  • not negates the single parameter
  • if check the first parameter, if it's true it returns the second parameter, otherwise the third (or a blank string if it's not specified)
  • and/or check if all/one of the parameters are true

A few short examples:

<if>
  <var>slimechunk</var>
  <str>Slimes!</str>
  <str></str>
</if>

<if>
  <not>
    <var>slimechunk</var>
  </not>
  <str>Not Slimes!</str>
  <str></str>
</if>

<and>
  <var>slimechunk</var>
  <var>wet</var>
  <var>burning</var>
</and>

<or>
  <var>slimechunk</var>
  <var>wet</var>
  <var>burning</var>
</or>