fix cast exception

This commit is contained in:
gnembon committed 2021-05-23 18:06:45 -03:00
1 parent 93b8d98a79
commit 1091171870
1 file changed
+2 -1
@@ -19,6 +19,7 @@ import net.minecraft.tag.BlockTags;
import net.minecraft.text.BaseText; import net.minecraft.text.BaseText;
import net.minecraft.server.world.ServerWorld; import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.DyeColor; import net.minecraft.util.DyeColor;
import net.minecraft.util.TypeFilter;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
import net.minecraft.util.registry.RegistryKey; import net.minecraft.util.registry.RegistryKey;
@@ -275,7 +276,7 @@ public class SpawnReporter
{ {
List<BaseText> lst = new ArrayList<>(); List<BaseText> lst = new ArrayList<>();
lst.add( Messenger.s(String.format("Loaded entities for %s class:", get_type_string(cat)))); lst.add( Messenger.s(String.format("Loaded entities for %s class:", get_type_string(cat))));
for (Entity entity : ((ServerWorld)worldIn).getEntitiesByType(null, (e) -> e.getType().getSpawnGroup()==cat)) for (Entity entity : ((ServerWorld)worldIn).getEntitiesByType(TypeFilter.instanceOf(Entity.class), (e) -> e.getType().getSpawnGroup()==cat))
{ {
boolean persistent = entity instanceof MobEntity && ( ((MobEntity) entity).isPersistent() || ((MobEntity) entity).cannotDespawn()); boolean persistent = entity instanceof MobEntity && ( ((MobEntity) entity).isPersistent() || ((MobEntity) entity).cannotDespawn());
if (!all && persistent) if (!all && persistent)