Jump to content




Add A New Api(java)

api java

8 replies to this topic

#1 Russoul

  • Members
  • 14 posts

Posted 28 October 2013 - 01:39 PM

I need to create API (java) , like os, rednet, etc . Not a peripheral or turtleupgrade . How can i do it ?

#2 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,452 posts

Posted 28 October 2013 - 04:26 PM

You could look through the ComputerCraft API, but I'm fairly sure to be able to mount up a directory on a computer, you need to have a peripheral and it needs to be attached to that computer. If your API doesn't need to be java-side, you could just use a resource pack to load it up into rom.

#3 MKlegoman357

  • Members
  • 1,170 posts
  • LocationKaunas, Lithuania

Posted 28 October 2013 - 04:49 PM

Actualy, os API is half written in Lua and rednet API is fully written in Lua. What kind of API you want to create? If you want it to interact with the world then you would have to make a mod or use already made mod like OpenPeripherals.

You can also easily create an API in Lua like this:

We make a new file (program) and call it terminal:
function clear ()
  term.clear()
  term.setCursorPos(1, 1)
end

function resetColors (tc, bc)
  term.setBackgroundColor(bc or colors.black)
  term.setTextColor(tc or colors.white)
end

function reset (tc, bc)
  resetColors(tc, bc)
  clear()
end

notice: all functions that are going to be used outside the API have to be global.

Next we load it in our program and then use it:

os.loadAPI("terminal")

terminal.reset(colors.lightGray, colors.gray)

print("This is light gray text in gray background!")


#4 brett122798

  • Members
  • 298 posts
  • LocationIn the TARDIS at an unknown place in time.

Posted 28 October 2013 - 07:54 PM

Yeah, does this require the use of Java? If so, you can decompile the CC jar and add whatever you'd like.

#5 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 28 October 2013 - 11:32 PM

View Postbrett122798, on 28 October 2013 - 07:54 PM, said:

If so, you can decompile the CC jar and add whatever you'd like.
And then never distribute it to anyone.

#6 Russoul

  • Members
  • 14 posts

Posted 29 October 2013 - 01:38 AM

API should interact with minecraft thread (mod, like openperipheral) . Actually what I need : ihostedperipheral interface in cc api has callmethod method that provides with icomputeraccess . I need to create JAVA API which will act like peripheral that is included in every pc from start, like os .

#7 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 29 October 2013 - 01:47 AM

APIs available from OpenPeripheral first require a peripheral connected to the computer. There is no way to add a Java API without a peripheral attached to the computer.

#8 Russoul

  • Members
  • 14 posts

Posted 29 October 2013 - 04:33 AM

Ok. Can someone help with turtleupgrades ?

#9 brett122798

  • Members
  • 298 posts
  • LocationIn the TARDIS at an unknown place in time.

Posted 29 October 2013 - 12:13 PM

View Posttheoriginalbit, on 28 October 2013 - 11:32 PM, said:

View Postbrett122798, on 28 October 2013 - 07:54 PM, said:

If so, you can decompile the CC jar and add whatever you'd like.
And then never distribute it to anyone.
Well yes, of course.

View PostRussoul, on 29 October 2013 - 04:33 AM, said:

Ok. Can someone help with turtleupgrades ?
What do you need help with, specifically?





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users