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

Memory card is not completely cleared #7946

Closed
Mithi83 opened this issue Jun 19, 2024 · 2 comments · Fixed by #7964
Closed

Memory card is not completely cleared #7946

Mithi83 opened this issue Jun 19, 2024 · 2 comments · Fixed by #7964
Assignees
Labels
bug Self explanatory?

Comments

@Mithi83
Copy link
Contributor

Mithi83 commented Jun 19, 2024

Describe the bug

Right-clicking a memory card used for P2P Tunnel setup does not properly clear the memory card.

How to reproduce the bug

  1. Take a blank memory card from the creative tab, inspect NBT: {count: 1, id: "ae2:memory_card"}
  2. Right-click a ME P2P Tunnel to initialize the card, inspect NBT: {components: {"ae2:memory_card_colors": ["black", "black", "green", "green", "cyan", "cyan", "red", "red"], "ae2:exported_p2p_frequency": 16360s, "ae2:exported_settings_source": {translate: "item.ae2.me_p2p_tunnel"}, "ae2:exported_p2p_type": "ae2:me_p2p_tunnel"}, count: 1, id: "ae2:memory_card"}
  3. Right-click into the air, notice message "Memory card cleared." Inspect NBT: {components: {"ae2:exported_p2p_frequency": 16360s, "ae2:exported_settings_source": {translate: "item.ae2.me_p2p_tunnel"}, "ae2:exported_p2p_type": "ae2:me_p2p_tunnel"}, count: 1, id: "ae2:memory_card"}

Expected behavior

I'd expect the NBT after a clear to match that of a totally blank card.

Additional details

1.20.1 was still ok, git blame makes me think the bug was introduced in 1.20.5

Which minecraft version are you using?

1.21

On which mod loaders does it happen?

NeoForge

Crash log

Self compiled 1.21

@Mithi83 Mithi83 added the bug Self explanatory? label Jun 19, 2024
@Mithi83
Copy link
Contributor Author

Mithi83 commented Jun 19, 2024

Manually adding card.remove(AEComponents.EXPORTED_*) calls (for EXPORTED_P2P_TYPE, EXPORTED_P2P_FREQUENCY, and EXPORTED_SETTINGS_SOURCE in my example) makes things work as expected.

The intention of the code seems to be that all those potential AEComponents.EXPORTED_* are stored inside the BuiltInRegistries.DATA_COMPONENT_TYPE.getTagOrEmpty(ConventionTags.EXPORTED_SETTINGS) and removed from the memory card by iterating over that container. Debug prints showed that the for-loop is never called, leading me to believe that the registry is never filled in the first place.

@shartte shartte self-assigned this Jun 23, 2024
@shartte
Copy link
Member

shartte commented Jun 23, 2024

Yeah I had the idea that since tags now can be defined on anything, we could also define a tag on data component types!
And then use that to just clear everything in that tag, when you clear the memory card.
I probably just forgot to define the tag in the datagen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Self explanatory?
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants