Lambda replacement

This commit is contained in:
paulevsGitch 2021-11-28 05:55:45 +03:00
parent 65d9d7f2ce
commit 6cbd400636

View file

@ -160,16 +160,13 @@ public class SpawnRuleBulder<M extends Mob> {
final List<SpawnRuleEntry> rulesCopy = Lists.newArrayList(this.rules);
Collections.sort(rulesCopy);
SpawnPredicate<M> predicate = new SpawnPredicate<M>() {
@Override
public boolean test(EntityType<M> entityType, ServerLevelAccessor serverLevelAccessor, MobSpawnType mobSpawnType, BlockPos blockPos, Random random) {
for (SpawnRuleEntry rule: rulesCopy) {
if (!rule.canSpawn(entityType, serverLevelAccessor, mobSpawnType, blockPos, random)) {
return false;
}
SpawnPredicate<M> predicate = (entityType, serverLevelAccessor, mobSpawnType, blockPos, random) -> {
for (SpawnRuleEntry rule: rulesCopy) {
if (!rule.canSpawn(entityType, serverLevelAccessor, mobSpawnType, blockPos, random)) {
return false;
}
return true;
}
return true;
};
SpawnRestrictionAccessor.callRegister(entityType, spawnType, heightmapType, predicate);