This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
ElvishJerricco's profile picture

CCTransport v2.1.2 (Redesign/Rewrite) - Not the mod we need, but the mod we deserve

Started by ElvishJerricco, 26 September 2013 - 12:36 AM
ElvishJerricco #1
Posted 26 September 2013 - 02:36 AM
CCTransport

CCTransport's old design has been totally retired in favor of a new one. It's a bit more useful this way.

GitHub - Download

There was a suggestion a while ago that CC should add the ability to serialize and deserialize items, a la Applied Energistics. The idea is generally not great in terms of balance and such, but it seems like such an obvious idea that it deserves to exist.

How to Use

It's a pretty simple to use mod. Place down the Serial Chest in the world, and attach it to your computer. The peripheral methods are as follows:
  • serialChest.serialize()
  • Remove exactly one item from the inventory and serialize it. Return: token, itemDetailsOrError If the serialization fails, token will be false and itemDetailsOrError will be the error message. If the serialization succeeds, the token is an alphanumeric, randomly generated string. itemDetailsOrError is a table with the same format as the turtle.inspect() return format.
  • serialChest.deserialize(token)
  • Deserialize a token into an item if possible. Parameter token: The alphanumeric token representing the item to deserialize. Return: success, errorMessage. Deserialization fails if the item currently in the serial chest isn't the same kind of item as the item being deserialized or if there isn't enough room left. If deserialization fails, the token is not invalidated. Deserialization succeeds if there is room for the item in the serial chest. The token is consumed and made invalid for reuse.
The serial_chest_update event

When a serial chest's contents are changed in any way, it emits a serial_chest_update event to all attached computers, where the event parameters are as follows:

local e, name, itemDetails = os.pullEvent("serial_chest_update")
  • Parameter name: The name of the peripheral that updated.
  • Parmaeter itemDetails: The details of the items in the chest.
Turtle Upgrade

Crafting a turtle with a serial chest makes a serial turtle, capable of using its peripheral just as an ordinary serial chest. It uses specifically the slot selected by turtle.select().

Changelog
Spoiler
  • v2.1.1
    • Bugfix
  • v2.1
    • Better Gradle versioning Base it on the tag and the commit.
    • Turtle Upgrade
  • v2.0
    • Complete rewrite.
    • 1.7.10
    • No longer open peripheral addon.
    • No longer uses single buffer for computers. Instead, you serialize and deserialize items.
    • No more sign stuff
  • v1.0.1
    • Fixed: Some inventories didn't work
  • v1.0.0
    • Added: ISidedInventory.getSlotsFromSide(side)
    • Added: ISidedInventory.pullFromComputerToSide(side)
    • Added: Sign.setText(text)
    • Added: Sign.getText()
    • Added: Sign.setLine(line, text)
    • Added: Sign.getLine(line)
  • v0.0.1
    • Initial
    • Added: IInventory.pushToComputer(slot, maxAmount)
    • Added: IInventory.pullFromComputer(slot)
Edited on 07 April 2015 - 11:21 PM
Zudo #2
Posted 26 September 2013 - 12:39 PM
Ooh, this looks nice :)/>
ElvishJerricco #3
Posted 26 September 2013 - 05:24 PM
Ooh, this looks nice :)/>

Thanks! Simple but useful. That's the goal right now.
electrodude512 #4
Posted 28 September 2013 - 03:31 PM
Cool! How hard would it be to make it save over chunk reload?
ElvishJerricco #5
Posted 29 September 2013 - 11:41 AM
Cool! How hard would it be to make it save over chunk reload?

Probably not too bad. But I don't really think it's a good idea to hold on to these item stacks in the computer. You could run into problems with different coroutines trying to use the buffer so it should be encouraged that people flush the buffer immediately after filling it, and i don't like the idea of people using the computer as some hackish, one-slot inventory.
ElvishJerricco #6
Posted 30 September 2013 - 05:51 PM
v1.0.0 is out. Added signs and sided inventories.

EDIT: Also the build script for the github repo is nicer.
Nathan1852 #7
Posted 08 October 2013 - 01:17 PM
Seems like pushFromComputer() doesn't work on most mod inventories. It didn't worked on all IC2 inventories and BC inventories for me… :(/>/>

After some testing, i found out that i can push Items from the Inventories into the computer, but i cannot push them into Inevntories from the Computer
Edited on 08 October 2013 - 12:02 PM
ElvishJerricco #8
Posted 08 October 2013 - 06:42 PM
Seems like pushFromComputer() doesn't work on most mod inventories. It didn't worked on all IC2 inventories and BC inventories for me… :(/> After some testing, i found out that i can push Items from the Inventories into the computer, but i cannot push them into Inevntories from the Computer

The function isn't pushFromComputer. It's pullFromComputer. It's worked for me in all my testing. Also, if the block is a sided inventory you can use pullFromComputerToSide instead of specifying a slot.
Nathan1852 #9
Posted 09 October 2013 - 08:48 AM
Seems like pushFromComputer() doesn't work on most mod inventories. It didn't worked on all IC2 inventories and BC inventories for me… :(/>/>/> After some testing, i found out that i can push Items from the Inventories into the computer, but i cannot push them into Inevntories from the Computer

The function isn't pushFromComputer. It's pullFromComputer. It's worked for me in all my testing. Also, if the block is a sided inventory you can use pullFromComputerToSide instead of specifying a slot.

Yeah, i didn't remebered the function name correctly. But i used the right one.

I theory, this should work with this code: http://puu.sh/4LApB.png and this setup: http://puu.sh/4LAqZ.jpg , right?
ElvishJerricco #10
Posted 09 October 2013 - 12:00 PM
Yeah, i didn't remebered the function name correctly. But i used the right one.

I theory, this should work with this code: http://puu.sh/4LApB.png and this setup: http://puu.sh/4LAqZ.jpg , right?

I'm not sure. I was fairly sure OpenPeripheral used "up" and "down." Not "top" and "bottom"

If that's not the issue, either the item in the computer buffer isn't allowed to be piped into the top, or I used the IInventory API wrong, which I'm fairly sure isn't true.
Nathan1852 #11
Posted 09 October 2013 - 03:31 PM
Yeah, i didn't remebered the function name correctly. But i used the right one.

I theory, this should work with this code: http://puu.sh/4LApB.png and this setup: http://puu.sh/4LAqZ.jpg , right?

I'm not sure. I was fairly sure OpenPeripheral used "up" and "down." Not "top" and "bottom"

If that's not the issue, either the item in the computer buffer isn't allowed to be piped into the top, or I used the IInventory API wrong, which I'm fairly sure isn't true.


Well, i just tested it with "up" and "down". It is still not working. And i am sure that Iron Ore can be piped into an electric furnace from the top…
ElvishJerricco #12
Posted 10 October 2013 - 02:06 PM
Well, i just tested it with "up" and "down". It is still not working. And i am sure that Iron Ore can be piped into an electric furnace from the top…

Fixed. Download v1.0.1
LaughingLeader #13
Posted 16 October 2013 - 07:16 PM
Thanks for making this mod! It goes really well with OpenPeripherals.

Now I can push items from my sort chest into the computer, and have another chest grab the items from there. Exactly what I needed for my system.
Jyzarc #14
Posted 14 November 2013 - 07:43 PM
What is your modpack policy?
ElvishJerricco #15
Posted 15 November 2013 - 02:40 AM
What is your modpack policy?

Don't claim it's not mine and you can use it for whatever you want.
Jyzarc #16
Posted 15 November 2013 - 05:17 PM
What is your modpack policy?

Don't claim it's not mine and you can use it for whatever you want.
Thank you, I will probably make a spotlight of this in a few days, but I dont really understand the getSlotsFromSide() and pullFromComputerToSide() methods, can you explain those?
ElvishJerricco #17
Posted 15 November 2013 - 09:59 PM
Thank you, I will probably make a spotlight of this in a few days, but I dont really understand the getSlotsFromSide() and pullFromComputerToSide() methods, can you explain those?

As you know, each inventory block has a set of slots representing each space you can put items in. OpenPeripheral gives you some level of access to these by letting you say "Move an item from slot a to slot b of the adjacent inventory." In a sided inventory, each side of the block corresponds to a certain few slots. getSlotsFromSide returns a table with all of those slots for a specified side.

With CCTransport, a computer has a small buffer inventory. It fits exactly one itemstack. You use pushToComputer(slot) to push an itemstack from the slot in the inventory to the buffer in the computer. To get it out, any inventory can then use pullFromComputer(slot) to pull the stack from the computer into the slot. In the case of sided inventories, pullFromComputerToSide(side) doesn't specify a slot. It specifies a side, and CCTransport tries its best to push the stack in, similar to piping an item in from that side with BuildCraft or something.
Jyzarc #18
Posted 15 November 2013 - 10:09 PM
Thank you, I will probably make a spotlight of this in a few days, but I dont really understand the getSlotsFromSide() and pullFromComputerToSide() methods, can you explain those?

As you know, each inventory block has a set of slots representing each space you can put items in. OpenPeripheral gives you some level of access to these by letting you say "Move an item from slot a to slot b of the adjacent inventory." In a sided inventory, each side of the block corresponds to a certain few slots. getSlotsFromSide returns a table with all of those slots for a specified side.

With CCTransport, a computer has a small buffer inventory. It fits exactly one itemstack. You use pushToComputer(slot) to push an itemstack from the slot in the inventory to the buffer in the computer. To get it out, any inventory can then use pullFromComputer(slot) to pull the stack from the computer into the slot. In the case of sided inventories, pullFromComputerToSide(side) doesn't specify a slot. It specifies a side, and CCTransport tries its best to push the stack in, similar to piping an item in from that side with BuildCraft or something.

Thank you, I will be doing a spotlight of this soon :D/>
Jyzarc #19
Posted 16 November 2013 - 12:12 PM
I cant get inv.pullFromComputerToSide(side) to work (I did wrap the peripheral of course). I assume the sides are the same you would use for something like the redstone api, so "left", "right", "back", etc. it just returns "lua:52: attempt to call nil" inv.getSlotsFromSide() to work either. All of the other methods work
ElvishJerricco #20
Posted 17 November 2013 - 09:46 PM
I cant get inv.pullFromComputerToSide(side) to work (I did wrap the peripheral of course). I assume the sides are the same you would use for something like the redstone api, so "left", "right", "back", etc. it just returns "lua:52: attempt to call nil" inv.getSlotsFromSide() to work either. All of the other methods work

The sided methods only work on ISidedInventories, not simple inventories like chests.
Jyzarc #21
Posted 19 November 2013 - 10:56 PM
It would be nice to have a method that returns true if there is something in the buffer, and maybe one that returns how many items are in it
ElvishJerricco #22
Posted 20 November 2013 - 02:16 PM
It would be nice to have a method that returns true if there is something in the buffer, and maybe one that returns how many items are in it

Not a bad idea. I'll get on that…

EDIT: Actually, can't do that very well. It would involve adding global functions to the computer, which I can't do through the CC API.
Edited on 20 November 2013 - 01:34 PM
Mikeemoo #23
Posted 23 November 2013 - 07:18 AM
Drop into #openmods IRC at some point, some changes happening to Open[x] that may effect you :)/>
Nathan1852 #24
Posted 28 November 2013 - 01:41 PM
And i found another bug…

It seems like CCTransport doesn't like Barrels from Factorisation that much.
It duplicates Items when i access it with a Computer and use .pushToComputer()
Jyzarc #25
Posted 01 December 2013 - 05:35 PM
And i found another bug…

It seems like CCTransport doesn't like Barrels from Factorisation that much.
It duplicates Items when i access it with a Computer and use .pushToComputer()
I dont know about this particular case, but generally speaking, barrels conflict/have conflicted with almost every other mod with item transport
Jyzarc #26
Posted 04 December 2013 - 11:40 PM
So I found this dupe bug in my attempts to make a basic slot machine. If you dont want to waste time trying to reproduce it you can use this script and follow what I did in the video.

[media]http://www.youtube.com/watch?v=R5ApmEUUX2k&feature=youtu.be[/media]

edit: these are barrels from Jabba by prof mobius btw
Edited on 04 December 2013 - 10:41 PM
andyoc #27
Posted 27 January 2014 - 04:08 PM
is there a way to check what item it has stored? this would be ideal for my quarry program if it does have such method!
ElvishJerricco #28
Posted 27 January 2014 - 05:10 PM
So I found this dupe bug in my attempts to make a basic slot machine.

I checked it out when you posted that and I checked it again just now. I cannot see any reason for this bug outside of the bugs barrels generally cause and I have no interest in special casing for other mods.

is there a way to check what item it has stored? this would be ideal for my quarry program if it does have such method!

Unfortunately this wouldn't be possible unless I could add APIs to the computer itself that do some Java rather than just to a peripheral.
Edited on 27 January 2014 - 04:12 PM
andyoc #29
Posted 27 January 2014 - 05:28 PM
such a shame would be a good add-on if it was possible thanks for the quick reply save me trying to figure it out myself i thought it stored the item it pulled from the chest into a variable or something?? it would be nice to read from it :(/>
Nathan1852 #30
Posted 16 April 2014 - 07:28 PM
Any chance that this gets updated for CC 1.6.x?
ElvishJerricco #31
Posted 30 October 2014 - 02:24 AM
With the lack of an official OpenPeripherals release for 1.7.10, I decided to update CCTransport to be a standalone CC addon that functions completely differently than it used to.
JustPingo #32
Posted 30 October 2014 - 09:47 AM
That is definitely awesome!
I have a few suggestions :
- A serializing turtle upgrade. Making the turtle able to serialize and unserialize in its own inventory.
- Something to make it less OP (energy consumption or something more creative!)
ElvishJerricco #33
Posted 30 October 2014 - 10:51 AM
That is definitely awesome!
Thanks!
- A serializing turtle upgrade. Making the turtle able to serialize and unserialize in its own inventory.
Good idea.
- Something to make it less OP (energy consumption or something more creative!)
Definitely don't want to tie this into any energy network as a requirement. CC likes being fairly standalone. I can definitely make turtles use some amount of fuel. But regular computers are a bit trickier…
JustPingo #34
Posted 30 October 2014 - 07:16 PM
Maybe you can add a fuel slot in the cereal chest, and then chest.refuel().

And by the way, if you keep the idea of fuel, that would be cool if you would set the amount of fuel needed for (de)serialization in the config file.
Edited on 30 October 2014 - 06:18 PM
ElvishJerricco #35
Posted 31 October 2014 - 03:48 AM
Updated. Changelog:
  • Better Gradle versioning Base it on the tag and the commit.
  • Turtle Upgrade
dokendo #36
Posted 01 January 2015 - 06:18 PM
Suggestion: a 2d dungeon explorer game with loot that deserializes into actual items.
zurbo #37
Posted 04 April 2015 - 03:47 AM
Hello,
I would like to know if I can use this mod in my (public) modpack and if yes what should I do for this ?
ElvishJerricco #38
Posted 04 April 2015 - 05:32 AM
Hello,
I would like to know if I can use this mod in my (public) modpack and if yes what should I do for this ?

Go ahead and use it. No issues here.
zurbo #39
Posted 04 April 2015 - 06:26 AM
ok thanks :)/>

but i have a (real) issue too:
http://pastebin.com/Jqru2Vmg
http://pastebin.com/HctUb7LY

the server crash like this every time
ElvishJerricco #40
Posted 04 April 2015 - 08:26 AM
ok thanks :)/>

but i have a (real) issue too:
http://pastebin.com/Jqru2Vmg
http://pastebin.com/HctUb7LY

the server crash like this every time

Silly bug. Should be good now.
zurbo #41
Posted 04 April 2015 - 02:45 PM
Humm

another crash :(/>
http://pastebin.com/GbzB6Ezs
ElvishJerricco #42
Posted 05 April 2015 - 02:45 AM
Humm

another crash :(/>
http://pastebin.com/GbzB6Ezs

… Did you actually update? That's exactly the issue the 2.1.1 release is supposed to fix. I'm not sure how that could be generated.
zurbo #43
Posted 05 April 2015 - 02:55 AM
yep i've updated it
but I've uploaded the wrong crash repport (my bad)
http://pastebin.com/GbzB6Ezs (edited)
ElvishJerricco #44
Posted 05 April 2015 - 10:31 PM
yep i've updated it
but I've uploaded the wrong crash repport (my bad)
http://pastebin.com/GbzB6Ezs (edited)

Hm strange. I'm not getting the same error, and I'm using the same versions of Forge, CC, and MC. Is this error occurring at launch or do you trigger it somehow?
zurbo #45
Posted 06 April 2015 - 12:58 PM
this occuring at launch :(/>
ElvishJerricco #46
Posted 06 April 2015 - 09:33 PM
this occuring at launch :(/>

Both me and SquidDev have tried to reproduce this crash under the exact same conditions as you and we aren't able to do so. The error you're getting is that the "getTabLabel" method for CreativeTabs can't be found, and that doesn't make any sense at all. Can you try a fresh install?
zurbo #47
Posted 07 April 2015 - 04:38 PM
I've uninstalled and reinstalled java (jre8) and forge but nothing changes… I have the exact same error:


java.lang.NoSuchMethodError: net.minecraft.creativetab.CreativeTabs.func_78013_b()Ljava/lang/String;


I will try it on annoter computer in the next weeks :)/>
Edited on 07 April 2015 - 02:38 PM
ElvishJerricco #48
Posted 07 April 2015 - 07:59 PM
I've uninstalled and reinstalled java (jre8) and forge but nothing changes… I have the exact same error:


java.lang.NoSuchMethodError: net.minecraft.creativetab.CreativeTabs.func_78013_b()Ljava/lang/String;

I will try it on annoter computer in the next weeks :)/>

Have you tried a fresh install of the mods?
zurbo #49
Posted 07 April 2015 - 11:32 PM
yep i've just try this a few minutes ago …. and also have the exact same bug :(/>

huum wait maybe I'm stupid but:
Is your mod available on server ?
If yes why the server should know the method to create creative tabs ?

cause yes … my issue is on the server only (client run normaly), maybe i should say that before to start wasting your time.
Edited on 07 April 2015 - 09:52 PM
ElvishJerricco #50
Posted 08 April 2015 - 12:52 AM
… Oh I feel dumb. I don't know why I never bothered to test it on a server, or why no one ever reported that it didn't work on a server. But yes, getTabLabel is @SideOnly(Side.CLIENT) so that is the problem.
ElvishJerricco #51
Posted 08 April 2015 - 01:21 AM
yep i've just try this a few minutes ago …. and also have the exact same bug :(/>/>

huum wait maybe I'm stupid but:
Is your mod available on server ?
If yes why the server should know the method to create creative tabs ?

cause yes … my issue is on the server only (client run normaly), maybe i should say that before to start wasting your time.

And there you go. I apologize for apparently never paying servers any mind. You should be good to go now with the 2.1.2 release.
AssossaGPB #52
Posted 08 April 2015 - 02:56 PM
Ah dang it, I was gonna make this eventually, but you beat me to it! Anyway, great work! I'm definitely going to get my server owner to install this and then use it rather than enderchests.
zurbo #53
Posted 08 April 2015 - 09:01 PM
thanks a lot :)/>