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

Hi, I working on my mod called AdvanceTime, and Minecraft stores its ticks in type long. I added this code into my project, however I would like to see this in Forge.

 

[net.minecraftforge.common - Properties.java]

 

public enum Type
    {
        STRING,
        INTEGER,
        BOOLEAN,
        DOUBLE,
        LONG;
...

 

/**
     * Returns the value in this property as an long,
     * if the value is not a valid long, it will return the
     * provided default.
     * 
     * @param _default The default to provide if the current value is not a valid long
     * @return The value
     */
    public long getLong(long _default)
    {
        try
        {
            return Long.parseLong(value);
        }
        catch (NumberFormatException e)
        {
            return _default;
        }
    }
    
    /**
     * Checks if the current value stored in this property can be converted to an long.
     * 
     * @return True if the type of the Property is an long
     */
    public boolean isLongValue()
    {
        try
        {
            Long.parseLong(value);
            return true;
        }
        catch (NumberFormatException e)
        {
            return false;
        }
    }

 

Also for the config file, I would like to to "L" instead of "D"

 

VR:

Neometron

Longs are just two ints.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

  • 2 months later...

But the person with the file open in a text editor, configuring the mods they have installed usually doesn't see it that way...

you can't parse your own long? because it looks like forge offers string config types.

  Quote
I think its my java of the variables.

  • 5 months later...
  • Author

I forgot about this old post, but AdvanceTime is released and it justify updating.

 

  Quote
Longs are just two ints.

Yes, but that was not what I was requesting.

I basically gave the code; why make mod developers dance around this one property type when it should be part of Forge?

 

  Quote
you can't parse your own long? because it looks like forge offers string config types.

Yes, this is what I ended up doing ;) However, why should I? Getting values from all other property types is pretty and clean, except when it comes to parsing longs with try-catch everywhere.

 

 

Guest
This topic is now closed to further replies.

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.