Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redstone requester + packager computercraft peripheral #7558

Closed

Conversation

Karotte128
Copy link

@Karotte128 Karotte128 commented Mar 2, 2025

This PR adds a CC:Tweaked (computercraft) peripheral for the new Redstone Requester and packager.
Let me know if you want any changes or additional peripheral functions :)

@Karotte128 Karotte128 changed the title Redstone requester comutercraft peripheral Redstone requester computercraft peripheral Mar 2, 2025
@Karotte128 Karotte128 changed the title Redstone requester computercraft peripheral Redstone requester + packager computercraft peripheral Mar 2, 2025
@uthoffcyra
Copy link

APIs for these new blocks would be awesome, though some documentation would be very helpful.

Redstone Requester

orderPackage(destination, item, amount)

Creates an order for a specific item from the stock network the Redstone Requester is tuned to.

  • destination: string. The address to be added as the package's destination label.
  • item: string. The ID of the item to be requested. For example, minecraft:quartz.
  • amount: integer. The number of the requested item to be packaged.

Packager

createPackage(destination)

Sends a signal to the Packager to draw items into a package with the specified address.

  • destination: string. The address to be added as the package's destination label.

  1. This is just what I could see from your code, is this correct?
  2. Does the function createPackage() throw if there is no destination provided, or does it create a package with no destination. The latter would likely be the desired (expected) outcome.
  3. The same goes for orderPackage(). If it was me, I would order the parameters as item and amount first, and then an optional destination at the end. An example in Lua is below.
local requester = peripheral.wrap('back')
requester.orderPackage('minecraft:quartz', 20) -- No destination address provided.
requester.orderPackage('minecraft:coal', 64, 'myfurnace') -- Destination address is provided.

Just my thoughts, however. Thank you for your work.

@Karotte128
Copy link
Author

Thank you for helping me on the docs.
The packager peripheral does use the old sign destination mechanic if no destination is provided. If you want a empty destination do not place a sign or give the function empty string.
The redstone requester is a bit different. I did not think about having empty destination because the package would get lost in the chain/belt system.
Currently you could pass a empty string, but if it is useful, I can change the argument order as you recommended.

@uthoffcyra
Copy link

Sounds great. Thanks for the clarification. In Create 6, packages without addresses can be picked up by Frogports that aren't given a name, so it may still be useful, but like you said passing an empty string may work just fine.

@VoidLeech VoidLeech added the pr type: feature PR adds a new feature or changes an existing feature label Mar 4, 2025
@McArctic
Copy link

McArctic commented Mar 6, 2025

Hey! Was looking over this pr, I think you should consider making requester.orderPackage() to be able to take in a table in place for the item string, this would allow the requester to have the same functionailty as in game.

@McArctic
Copy link

McArctic commented Mar 6, 2025

APIs for these new blocks would be awesome, though some documentation would be very helpful.

Redstone Requester

orderPackage(destination, item, amount)

Creates an order for a specific item from the stock network the Redstone Requester is tuned to.

  • destination: string. The address to be added as the package's destination label.
  • item: string. The ID of the item to be requested. For example, minecraft:quartz.
  • amount: integer. The number of the requested item to be packaged.

Packager

createPackage(destination)

Sends a signal to the Packager to draw items into a package with the specified address.

  • destination: string. The address to be added as the package's destination label.
  1. This is just what I could see from your code, is this correct?
  2. Does the function createPackage() throw if there is no destination provided, or does it create a package with no destination. The latter would likely be the desired (expected) outcome.
  3. The same goes for orderPackage(). If it was me, I would order the parameters as item and amount first, and then an optional destination at the end. An example in Lua is below.
local requester = peripheral.wrap('back')
requester.orderPackage('minecraft:quartz', 20) -- No destination address provided.
requester.orderPackage('minecraft:coal', 64, 'myfurnace') -- Destination address is provided.

Just my thoughts, however. Thank you for your work.

Hey, seems like this documentation is wrong

I think the correct way to call this method would be

requester.orderPackage('myfurnace', 'minecraft:coal', 64)

@McArctic
Copy link

McArctic commented Mar 6, 2025

I got bored and made a new pr build apon this #7757, I just added the changes I stated earlier aswell as a throw if the network does not have the stock requested :)

@Karotte128
Copy link
Author

I got bored and made a new pr build apon this #7757, I just added the changes I stated earlier aswell as a throw if the network does not have the stock requested :)

Oh, thank you!
Should I close this my PR now and use the updated one?

@McArctic
Copy link

McArctic commented Mar 6, 2025

I got bored and made a new pr build apon this #7757, I just added the changes I stated earlier aswell as a throw if the network does not have the stock requested :)

Oh, thank you! Should I close this my PR now and use the updated one?

Honestly, no clue, I am new to contributing to projects lol. Whatever you feel is best :)

@Karotte128 Karotte128 closed this Mar 6, 2025
@Karotte128
Copy link
Author

Closed, please use #7757

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr type: feature PR adds a new feature or changes an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants