Is it possible to make a native API in Java and have it picked up in ComputerCraft?
If so, how would I do that?
Native Java Api Possible?
Started by distantcam, Oct 20 2013 10:45 PM
9 replies to this topic
#1
Posted 20 October 2013 - 10:45 PM
#2
Posted 21 October 2013 - 12:19 AM
You can write java code that is executed by computers using peripherals. Check out this link for the very plain basics. Beyond that, I'm in the process of writing up a peripheral tutorial which may or may not get posted sometime this month (between frequent MC/Forge updates and real life, I've had a lot of trouble getting anything done). Assuming you don't already have background modding experience, check out this to learn about actually making a mod.
As for making an actual API that has no physical block in the world, I'm afraid that's quite difficult. You can make blocks in the world into peripherals, as exampled by OpenPeripheral, but making an API without a peripheral is essentially impossible without deobfuscating/messing around with native CC code, which is not allowed.
As for making an actual API that has no physical block in the world, I'm afraid that's quite difficult. You can make blocks in the world into peripherals, as exampled by OpenPeripheral, but making an API without a peripheral is essentially impossible without deobfuscating/messing around with native CC code, which is not allowed.
#3
Posted 21 October 2013 - 10:04 AM
I had thought about doing it as a peripheral, so I'm glad that'll work and was the right track.
Is it worth asking if future versions of ComputerCraft could support native APIs?
Those links were helpful, thanks! Now to relearn Java (it's been 11+ years).
Is it worth asking if future versions of ComputerCraft could support native APIs?
Those links were helpful, thanks! Now to relearn Java (it's been 11+ years).
#5
Posted 21 October 2013 - 06:34 PM
Lyqyd, on 21 October 2013 - 11:31 AM, said:
They already do; see "Peripherals". As for java code loaded solely from Lua code, that will never happen.
I meant without needing a peripheral.
I'm curious as to why loading java as an API without a peripheral would never happen. Is it a security problem? Technical problem?
#6
Posted 21 October 2013 - 06:46 PM
Probably both, but a big concern would be that it would allow code to break out of the Lua sandbox.
#7
Posted 21 October 2013 - 07:33 PM
Interesting.
Wait, does that mean that peripherals run outside the Lua sandbox? So peripherals are running in Minecraft outside of ComputerCraft?
That's a pretty neat way of dealing with plugins that might potentially crash and bring down Computercraft. Although really that's just shoving the problem back onto Minecraft.
Wait, does that mean that peripherals run outside the Lua sandbox? So peripherals are running in Minecraft outside of ComputerCraft?
That's a pretty neat way of dealing with plugins that might potentially crash and bring down Computercraft. Although really that's just shoving the problem back onto Minecraft.
#8
Posted 21 October 2013 - 07:38 PM
distantcam, on 21 October 2013 - 07:33 PM, said:
Wait, does that mean that peripherals run outside the Lua sandbox? So peripherals are running in Minecraft outside of ComputerCraft?
#9
Posted 22 October 2013 - 02:27 PM
Alright, well I've posted the peripheral tutorial here. Note that the tutorial is still in it's early stages so may have slightly incorrect and/or not understandable information. Hopefully it will help you out. You can check out the full code here if you would prefer to learn by example.
#10
Posted 23 October 2013 - 11:08 PM
Bubba, on 22 October 2013 - 02:27 PM, said:
great tutorial btw,
but yes a peripheral will call back into its java programming so maybe just add a peripheral like a command block where a method can be called with some code as an argument and then it can be run somehow
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











