Skip to content

Conversation

@BirbIrl
Copy link
Contributor

@BirbIrl BirbIrl commented Mar 10, 2025

This is the backported version of @AsterAether, @Karotte128, @McArctic and I's efforts at bringing the logistics blocks to full compatibility with computercraft!
The original PR can be found here: #7669
The wiki PR is here: Creators-of-Create/wiki#4
And there's also a minimal serial test world made specifically for this PR: https://github.com/BirbIrl/Create-CC-Integration-Tests
Note that 1.20.1 is technically the "base" branch for us, and our 1.21.1 branch merges these commits in with extra patches.

Oh also there's like 10 lines that got edited out cuz of linting (probably cause of me, i refuse to use an IDE and rock neovim just to feel something), whoops! I'm afraid of adding commits to undo that as to not confuse git with what should be merged and how between the branches. Hope that's okay!

oh and Aster, Karotte and Arcitc all have equal say here. if you have any questions and i'm unavailable when they are - take their word and assume i agree with them! :D

BirbIrl and others added 30 commits March 7, 2025 18:42
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
…getting to set a variable t what they want it to be
Order is off when placing into requester
fixed the ordering bug
Added some safety stuff and made it actually save
Added a check to respect the redstone requesters default 256 max item limit
@BirbIrl
Copy link
Contributor Author

BirbIrl commented Jun 22, 2025

Passed my finals, did some tweaks, here's a status update:

  • The PR is now officially feature complete. Any new commit should be a bugfix/cleanup.
  • The wiki PR is very outdated and i'll be working on it this week
  • I'm still working on my serial tests, which already squashed one bug, so there's a good chance i'll find another by the time i'm done

Future plans we'd love to implement (well), but didn't get to:

  • implement the generic inventory api handler for the stock ticker, so we can export items from it. Currently held back by jank on CC's end on adding generic capabilities to IPeripheral's and nesting functions and general not-worth-the-effort-ness on my end, since it's possible, would just be a lot of rewriting. Related topic here API Question abt generic inv handler cc-tweaked/CC-Tweaked#2225

  • Add events for packagers, repackagers, stock tickers, frogposts, postboxes, stock links (which aren't a peripheral yet) etc. The events would trigger when:

    • orders are made
    • packages are made
    • packages are received

    Currently waiting for Add ComputerCraft integrations to more devices (1.20.1 edition) #7453 to get pulled in first.

  • Cleaning up redstone requester's .configureCraft() to not get reset when the player interacts with it. Context: Computer Craft integration for Update 6 Logistics Blocks  #7883 (comment)

  • Adding requesting crafts with the stock ticker. Held back by the fact we're already testing our luck with how complex stock ticker's requestFiltered is so throwing more complexity at it sounds like a bad idea. I'd say after the redstone requester becomes 100% jank free, we can go about upping the stock ticker.

  • Currently the tablecloth (very rarely) refuses to update the model on the client after we change it's wares via code (probs a block update thing). We've tried basically everything, got it working, now one of the updates in the last 3 months makes it break randomly again lol. If you guys can find a way to fix it that'd be lovely, if you can even manage to reproduce it.

As for the serial tests i'm working on, i'm just making a super minimal world that can hopefully be crunched to a megabyte or two that works off a lua library i made to take snapshots of peripherals, then runs some operations one after another.
It also clones the mutable block entities above down into itself to make re-running it super quick for debugging

I know there's more correct ways to do tests, esp since this is like insanely hard to automate, but ideally when it's done you guys can have the script run on startup and if it succeeds place a dummy block that a proper serial test checks for - that's out of my scope though. The code for the tests should work for whatever approach it's run through
I'll have the world dir on my github when it's done done
tests
image

So, i'm gonna open the pr, as the code's not gonna be changing much from now on.
Back to whacking at the wiki and tests at my snail's pace now :>

@BirbIrl BirbIrl marked this pull request as ready for review June 22, 2025 16:09
@BirbIrl
Copy link
Contributor Author

BirbIrl commented Jun 24, 2025

The PR is now officially feature complete. Any new commit should be a bugfix/cleanup

I lied, added a new feature, now you can config the frogports to either send and recieve/only send with .getConfiguration and .setConfiguration. Reason being - i needed this for my serial tests :>

BirbIrl added 3 commits June 24, 2025 16:23
also had to refactor .configure and .configureCraft to .setRequest and
.setCraftingRequest for this
@uthoffcyra
Copy link

Hey all! I've been watching this PR from the sidelines, I'm not familiar with Java but moreso with the Lua side of things. I know this is nearing completion, and I don't want to add any more burden to you all, but I wanted know if there was any integration formed with ComputerCraft's event system?

It could be extremely useful to have an event that fires whenever, say, a Frogport or Postbox recieves a new package. If a player is waiting for a package with specific materials, a computer connected to it could detect that, see that the contents within match, and perform some other function like sending a message to that player, or activating a redstone lamp signifying that, or whatever.

Another example could be sending an update when a stock link's inventory updates, so that a program doesn't repeatedly need to check for them— the code would only be run when a change is made.

Again, not familiar with the Java side of things, and I don't believe Create has any integration with this elsewhere, so I'm not sure how realistic something like this would be. Regardless, thank you for your time!

@BirbIrl
Copy link
Contributor Author

BirbIrl commented Jun 25, 2025

I wanted know if there was any integration formed with ComputerCraft's event system?

oh yeah yup, just two messages ago, in the future plans section i've mentioned:

Add events for packagers, repackagers, stock tickers, frogposts, postboxes, stock links (which aren't a peripheral yet) etc. The events would trigger when:

(i don't blame you for not seeing that either, pretty sure the discussion under this PR is longer the gentoo install guide)

sending an update when a stock link's inventory updates

the network doesn't really know when inventories have items added to them. Every time you request a package, it checks if the corresponding items are available. (since y'know, you could have stock links attached to like 20 barrels, means you'd have to run 20 checks a tick for if any item was added)
You'd have to make designated import points with ledgers that log each item that goes in, and transmits it over the rednet

we will however try and make events for when any package is ordered in the future :>

so, this is planned, we're just waiting for elementW's event integration first, as to not double the implementation!

@uthoffcyra
Copy link

oh yeah yup, just two messages ago, in the future plans section i've mentioned:

Omg, I totally missed that I'm so sorry. Thanks for the clarification! The stock link limitation makes sense, and the ledger station doesnt sound like it would be too difficult of a work around anyways. Excited to see this PR eventually merge and see people make a lot of cool stuff with it. Great work, and good luck with the rest of the features!

previously the filter would break after comparing against the item,
defaulting to _mode = contains.
@BirbIrl
Copy link
Contributor Author

BirbIrl commented Jun 25, 2025

The test world is finished and available for anyone to try and contribute to when making changes to the create logistics compatiblity :D

right here: https://github.com/BirbIrl/Create-CC-Integration-Tests

For anyone that's part of the create team - do anything with it, it's licensed under MIT. It has served me well personally, letting me catch three bugs that previously went under the radar :>

I'm going to link the test world in the main post of this PR as well

@BirbIrl
Copy link
Contributor Author

BirbIrl commented Jun 28, 2025

after a good 3 months...

the PR is now super-duper done.

We have added computercraft functionality for:

On top of that, packages are now lua objects available by getItemDetail or getPackage for packagers, which let you peek inside the package and the encoded order, to make your own sorting system. if the package is held inside a packager it also lets you change the address it's shipped to.

There is a serial test world with it's own custom tool suite which i made because i noticed some update on the dev branch subtly broke one of our functions - this makes spotting such cases really quick and simple :>
Additionally since it's under MIT, you guys can grab anything written/built there and add it to your test suite.

We've made a wiki PR as well, it's on my github pages available to look at here. It has full documentation of everything we've added

Future plans we'd love to implement (well), but didn't get to:

  • implement the generic inventory api handler for the stock ticker, so we can export items from it. Currently held back by jank on CC's end on adding generic capabilities to IPeripheral's and nesting functions and general not-worth-the-effort-ness on my end, since it's possible, would just be a lot of rewriting. Related topic here API Question abt generic inv handler cc-tweaked/CC-Tweaked#2225

  • Add events for packagers, repackagers, stock tickers, frogposts, postboxes, stock links (which aren't a peripheral yet) etc. The events would trigger when:

    • orders are made
    • packages are made
    • packages are received

    Currently waiting for Add ComputerCraft integrations to more devices (1.20.1 edition) #7453 to get pulled in first.

  • Cleaning up redstone requester's .configureCraft() to not get reset when the player interacts with it. Context: Computer Craft integration for Update 6 Logistics Blocks  #7883 (comment)

  • Adding requesting crafts with the stock ticker. Held back by the fact we're already testing our luck with how complex stock ticker's requestFiltered is so throwing more complexity at it sounds like a bad idea. I'd say after the redstone requester becomes 100% jank free, we can go about upping the stock ticker.

  • Currently the tablecloth (very rarely) refuses to update the model on the client after we change it's wares via code. Reproducing it is completely random and i have, after testing the pr for hours this week, only seen it happen once, and when i re-ran a test to see if it would happen again, it didn't. The tablecloth is it's own living entity with a soul and it's only purpose is to toy with us. We tried fixing it like 10 different times, thinking we got it working, only for it randomly break after a month. This thing is beyond us and we're leaving it how it is. Good enough.

My job here is done :D, I'd like to thank everyone that worked with me on this PR:

  • @AsterAether, @Karotte128 and @McArctic for the tons of effort in setting the foundations of this PR over the first week of development, coding tons, discussing how we should do things and being part time janitors.
  • @lucyamonster for chipping a couple good ideas and planting code that then grew into even more good stuff, as well as being another part time janitor
  • @ShimmerGlass and @aearil for actually playing through a survival world with the PR, coding in a huuge chunk of functionality that we missed and fixing bugs
  • @MaxOrtGit for implementing the most complex systems in this pr, like the package+orderdata data structures and re-implementing requestFiltered into something great, as well as always being there to help debug this PR in this last week's stretch

plus two smoller thank-you's to:

  • @Electric131 for catching a missing functionality in requestFiltered and proposing a change we ended up re-implementing on top of MaxOrt's rework.
  • @uthoffcyra for actually reading the wiki PR and adding a couple edits to it

+ extra thanks for everyone being super chill and great to work with! Please don't see this as my pr just because it says so on github, this was a pretty equal team effort!

@BirbIrl
Copy link
Contributor Author

BirbIrl commented Jun 29, 2025

Happy to merge this as soon as you consider it ready.

oh yeah @simibubi this is the part where i @ you and mention that yes the pr is merge ready :D

@BirbIrl
Copy link
Contributor Author

BirbIrl commented Jun 29, 2025

Updated to match upstream, the test world passes all tests - apart from the bug i mentioned in the Hungry Frogs II commit comments 9d2127b#r161075530 where it yields negative, but after adding the missing ! it passes :D

@IThundxr
Copy link
Member

Thanks to everyone who contributed to this PR, this will definitely be something exciting for the folks who enjoy using CC:T alongside Create

@IThundxr IThundxr merged commit e0c859a into Creators-of-Create:mc1.20.1/dev Jun 29, 2025
1 check passed
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.