This is a read-only snapshot of the ComputerCraft forums,
taken in April 2020.
Add A New Api(java)
Started by Russoul, 28 October 2013 - 12:39 PMPosted 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 ?
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.
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:
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:
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!")
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.
Posted 28 October 2013 - 11:32 PM
And then never distribute it to anyone.If so, you can decompile the CC jar and add whatever you'd like.
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 .
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.
Posted 29 October 2013 - 04:33 AM
Ok. Can someone help with turtleupgrades ?
Posted 29 October 2013 - 12:13 PM
Well yes, of course.And then never distribute it to anyone.If so, you can decompile the CC jar and add whatever you'd like.
What do you need help with, specifically?Ok. Can someone help with turtleupgrades ?