This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Tiin57's profile picture

[Java/Mod API] getIComputerAccessForID(int id);

Started by Tiin57, 09 January 2013 - 03:05 PM
Tiin57 #1
Posted 09 January 2013 - 04:05 PM
Not much else to say.
I'm having trouble creating a networking peripheral due to there being no way to get an IComputerAccess from just the ID. I know I could do it with reflection, but isn't the point of an API to avoid reflection that could require constant rewrites?
immibis #2
Posted 09 January 2013 - 04:16 PM
What if the computer isn't loaded?
What if there are two computers with that ID?
You can keep track of it yourself.
Dlcruz129 #3
Posted 09 January 2013 - 05:11 PM
What if the computer isn't loaded?
What if there are two computers with that ID?
You can keep track of it yourself.

1. Return null.

2. How would that happen?
Cloudy #4
Posted 09 January 2013 - 08:25 PM
Why would you need to get the IComputerAccess randomly like that? On attach() you're provided with one - so you don't need us to keep track.

Two computers with the same ID can easily happen in creative mode.
Tiin57 #5
Posted 09 January 2013 - 11:45 PM
Hmm. Ok, thank you for explaining the invalidity of the suggestion.