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

Computer Craft integration for Packager and Stock Ticker #7669

Open
wants to merge 7 commits into
base: mc1.21.1/dev
Choose a base branch
from

Conversation

BirbIrl
Copy link

@BirbIrl BirbIrl commented Mar 4, 2025

Hi, this is cross-linked with the wiki pr that has all the documenation. you can preview the documentation here. I added a new folder called "logistics" with the 2 new peripherals.

I also made an unlisted youtube video showcasing the PR: https://youtu.be/_zsRSmOwv90

The most notable additions are:
The blockentity for the packager now gets a new variable that only gets used if a powered on computer is actively connected to it - it overwrites the address it'd get from a sign with one from the computer, if one exists.
There is a full item-filtering-search-requesting algorithm made to work with the type-unsafeness of lua, working in spirit with how native Computer Craft does, and similarly to that of AdvancedPeripherals and similar bridging mods. Basically, type in some data, the Logistical system will get you a package matching that data under a given address. Full documentation here.

Couple notes:

  • I don't want to impede on the existing code, so I made 0 deletions and only insertions. Feel free to integrate anything into the game's main code if it's not a problem (packager's makePackage currently has to check if the package was made manually becuase .activate() doesn't return a value)
  • The filter algo i made and the item-listing method is made to match that of the native ComputerCraft library, hence why it's so cursed - along with all the lua type checking. I'm NOT super experienced with java so if any of you have wayyy better ideas on how to implement it, i wouldn't be surprised. It works - but it's hard to work with for anyone in the future wanting to contribute on this. I'm trying to make all the functions as feature-complete as possible though, as to not mess with people's existing code between versions.
  • I try and match each block's power equal to that of doing things manually. You can manually change the packager's address - so you can .setAddress(). You can request pretty much anything if you try hard enough manually, so the stock ticker can request via the filter algo i provided to HOPEFULLY match all cases. i based it off "i wonder how the filter worked in advanced peripherals" and tried to make it as good as possible :P
  • Default address for .request() is an empty string instead of no address because skill issue. Just sending null causes issues down the stack. the packager can handle null addresses just fine tho.
  • I burnt out before i could add frogposts :(. if anyone wants to take a shot at implementing them - feel invited!
    if this gets pulled in i'd also like to use their function to send events whenever a package is sent, whenever a package is received - et cetra. tons of room here. Could also add events to packagers to fire with the address of the package and contents whenever it pulls in an item :D.
  • Advanced Peripherals has a system for AE/RS integration that, whenever you try and get an item's details - it also gives you a fingerprint, that is all of the item's nbt, plus name, plus count - might be a good idea to implement that so we can pull out specific items in the storage without having to write filters.
  • I've also not set up ordering crafting recipes. Genuinely looked at how that system works, looked back at me trying to parse lua item details and went "ok i think i'll pass". If the code gets ever straightened out, getting that implemented somewhere in the future would be great,

and even with all that, this is a major CC implementation that expands the amount of things you can do in create by a LOT, while encouraging to use create's new features instead of sending and reading items by a wired CC network.
(oh also there is also full type checking and error handling with custom messages and examples to help guide players :>)

And thank you for making one of the best designed mods, i'm in love with 6.0!

BirbIrl added 7 commits March 3, 2025 18:34
added Packager's functionality as a CC peripheral, fixed a bug with the
stock ticker not counting the items if you didn't specify a max count
and cleaned things up. Just gotta fix the styling now.

sir a second styling fix has hit the pr

Squash linting + removed a pointless import i missed
enchantment checks exclusive, (one enchant per one set of enchant traits), made it so the number of enchants in the filter and items have to match. Will give a good example of it in the documentation linked in the pr
@BirbIrl
Copy link
Author

BirbIrl commented Mar 4, 2025

I've been grinding the pr for 3 days on and on, while i was in the zoneee but now i'm taking a bit of a break. I'll be editing this message with random things i might need to change (even if the fixes are really really easy, i don't have the time to test):

  • The stock ticker's "request" function probably shouldn't work if the network is locked. anyone could just put a pc next to it and request any item otherwise. Maybe that's still fine? unsure.
  • The packager should send an error whenever you try and make a package but it's connected to a network. currently it just returns false, which is fine, but errors are probably a better idea for this kind of behaviour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant