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

Fix mte traits being treated as duplicate #1690

Merged
merged 2 commits into from
Apr 10, 2023
Merged

Conversation

TechLord22
Copy link
Member

@TechLord22 TechLord22 commented Apr 9, 2023

What

This PR fixes a bug where MTETraits would all be treated as duplicate. This is because it was stored in the MTE's trait map before initializing the name and networkId of the trait. Therefore, the mteTraitByNetworkId map in MTE treated each trait as the same, breaking network sync. This PR fixes this.

Additionally, the networkId stored in the trait itself was always zero, due to using the result of map#put to initialize it. This was another problem, since the return value of map#put is the old value, which is always 0 for unique traits, and is not the new id.

This problem is linked to machine animations not working, recipe search sometimes not starting, likely sounds not functioning, and possibly many other issues.

Implementation Details

The MTETrait name field is now stored as a constant instead of being created each time. The creation of the name has moved to an protected abstract method createName(), while the getter has been made final and concrete.

Outcome

Fixes MTETraits being treated as duplicates. Closes #1692.

Potential Compatibility Issues

Mods which adopted the new MTETrait system will have to change their override of getName(), which is now concrete and final, to createName().

@TechLord22 TechLord22 merged commit 09447e9 into master Apr 10, 2023
@TechLord22 TechLord22 deleted the tc-fix-mtetrait branch April 10, 2023 02:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: release blocker Must have for next release type: bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Machine Textures do not change when running and Audio for machines does not play
2 participants