skyboy / MineFactoryReloaded

104 stars 75 forks source link

Support for Additional Machines #575

Open TomShkurti opened 8 years ago

TomShkurti commented 8 years ago

I've been trying to make a few new MFR machines for personal use (and possibly publishing them as add-ons much later on), and while it's POSSIBLE to add new blocks that use the MFR interface and generally look and act like MFR machines, it's a very convoluted and hackish process that involves directly copying around 700 lines of code and creating "clones" of BlockFactoryMachine and BlockFactoryMachineItem. I don't know, maybe I'm just doing it wrong and this is already supported, but additional expandability would be nice.

skyboy commented 8 years ago

The capability sorta exists by mirroring much of what MFR does with the machine block registration and re-using the Machine class, but there's no real proper support for it. It should work fine to register your own blocks, giving MFR a couple blocks of room (so above index 5) for expansion if it needs it but the concept has never been tested, and multiple addons would potentially conflict.

TomShkurti commented 8 years ago

Looking over what I did, maybe moving some/most of the functionality of Machine and BlockFactoryMachine to another class, then having Machine and BlockFactoryMachine inherit THAT and do the part where they are actually added to the Machine registry?

I have no problem making the machines I've added show up without being in the registry- I can even sort of replace existing machines- it's just a lot of cloning.

skyboy commented 8 years ago

Machine is self-registering once you create an instance; It just needs blocks associated in a hashmap; It'd let you get away with using most of MFR's base code, but configuration has to be handled somewhat manually and some care needs to be taken that Machine instances you didn't make don't read from your config. It does otherwise look like everything is essentially set up for addons to easily extend. When I move minecraft versions I'll more properly integrate the concept.