Skip to content

Commit

Permalink
only try replacement once, in case chunks suddenly vanish, get unload…
Browse files Browse the repository at this point in the history
…ed, ...
  • Loading branch information
DaFuqs committed Nov 18, 2021
1 parent 780277b commit 53c300a
Showing 1 changed file with 0 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,6 @@ public static void tick(MinecraftServer server) {

// Some protection against concurrent modifications
List<LootCrateReplacementPosition> list = new ArrayList<>(replacements);
List<LootCrateReplacementPosition> tryAgainList = new ArrayList<>();
replacements.clear();

for (LootCrateReplacementPosition replacementPosition : list) {
Expand All @@ -293,7 +292,6 @@ public static void tick(MinecraftServer server) {
blockEntity = serverWorld.getBlockEntity(replacementPosition.blockPos);
} catch (Exception e) {
LootCrates.LOGGER.error("[LootCrates] Error while replacing a container with loot table '" + replacementPosition.lootTable + "' in the world '" + replacementPosition.worldKey + "' at '" + replacementPosition.blockPos + "' ) + " + e.getLocalizedMessage());
tryAgainList.add(replacementPosition);
continue;
}
if(blockEntity != null && !(blockEntity instanceof LootCrateBlockEntity)) {
Expand Down Expand Up @@ -344,16 +342,11 @@ public static void tick(MinecraftServer server) {
}
}
}
} else {
tryAgainList.add(replacementPosition);
}
} catch (Exception e) {
LootCrates.LOGGER.error("[LootCrates] Error while replacing a container with loot table '" + replacementPosition.lootTable + "' in the world '" + replacementPosition.worldKey + "' at '" + replacementPosition.blockPos + "') + " + e.getLocalizedMessage());
tryAgainList.add(replacementPosition);
}
}

replacements = tryAgainList;
}
}

Expand Down

0 comments on commit 53c300a

Please sign in to comment.