Make possible for addons to add machine items in other creative tabs#1510
Merged
ALongStringOfNumbers merged 1 commit intoGregTechCEu:masterfrom Mar 2, 2023
Merged
Conversation
…to add machine items in their own creative tabs
LAGIdiot
approved these changes
Feb 21, 2023
Contributor
LAGIdiot
left a comment
There was a problem hiding this comment.
Implementation looks reasonable. In game testing was not performed.
ALongStringOfNumbers
approved these changes
Mar 2, 2023
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.
What
This PR introduces a method to add machines in creative tabs other than
gregtech.main.This feature is only intended for addons - specifically, only custom MTEs; providing ways to arbitrarily change creative tabs for existing MTEs is not the goal of this PR.
Implementation Details
Creative tab checking is now handled by MTEs directly, by newly created method
MetaTileEntity#isInCreativeTab(CreativeTabs). This method can be overridden, allowing fine controls on which creative tab the machine is added. The method is called onBlockMachine#getSubBlocks()so that previous implementations ofMetaTileEntity#getSubItems()function the same way.To minimize performance impact, each additional creative tabs for machines must be manually registered by
MachineItemBlock#addCreativeTab(CreativeTabs). This approach should retain performance on unmodified instance as-is.Potential Compatibility Issues
Compatibility issue should be minimal, as the interaction between previous
MetaTileEntity#getSubItems()implementations and newly added API produces identical result to previous code.I did not observe any performance degradation from my own testing, but considering it was done with just one extra tab registered, it is not a definite answer.