Epic Fight

Epic Fight

13M Downloads

[FEATURE] Increased compat so other mods can view DefinedWeaponTypes.TYPES

pitbox46 opened this issue ยท 6 comments

commented

I would have made a pull request, but it seems like the code hasn't been pushed for 1.17 yet.

I am the dev of Epic Fight NBT Integration, so I am asking for slightly more compat for the 1.17 version. Currently DefinedWeaponTypes.TYPES is private. I would appreciate if either the constant were public or perhaps if there was a method that returned an immutable copy of TYPES.
If you add weapons in the future, currently I have to manually add each one so my mod can use it. If I could access TYPES however, this process would be automatic for me.

commented

Is DefinedWeaponTypes#get method can't solve this problem?

commented

Something like this would be best since I would also need access to the keys.

public static ImmutableMap<String, Function<Item, CapabilityItem>> getTypes() {
    return ImmutableMap.copyOf(TYPES);
}
commented

Ok, I'll add this method in the next 1.17.1.

commented

It doesn't solve the issue since it requires the string to begin with.

commented

I see. Can this kind of method solve your problem?

public static Collection<Function<Item, CapabilityItem>> getAllTypes() {
return TYPES.values();
}

commented

Thanks!