Hello, Im wondering if it is even possible to have a mod where there is java coding in game. I know there are mods that use forth and lua to do all sorts of crazy things in minecraft... so is java an option? I'm guessing this is probably unrealistic, but why? I tried forth and personally hate how the stack based environment works, and lua was alright, but I miss me some good ol' java.
Maybe a mod that makes us learn Java in a way where we could use it in game. And with enough development, even teach everyone how to actually make a mod.
Yeah that would be great. I think the main issue might be that java is more complex than forth, there might be an issue with coding it. How people do that stuff is beyond me, but I can't thank them enough for it. I think it would be cool to have even just single classes instead of whole projects, you could still do a ton with it. I personally would enjoy it most of it was like redpower, with the items it has, but just with java and not forth. Return statements could give you you're final answers to things. If returned as an int, maybe it could go to something like an io extender.
if you do, message me about it. i will advertise it as much as humanly possible if its smooth enough lol. And java isnt too hard to learn, im sure plenty of people would love it. It would also give the person real world knowledge.
It's actually fairly easy to be done. What's not as easy is to provide a proper development environment in the game, like an API that allows you to access the I/O of the circuitry or provides limited access to the file system. It requires a SecurityManager, after all it would be a potential vulnerability if just about anybody can program something on your server. That would be the main challenge, but getting it in the game... easy peasy.
Gimme some time though, I'm still working on other aspects of the mod before I'll implement a programming interface to the technic side.
I would say work on single player first, get that working, and then implement the security. On the mindcrack server im on, computercraft is disabled. A lot of servers do this because they dont want any griefing. I'm not sure how easily it can be done, but maybe separate the pack into different parts so that one can be disabled without the whole mod being broken. Im not sure if any of this will be hard/impossible, so take what i say with a grain of salt
im going to check out the mod, i have to mod my vanilla right now for it.
The thing is, Java actually provides something called a SecurityManager. That's why I spelled it like that, it already exists. I just haven't worked with it yet and don't know its full abilities. I think I should be able to restrict file system access as well as certain advanced features like additional class loading, bytecode manipulation, and the Reflection API. All these are things that both FML and my mod make use of to provide complex features, but they are just as dangerous and would not only result in Minecraft server grieving but could possibly ravage your maschine.
I'll definitely look into that as it is very important, I'd say. About server griefing... it depends on the API you provide.
oh, you know, i think ive heard of that when i was reading the java api.. maybe not though. and alright, thanks.
You are talking about bootstrapping a language with Java syntax; not an easy thing to do. If you want a basic API with Java syntax, that is one thing, but emulating a fully object oriented language is not a trivial thing to do. Aside from the IDE to program in, you need to then implement a file system in the game to handle the files: This is now an operating system. The only "language" I have seen implemented in MC was Lua on ComputerCraft, and really is was a Lua sysntax interacting with an API. I don't know what the end goal of "programming in Java inside of Minecraft" would be, but achieving the goals you seem to be putting forth would be a dubious proposition at best.
With that said, I'm not trying to stop you, only make you realize the scope of what you are trying to achieve.
You are talking about bootstrapping a language with Java syntax; not an easy thing to do. If you want a basic API with Java syntax, that is one thing, but emulating a fully object oriented language is not a trivial thing to do. Aside from the IDE to program in, you need to then implement a file system in the game to handle the files: This is now an operating system. The only "language" I have seen implemented in MC was Lua on ComputerCraft, and really is was a Lua sysntax interacting with an API. I don't know what the end goal of "programming in Java inside of Minecraft" would be, but achieving the goals you seem to be putting forth would be a dubious proposition at best.
With that said, I'm not trying to stop you, only make you realize the scope of what you are trying to achieve.
See, that's what I kinda thought. I felt there was a reason that people were using such lightweight programming languages. I honestly wouldn't mind if it was just a single class, no multiple objects. Like I've said, I am clueless when it comes to this. I do know, however, that I love how redpower works, which uses forth. I just hate the language. I've been reading a book on it and its not fun. Thanks for your opinion, I'm just wondering if its feasible, or if there is already a mod out there.
Yeah, it would be much easier to add support for the RhinoEngine. However, sandboxing the engine and adding mod support from Javascript isn't going to be easy. It's going to be a lot of work and most likely isn't worth it - what exactly do you hope to acheive from these scripts?
Yeah, it would be much easier to add support for the RhinoEngine. However, sandboxing the engine and adding mod support from Javascript isn't going to be easy. It's going to be a lot of work and most likely isn't worth it - what exactly do you hope to acheive from these scripts?
Have you checked the mod's abilities?
I intend to replace all trivial mods and tweaks and allow easy customization.
Also, I don't see the purpose in sandboxing (even though that should be relatively easy to do).
It really isn't that hard. All you need is a class loader... you'd write the Java file ingame in an editor, it is saved to a file. That file is then looked up, compiled, and using the classloader brought into the game. That's about it. You don't "simulate" Java, you use Java. Deals with the problem of the file system as far as you are concerned, but like I said, the real problem is to make it safe for server owners.
Concerning compiling of Java code, there are libraries out there that can do that at ease. True, it would be a dependency, but Forge can deal with that.
To do what you described would mean differentiating between Java files and in-game Java files. I don't know how much you know about Java, but at the very least you would need a JDK to develop the Java program, which is different than the standard user JRE, assuming you turn a blind eye to the technical fact that running a Java program using the computer's JDK inside another program is really not feasible. Java is compiled into byte code after being converted into class files, but it is still converted into native code on run time using a JIT compiler on a VM. You want to use a program running on this VM to in turn use the same VM to compile its byte code; something not technically feasible. To implement what you want, you need to write a VM for use inside of MC, you cannot use the computer's VM. A good explanation of how the Java compiling and rin process can be found in the explanations found here: http://stackoverflow.com/questions/1326071/is-java-a-compiled-or-an-interpreted-programming-language
Also, as I pointed out previously, I don't see a clear end goal here.
The only mod I have used for MC that has scripting in it is ComputerCraft, and as I said before it's really just a Lua wrapper around an API with basic printout and function (or in Java methods) building capability, not OOP like Java or C++. Once again, if you want a wrapper similar to ComputerCraft with Java syntax, that's one thing (although things like static variables and expressions can eradicated), but I see a HUGE technical headache and no real value in implementing Java inside of MC.
So a question to the OP and anyone else posting: What is the goal of implementing Java inside of MC? Moreover, if this is intended to be an instrument of teaching, this is probably the last place you want to try to learn Java.
To do what you described would mean differentiating between Java files and in-game Java files. I don't know how much you know about Java, but at the very least you would need a JDK to develop the Java program, which is different than the standard user JRE, assuming you turn a blind eye to the technical fact that running a Java program using the computer's JDK inside another program is really not feasible. Java is compiled into byte code after being converted into class files, but it is still converted into native code on run time using a JIT compiler on a VM. You want to use a program running on this VM to in turn use the same VM to compile its byte code; something not technically feasible. To implement what you want, you need to write a VM for use inside of MC, you cannot use the computer's VM. A good explanation of how the Java compiling and rin process can be found in the explanations found here: http://stackoverflow.com/questions/1326071/is-java-a-compiled-or-an-interpreted-programming-language
Also, as I pointed out previously, I don't see a clear end goal here.
The only mod I have used for MC that has scripting in it is ComputerCraft, and as I said before it's really just a Lua wrapper around an API with basic printout and function (or in Java methods) building capability, not OOP like Java or C++. Once again, if you want a wrapper similar to ComputerCraft with Java syntax, that's one thing (although things like static variables and expressions can eradicated), but I see a HUGE technical headache and no real value in implementing Java inside of MC.
So a question to the OP and anyone else posting: What is the goal of implementing Java inside of MC? Moreover, if this is intended to be an instrument of teaching, this is probably the last place you want to try to learn Java.
Computercraft with java syntax sounds nice, I'd be fine with that of its easier. But I'd rather have redpower with java syntax, would that be really cool. I just want java lol. I have no clue whether its possible or not.
Some people in this thread need to learn the difference between scripting (intepreted) languages and compiled languages and see that only scripting languages are practical to use for the ingame scripting. The rest goes to text files, and you don't want to turn Minecraft game into an advanced text editor or an IDE.
Thanks
true. Although, I feel more people know java than Forth and Lua. It would be an easier transition.
I would say work on single player first, get that working, and then implement the security. On the mindcrack server im on, computercraft is disabled. A lot of servers do this because they dont want any griefing. I'm not sure how easily it can be done, but maybe separate the pack into different parts so that one can be disabled without the whole mod being broken. Im not sure if any of this will be hard/impossible, so take what i say with a grain of salt
im going to check out the mod, i have to mod my vanilla right now for it.
oh, you know, i think ive heard of that when i was reading the java api.. maybe not though. and alright, thanks.
You are talking about bootstrapping a language with Java syntax; not an easy thing to do. If you want a basic API with Java syntax, that is one thing, but emulating a fully object oriented language is not a trivial thing to do. Aside from the IDE to program in, you need to then implement a file system in the game to handle the files: This is now an operating system. The only "language" I have seen implemented in MC was Lua on ComputerCraft, and really is was a Lua sysntax interacting with an API. I don't know what the end goal of "programming in Java inside of Minecraft" would be, but achieving the goals you seem to be putting forth would be a dubious proposition at best.
With that said, I'm not trying to stop you, only make you realize the scope of what you are trying to achieve.
Check my Youtube Channel, RxDTheMinecrafter!
See, that's what I kinda thought. I felt there was a reason that people were using such lightweight programming languages. I honestly wouldn't mind if it was just a single class, no multiple objects. Like I've said, I am clueless when it comes to this. I do know, however, that I love how redpower works, which uses forth. I just hate the language. I've been reading a book on it and its not fun. Thanks for your opinion, I'm just wondering if its feasible, or if there is already a mod out there.
I'll check it out, thanks. I'm thinking of making a mod pack that would be a red stone pack or programmers pack. I think it'd be cool.
Yeah, it would be much easier to add support for the RhinoEngine. However, sandboxing the engine and adding mod support from Javascript isn't going to be easy. It's going to be a lot of work and most likely isn't worth it - what exactly do you hope to acheive from these scripts?
Have you checked the mod's abilities?
I intend to replace all trivial mods and tweaks and allow easy customization.
Also, I don't see the purpose in sandboxing (even though that should be relatively easy to do).
To do what you described would mean differentiating between Java files and in-game Java files. I don't know how much you know about Java, but at the very least you would need a JDK to develop the Java program, which is different than the standard user JRE, assuming you turn a blind eye to the technical fact that running a Java program using the computer's JDK inside another program is really not feasible. Java is compiled into byte code after being converted into class files, but it is still converted into native code on run time using a JIT compiler on a VM. You want to use a program running on this VM to in turn use the same VM to compile its byte code; something not technically feasible. To implement what you want, you need to write a VM for use inside of MC, you cannot use the computer's VM. A good explanation of how the Java compiling and rin process can be found in the explanations found here: http://stackoverflow.com/questions/1326071/is-java-a-compiled-or-an-interpreted-programming-language
Also, as I pointed out previously, I don't see a clear end goal here.
The only mod I have used for MC that has scripting in it is ComputerCraft, and as I said before it's really just a Lua wrapper around an API with basic printout and function (or in Java methods) building capability, not OOP like Java or C++. Once again, if you want a wrapper similar to ComputerCraft with Java syntax, that's one thing (although things like static variables and expressions can eradicated), but I see a HUGE technical headache and no real value in implementing Java inside of MC.
So a question to the OP and anyone else posting: What is the goal of implementing Java inside of MC? Moreover, if this is intended to be an instrument of teaching, this is probably the last place you want to try to learn Java.
Computercraft with java syntax sounds nice, I'd be fine with that of its easier. But I'd rather have redpower with java syntax, would that be really cool. I just want java lol. I have no clue whether its possible or not.