404 posts
Location
St. Petersburg
Posted 12 November 2012 - 08:45 AM
I want to make an item that has all the functionality of a disk in CC, but that has added functionality as well. Would this count as a peripheral, or what? And how would I do this?
1190 posts
Location
RHIT
Posted 12 November 2012 - 08:49 AM
Anything that you can use peripheral.wrap() on would count as a peripheral. Look around the forums and see if you figure out how to make one - I'm still learning myself and it is somewhat of a proccess. I would suggest that you download a java decompiler such as JD GUI and decompiling some other people's peripherals to get a general idea of how it's done (do not copy/paste their code!).
To write peripherals you must use Minecraft Coder Pack to decompile Minecraft and then add the ComputerCraft peripheral apis located
here to your project.
404 posts
Location
St. Petersburg
Posted 12 November 2012 - 08:54 AM
That's all fine and dandy, but does anyone know how to add a disk to CC?
715 posts
Posted 12 November 2012 - 12:33 PM
You could take a look at the disk class of ComputerCraft and use that as a guide for creating your own.
The problem is that you still need something to access your extended features, because the default disk drive won't be able to access them.
At most it can access only the parts of your disk that it has in common with the default disks.
So in addition to your disk you need to make your own disk-drive into which you can add the necessary code to access your features.
This drive will then be the peripheral that acts as an interface between your special disks and the computer.
1054 posts
Posted 12 November 2012 - 12:43 PM
Maybe you could use the IMedia API that comes with CC 1.46? It doesn't really enable you to add extra functionality, it just lets you implement your own way to set and get labels, to get the title of a record and to mount data. If you do need extra functions, then Espen's way is how to do it. A custom disk drive.
404 posts
Location
St. Petersburg
Posted 12 November 2012 - 02:17 PM
Maybe you could use the IMedia API that comes with CC 1.46? It doesn't really enable you to add extra functionality, it just lets you implement your own way to set and get labels, to get the title of a record and to mount data. If you do need extra functions, then Espen's way is how to do it. A custom disk drive.
Thank you Orwell, that sounds promising. Do you have a download link for that? The API I downloaded only has IComputerAccess and IPeripheral.
404 posts
Location
St. Petersburg
Posted 12 November 2012 - 02:21 PM
You could take a look at the disk class of ComputerCraft and use that as a guide for creating your own.
The problem is that you still need something to access your extended features, because the default disk drive won't be able to access them.
At most it can access only the parts of your disk that it has in common with the default disks.
So in addition to your disk you need to make your own disk-drive into which you can add the necessary code to access your features.
This drive will then be the peripheral that acts as an interface between your special disks and the computer.
The only CC functionality exactly mimicks the CC disk. The rest of the mod is completely separate.
1054 posts
Posted 12 November 2012 - 02:23 PM
Maybe you could use the IMedia API that comes with CC 1.46? It doesn't really enable you to add extra functionality, it just lets you implement your own way to set and get labels, to get the title of a record and to mount data. If you do need extra functions, then Espen's way is how to do it. A custom disk drive.
Thank you Orwell, that sounds promising. Do you have a download link for that? The API I downloaded only has IComputerAccess and IPeripheral.
Oh, well, it's definitely in the ComputerCraft mod itself: '/dan200/computer/api/IMedia.class'. You'll have to compile against it as a library to access it then. Or you could ask dan200 or Cloudy to publish the API, it's in the api folder anyway… :unsure:/>/>
2447 posts
Posted 13 November 2012 - 10:01 AM
The IMedia API isn't quite complete yet - hence why not released.