Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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

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.

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

 

  • Author
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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.