Just Enough Dimensions

Just Enough Dimensions

4M Downloads

Suggestion: Mod access

SkullbocksDE opened this issue ยท 9 comments

commented

HI maruohon aka masa_,
in fact an awesome mod working flawless!

My suggestion: Make your mod accessible for other mods.

Currently I'm that far in modding that I'm able to access other mods, but I haven't found any static defines to get at least anything from your mod.

Are you able to rewrite some interfaces to have this working?

It would be awesome to have access to:
public List getRegisteredDimensions();

To get the entire list of custom defined dimensions from your JSON config.

What I want to achieve is:
Getting rid of silly dimension numbers in my mod, because they are really so not cool.

The plan would be:
Getting a list of all JED dimensions and resolve the name of each dimension to display a name for a dimension in my mod instead of that damn stupid dimension number.

Kind regards

commented

Yeah, I guess I should add some sort of basic API to the mod.

In your case, do you specifically need the list from JED, or just all dimensions in the game in general? I think this should be doable via the Forge DimensionManager class. You can get a list of registered dimension from there, and then you should be able to get the name for each dimension from its DimensionType.

commented

Hi masa_,

I would be happy about some sort of:
static String getNameOfDimension( int dimension ); //Empty=not available

Maybe other modders would be happy too about such a nice little feature. I could imagine a mod for custom join messages for each dimension using that function: Welcome to %s - a magical world.

But in fact at least a basic API would be overwhelming!

Kind regards

commented

Well, to just get the name of the dimensions, you can definitely get them from the DimensionManager. And in fact, that's how I do it in the /jed listregistereddimensions command as well. You can look at https://github.com/maruohon/justenoughdimensions/blob/master/src/main/java/fi/dy/masa/justenoughdimensions/world/util/DimensionDump.java for a reference.

commented

Hi masa_,

good point, but I'm missing the dimension id to let this really happen. You know? Like the above example. I need to get the name from its corresponding dimension, otherwise I'm stumbling in the deep dark. :-)

commented

Your DimensionDump would need something like the following:

public static HashMap<Integer,String> getNamedDimensions()
    {
    	HashMap<Integer,String> ret = new HashMap<Integer,String>();
        DimensionDump dimensionDump = new DimensionDump(6);
        Integer[] ids = DimensionManager.getStaticDimensionIDs();

        for (int i = 0; i < ids.length; i++)
        {
            DimensionType type = DimensionManager.getProviderType(ids[i]);

            if (type == null)
            {
                continue;
            }

            String dimId = ids[i].toString();
            String name = type.getName();
            ret.put(ids[i], name);
        }
        return ret;
    }

Btw. I tried it on my own, but it fails the signing:

Execution failed for task ':signJar'.
> jarsigner returned: 1

Maybe because of the missing keyStore?
keyStore = "../../../keystore_masas_mods.jks"

Have a nice day.

commented

Yeah I need to fix/change the build script so that it doesn't try to sign the mod if the key store isn't present, which obviously would be the case for anyone else trying to build the mod...

commented

Yeah, I should take the time soon to fix the signing stuff in the build scripts of all my mods...

I'm not sure what you mean by including the snippet? Do you mean I should add that DimensionDump code above to the mod? I don't see the benefit really in adding that to JED, since that code has nothing to do with JED itself, it's just generic dimension query code using the Forge DimensionManager. Meaning that it can be added to any mod that needs the names, like yours. I also see two unused lines on that snippet, the DimensionDump instance for example is not needed for anything, and that is the only thing referenced from JED code.

And as to the build failing, in the mean time before I fix the build script, you can bypass that issue by simply commenting out the signing stuff, ie. lines 94 to 104 in build.gradle, or I guess even just line 104.

commented

Hi masa,
it seems like you're a busy person, but as long as you didn't find any time to remove/change the signing process or creating an accessible API. would you mind to include the snippet from above (after a short verification of you)?

commented

Hi masa,
no problem. I needed to comment out the part "certificateFingerprint = Reference.FINGERPRINT" too and the lines 112 to 129 in JustEnoughDimensions.java

After then I was able to include my snippet. I was about to say to include the snippet temporary to have a running solution for me, but now I've my modification running waiting for your signing fix and the API.
Have a nice day