From 3396e16659e98ad723a883ff91daa5704c194d08 Mon Sep 17 00:00:00 2001 From: StewStrong Date: Thu, 21 Dec 2023 19:43:53 -0700 Subject: [PATCH] Fix replaceProcessUnloads I think? --- .../MixinPersistentEntitySectionManager.java | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/common/src/main/java/org/valkyrienskies/mod/mixin/feature/shipyard_entities/MixinPersistentEntitySectionManager.java b/common/src/main/java/org/valkyrienskies/mod/mixin/feature/shipyard_entities/MixinPersistentEntitySectionManager.java index 4d6aa8996..0f7068745 100644 --- a/common/src/main/java/org/valkyrienskies/mod/mixin/feature/shipyard_entities/MixinPersistentEntitySectionManager.java +++ b/common/src/main/java/org/valkyrienskies/mod/mixin/feature/shipyard_entities/MixinPersistentEntitySectionManager.java @@ -57,15 +57,20 @@ private boolean processChunkUnload(final long l) { method = "processUnloads", at = @At(value = "HEAD"), cancellable = true ) private void replaceProcessUnloads(final CallbackInfo ci) { - final LongSet toRemove = new LongOpenHashSet(); - for (final long key : this.chunksToUnload) { - if (this.chunkVisibility.get(key) != Visibility.HIDDEN) { - toRemove.add(key); - } else if (this.processChunkUnload(key)) { - toRemove.add(key); + // I don't know why this crashes, try-catch please help me! + try { + final LongSet toRemove = new LongOpenHashSet(); + for (final long key : this.chunksToUnload) { + if (this.chunkVisibility.get(key) != Visibility.HIDDEN) { + toRemove.add(key); + } else if (this.processChunkUnload(key)) { + toRemove.add(key); + } } + chunksToUnload.removeAll(toRemove); + } catch (final Exception e) { + e.printStackTrace(); } - chunksToUnload.removeAll(toRemove); ci.cancel(); } }