Jump to content




[question] would a disk-like mod count as a peripheral?

java

  • You cannot reply to this topic
8 replies to this topic

#1 tesla1889

  • Members
  • 351 posts
  • LocationSt. 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?

#2 Bubba

    Use Code Tags!

  • Moderators
  • 1,142 posts
  • LocationRHIT

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.

#3 tesla1889

  • Members
  • 351 posts
  • LocationSt. 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?

#4 Espen

    Curious Explorer

  • Members
  • 708 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.

#5 Orwell

    Self-Destructive

  • Members
  • 1,091 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.

#6 tesla1889

  • Members
  • 351 posts
  • LocationSt. Petersburg

Posted 12 November 2012 - 02:17 PM

View PostOrwell, on 12 November 2012 - 12:43 PM, said:

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.

#7 tesla1889

  • Members
  • 351 posts
  • LocationSt. Petersburg

Posted 12 November 2012 - 02:21 PM

View PostEspen, on 12 November 2012 - 12:33 PM, said:

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.

#8 Orwell

    Self-Destructive

  • Members
  • 1,091 posts

Posted 12 November 2012 - 02:23 PM

View Posttesla1889, on 12 November 2012 - 02:17 PM, said:

View PostOrwell, on 12 November 2012 - 12:43 PM, said:

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:/>

#9 Cloudy

    Ex-Developer

  • Members
  • 2,543 posts

Posted 13 November 2012 - 10:01 AM

The IMedia API isn't quite complete yet - hence why not released.





3 user(s) are reading this topic

0 members, 3 guests, 0 anonymous users