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

Add selective voiding and ME hatch capabillity to Distillation Tower multiblocks #2261

Merged
merged 5 commits into from
Nov 6, 2024

Conversation

krossgg
Copy link
Contributor

@krossgg krossgg commented Oct 30, 2024

What

This PR creates custom Machine and RecipeLogic classes for DistillationTower multiblocks, like the Distillation Tower and the Large Fractionating Distillery. In doing so, the ability to omit output hatches on selected layers and void the contents of those layers has been added. In addition, this allows for ME Output Hatches to be used as part of the structure while still providing exactly one output per layer.

Implementation Details

This functionality is achieved by creating a list of fluid handlers when the structure is formed. The output hatches are iterated from top to bottom and added to this list. In any omitted layers, a VoidFluidHandler is added instead, which will void any fluid given to it.

Throughout the recipe logic, instead of going through the recipe's own matching/handling system, the distillation tower will match/handle its own fluid outputs via the DistillationTowerLogic#applyFluidOutputs method.

This does not break the ability for the LFD to run regular distillery recipes, even if the first layer happens to not have an output hatch. The machine will keep track of its first non-void fluid handler and output to that instead.

Once a recipe is able to be run and the inputs are consumed, the recipe logic will update and expose a trimmed version of the recipe running to any output displays, such as Jade or the machine UI.

Outcome

Resolves #2103
Players are now able to omit layers to void those layers' outputs or use ME Output Hatches to deal with mass fluid in a layer.

Additional Information

This new class is friendly to custom multiblocks (as long as they are oriented vertically), with an optional parameter specifying the height offset between the controller and the first fluid output layer.
New shapeinfos for all sizes of DTs and LFDs have been added in order to properly represent how they should be built.
A new recipe type UI has also been designed for the DT recipes

r

@krossgg krossgg added type: feature New feature or request Do Not Merge DO NOT MERGE THIS PR YET! labels Oct 30, 2024
@krossgg krossgg requested a review from a team as a code owner October 30, 2024 01:09
Copy link
Member

@mikerooni mikerooni left a comment

Choose a reason for hiding this comment

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

Unfortunately can't review the actual recipe logic yet, but I have some small (optional) recommendations ^^

@Nullable
public Iterator<GTRecipe> searchRecipe() {
var recipeType = machine.getRecipeType();
if (recipeType == GTRecipeTypes.DISTILLERY_RECIPES) return super.searchRecipe();
Copy link
Member

Choose a reason for hiding this comment

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

this probably shouldn't be hardcoded like this? or is there no other way

Copy link
Member

Choose a reason for hiding this comment

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

Might be able to merge this together with the interface I suggested for the parallel limit

Copy link
Contributor Author

@krossgg krossgg Oct 30, 2024

Choose a reason for hiding this comment

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

Needs to be hard coded in order to use DTs output matching method.

GTRecipeType#searchRecipe , which is used in the default recipe logic searchRecipe, is hardcoded to use GTrecipe#matchRecipe. This does not work for me because it would not respect the separation of layers.

In a future PR, I plan to extract out this repeated hardcoded matching condition from various places in RecipeLogic so that it becomes easier to write custom recipe logic without copy pasting a lot of methods with only a single line change (like you see here with the DT logic). However that is beyond the scope of this PR.

@krossgg krossgg removed the Do Not Merge DO NOT MERGE THIS PR YET! label Nov 2, 2024
@krossgg krossgg requested a review from screret November 2, 2024 20:42
@screret screret merged commit d868b95 into GregTechCEu:1.20.1 Nov 6, 2024
3 checks passed
@krossgg krossgg deleted the distillation-tower-rework branch November 12, 2024 05:12
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.

Large Fractionating Distillery no longer supports ME Output Hatches
3 participants