code formatting
This commit is contained in:
parent
61ffc8e198
commit
78c18135df
@ -68,23 +68,18 @@ public class WorkstationOptimization implements VillagerOptimizerModule, Listene
|
|||||||
|
|
||||||
final Location workstationLoc = placed.getLocation();
|
final Location workstationLoc = placed.getLocation();
|
||||||
|
|
||||||
List<Entity> nearbyUnoptimized = workstationLoc.getNearbyEntities(search_radius, search_radius, search_radius)
|
List<Entity> nearbyUnoptimized = workstationLoc.getNearbyEntities(search_radius, search_radius, search_radius).stream().sorted(Comparator.comparingInt(entity -> {
|
||||||
.stream().sorted(Comparator.comparingInt(entity -> {
|
if (entity.getType().equals(EntityType.VILLAGER)) {
|
||||||
if (entity.getType().equals(EntityType.VILLAGER)) {
|
Villager villager = (Villager) entity;
|
||||||
Villager villager = (Villager) entity;
|
Villager.Profession profession = villager.getProfession();
|
||||||
Villager.Profession profession = villager.getProfession();
|
if (!profession.equals(Villager.Profession.NONE) && !profession.equals(Villager.Profession.NITWIT) && !villagerManager.getOrAdd(villager).isOptimized()) {
|
||||||
if (
|
return (int) entity.getLocation().distance(workstationLoc);
|
||||||
!profession.equals(Villager.Profession.NONE)
|
}
|
||||||
&& !profession.equals(Villager.Profession.NITWIT)
|
}
|
||||||
&& !villagerManager.getOrAdd(villager).isOptimized()
|
return Integer.MAX_VALUE;
|
||||||
) {
|
})).toList();
|
||||||
return (int) entity.getLocation().distance(workstationLoc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Integer.MAX_VALUE;
|
|
||||||
})).toList();
|
|
||||||
if (nearbyUnoptimized.isEmpty()) return;
|
|
||||||
|
|
||||||
|
if (nearbyUnoptimized.isEmpty()) return;
|
||||||
WrappedVillager closest = villagerManager.getOrAdd((Villager) nearbyUnoptimized.get(0));
|
WrappedVillager closest = villagerManager.getOrAdd((Villager) nearbyUnoptimized.get(0));
|
||||||
|
|
||||||
if (closest.setOptimization(OptimizationType.WORKSTATION)) {
|
if (closest.setOptimization(OptimizationType.WORKSTATION)) {
|
||||||
@ -113,23 +108,18 @@ public class WorkstationOptimization implements VillagerOptimizerModule, Listene
|
|||||||
|
|
||||||
final Location workstationLoc = placed.getLocation();
|
final Location workstationLoc = placed.getLocation();
|
||||||
|
|
||||||
List<Entity> nearbyOptimized = workstationLoc.getNearbyEntities(search_radius, search_radius, search_radius)
|
List<Entity> nearbyOptimized = workstationLoc.getNearbyEntities(search_radius, search_radius, search_radius).stream().sorted(Comparator.comparingInt(entity -> {
|
||||||
.stream().sorted(Comparator.comparingInt(entity -> {
|
if (entity.getType().equals(EntityType.VILLAGER)) {
|
||||||
if (entity.getType().equals(EntityType.VILLAGER)) {
|
Villager villager = (Villager) entity;
|
||||||
Villager villager = (Villager) entity;
|
Villager.Profession profession = villager.getProfession();
|
||||||
Villager.Profession profession = villager.getProfession();
|
if (!profession.equals(Villager.Profession.NONE) && !profession.equals(Villager.Profession.NITWIT) && villagerManager.getOrAdd(villager).isOptimized()) {
|
||||||
if (
|
return (int) entity.getLocation().distance(workstationLoc);
|
||||||
!profession.equals(Villager.Profession.NONE)
|
}
|
||||||
&& !profession.equals(Villager.Profession.NITWIT)
|
}
|
||||||
&& villagerManager.getOrAdd(villager).isOptimized()
|
return Integer.MAX_VALUE;
|
||||||
) {
|
})).toList();
|
||||||
return (int) entity.getLocation().distance(workstationLoc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Integer.MAX_VALUE;
|
|
||||||
})).toList();
|
|
||||||
if (nearbyOptimized.isEmpty()) return;
|
|
||||||
|
|
||||||
|
if (nearbyOptimized.isEmpty()) return;
|
||||||
WrappedVillager closest = villagerManager.getOrAdd((Villager) nearbyOptimized.get(0));
|
WrappedVillager closest = villagerManager.getOrAdd((Villager) nearbyOptimized.get(0));
|
||||||
|
|
||||||
if (closest.getOptimizationType().equals(OptimizationType.WORKSTATION)) {
|
if (closest.getOptimizationType().equals(OptimizationType.WORKSTATION)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user