Jump to content

Recommended Posts

Posted

could someone help me with int conversion for my tooltips??

above constructor ive set

public int BurnTime;

public String burntime = String.valueOf(BurnTime);

 

in constructor i set

int BurnTime

 

in the super i set this.

BurnTime = burntime;

 

in the add information code i set

tooltip.add(this.burntime);

i get no errors and yes the item has the right burn time set to it (the items burn at the rate in which they are set)

but the tooltip says 0, i cant get it to write the proper int 2018-08-17_05_21_37.thumb.png.bdec37adca9c9d232cafd315ab37db3f.png 

ive tried using

 

Integer.toString(BurnTime)

String.valueOf(BurnTime)

Integer(BurnTime).toString()

 

https://github.com/reapersremorse/UTO-Mod/blob/master/src/main/java/com/reapersremorse/uto/prefabs/items/BasicItemPrefab.java

Posted
6 minutes ago, reapersremorse said:

could someone help me with int conversion for my tooltips??

Please learn Java.

7 minutes ago, reapersremorse said:

public String burntime = String.valueOf(BurnTime);

This is ran once and it happens before you set your BurnTime variable in your constructor. You need to set this also in your constructor.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted

Your burntime string is set before you have assigned any bvalue to your integer burntime.

Remove this variable, it's unnecessary. And do not name your variables from upper case (google for java naming conventions)

tooltip.add(String.valueOf(burnTime));//burnTime is your integer variable

 

Posted
2 minutes ago, diesieben07 said:
  • When this executes, BurnTime is not initialized yet, so it is 0. burntime therefor gets initialized to "0" and is never changed.

     

i tried setting as an int instead of a string, it only wants a string so i converted it to a string.

3 minutes ago, diesieben07 said:
  • Why do you even have this separate String field? Just use the int field when you create the tooltip

does this mean i have to set 2 fields for my tooltips? i could not use an int in any way inside the tooltips, when i tried setting the field from 
public void addInformation(ItemStack stack, World worldIn, List<String> tooltip, ITooltipFlag flagIn) {

into
public void addInformation(ItemStack stack, World worldIn, List<int> tooltip, ITooltipFlag flagIn) {
or

public void addInformation(ItemStack stack, World worldIn, List<Integer> tooltip, ITooltipFlag flagIn) {
it would not add the tooltips.

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I was trying to find a mod that added something specific, and was unable to find it with what limited memory I had of seeing it. I don't know why there isn't an option to include words in overviews of mods. I could see it being in the sort tab near filters on the app in my opinion. It might help someone trying to find something specific, only based off something from the overview tab, but idk
    • Please read the FAQ and post logs as described there.   Also, do not just add a post onto someone else's thread with your issue, create a new one please.
    • I am creating a server with mods but when i try tostart it it say in the logs:   [29Jan2025 20:36:50.715] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file /server/libraries/net/minecraftforge/fmlcore/1.20.1-47.3.27/fmlcore-1.20.1-47.3.27.jar is missing mods.toml file 159[29Jan2025 20:36:50.717] [main/DEBUG] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Considering mod file candidate /server/libraries/net/minecraftforge/javafmllanguage/1.20.1-47.3.27/javafmllanguage-1.20.1-47.3.27.jar 160[29Jan2025 20:36:50.717] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file /server/libraries/net/minecraftforge/javafmllanguage/1.20.1-47.3.27/javafmllanguage-1.20.1-47.3.27.jar is missing mods.toml file 161[29Jan2025 20:36:50.718] [main/DEBUG] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Considering mod file candidate /server/libraries/net/minecraftforge/lowcodelanguage/1.20.1-47.3.27/lowcodelanguage-1.20.1-47.3.27.jar 162[29Jan2025 20:36:50.718] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file /server/libraries/net/minecraftforge/lowcodelanguage/1.20.1-47.3.27/lowcodelanguage-1.20.1-47.3.27.jar is missing mods.toml file 163[29Jan2025 20:36:50.719] [main/DEBUG] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Considering mod file candidate /server/libraries/net/minecraftforge/mclanguage/1.20.1-47.3.27/mclanguage-1.20.1-47.3.27.jar 164[29Jan2025 20:36:50.719] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file /server/libraries/net/minecraftforge/mclanguage/1.20.1-47.3.27/mclanguage-1.20.1-47.3.27.jar is missing mods.toml file
    • How do you configure the entity reach of a custom weapon? Asking for 1.21 Minecraft parchment
  • Topics

×
×
  • Create New...

Important Information

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