
Custom conduit of previously registered type
BSFishy opened this issue ยท 4 comments
Issue Description:
I am trying to make a mod that adds a custom conduit to EnderIO. It is a power conduit, so keep that in mind. The issue is that whenever I try to register the conduit to the ConduitRegistry
, it says that the conduit's offset could not be set. This is because Offsets will not allow multiple of the same type of conduit to be registered.
What happens:
The game crashes, producing an error saying that an offset could not be registered.
What you expected to happen:
The conduit to be registered, and everyone is happy
Steps to reproduce:
- Create a new conduit
- Register it using a new ConduitInfo, but with a conduit's type that has already been registered
- Crash ;-;
Affected Versions (Do not use "latest"):
- EnderIO: 3.1.180
- EnderCore: 0.4.1.65
- Minecraft: 1.10.2
- Forge: 1.10.2-12.18.3.2281
Your most recent log file where the issue was present:
Not really unexpected, that interface is to register a new conduit type, not to add members to an existing type.
I could add a method to do that, could you please first try out if it would actually work?
/** Add a member to an already registered conduit type. The given 'info' MUST already be registered, you can access all registered types with getAll().
**/
public static void injectMember(ConduitInfo info, Class<? extends IConduit> member) {
conduitCLassMap.put(member, info);
final UUID uuid = UUID.nameUUIDFromBytes(member.getName().getBytes());
conduitMemberMapF.put(member, uuid);
conduitMemberMapR.put(uuid, member);
}
Test that code? If so, is it already built, and on a Maven server? I am using EnderIO as a dependency, from the CurseForge-provided servers. I can setup EnderIO to download from another source, if need be.
@HenryLoenwind I was not able to compile the project in my local environment. Is there any way I can get someone else to make a commit/compile it for me because I don't want to make a pull request, not knowing if it works, let alone compiles. Other thoughts are:
- There should be some sort of way it is checking to make sure the
ConduitInfo
is registered, i.e. something like this on the first line of that method you proposed:
if(!conduitInfos.contains(info))
throw new IllegalArgumentException("The specified ConduitInfo has not been added yet");
- I have a repository if you want to test it out over here