Skip to content

Fix game crash when building a mega distillation tower in creative using hologram - #7849

Open
6C-C6 wants to merge 2 commits into
GTNewHorizons:masterfrom
6C-C6:megaDistillationTower_OutOfBound_fix
Open

Fix game crash when building a mega distillation tower in creative using hologram#7849
6C-C6 wants to merge 2 commits into
GTNewHorizons:masterfrom
6C-C6:megaDistillationTower_OutOfBound_fix

Conversation

@6C-C6

@6C-C6 6C-C6 commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Got a game crash when trying to build a mega distillation tower (new structure one), with

java.lang.IndexOutOfBoundsException: Index: 2, Size: 2

on function

gregtech.common.tileentities.machines.multi.MTEMegaDistillationTower.getCurrentLayerBottomOutputHatchCount(MTEMegaDistillationTower.java:373)

according to the crash report.

Fix it by adding the layer index by 1, and use index-1 for outputHatchesPerLayer.get().
Refrencing to the old structure's code:

return this.mOutputHatchesByLayer.size() < this.mHeight || this.mHeight <= 0 ? 0
where mHeight ranges in [1, tTotalHeight - 1], which is equal to the index of fluid output layers.

Also change the variable name from currentLayer to currentOutputLayer, as the previous one has already been used otherwhere in the code, refering to the layer index of middle pieces.

Checklist

  • I have tested this PR in DevEnv
  • I have tested this PR in Fullpack
  • This PR is in compliance with the GTNH AI Policy
  • This PR requires another PR in order to merge

built and tested, success both with construct and survivalConstruct.
@Auynonymous Auynonymous added the Bug Fix Fixes a bug. Please link it in the PR if an issue exists for it. label Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Fix Fixes a bug. Please link it in the PR if an issue exists for it.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants