Skip to content

Commit

Permalink
fix: rare crash during entity join
Browse files Browse the repository at this point in the history
Caused by improper use of synchronized fast map
  • Loading branch information
klikli-dev committed Aug 29, 2024
1 parent bffbc85 commit 34af98b
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public class BookDataManager extends SimpleJsonResourceReloadListener {

private static final BookDataManager instance = new BookDataManager();

private Map<ResourceLocation, Book> books = Object2ObjectMaps.synchronize(new Object2ObjectOpenHashMap<>());
private final Map<ResourceLocation, Book> books = Object2ObjectMaps.synchronize(new Object2ObjectOpenHashMap<>());
private boolean loaded;
private boolean booksBuilt;
private HolderLookup.Provider registries;
Expand Down Expand Up @@ -91,7 +91,7 @@ public boolean areBooksBuilt() {

public void onDatapackSyncPacket(SyncBookDataMessage message) {
this.preLoad();
this.books = Object2ObjectMaps.synchronize(new Object2ObjectOpenHashMap<>(message.books));
this.books.putAll(message.books);
this.onLoadingComplete();
}

Expand Down

0 comments on commit 34af98b

Please sign in to comment.