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

Support stack aware recipe remainders 1.19.2 #2556

Merged
merged 36 commits into from
Nov 20, 2022

Conversation

AlphaMode
Copy link
Contributor

This PR allows modders to add stack aware recipe remainders
This is useful for mods that adds custom buckets that support different fluids

This address the long lasting issue #50

Reopened from #2464

AlphaMode and others added 15 commits September 27, 2022 14:49
…/RecipeRemainderHandler.java

Co-authored-by: Technici4n <[email protected]>
…tem/CustomDamageTest.java

Co-authored-by: Salvatore Peluso <[email protected]>
…m/AbstractFurnaceBlockEntityMixin.java

Co-authored-by: Salvatore Peluso <[email protected]>
@AlphaMode AlphaMode changed the title 1.19.2 remaining Support stack aware recipe remainders 1.19.2 Sep 27, 2022
@Technici4n Technici4n added the next? Likely candidate for upcoming releases label Sep 27, 2022
Copy link
Member

@Technici4n Technici4n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few extra things I noticed while reviewing the PR, but nothing major. This is looking pretty good!

Copy link
Contributor

@devpelux devpelux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For other things i've tested and it works great.

Copy link
Member

@modmuss50 modmuss50 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The API and changes look great just a few nit picks. Nice work 👍

However I think extra care needs to be taken with this PR to help ensure that existing behaviour is not altered. This PR has some very delicate mixins touching some very delicate parts of the game. Updating to newer MC will have a good chance at silently breaking this logic.

Unlike some other hooks that clearly can only affect the behavour when mods are being used this has a high possibility of changing vanilla behavour when only fabric API is installed.

I hope you don't mind but I have added a gametest that fully tests the furnace part of this PR. It would be great to see the same done for the brewing stand and possibly the recipe (Will need a different approach) to help ensure the stability of this when going to newer MC versions.

Thanks a lot, let me know if you have any questions.

…e remainder stack instead of the original stack, refactoring.
@devpelux
Copy link
Contributor

devpelux commented Oct 14, 2022

I've added the remaining tests for brewing stand and recipe, please check them 👍

AlphaMode#2

AlphaMode and others added 3 commits October 15, 2022 19:25
Add automatized gametests for brewing stand and recipe mixins, fixed and tweaked something.
Use (0,1,0) position for game tests
@Technici4n Technici4n self-requested a review November 7, 2022 17:58
@modmuss50 modmuss50 added enhancement New feature or request last call If you care, make yourself heard right away! labels Nov 14, 2022
@modmuss50 modmuss50 added the merge me please Pull requests that are ready to merge label Nov 20, 2022
@modmuss50 modmuss50 merged commit fa140d5 into FabricMC:1.19.2 Nov 20, 2022
modmuss50 pushed a commit that referenced this pull request Nov 20, 2022
* Support stack aware recipe remainders

* Fix checkstyle

* Remove all overwrites

* Add FabricItemStack and make RecipeRemainderHandler thread safe

* Update fabric-item-api-v1/src/main/java/net/fabricmc/fabric/api/item/v1/FabricItem.java

Co-authored-by: apple502j <[email protected]>

* Update fabric-item-api-v1/src/main/java/net/fabricmc/fabric/api/item/v1/FabricItem.java

Co-authored-by: apple502j <[email protected]>

* Update fabric-item-api-v1/src/main/java/net/fabricmc/fabric/api/item/v1/FabricItem.java

Co-authored-by: apple502j <[email protected]>

* Update fabric-item-api-v1/src/main/java/net/fabricmc/fabric/api/item/v1/FabricItem.java

Co-authored-by: apple502j <[email protected]>

* Update fabric-item-api-v1/src/main/java/net/fabricmc/fabric/api/item/v1/FabricItem.java

Co-authored-by: apple502j <[email protected]>

* Update fabric-item-api-v1/src/main/java/net/fabricmc/fabric/impl/item/RecipeRemainderHandler.java

Co-authored-by: Technici4n <[email protected]>

* Remove hasRecipeRemainder, Update test mod and remove unneeded mixins

* Update fabric-item-api-v1/src/testmod/java/net/fabricmc/fabric/test/item/CustomDamageTest.java

Co-authored-by: Salvatore Peluso <[email protected]>

* Avoid copying the ItemStack

* Update fabric-item-api-v1/src/main/java/net/fabricmc/fabric/mixin/item/AbstractFurnaceBlockEntityMixin.java

Co-authored-by: Salvatore Peluso <[email protected]>

* Sneakily change duplicate keybinding to a less used key

* make everything thread safe and improve AbstractFurnaceBlockEntityMixin

* Update fabric-item-api-v1/src/main/java/net/fabricmc/fabric/api/item/v1/FabricItem.java

Co-authored-by: Technici4n <[email protected]>

* Update fabric-item-api-v1/src/main/java/net/fabricmc/fabric/api/item/v1/FabricItemStack.java

Co-authored-by: Technici4n <[email protected]>

* Update fabric-item-api-v1/src/main/java/net/fabricmc/fabric/api/item/v1/FabricItem.java

Co-authored-by: Salvatore Peluso <[email protected]>

* clear thread local and change field prefix

* forgot the allow

* Update fabric-item-api-v1/src/main/java/net/fabricmc/fabric/api/item/v1/FabricItem.java

Co-authored-by: Salvatore Peluso <[email protected]>

* Update fabric-item-api-v1/src/testmod/java/net/fabricmc/fabric/test/item/CustomDamageTest.java

Co-authored-by: Technici4n <[email protected]>

* Add FurnaceGameTest

* Change test keybind back to LShift

* Fix brewing stand remainder and fix nitpicks

* add code example to remainder javadoc

* Fixed and reformatted docs, changed recipe mixin behavior to store the remainder stack instead of the original stack, refactoring.

* Added gametests for brewing stand and recipe mixins, fixed furnace gametest compairing stacks with themselves.

* Use (0,1,0) position for game tests

* Review changes

Co-authored-by: apple502j <[email protected]>
Co-authored-by: Technici4n <[email protected]>
Co-authored-by: Salvatore Peluso <[email protected]>
Co-authored-by: modmuss50 <[email protected]>

(cherry picked from commit fa140d5)
modmuss50 pushed a commit that referenced this pull request Nov 20, 2022
* Support stack aware recipe remainders

* Fix checkstyle

* Remove all overwrites

* Add FabricItemStack and make RecipeRemainderHandler thread safe

* Update fabric-item-api-v1/src/main/java/net/fabricmc/fabric/api/item/v1/FabricItem.java

Co-authored-by: apple502j <[email protected]>

* Update fabric-item-api-v1/src/main/java/net/fabricmc/fabric/api/item/v1/FabricItem.java

Co-authored-by: apple502j <[email protected]>

* Update fabric-item-api-v1/src/main/java/net/fabricmc/fabric/api/item/v1/FabricItem.java

Co-authored-by: apple502j <[email protected]>

* Update fabric-item-api-v1/src/main/java/net/fabricmc/fabric/api/item/v1/FabricItem.java

Co-authored-by: apple502j <[email protected]>

* Update fabric-item-api-v1/src/main/java/net/fabricmc/fabric/api/item/v1/FabricItem.java

Co-authored-by: apple502j <[email protected]>

* Update fabric-item-api-v1/src/main/java/net/fabricmc/fabric/impl/item/RecipeRemainderHandler.java

Co-authored-by: Technici4n <[email protected]>

* Remove hasRecipeRemainder, Update test mod and remove unneeded mixins

* Update fabric-item-api-v1/src/testmod/java/net/fabricmc/fabric/test/item/CustomDamageTest.java

Co-authored-by: Salvatore Peluso <[email protected]>

* Avoid copying the ItemStack

* Update fabric-item-api-v1/src/main/java/net/fabricmc/fabric/mixin/item/AbstractFurnaceBlockEntityMixin.java

Co-authored-by: Salvatore Peluso <[email protected]>

* Sneakily change duplicate keybinding to a less used key

* make everything thread safe and improve AbstractFurnaceBlockEntityMixin

* Update fabric-item-api-v1/src/main/java/net/fabricmc/fabric/api/item/v1/FabricItem.java

Co-authored-by: Technici4n <[email protected]>

* Update fabric-item-api-v1/src/main/java/net/fabricmc/fabric/api/item/v1/FabricItemStack.java

Co-authored-by: Technici4n <[email protected]>

* Update fabric-item-api-v1/src/main/java/net/fabricmc/fabric/api/item/v1/FabricItem.java

Co-authored-by: Salvatore Peluso <[email protected]>

* clear thread local and change field prefix

* forgot the allow

* Update fabric-item-api-v1/src/main/java/net/fabricmc/fabric/api/item/v1/FabricItem.java

Co-authored-by: Salvatore Peluso <[email protected]>

* Update fabric-item-api-v1/src/testmod/java/net/fabricmc/fabric/test/item/CustomDamageTest.java

Co-authored-by: Technici4n <[email protected]>

* Add FurnaceGameTest

* Change test keybind back to LShift

* Fix brewing stand remainder and fix nitpicks

* add code example to remainder javadoc

* Fixed and reformatted docs, changed recipe mixin behavior to store the remainder stack instead of the original stack, refactoring.

* Added gametests for brewing stand and recipe mixins, fixed furnace gametest compairing stacks with themselves.

* Use (0,1,0) position for game tests

* Review changes

Co-authored-by: apple502j <[email protected]>
Co-authored-by: Technici4n <[email protected]>
Co-authored-by: Salvatore Peluso <[email protected]>
Co-authored-by: modmuss50 <[email protected]>
(cherry picked from commit fa140d5)
EnnuiL added a commit to QuiltMC/quilted-fabric-api that referenced this pull request Nov 21, 2022
* Support stack aware recipe remainders (FabricMC#2556)

* Support stack aware recipe remainders

* Fix checkstyle

* Remove all overwrites

* Add FabricItemStack and make RecipeRemainderHandler thread safe

* Update fabric-item-api-v1/src/main/java/net/fabricmc/fabric/api/item/v1/FabricItem.java

Co-authored-by: apple502j <[email protected]>

* Update fabric-item-api-v1/src/main/java/net/fabricmc/fabric/api/item/v1/FabricItem.java

Co-authored-by: apple502j <[email protected]>

* Update fabric-item-api-v1/src/main/java/net/fabricmc/fabric/api/item/v1/FabricItem.java

Co-authored-by: apple502j <[email protected]>

* Update fabric-item-api-v1/src/main/java/net/fabricmc/fabric/api/item/v1/FabricItem.java

Co-authored-by: apple502j <[email protected]>

* Update fabric-item-api-v1/src/main/java/net/fabricmc/fabric/api/item/v1/FabricItem.java

Co-authored-by: apple502j <[email protected]>

* Update fabric-item-api-v1/src/main/java/net/fabricmc/fabric/impl/item/RecipeRemainderHandler.java

Co-authored-by: Technici4n <[email protected]>

* Remove hasRecipeRemainder, Update test mod and remove unneeded mixins

* Update fabric-item-api-v1/src/testmod/java/net/fabricmc/fabric/test/item/CustomDamageTest.java

Co-authored-by: Salvatore Peluso <[email protected]>

* Avoid copying the ItemStack

* Update fabric-item-api-v1/src/main/java/net/fabricmc/fabric/mixin/item/AbstractFurnaceBlockEntityMixin.java

Co-authored-by: Salvatore Peluso <[email protected]>

* Sneakily change duplicate keybinding to a less used key

* make everything thread safe and improve AbstractFurnaceBlockEntityMixin

* Update fabric-item-api-v1/src/main/java/net/fabricmc/fabric/api/item/v1/FabricItem.java

Co-authored-by: Technici4n <[email protected]>

* Update fabric-item-api-v1/src/main/java/net/fabricmc/fabric/api/item/v1/FabricItemStack.java

Co-authored-by: Technici4n <[email protected]>

* Update fabric-item-api-v1/src/main/java/net/fabricmc/fabric/api/item/v1/FabricItem.java

Co-authored-by: Salvatore Peluso <[email protected]>

* clear thread local and change field prefix

* forgot the allow

* Update fabric-item-api-v1/src/main/java/net/fabricmc/fabric/api/item/v1/FabricItem.java

Co-authored-by: Salvatore Peluso <[email protected]>

* Update fabric-item-api-v1/src/testmod/java/net/fabricmc/fabric/test/item/CustomDamageTest.java

Co-authored-by: Technici4n <[email protected]>

* Add FurnaceGameTest

* Change test keybind back to LShift

* Fix brewing stand remainder and fix nitpicks

* add code example to remainder javadoc

* Fixed and reformatted docs, changed recipe mixin behavior to store the remainder stack instead of the original stack, refactoring.

* Added gametests for brewing stand and recipe mixins, fixed furnace gametest compairing stacks with themselves.

* Use (0,1,0) position for game tests

* Review changes

Co-authored-by: apple502j <[email protected]>
Co-authored-by: Technici4n <[email protected]>
Co-authored-by: Salvatore Peluso <[email protected]>
Co-authored-by: modmuss50 <[email protected]>
(cherry picked from commit fa140d5)

* Bump version

* Update to Fabric API 0.67.0

* Update fabric-item-api-v1/src/testmod/resources/fabric-item-api-tests-v1.mixins.json

Co-authored-by: Ennui Langeweile <[email protected]>

Co-authored-by: AlphaMode <[email protected]>
Co-authored-by: modmuss50 <[email protected]>
Co-authored-by: Ennui Langeweile <[email protected]>
EnnuiL pushed a commit to QuiltMC/quilted-fabric-api that referenced this pull request Nov 23, 2022
* Fix shulker boxes accepting other shulkers when using a directionless `InventoryStorage` (FabricMC#2669)

* Fix shulker boxes accepting other shulkers

If a mod creates a directionless InventoryStorage, it only calls
Inventory.isValid and not SidedInventory.canInsert. However, shulker
boxes only override the latter, allowing shulkers to be inserted into
them.

* Check for insertion in inventorySlotWrapper instead

* Load modded translations on the server (FabricMC#2668)

* Load modded translations on the server

* Don't load built-in mods

* Adjust nether biomes injection point (FabricMC#2666)

Co-authored-by: apple502j <[email protected]>

* Add access widener for `ItemModelGenerator#writer` (FabricMC#2635)

Allows for the use of custom Models and TextureMaps for generating item models.

* Fixed ScreenEvents Javadoc (FabricMC#2618)

(cherry picked from commit 33716ae)

* Split all duplicated packages (FabricMC#2617)

* Move duplicated v0/v1 impl packages to v0 subpackages

Fixes FabricMC#2616. The convention is adopted from the command API (v1)
whose impl classes have the v1 subpackage.

* Separate client code into its own packages everywhere

* Fix code style

* Fix code style, part 2

* Allow v0 in package names

* Allow v0 in package names (fixed)

* Support stack aware recipe remainders (FabricMC#2556)

* Support stack aware recipe remainders

* Fix checkstyle

* Remove all overwrites

* Add FabricItemStack and make RecipeRemainderHandler thread safe

* Update fabric-item-api-v1/src/main/java/net/fabricmc/fabric/api/item/v1/FabricItem.java

Co-authored-by: apple502j <[email protected]>

* Update fabric-item-api-v1/src/main/java/net/fabricmc/fabric/api/item/v1/FabricItem.java

Co-authored-by: apple502j <[email protected]>

* Update fabric-item-api-v1/src/main/java/net/fabricmc/fabric/api/item/v1/FabricItem.java

Co-authored-by: apple502j <[email protected]>

* Update fabric-item-api-v1/src/main/java/net/fabricmc/fabric/api/item/v1/FabricItem.java

Co-authored-by: apple502j <[email protected]>

* Update fabric-item-api-v1/src/main/java/net/fabricmc/fabric/api/item/v1/FabricItem.java

Co-authored-by: apple502j <[email protected]>

* Update fabric-item-api-v1/src/main/java/net/fabricmc/fabric/impl/item/RecipeRemainderHandler.java

Co-authored-by: Technici4n <[email protected]>

* Remove hasRecipeRemainder, Update test mod and remove unneeded mixins

* Update fabric-item-api-v1/src/testmod/java/net/fabricmc/fabric/test/item/CustomDamageTest.java

Co-authored-by: Salvatore Peluso <[email protected]>

* Avoid copying the ItemStack

* Update fabric-item-api-v1/src/main/java/net/fabricmc/fabric/mixin/item/AbstractFurnaceBlockEntityMixin.java

Co-authored-by: Salvatore Peluso <[email protected]>

* Sneakily change duplicate keybinding to a less used key

* make everything thread safe and improve AbstractFurnaceBlockEntityMixin

* Update fabric-item-api-v1/src/main/java/net/fabricmc/fabric/api/item/v1/FabricItem.java

Co-authored-by: Technici4n <[email protected]>

* Update fabric-item-api-v1/src/main/java/net/fabricmc/fabric/api/item/v1/FabricItemStack.java

Co-authored-by: Technici4n <[email protected]>

* Update fabric-item-api-v1/src/main/java/net/fabricmc/fabric/api/item/v1/FabricItem.java

Co-authored-by: Salvatore Peluso <[email protected]>

* clear thread local and change field prefix

* forgot the allow

* Update fabric-item-api-v1/src/main/java/net/fabricmc/fabric/api/item/v1/FabricItem.java

Co-authored-by: Salvatore Peluso <[email protected]>

* Update fabric-item-api-v1/src/testmod/java/net/fabricmc/fabric/test/item/CustomDamageTest.java

Co-authored-by: Technici4n <[email protected]>

* Add FurnaceGameTest

* Change test keybind back to LShift

* Fix brewing stand remainder and fix nitpicks

* add code example to remainder javadoc

* Fixed and reformatted docs, changed recipe mixin behavior to store the remainder stack instead of the original stack, refactoring.

* Added gametests for brewing stand and recipe mixins, fixed furnace gametest compairing stacks with themselves.

* Use (0,1,0) position for game tests

* Review changes

Co-authored-by: apple502j <[email protected]>
Co-authored-by: Technici4n <[email protected]>
Co-authored-by: Salvatore Peluso <[email protected]>
Co-authored-by: modmuss50 <[email protected]>

* Fix FabricMC#2657: Transfer API edge case with bad isValid overrides (FabricMC#2659)

Co-authored-by: modmuss50 <[email protected]>

* Only load default language on the server.

* Bump version

* Cleanup licenses and imports

* Fix mod/mixin.json's

* Port recipe remainder api

Co-authored-by: Jonathan Coates <[email protected]>
Co-authored-by: modmuss50 <[email protected]>
Co-authored-by: apple502j <[email protected]>
Co-authored-by: 90 <[email protected]>
Co-authored-by: Kevinthegreat <[email protected]>
Co-authored-by: Juuz <[email protected]>
Co-authored-by: AlphaMode <[email protected]>
Co-authored-by: Technici4n <[email protected]>
Co-authored-by: Salvatore Peluso <[email protected]>
@Technici4n Technici4n mentioned this pull request Dec 18, 2022
@haykam821
Copy link
Contributor

This pull request changed vanilla mechanics by using recipe remainders in brewing stands, as documented in #2873.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request last call If you care, make yourself heard right away! merge me please Pull requests that are ready to merge next? Likely candidate for upcoming releases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants