Hey, I'm trying to create an API that allows mods to connect their fences to modded ones, and other vanilla fences as this is normally impossible in 1.7.10. So far so good, however, there's a problem.
To get the vanilla fences to cooperate, I registered a substitute, which is my own class that extends the vanilla one, with slight changes to what it's willing to connect to. However, since I never changed the ItemBlock I tried to just give it the same ItemBlock, however I get the error of "The object substitution is already registered. This won't work" if I try to use the same ItemBlock as a substitute. I mean, the substitution already being registered is the whole point of why I want to substitute it! If I don't register an ItemBlock with the block, the ItemBlock disappears from the game and will give errors trying to load worlds that had it, as it seems registering a substitute for a block unregisters the ItemBlock unless you register a replacement.
The way around this I've found is to register an ItemBlock of the same class with the same inputs. However I feel like there's a better way to go about doing this. The reason this is such a huge problem is that registering a new instance of the ItemBlock causes it to show up twice in NEI and Creative. Now, another huge problem. Since many mods for 1.7.10 are old and dead, I made it so it'll automatically create connectable fences for certain mods. Not only does this cause the issue of the duplicate listing for them too, but some mods don't work correctly when a new instance of their ItemBlock is created. I tried to support RailCraft, however, the game crashes when trying to display the walls' ItemBlocks in Creative. I'm so close because the blocks work just fine! It's only when we talk about the ItemBlocks that we start getting severe issues. I've tried every way I could possibly think of to get an identical ItemBlock and all end in the same error as above. I tried making a newInstance() and I got an instantiation exception through Java.
How can I simply just use the same ItemBlock as before without creating a new one, avoiding this whole issue?