-
Notifications
You must be signed in to change notification settings - Fork 549
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
Recipe Rewrite (API Only) #4256
base: master
Are you sure you want to change the base?
Recipe Rewrite (API Only) #4256
Conversation
Your Pull Request was automatically labelled as: "🔧 API" |
Slimefun preview buildA Slimefun preview build is available for testing! https://preview-builds.walshy.dev/download/Slimefun/4256/fa7e33aa
|
I'm going to throw together a showcase addon sometime next week to facilitate testing since I don't want to migrate any Slimefun stuff in this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some questions and comments my side but very excited for this, thank you!
@@ -0,0 +1,254 @@ | |||
# 2. Recipe rewrite |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
initial review is just on the adr - thank you for this by the way, it makes large changes like this much better :)
the recipe should be matched to items in a multiblock/machine when crafting. The base ones are: | ||
|
||
- Shaped/Shapeless: Exactly the same as vanilla | ||
- Subset: How the current smeltery, etc. craft |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we expand and say what this actually is
`RecipeInput`s are a list of `RecipeInputItem`s plus a `MatchProcedure` -- how the inputs of | ||
the recipe should be matched to items in a multiblock/machine when crafting. The base ones are: | ||
|
||
- Shaped/Shapeless: Exactly the same as vanilla |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Shaped/Shapeless: Exactly the same as vanilla | |
- Shaped/Shapeless: Exactly the same as vanilla. Shaped recipes need to be crafted exactly as defined. Shapeless need to be in the same order but can move (e.g. 3 sticks down the y axis could be on any x axis) |
(ngl shaped + shapeless are both wrong in mc...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think we have differing definitions of shaped/shapeless; for me:
- shaped means as long as the order and relative positions of the items are the same, they can be moved anywhere on the crafting grid and it will be crafted
- shapeless means as long as the all the specified items (and nothing extra) are there it will be crafted regardless of order
these are what mc does and i want to keep the naming consistent. i also don't see why they are 'wrong' per se, although ordered and orderless might have been a better name tbh
what you defined as shaped i think i would call smth like 'fixed', and as a player i dislike those kinds of recipes -- copper wire for example needs 3 copper ingots in the middle row, which means i can't shift click them in (to the top row), whereas if it were 'shaped' i could.
i probably wasn't clear enough that i wanted to move away from those recipes since they are pretty annoying as a player to use
ill add it in (albeit w/ different name), but i don't see a reason to use it over mc shaped
|
||
- Shaped/Shapeless: Exactly the same as vanilla | ||
- Subset: How the current smeltery, etc. craft | ||
- Shaped-flippable: The recipe can be flipped on the Y-axis |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
give an example
moved to `plugins/Slimefun/recipes/` (unless a file with its name already exists). | ||
|
||
Addons should do the same. (We recommend saving to | ||
`plugins/Slimefun/recipes/<your-addon-name>/` but it's not required). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wonder if we just make this required - otherwise i think we just have people overriding eachother.
On the first server tick, all recipes in the `plugins/Slimefun/recipes` folder | ||
are read and added to the `RecipeService`, removing all recipes with the | ||
same filename. This is why recipes should ideally be *defined* in JSON, | ||
to prevent unnecessary work. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
err interesting...
any reason to not just make plugins register their recipes? avoids the whole 1 tick thing.
Also ideally we just don't ever depend on a filename, that's not great.
RecipeService.registerRecipes(Path.of(getPluginFolder(), "recipes", "recipes.json"));
(this is reading from addon folder which i also think is fine)
same filename. This is why recipes should ideally be *defined* in JSON, | ||
to prevent unnecessary work. | ||
|
||
When loading JSON recipes, we also need to be able to tell the difference between |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need to do this? what's the use case?
|
||
While the server is running, recipes can be modified in code, saved to disk, or | ||
re-loaded from disk. New recipes can also be added, however not to any existing | ||
file (unless forced, which is not recommended) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not?
|
||
### Stage 4 | ||
|
||
On server shutdown (or `/sf recipe save`), **all** recipes are saved to disk. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this include ones where addons register them without a file? If so, why?
I like owners being able to change but I'd also like to not force that to be the case.
Co-authored-by: Daniel Walsh <[email protected]>
Co-authored-by: Daniel Walsh <[email protected]>
Co-authored-by: Daniel Walsh <[email protected]>
Description
The long awaited recipe rewrite (supersedes #4093)
Proposed changes
In short, adds true shaped/shapeless crafting, tagged inputs, and json (de)serialization (custom recipes)
Full ADR here
Related Issues (if applicable)
N/A
Checklist
Nonnull
andNullable
annotations to my methods to indicate their behaviour for null values