austinv11 / PeripheralsPlusPlus

A pseudo-port of miscperipherals, with other stuff as well!
GNU General Public License v2.0
25 stars 27 forks source link

Remove ID requirement for Pocket Peripherals #77

Open SquidDev opened 9 years ago

SquidDev commented 9 years ago

The new pocket computer peripherals do look really cool. I was going to add them in CCTweaks, but looks like you beat me to them. :smile:.

Just wondering why you chose to use IDs rather than string identifiers? I know turtle upgrades use IDs but 'modern' MC uses string identifiers. If you use WorldSavedData and world.mapStorage you can store a string/id lookup table for them, then use Loader.instance().activeModContainer().getModId() to namespace identifiers based on mod.

It does look really cool though!

austinv11 commented 9 years ago

The thing is, vanilla CC has rudimentary support for pocket computer peripherals (and I say rudimentary because dan hasn't opened up an official API) and the upgrades are stored on a pocket computer's nbt as a short. For example, in vanilla CC, the modem upgrade gets written to a pocket computer's nbt as "upgrade:1s". I'm just changing the value of the upgrade to be in line with how CC does things. It also fits into how the CC api is currently used regarding turtle upgrades.

That being said, there isn't any peripherals created for pocket computers yet because it is still early in development. So I might end up using string identifiers. But thanks for the feedback!

Sorry for stealing a possible feature of yours!

SquidDev commented 9 years ago

Don't worry about stealing features - I have a massive feature backlog anyway.

I should probably have been clearer - instead of storing the string in the pocket computer, you can store a String <=> ID lookup table in the save folder - similar to how block and item IDs are implemented.

I'm perfectly fine with IDs instead - I just remember getting stressed out in 1.6 that I wouldn't cause ID conflicts with other mods, as well as checking the CC wiki's turtle ID list to ensure I was a long way away from any other mod. I'd consider CC's use of IDs a relic of 'the olden days' of modding - though also keeping your API in line with CC's is also important.

I didn't even realise that it was a short - thought it was just a boolean 'has modem' flag - shows you how long since I read the Pocket computer's source.

Gotta say, I hadn't realised how fleshed out this mod was until I started trawling through the source. :+1: