Max collisions optimization (#1038)

* Lift entity limit up to the `getOtherEntities` method so it bails early

This has the potential to prevent a lot of bounding box computation

* Clean up decompiled code

* Fix raw generic types

This doesn't alter the signature, but it helps the compiler warn about misuse of the type later on

* Actually abort forEach when `limit` entities have been checked

`throw`ing a known exception is the easiest way to `break` out of a forEach call
This commit is contained in:
Mitchell Skaggs authored and GitHub committed 2021-08-03 07:20:09 -03:00
1 parent 56a15fb384
commit 28cb136c6b
6 files changed
+97 -29

No files matched your search

@@ -5,12 +5,18 @@ import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Box;
import org.jetbrains.annotations.Nullable;
import java.util.List;
import java.util.Map;
import java.util.function.Predicate;
public interface WorldInterface
{
Map<EntityType, Entity> getPrecookedMobs();
Map<EntityType<?>, Entity> getPrecookedMobs();
boolean setBlockStateWithBlockEntity(BlockPos blockPos, BlockState blockState, BlockEntity newBlockEntity, int int1);
List<Entity> getOtherEntitiesLimited(@Nullable Entity except, Box box, Predicate<? super Entity> predicate, int limit);
}