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

Logistics pipes and meta-data

Started by asparagus, 11 September 2016 - 05:18 PM
asparagus #1
Posted 11 September 2016 - 07:18 PM
For starters, the information present at: http://rs485.network...mputerCraft_API is highly outdated and therefore I'd kindly ask you not to redirect me there.

I've read multiple threads on multiple different websites, scanned other peoples programs and have tried multiple attempts at prompting a logistics request pipe to send me an item based upon both the id and the metadata. With multiple mods implementing id's with metadata iterations, single id's really don't cut it.

I found this thread: http://www.computerc...ogistics-pipes/


It helped get me on the right track and simplify my current request situation, but this still doesn't help with the meta data issue.
So, working with the bit of code KingofGamesYami supplied to help the OP in that thread, how would I go about adding metadata to the request ID? The whole Item Identifier thing confuses me.


local function easyRequest( itemID, amount )
  local result = lp.getLP().getItemIdentifierBuilder()
  result.setItemID( itemID )
  lp.makeRequest( result.build(), amount )
end
easyRequest( "minecraft:stone", 1 )
KingofGamesYami #2
Posted 11 September 2016 - 07:25 PM
I think you're looking for setItemData.


local function easyRequest( itemID, amount, meta )
  local result = lp.getLP().getItemIdentifierBuilder()
  result.setItemID( itemID )
  result.setItemData( meta ) --# add the metadata to the item identifier
  lp.makeRequest( result.build(), amount )
end
easyRequest( "minecraft:stone", 1, 4 ) --# I don't actually know anything about metadata so 4 might not be valid
asparagus #3
Posted 11 September 2016 - 07:48 PM
I think you're looking for setItemData.


local function easyRequest( itemID, amount, meta )
  local result = lp.getLP().getItemIdentifierBuilder()
  result.setItemID( itemID )
  result.setItemData( meta ) --# add the metadata to the item identifier
  lp.makeRequest( result.build(), amount )
end
easyRequest( "minecraft:stone", 1, 4 ) --# I don't actually know anything about metadata so 4 might not be valid

How'd you go about finding "setItemData"? Is that part of the logistics pipe api?
KingofGamesYami #4
Posted 11 September 2016 - 08:19 PM
It was posted here.
I use a simple for loop to get a list of functions available to an itemEdintifierBuilder object (see post #6 in that thread for the actual code).

Edit: I actually wrote a tutorial on this subject (not logistics pipes specifically, but peripherals in general).
Edited on 11 September 2016 - 06:22 PM
asparagus #5
Posted 11 September 2016 - 09:23 PM
Ahhhhh, I got it now. I figured it was something as simple as adding a meta number somewhere in the function. Many thanks