diff --git a/src/main/java/dev/tr7zw/entityculling/CullTask.java b/src/main/java/dev/tr7zw/entityculling/CullTask.java index 2f67c11..7482994 100644 --- a/src/main/java/dev/tr7zw/entityculling/CullTask.java +++ b/src/main/java/dev/tr7zw/entityculling/CullTask.java @@ -92,7 +92,11 @@ private void cullEntities(Vec3 cameraMC, Vec3d camera) { // less // overhead probably than trying to sync stuff up for no really good reason } - if (entity == null || !(entity instanceof Cullable)) { + if (entity == null) { + // assume the iterator is broken, cancel the loop https://github.com/tr7zw/EntityCulling/issues/168 + break; + } + if (!(entity instanceof Cullable)) { continue; // Not sure how this could happen outside from mixin screwing up the inject into // Entity } @@ -145,6 +149,10 @@ private void cullBlockEntities(Vec3 cameraMC, Vec3d camera) { // less // overhead probably than trying to sync stuff up for no really good reason } + if (entry == null) { + // assume the iterator is broken, cancel the loop https://github.com/tr7zw/EntityCulling/issues/168 + break; + } if (blockEntityWhitelist.contains(entry.getValue().getType())) { continue; }