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

Brewery Potion Recipe Handler #2506

Open
wants to merge 4 commits into
base: 1.20.1
Choose a base branch
from
Open

Brewery Potion Recipe Handler #2506

wants to merge 4 commits into from

Conversation

screret
Copy link
Member

@screret screret commented Dec 6, 2024

What

  • make breweries able to brew vanilla and modded! potions
  • add potion fluids to go along with this
  • made potions able to transfer their fluid out via clicking a slot

Implementation Details

  • potion fluid implementation is mostly copied and trimmed down from create (MIT)
  • technically breaking (though I hope nobody touched this), had to add a new field to TagOrCycleItemStackHandler to support NBT on tags
  • brewery recipe logic just loops through all available potion recipes as there is no better way to do this sanely.

Outcome

  • the tooltip is real

Additional Information

java_qC0NJifVYU.mp4
java_CtznuDVg9l.mp4

image

@screret screret requested a review from a team as a code owner December 6, 2024 21:32
@YoungOnionMC YoungOnionMC changed the title give breweries the ability to make potions Brewery Potion Recipe Handler Dec 6, 2024
@jtuc
Copy link

jtuc commented Dec 7, 2024

Looks neat!

Testing with JEI 15.20.0.105, clicking the "Show Recipes" arrow in the Brewery GUI causes a crash - looks like JEI doesn't like the gtceu:dummy recipe?
EMI and REI do not crash when doing this, so looks to be JEI-specific.

[07Dec2024 13:19:56.160] [Render thread/ERROR] [net.minecraft.client.Minecraft/FATAL]: Reported exception thrown!
net.minecraft.ReportedException: mouseClicked event handler
	at net.minecraft.client.gui.screens.Screen.m_96579_(Screen.java:444) ~[client-1.20.1-20230612.114412-srg.jar%23162!/:?]
	at net.minecraft.client.MouseHandler.m_91530_(MouseHandler.java:89) ~[client-1.20.1-20230612.114412-srg.jar%23162!/:?]
	at net.minecraft.client.MouseHandler.m_168091_(MouseHandler.java:189) ~[client-1.20.1-20230612.114412-srg.jar%23162!/:?]
	at net.minecraft.util.thread.BlockableEventLoop.execute(BlockableEventLoop.java:102) ~[client-1.20.1-20230612.114412-srg.jar%23162!/:?]
	at net.minecraft.client.MouseHandler.m_91565_(MouseHandler.java:188) ~[client-1.20.1-20230612.114412-srg.jar%23162!/:?]
	at org.lwjgl.glfw.GLFWMouseButtonCallbackI.callback(GLFWMouseButtonCallbackI.java:43) ~[lwjgl-glfw-3.3.1.jar%2386!/:build 7]
	at org.lwjgl.system.JNI.invokeV(Native Method) ~[lwjgl-3.3.1.jar%2398!/:build 7]
	at org.lwjgl.glfw.GLFW.glfwPollEvents(GLFW.java:3403) ~[lwjgl-glfw-3.3.1.jar%2386!/:build 7]
	at com.mojang.blaze3d.systems.RenderSystem.pollEvents(RenderSystem.java:201) ~[client-1.20.1-20230612.114412-srg.jar%23162!/:?]
	at com.mojang.blaze3d.systems.RenderSystem.flipFrame(RenderSystem.java:212) ~[client-1.20.1-20230612.114412-srg.jar%23162!/:?]
	at com.mojang.blaze3d.platform.Window.m_85435_(Window.java:274) ~[client-1.20.1-20230612.114412-srg.jar%23162!/:?]
	at net.minecraft.client.Minecraft.m_91383_(Minecraft.java:1170) ~[client-1.20.1-20230612.114412-srg.jar%23162!/:?]
	at net.minecraft.client.Minecraft.m_91374_(Minecraft.java:718) ~[client-1.20.1-20230612.114412-srg.jar%23162!/:?]
	at net.minecraft.client.main.Main.main(Main.java:218) ~[minecraft-1.20.1-client.jar:?]
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?]
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]
	at net.minecraftforge.fml.loading.targets.CommonLaunchHandler.runTarget(CommonLaunchHandler.java:111) ~[fmlloader-1.20.1-47.3.0.jar:?]
	at net.minecraftforge.fml.loading.targets.CommonLaunchHandler.clientService(CommonLaunchHandler.java:99) ~[fmlloader-1.20.1-47.3.0.jar:?]
	at net.minecraftforge.fml.loading.targets.CommonClientLaunchHandler.lambda$makeService$0(CommonClientLaunchHandler.java:25) ~[fmlloader-1.20.1-47.3.0.jar:?]
	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:30) ~[modlauncher-10.0.9.jar:?]
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) ~[modlauncher-10.0.9.jar:?]
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) ~[modlauncher-10.0.9.jar:?]
	at cpw.mods.modlauncher.Launcher.run(Launcher.java:108) ~[modlauncher-10.0.9.jar:?]
	at cpw.mods.modlauncher.Launcher.main(Launcher.java:78) ~[modlauncher-10.0.9.jar:?]
	at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) ~[modlauncher-10.0.9.jar:?]
	at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) ~[modlauncher-10.0.9.jar:?]
	at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:141) ~[bootstraplauncher-1.1.2.jar:?]
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?]
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]
	at io.github.zekerzhayard.forgewrapper.installer.Main.main(Main.java:67) ~[?:?]
	at org.prismlauncher.launcher.impl.StandardLauncher.launch(StandardLauncher.java:105) ~[?:?]
	at org.prismlauncher.EntryPoint.listen(EntryPoint.java:129) ~[?:?]
	at org.prismlauncher.EntryPoint.main(EntryPoint.java:70) ~[?:?]
Caused by: java.lang.IllegalStateException: There is no recipe category registered for: RecipeType[uid=gtceu:dummy, recipeClass=class com.gregtechceu.gtceu.integration.jei.recipe.GTRecipeWrapper]
A recipe category must be registered in order to use this recipe type.
	at mezz.jei.library.recipes.collect.RecipeTypeDataMap.get(RecipeTypeDataMap.java:38) ~[jei-1.20.1-forge-15.20.0.105.jar%23161!/:15.20.0.105]
	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) ~[?:?]
	at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625) ~[?:?]
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) ~[?:?]
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[?:?]
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:575) ~[?:?]
	at java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260) ~[?:?]
	at java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:616) ~[?:?]
	at java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:622) ~[?:?]
	at java.util.stream.ReferencePipeline.toList(ReferencePipeline.java:627) ~[?:?]
	at mezz.jei.library.recipes.RecipeManagerInternal.getRecipeCategoriesForTypes(RecipeManagerInternal.java:188) ~[jei-1.20.1-forge-15.20.0.105.jar%23161!/:15.20.0.105]
	at mezz.jei.library.recipes.RecipeCategoriesLookup.get(RecipeCategoriesLookup.java:51) ~[jei-1.20.1-forge-15.20.0.105.jar%23161!/:15.20.0.105]
	at mezz.jei.gui.recipes.RecipeGuiLogic.showCategories(RecipeGuiLogic.java:158) ~[jei-1.20.1-forge-15.20.0.105.jar%23161!/:15.20.0.105]
	at mezz.jei.gui.recipes.RecipesGui.showTypes(RecipesGui.java:473) ~[jei-1.20.1-forge-15.20.0.105.jar%23161!/:15.20.0.105]
	at com.gregtechceu.gtceu.api.recipe.ui.GTRecipeTypeUI.lambda$createEditableUITemplate$3(GTRecipeTypeUI.java:253) ~[gtceu-1.20.1-1.5.5.jar%23159!/:1.5.5]
	at com.lowdragmc.lowdraglib.gui.widget.ButtonWidget.mouseClicked(ButtonWidget.java:65) ~[ldlib-forge-1.20.1-1.0.31.jar%23176!/:?]
	at com.lowdragmc.lowdraglib.gui.widget.WidgetGroup.mouseClicked(WidgetGroup.java:602) ~[ldlib-forge-1.20.1-1.0.31.jar%23176!/:?]
	at com.lowdragmc.lowdraglib.gui.widget.WidgetGroup.mouseClicked(WidgetGroup.java:602) ~[ldlib-forge-1.20.1-1.0.31.jar%23176!/:?]
	at com.lowdragmc.lowdraglib.gui.widget.WidgetGroup.mouseClicked(WidgetGroup.java:602) ~[ldlib-forge-1.20.1-1.0.31.jar%23176!/:?]
	at com.lowdragmc.lowdraglib.gui.widget.WidgetGroup.mouseClicked(WidgetGroup.java:602) ~[ldlib-forge-1.20.1-1.0.31.jar%23176!/:?]
	at com.lowdragmc.lowdraglib.gui.modular.ModularUIGuiContainer.m_6375_(ModularUIGuiContainer.java:259) ~[ldlib-forge-1.20.1-1.0.31.jar%23176!/:?]
	at net.minecraft.client.MouseHandler.m_168084_(MouseHandler.java:92) ~[client-1.20.1-20230612.114412-srg.jar%23162!/:?]
	at net.minecraft.client.gui.screens.Screen.m_96579_(Screen.java:437) ~[client-1.20.1-20230612.114412-srg.jar%23162!/:?]
	... 36 more

@screret
Copy link
Member Author

screret commented Dec 7, 2024

Hm, how'd a dummy recipe type get in there...

@screret
Copy link
Member Author

screret commented Dec 7, 2024

I'll look into that, thanks

@jtuc
Copy link

jtuc commented Dec 8, 2024

The source of the dummy recipe category is GTRecipeBuilder#buildRawRecipe - in 039659f this method was changed to force the recipe category to GTRecipeCategories.DUMMY, presumably as a way to "Hide raw recipes".
I did try editing that line to pass through recipeCategory like it used to, and although it prevented the crash, clicking "show recipes" just did nothing instead.

@krossgg
Copy link
Contributor

krossgg commented Dec 8, 2024

Yes, this is an issue on my end with recipe categories. I need to change how representative recipes get built.

@krossgg krossgg added the type: feature New feature or request label Dec 12, 2024
@krossgg
Copy link
Contributor

krossgg commented Dec 12, 2024

Representative recipes (including the JEI progress bar click) have been fixed.
List<Either<Triple<X>, List<Stack>>> has been removed in favor of the Fluid/Item EntryList interfaces and their two implementations.

@jtuc
Copy link

jtuc commented Dec 12, 2024

Retested dc255e2 with EMI/JEI/REI, looks good to me.
The only other thing I'd suggest is it feels a little weird to be able to bottle potions from machine GUIs but not be able to bottle water - not a big deal, but might make sense to add?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants