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

Refactor recipe serializers and make power crafting recipes visible in the recipe book #247

Merged
merged 14 commits into from
Sep 27, 2024

Conversation

eggohito
Copy link
Collaborator

@eggohito eggohito commented Jul 26, 2024

This PR does the following:

  • Overhauls how power crafting recipes are handled; it now registers the crafting recipes defined in powers to the recipe manager, making said crafting recipes visible in the recipe book. It also adds onto the tooltip when hovering over the widget for the recipe that determines whether the player is missing the required power for crafting the recipe.
  • Overhauls how crafting recipes are modified; the first matching crafting recipe is now wrapped with a wrapper that can conditionally modify the result stack of the crafting recipe. This change might lessen the lookup load compared to the previous impl. which used to make the recipe manager search through its entries twice (one to look for the first match, and two to look for the internal recipe that uses the modified_crafting (previously modified) recipe serializer.

eggohito added 2 commits July 26, 2024 23:39
+ Added `neo_recipe` power type temporarily.
+ Added `power_crafting` recipe serializer with the following fields:
    * `power`  - The power ID that corresponds to the recipe (The power must exist and use the `neo_recipe` power type, otherwise, it will cause an error.)
    * `recipe` - The recipe. (Must be a crafting recipe, otherwise, it will cause an error.)
* Renamed `modified` recipe serializer to `modified_crafting`.
* Renamed `power_restricted` recipe serializer to `legacy_power_crafting` and deprecated it in favor of using the `power_crafting` recipe serializer.
@eggohito eggohito added this to the 2.12.x milestone Aug 8, 2024
…alizers

# Conflicts:
#	src/main/java/io/github/apace100/apoli/Apoli.java
#	src/main/java/io/github/apace100/apoli/data/ApoliDataTypes.java
#	src/main/java/io/github/apace100/apoli/mixin/ServerPlayerEntityMixin.java
#	src/main/java/io/github/apace100/apoli/power/factory/PowerFactories.java
#	src/main/java/io/github/apace100/apoli/power/type/RecipePowerType.java
#	src/main/java/io/github/apace100/apoli/util/LegacyPowerCraftingRecipe.java
#	src/main/java/io/github/apace100/apoli/util/ModifiedCraftingRecipe.java
#	src/main/resources/apoli.mixins.json
@eggohito eggohito marked this pull request as ready for review August 20, 2024 15:42
* No longer uses a single instance structure; instead, uses a delegating crafting recipe for modifying the result stack of the affected crafting recipe
* Now affects the result stacks in the widgets of the recipe book
* Fixed `item_action_after_crafting`/`item_action_after_grinding` item actions not being executed
…alizers

# Conflicts:
#	src/main/java/io/github/apace100/apoli/Apoli.java
#	src/main/java/io/github/apace100/apoli/util/ApoliCodecs.java
#	src/main/java/io/github/apace100/apoli/util/MiscUtil.java
* Power recipes are now defined in powers again
* Power recipes are inserted into the recipe manager post-power reload, instead of validating already defined recipes
@eggohito
Copy link
Collaborator Author

I've decided to keep the old format for defining recipes in powers. Also, power crafting recipes will no longer be allowed to be used in recipe JSONs since power crafting recipes will be automatically registered to the recipe manager after all powers have been reloaded

@eggohito eggohito changed the title Refactor recipe serializers and add new power_crafting recipe serializer Refactor recipe serializers and make power crafting recipes visible in the recipe book Sep 24, 2024
@eggohito eggohito merged commit acd106a into 1.21.x/dev Sep 27, 2024
@eggohito eggohito deleted the feat/refactored_recipe_serializers branch September 27, 2024 09:36
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