Easy-To-Use ComputerCraft Support?

  • The FTB Forum is now read-only, and is here as an archive. To participate in our community discussions, please join our Discord! https://ftb.team/discord

Reika

RotaryCraft Dev
FTB Mod Dev
Sep 3, 2013
5,079
5,331
550
Toronto, Canada
sites.google.com
Im not so experinced in Java yet and are only now learning to make MC mods but there is what I will do (psodu code and I will expect it to be like this)

a = new array()
b = new class_of_object()
b.itemID = 30761
b.metadata = 42
b.stackSize = 64
b.displayName = "Yeast"

a.append(b)

Then you only need to return a (the array) to CC. CC will then in Lua return

{
[ "itemID", 30761],
[ "metadata", 42],
["stackSize", 64],
["displayName", "Yeast"]
}
Again, I can only return number types, booleans, and strings.
 

Niels Henriksen

New Member
Jul 29, 2019
502
0
1
Again, I can only return number types, booleans, and strings.

You just said that the javadoc says "An array of objects, representing values you wish to return to the lua program."

number, booleans and strings ARE objects. Combine them in an array.
 

Reika

RotaryCraft Dev
FTB Mod Dev
Sep 3, 2013
5,079
5,331
550
Toronto, Canada
sites.google.com
You just said that the javadoc says "An array of objects, representing values you wish to return to the lua program."

number, booleans and strings ARE objects. Combine them in an array.
Did you not read the very next line? The javadoc says this:
Code:
Integers, Doubles, Floats, Strings, Booleans and null be converted to their corresponding lua type.
All other types will be converted to nil.

So whether it is a HashMap or a custom class or an array (inside the array) or a list or a TileEntity, it will not be accepted.


:3
 
  • Like
Reactions: FurryDJ

Niels Henriksen

New Member
Jul 29, 2019
502
0
1
Did you not read the very next line? The javadoc says this:
Code:
Integers, Doubles, Floats, Strings, Booleans and null be converted to their corresponding lua type.
All other types will be converted to nil.

So whether it is a HashMap or a custom class or an array (inside the array) or a list or a TileEntity, it will not be accepted.

Yes I was reading it. You are only allowed to use Integers, Doubles, Floats, Strings, Booleans and null and these will be converted (not by you but by CC) to their corresponding Lua type.

It means that you cant use a custom class or hashmap, but I don't know if you can use an array (maybe not).

I can be wrong and I haven't tried it yet and my skills in Java are not on that level.
But that's the way you normal will do it in programming and that's the way I'm doing it in .NET (C#) in my work.

We need Daniel "Dan200" Ratcliffe to answer on this.
 

Reika

RotaryCraft Dev
FTB Mod Dev
Sep 3, 2013
5,079
5,331
550
Toronto, Canada
sites.google.com
Yes I was reading it. You are only allowed to use Integers, Doubles, Floats, Strings, Booleans and null and these will be converted (not by you but by CC) to their corresponding Lua type.

It means that you cant use a custom class or hashmap, but I don't know if you can use an array (maybe not).
Seeing as I said so in that very line, I will go out on a limb and assume not.
 

Reika

RotaryCraft Dev
FTB Mod Dev
Sep 3, 2013
5,079
5,331
550
Toronto, Canada
sites.google.com
Well, it accepted it, but it suffers from readability issues, plus it now needs to be serialized to output something useful:
k9cY14K.png
 

Lathanael

New Member
Jul 29, 2019
959
0
0
OpenComputers is basically ComputerCraft with different crafting recipes.
While true, it has some unique features and more importantly for me: it is way more balanced compared to CC. If it's not something you consider worth doing i'll ask the OC team about it :)
 

Reika

RotaryCraft Dev
FTB Mod Dev
Sep 3, 2013
5,079
5,331
550
Toronto, Canada
sites.google.com
While true, it has some unique features and more importantly for me: it is way more balanced compared to CC. If it's not something you consider worth doing i'll ask the OC team about it :)
I am very leery about unauthorized plugins of this nature, as they can extremely easily unbalance the mod or screw up its design or techtree. Please do not request it.
 
Last edited:

CaseyRobinson

New Member
Jul 29, 2019
50
0
0
Maybe it's because OpenPeripherals has trained me to expect peripheral data formatted like that, but that's exactly what I would expect. Yeah, it's sort of clunky from the lua interpreter prompt like that, but it's pretty easy to use in a script.
 

Lathanael

New Member
Jul 29, 2019
959
0
0
I am very leery about unauthorized plugins of this nature, as they can extremely easily unbalance the mod or screw up its design or techtree.
I know you are very protective about your mods, which isn't all that bad and i mostly agree with what you have said in the past. But this leaves people like me hanging in the air. I will never go back and include CC in any of my personal packs because i do not like it's balance and approach to certain things.
What i am going to try is if the support for CC peripherals from OC already includes yours once v18 is released otherwise it leaves us with 3 possibilities once CC support is out:
  1. No OC support (the least desirable one for me)
  2. You include code for OC support the same as for CC
  3. You give the OC developers a list of the things you support for CC and let them implement it
Hopefully this can be resolved one way or the other way as long as it isn't option #1 :)
 

Reika

RotaryCraft Dev
FTB Mod Dev
Sep 3, 2013
5,079
5,331
550
Toronto, Canada
sites.google.com
I know you are very protective about your mods, which isn't all that bad and i mostly agree with what you have said in the past. But this leaves people like me hanging in the air. I will never go back and include CC in any of my personal packs because i do not like it's balance and approach to certain things.
What i am going to try is if the support for CC peripherals from OC already includes yours once v18 is released otherwise it leaves us with 3 possibilities once CC support is out:
  1. No OC support (the least desirable one for me)
  2. You include code for OC support the same as for CC
  3. You give the OC developers a list of the things you support for CC and let them implement it
Hopefully this can be resolved one way or the other way as long as it isn't option #1 :)
I see no reason they would listen to me for #3, as they would likely just see me as telling them what to do. So the end result would be it starting 'legitimate' (eg "getPower", "getItemInSlot"), it would quickly become "set Output for Coil beyond max allowed" or "set CVT ratio to 64" or "reduce engine temperature" or "pull item out of slot X".
 

Lathanael

New Member
Jul 29, 2019
959
0
0
I see no reason they would listen to me for #3, as they would likely just see me as telling them what to do. So the end result would be it starting 'legitimate' (eg "getPower", "getItemInSlot"), it would quickly become "set Output for Coil beyond max allowed" or "set CVT ratio to 64" or "reduce engine temperature" or "pull item out of slot X".
You seem to have a very negative "attitude"(I lack the proper word here as English isn't my native language hopefully you understand what i mean) to other modders sometimes. What good would it be for someone going against your will? The only outcome i can see is much bad blood (GT vs TiC anyone? [*hint* rhetoric reference don't answer to this one!]) and loss of trust for the people included in this event.
If someone really wanted to mess with your mods they could easily use ASM and Java Reflection to ensure a certain result using your mods but that requires some effort which probably isn't even worth the time. Sure it is a possibility that such a thing might happen but imo very unlikely!
What OpenPeripheral (addon for CC) and OpenComponents (addon for OC) really do is reading conditions/informations from blocks for either redstone control over certain stuff under certain conditions, displaying that information or if allowed by the other mods API set certain things(note the allowed by api)[like telling AE to craft something]. I think no harm would be done if such things were allowed.

It really depends on communication. A friendly and nice request is hardly something that gets turned into a mess. Now that i've written this wall of text i guess that i should say that i did never intend to offend you but due to english being only my second language some things might have come off wrong and i apologize if they did! Take my replies as something coming from someone who really likes to play with your mods and is concerned about their future and wants to make certain they can be played in a huge variety without breaking them.
 

Reika

RotaryCraft Dev
FTB Mod Dev
Sep 3, 2013
5,079
5,331
550
Toronto, Canada
sites.google.com
You seem to have a very negative "attitude"(I lack the proper word here as English isn't my native language hopefully you understand what i mean) to other modders sometimes. What good would it be for someone going against your will? The only outcome i can see is much bad blood (GT vs TiC anyone? [*hint* rhetoric reference don't answer to this one!]) and loss of trust for the people included in this event.
If someone really wanted to mess with your mods they could easily use ASM and Java Reflection to ensure a certain result using your mods but that requires some effort which probably isn't even worth the time. Sure it is a possibility that such a thing might happen but imo very unlikely!
What OpenPeripheral (addon for CC) and OpenComponents (addon for OC) really do is reading conditions/informations from blocks for either redstone control over certain stuff under certain conditions, displaying that information or if allowed by the other mods API set certain things(note the allowed by api)[like telling AE to craft something]. I think no harm would be done if such things were allowed.

It really depends on communication. A friendly and nice request is hardly something that gets turned into a mess. Now that i've written this wall of text i guess that i should say that i did never intend to offend you but due to english being only my second language some things might have come off wrong and i apologize if they did! Take my replies as something coming from someone who really likes to play with your mods and is concerned about their future and wants to make certain they can be played in a huge variety without breaking them.
I am not saying they would do it with hostile intent, but more along the lines of either complete unawareness of its ramifications (a very common thing with RC and the primary reason I do not allow the removal of machines, no matter the intention) or a "everyone can do their own mod their own way" mentality. I have run into both in the past - the former with a mod that allowed a different way to transport RC power (negated the 3D nature of the power system, nullifying gearboxes like the old RF compatibility did), and the latter when asking for the ability to exclude ReactorCraft nuclear waste from "item destruction" machines like TE's nullifier (the response I was given was "well don't make an item you should have to have a special way to dispose of then"). Fortunately, in the former case they were understanding and killed the project, but in the latter case, well...that exploit still exists.
This becomes especially pertinent knowing that people have been asking for CC support for a long time, often asking for control over things for which I would never give control, but another developer, not knowing my reasons, likely would do in an effort to please their users.
 

Lathanael

New Member
Jul 29, 2019
959
0
0
I am not saying they would do it with hostile intent, but more along the lines of either complete unawareness of its ramifications (a very common thing with RC and the primary reason I do not allow the removal of machines, no matter the intention) or a "everyone can do their own mod their own way" mentality. I have run into both in the past - the former with a mod that allowed a different way to transport RC power (negated the 3D nature of the power system, nullifying gearboxes like the old RF compatibility did), and the latter when asking for the ability to exclude ReactorCraft nuclear waste from "item destruction" machines like TE's nullifier (the response I was given was "well don't make an item you should have to have a special way to dispose of then"). Fortunately, in the former case they were understanding and killed the project, but in the latter case, well...that exploit still exists.
This becomes especially pertinent knowing that people have been asking for CC support for a long time, often asking for control over things for which I would never give control, but another developer, not knowing my reasons, likely would do in an effort to please their users.
Couldn't you include something like this in your request for support to other mod authors? Considering most of the current open source devs(Open Computers is open source and thus one could easily spot wrong doings!) are very open minded and i do not see an issue here. The worst you can get as an answer is the one you already got from that one dev about destroying ReC waste. The only thing lost would be a little bit of time spent on the request. The gain would be compatibility with another mod, a worthy trade imo.