Skip to content

Use Functions for Item Bus Inventories#4570

Open
TechLord22 wants to merge 1 commit into1.20.1from
tc/inventory-funcs
Open

Use Functions for Item Bus Inventories#4570
TechLord22 wants to merge 1 commit into1.20.1from
tc/inventory-funcs

Conversation

@TechLord22
Copy link
Member

What

Changes Item Buses to use a Function to supply their inventory instead of the super constructor calling a method. This prevents initialization order problems, where the createInventory() function would like to use instance variables defined in a subclass, but the superclass calls it before the subclass's variables are initialized.

This PR adds static factory methods to create all of the item bus classes to make registration easier, but leaves function-based constructors on all classes to keep future subclassing available as needed.

Outcome

Allows for cleaner item bus initialization order, prevents non-obvious bugs due to the above scenario.

How Was This Tested

I did a brief test to make sure all the buses worked as expected.

@TechLord22 TechLord22 requested a review from a team as a code owner February 8, 2026 00:51
@github-actions github-actions bot added the 1.20.1 label Feb 8, 2026
@TechLord22 TechLord22 added the type: refactor Suggestion to refactor a section of code label Feb 8, 2026
@github-actions github-actions bot added the Tests: Failed Game Tests have failed on this PR label Feb 8, 2026
YoungOnionMC
YoungOnionMC previously approved these changes Feb 8, 2026
@YoungOnionMC
Copy link
Member

how come the CONFIG_SIZE value was removed for the ae part hatches?

@YoungOnionMC YoungOnionMC added type: feature New feature or request bundled for a 0.X.0 Update Release: Major - 0.X.0 Releases focused on Content, changes to gameplay; While maintaining mostly API stability. labels Feb 8, 2026
Base automatically changed from 1.20.1-v8.0.0 to 1.20.1 February 14, 2026 22:08
@Ghostipedia Ghostipedia dismissed YoungOnionMC’s stale review February 14, 2026 22:08

The base branch was changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1.20.1 Release: Major - 0.X.0 Releases focused on Content, changes to gameplay; While maintaining mostly API stability. Tests: Failed Game Tests have failed on this PR type: feature New feature or request bundled for a 0.X.0 Update type: refactor Suggestion to refactor a section of code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants