Fix size-related issues when printing tanks and vaults#10525
Open
Apertyotis wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The following content is machine-translated and may contain inaccuracies.
I noticed that since commit 1491ed3, the size properties of
FluidTankhave been treated as safe NBT. This fixed some issues, but it also introduced two new ones.First, players can use schematics to print a single tank with a large capacity. Second, even when printing a normal 3*3 tank, obvious errors still occur if the schematic is rotated by 90°.
For context, the behavior before this commit was: printing large tanks generally worked fine, but printing a single tank block would incorrectly set its capacity to 0. Vaults suffered from the same issue. My previous PR (#10084) attempted to fix this by following the same approach as
commit 1491ed3, but based on the discussion above, that does not seem to be the right solution.The root cause is almost certainly a limitation in the multiblock structure detection code. If that code were robust enough, it would correctly identify tanks regardless of how they were printed. However, that codebase is large and complex, and I am not in a position to thoroughly investigate it. Reviewing PRs that touch such systems is also understandably difficult for the maintainers.
Because of that, I chose a different approach that is much simpler, albeit less elegant. Since the multiblock detection logic always works correctly when players place blocks manually, the idea is to make schematic placement resemble manual placement as closely as possible. The implementation is straightforward: always treat printed tank controller as a 1*1 tank.
In
FluidTankBlockEntity.<init>, bothwidthandheightare initialized to1. However, they are later overwritten by values read from NBT. Beforecommit 1491ed3, those values were not present in the NBT at all, causing them to default to0, which is the direct reason of the issue.This effectively restores the pre-
1491ed3behavior for printing large tanks while also fixing the single-tank issue.The fix is still not perfect, however. When a tank schematic is printed with rotation, the
windowproperty can still become inconsistent.