Skip to content

Conversation

@adam8797
Copy link

@adam8797 adam8797 commented Aug 14, 2025

This PR implements a workflow for users to both make and accept payments using numismatics coins (or cards) at Create shopkeepers.

Player Experience

Enabling the shopkeeper to accept coins

Opting into these features is as simple as placing a coin depositor next to the same stock ticker that serves the shop. It can be placed on any orthogonal side, like so:
Screenshot 2025-08-14 at 9 11 29 AM

The player may then optionally place a card in the depositor. If they do not insert a card, coins will be accepted but they will remain in the depositor.

Placing an order as a customer

If a customer attempts a transaction that does not include any numismatics coins in its costs, the player will not experience any difference. The standard Create shop mechanics will take over and fulfill the order.

If the order does have costs in the form of coins, they'll be prompted with a payment screen:

Screenshot 2025-08-14 at 9 10 57 AM

They can then place a card in the slot, or pay with coins out of their inventory. The Pay with Coins button is disabled if they do not have the requisite amount of coins available in their inventory.

Upon clicking one of the payment buttons, the transaction is processed, and then any non-coin item costs are processed in the standard way.

If the player pays with coins, we withdraw coins in a greedy fashion, and will break a coin into change if needed. This is a one-click coin payment, regardless of the number and variety of coins needed.

This patch does allow for payment of mixed item & coin, but each individual item can still only have a cost of a single item or coin.

Technical details

The main flow here is that of a deferred payment system. We intercept calls to the Create interactWithShop() function which is called whenever the player right clicks on a stock keeper with a shopping list. We check a handful of preconditions, and if they all pass we:

  1. Save the context of the current transaction, assign it a unique ID, and register it in a global registry, and cancel the underlying Create function call.
  2. Pop the menu open for the player to interact with, and they make a selection of payment method
  3. Once the selection has been made, we send a packet back to the server to complete a given deferred transaction.
  4. If the user abandons the menu, we send a packet back to void the deferred transaction.

resolves #119

@Bjorkan
Copy link

Bjorkan commented Oct 18, 2025

Wow! Looks awesome! Would love to test it out on my survival world. Is it okay just to build it from your PR or is there something else I would need to think about before testing it out? :)

@adam8797
Copy link
Author

Thanks! Yeah it should build just fine, and doesn’t need any extra dependencies.

Have fun! If you notice any issues that I didn’t catch lmk. No telling if the maintainers will actually accept the PR, so don’t get too attached just yet :)

@Bjorkan
Copy link

Bjorkan commented Oct 18, 2025

Thanks! Yeah it should build just fine, and doesn’t need any extra dependencies.

Have fun! If you notice any issues that I didn’t catch lmk. No telling if the maintainers will actually accept the PR, so don’t get too attached just yet :)

Sounds great! Have you heard anything from the maintainers? This PR is the only thing we missed while using this mod just now. We have a bank terminal infront of every shopkeeper, but to have a card to use is much cleaner. :)

I'll comment here if I find any bugs, and I wish you the best to getting this merged! I wish you a nice weekend here from Sweden!

@adam8797
Copy link
Author

I haven’t heard anything recently! However I get that they’re all volunteers and probably focused on Steam n’ Rails right now, so I imagine someone will get to it eventually.

And same here, it’s the main thing holding us back from having an economy really based on numismatics coins. I made this PR cause I was in the same position as you!

Hope you have a wonderful weekend as well :)

@Bjorkan
Copy link

Bjorkan commented Oct 21, 2025

Hello again @adam8797 !

I realized when I was compiling this that you have (for obvious reasons) aimed this for the 1.21 version, however the server me and my friends are on is 1.20.1. Is it still possible to compile or is there too big of a difference?

Take care!

@adam8797
Copy link
Author

Hey @Bjorkan yeah I can take a look, I may end up with a few hours today. It should be pretty easy, but if it turns into a big effort I probably wont unless the maintainers want to be supporting both 1.20 and 1.21

@Bjorkan
Copy link

Bjorkan commented Oct 25, 2025

Hey @Bjorkan yeah I can take a look, I may end up with a few hours today. It should be pretty easy, but if it turns into a big effort I probably wont unless the maintainers want to be supporting both 1.20 and 1.21

How kind! However feel no pressure from me to do it! I am just impressed with what you have already done! So don't push yourself!

Wishing you all the best :)

@adam8797
Copy link
Author

Hey Sorry @Bjorkan it looks like its gonna be more than just a simple rebase, so I'm not going to put the effort into back-porting to 1.20 for now... sorry! I tried it, but they made a number of changes between 1.20 and 1.21 that I'm not looking to try and unwind.

Hopefully if you all move the server to 1.21 in the future you can give it a try! :)

@adam8797
Copy link
Author

@IThundxr I noticed you pushed recently to 1.21.1/1.0.x, would you like me to re-base onto that?

@Bjorkan
Copy link

Bjorkan commented Oct 28, 2025

Hey Sorry @Bjorkan it looks like its gonna be more than just a simple rebase, so I'm not going to put the effort into back-porting to 1.20 for now... sorry! I tried it, but they made a number of changes between 1.20 and 1.21 that I'm not looking to try and unwind.

Hopefully if you all move the server to 1.21 in the future you can give it a try! :)

No need to apologize! 🥳 Thank you for taking a look!

@IThundxr
Copy link
Member

@IThundxr I noticed you pushed recently to 1.21.1/1.0.x, would you like me to re-base onto that?

That's fine, i can rebase it whenever we merge it

@adam8797
Copy link
Author

@Bjorkan you're in luck, my friends decided they wanted to run a pack on 1.20.1 so I'm backporting these changes anyway! I hope to have it done in a few days, if you're still willing to pilot the feature :)

@Bjorkan
Copy link

Bjorkan commented Nov 27, 2025

@Bjorkan you're in luck, my friends decided they wanted to run a pack on 1.20.1 so I'm backporting these changes anyway! I hope to have it done in a few days, if you're still willing to pilot the feature :)

Wow! Is that so? Of course! 🤩

@adam8797
Copy link
Author

@Bjorkan see the other PR I have open! It should build for Fabric and Forge, whichever you're running on. As always, please backup your world! I can't really see how it would break anything, but I don't want to be responsible if anything goes bad :)

Let me know if you find any issues!

@adam8797 adam8797 force-pushed the feature/shopkeeper_integration branch from d71997e to 76adb75 Compare November 29, 2025 22:35
@adam8797 adam8797 changed the base branch from 1.21.1/1.0.x-next to 1.21.1/1.0.x November 29, 2025 22:36
@adam8797 adam8797 changed the title Create 6 Shopkeeper payment integration Create 6 Shopkeeper payment integration (1.21.1) Nov 29, 2025
@adam8797
Copy link
Author

Ok, Sorry for all the noise. I've done the following:

  1. I've submitted a PR for the 1.20.1 branch (both forge and fabric)
  2. I've done a small refactor to this branch to bring it in-line with how its done in the 1.20.1 branch. If Create Fabric ever supports 1.21.1 we can implement this behavior in the same way as its done there.
  3. I squashed a bunch of commits, as I was getting tired of wrangling them all around.

Please let me know if there's anything else I can do!

@adam8797 adam8797 force-pushed the feature/shopkeeper_integration branch from 49e5ee7 to fcb37f3 Compare November 30, 2025 03:38
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.

3 participants