Jump to content
  • Home
  • Files
  • Docs
  • Merch
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • Weird character when formatting in colours
1.13 Update Notes for Mod Creators
Sign in to follow this  
Followers 1
Acrogenous

Weird character when formatting in colours

By Acrogenous, October 27, 2017 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

Acrogenous    1

Acrogenous

Acrogenous    1

  • Tree Puncher
  • Acrogenous
  • Members
  • 1
  • 28 posts
Posted October 27, 2017

On the lore of one of my Items there is this string:

colourglitch2.png.000d61331d9778242abc8b80972d8c81.png

but in minecraft it is displayed with what I believe is an Å at the start of it:

colourglitch.png.615fdd2727cb1e10d3dc48b7b4e8882f.png

any idea to how I remove this rogue character but keep the formatting?

Thanks in advanced

  • Quote

Share this post


Link to post
Share on other sites

Draco18s    2092

Draco18s

Draco18s    2092

  • Reality Controller
  • Draco18s
  • Members
  • 2092
  • 14021 posts
Posted October 27, 2017

Show your code. You're probably doing it wrong.

 

  • Quote

Share this post


Link to post
Share on other sites

diesieben07    6679

diesieben07

diesieben07    6679

  • Reality Controller
  • diesieben07
  • Forum Team
  • 6679
  • 45660 posts
Posted October 27, 2017
11 minutes ago, Acrogenous said:

On the lore of one of my Items there is this string:

colourglitch2.png.000d61331d9778242abc8b80972d8c81.png

but in minecraft it is displayed with what I believe is an Å at the start of it:

colourglitch.png.615fdd2727cb1e10d3dc48b7b4e8882f.png

any idea to how I remove this rogue character but keep the formatting?

Thanks in advanced

Don't put formatting codes in your lang file. Use String interpolation.

  • Like 1
  • Quote

Share this post


Link to post
Share on other sites

Acrogenous    1

Acrogenous

Acrogenous    1

  • Tree Puncher
  • Acrogenous
  • Members
  • 1
  • 28 posts
Posted October 27, 2017 (edited)
18 minutes ago, diesieben07 said:

Don't put formatting codes in your lang file. Use String interpolation.

this isn't the lang file this is 

Lore.add(1,"§2Bound Entropy: "+String.valueOf(a.getTagCompound().getInteger("entropy")));

how would you suggest to go about using string interpolation to achieve the same result? (I am not particularly familiar with interpolation)

Edited October 27, 2017 by Acrogenous
  • Quote

Share this post


Link to post
Share on other sites

Draco18s    2092

Draco18s

Draco18s    2092

  • Reality Controller
  • Draco18s
  • Members
  • 2092
  • 14021 posts
Posted October 27, 2017 (edited)

Yep, you're doing it wrong.

The TextFormatting enum is a thing.

https://github.com/Draco18s/ReasonableRealism/blob/1.12.1/src/main/java/com/draco18s/flowers/item/ItemOreFlower1.java#L55

Edited October 27, 2017 by Draco18s
  • Like 1
  • Quote

Share this post


Link to post
Share on other sites

Differentiation    27

Differentiation

Differentiation    27

  • Dragon Slayer
  • Differentiation
  • Members
  • 27
  • 573 posts
Posted October 27, 2017

Lore.add(1, TextFormatting.DARK_GREEN + "Bound Entropy: " + String.valueOf(a.getTagCompound().getInteger("entropy")));

Solved.

  • Like 1
  • Quote

Share this post


Link to post
Share on other sites

Acrogenous    1

Acrogenous

Acrogenous    1

  • Tree Puncher
  • Acrogenous
  • Members
  • 1
  • 28 posts
Posted October 27, 2017

Ah, I thought that only applied to TextComponent! Thank you all!

  • Quote

Share this post


Link to post
Share on other sites

diesieben07    6679

diesieben07

diesieben07    6679

  • Reality Controller
  • diesieben07
  • Forum Team
  • 6679
  • 45660 posts
Posted October 27, 2017
43 minutes ago, Acrogenous said:

this isn't the lang file

It should be.

 

43 minutes ago, Acrogenous said:

how would you suggest to go about using string interpolation to achieve the same result? (I am not particularly familiar with interpolation)

I18n.format("my.text", TextFormatting.GREEN, entropy) with

my.text=%sBound Entropy: %s

  • Quote

Share this post


Link to post
Share on other sites

Choonster    1623

Choonster

Choonster    1623

  • Reality Controller
  • Choonster
  • Forge Modder
  • 1623
  • 5050 posts
Posted October 28, 2017

While using a lang file and the TextFormatting enum is the proper way to do this, it should still be possible to use formatting codes inline. Your issue was probably happening because your code wasn't saved or compiled as UTF-8.

  • Like 1
  • Quote

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 1
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • KingMax
      Endsieg WW2 - Server due to start very soon - Working guns and vehicles!

      By KingMax · Posted 4 minutes ago

      Greetings Comrade/Captain/Hauptmann! Welcome to Europe's final theater of war, Scandinavia! Despite the fall of Berlin the third Reich continues to hold out in Norway and the surrounding areas, the war is not yet over. Ultimate Victory will require many more battles to be fought. Infrastructure will need to be built, tanks, planes and ships shall have to be designed and produced and factories will be needed to produce the weapons of war.Endsieg has a multitude of special mechanics found on almost no other MC servers: fully functional ground, air and sea vehicles, guns, factories and more!Will you fight for the Allies to liberate Norway from tyranny?Will you defend the Soviet motherland by finally defeating the fascist menace?Will you take up the mantle of saving the remains of the Third Reich?Will you preserve the territorial integrity of the Republic of Finland?Will you help the Kingdom of Sweden once again rise to prominence as a Baltic powerhouse?Due to launch in a short matter of days or weeks, join our discord!discord.gg/anp3BJQ
    • Crack3dC0d3
      [1.14.4] Multiple models on the same item.

      By Crack3dC0d3 · Posted 31 minutes ago

      bump
    • snivinia
      unable to connect to friend's modded server

      By snivinia · Posted 1 hour ago

      my mistake, these should be the right links now https://drive.google.com/file/d/1CxPl-CVNCtOl0LWKv9U7o9WT6jBtMOe1/view?usp=sharing https://drive.google.com/file/d/11YJ-SAt7nYmloZQXOw5f4-gsxpYtDMyN/view?usp=sharing will also update in original post
    • plugsmustard
      [1.14.4] How to get Minecraft Horse model/texture to make a custom unicorn?

      By plugsmustard · Posted 1 hour ago

    • Draco18s
      Distinguish singleplayer vs. multiplayer

      By Draco18s · Posted 2 hours ago

      As you did not provide very much code...   Who knows.
  • Topics

    • KingMax
      0
      Endsieg WW2 - Server due to start very soon - Working guns and vehicles!

      By KingMax
      Started 4 minutes ago

    • Crack3dC0d3
      4
      [1.14.4] Multiple models on the same item.

      By Crack3dC0d3
      Started December 2

    • snivinia
      2
      unable to connect to friend's modded server

      By snivinia
      Started 18 hours ago

    • DragonITA
      12
      [1.14.4] How to get Minecraft Horse model/texture to make a custom unicorn?

      By DragonITA
      Started 13 hours ago

    • solitone
      8
      Distinguish singleplayer vs. multiplayer

      By solitone
      Started Thursday at 08:20 PM

  • Who's Online (See full list)

    • LexManos
    • eatthenight
    • tdude0317
    • saxon564
    • imacatlolol
    • TheAmazingTurkey
    • Jaffaaaaa
    • KingMax
    • Frizzk
    • TheOnlyTrueEnte
    • plugsmustard
    • diesieben07
    • Epicmoofish
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • Weird character when formatting in colours
  • Theme
  • Contact Us
  • Discord

Copyright © 2019 ForgeDevelopment LLC · Ads by Curse Powered by Invision Community