Skip to content

Conversation

@SirYwell
Copy link
Member

Overview

Fixes #2928

Description

IBlocks#getEntities() and IBlocks#getTiles() returned mutable collections before #2883, which FAWE depends on when trimming or stripping NBT data. After the change, getEntities() still returns a mutable set which does not reflect changes to the original set, and getTiles() returns an immutable view of the backing map. This leads to exceptions and misbehavior as seen in #2928.

This change does two things:

  • Avoid the usage of the deprecated methods in FAWE and use tiles() and entities() instead, this should also bring performance benefits
  • Make getTiles() mutable again. This does not work as easy for getEntities(), so I just hope no one outside of FAWE uses this method while relying on mutability.

I also noticed that entity NBT stripping was broken, as we lowercase all keys to strip, but the code called toUpperCase when looking up if the key should be removed.

The stripEntityNBT and stripBlockNBT methods do not care about that at all, so I assume they won't work currently?

### Submitter Checklist
- [x] Make sure you are opening from a topic branch (**/feature/fix/docs/ branch** (right side)) and not your main branch.
- [x] Ensure that the pull request title represents the desired changelog entry.
- [x] New public fields and methods are annotated with `@since TODO`.
- [x] I read and followed the [contribution guidelines](https://github.com/IntellectualSites/.github/blob/main/CONTRIBUTING.md).

@SirYwell SirYwell requested a review from a team as a code owner September 24, 2024 16:41
@github-actions github-actions bot added the Bugfix This PR fixes a bug label Sep 24, 2024
@dordsor21 dordsor21 requested a review from a team September 25, 2024 16:30
@NotMyFault NotMyFault merged commit 3b6e5e8 into main Sep 28, 2024
@NotMyFault NotMyFault deleted the fix/mutable-tiles-entities branch September 28, 2024 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bugfix This PR fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

java.lang.UnsupportedOperationException: Immutable

4 participants