Skip to content

Commit

Permalink
Prevent BEs that get removed by other mods in-between being loaded an…
Browse files Browse the repository at this point in the history
…d the end of the tick from crashing the game.
  • Loading branch information
shartte committed Oct 14, 2024
1 parent 3552335 commit da87ada
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@
class ServerBlockEntityRepo {
record FirstTickInfo<T extends BlockEntity>(T blockEntity, Consumer<? super T> initFunction) {
void callInit() {
initFunction.accept(blockEntity);
// It's possible the BE has already been removed after it was loaded. We skip initialization in that case.
if (!blockEntity.isRemoved()) {
initFunction.accept(blockEntity);
}
}
}

Expand Down

0 comments on commit da87ada

Please sign in to comment.