mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 15:49:00 +01:00
parent
919ab67a13
commit
9980f427db
2 changed files with 9 additions and 8 deletions
|
@ -5,7 +5,7 @@ Subject: [PATCH] Use more reasonable thread count default for bootstrap
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/SystemUtils.java b/src/main/java/net/minecraft/server/SystemUtils.java
|
||||
index 7e224ebeff3bf34270df173a47b08d3290c00670..60d7c06d4c5bd054a411c915af3ae685df24ccd4 100644
|
||||
index 7e224ebeff3bf34270df173a47b08d3290c00670..0b6b7d2b84aa595a80aae1c580d8794528910bbc 100644
|
||||
--- a/src/main/java/net/minecraft/server/SystemUtils.java
|
||||
+++ b/src/main/java/net/minecraft/server/SystemUtils.java
|
||||
@@ -66,7 +66,8 @@ public class SystemUtils {
|
||||
|
@ -13,7 +13,7 @@ index 7e224ebeff3bf34270df173a47b08d3290c00670..60d7c06d4c5bd054a411c915af3ae685
|
|||
|
||||
private static ExecutorService k() {
|
||||
- int i = MathHelper.clamp(Runtime.getRuntime().availableProcessors() - 1, 1, 7);
|
||||
+ int i = Math.min(8, Math.max(Runtime.getRuntime().availableProcessors() - 2, 3)); // Paper - use more reasonable default - 2 is hard minimum to avoid using unlimited threads
|
||||
+ int i = Math.min(8, Math.max(Runtime.getRuntime().availableProcessors() - 2, 2)); // Paper - use more reasonable default - 2 is hard minimum to avoid using unlimited threads
|
||||
+ i = Integer.getInteger("Paper.WorkerThreadCount", i); // Paper - allow overriding
|
||||
Object object;
|
||||
|
||||
|
|
|
@ -39,10 +39,10 @@ So we cache that and only rebuild it if professions change, which should be neve
|
|||
a plugin manipulates and adds custom professions, which it will handle by rebuilding.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/BehaviorFindPosition.java b/src/main/java/net/minecraft/server/BehaviorFindPosition.java
|
||||
index 35eb3a5a61145e94d5b0c77c0eb13bfa46fac23b..be85c20bdc7dc10e6389d4ad8738fd5866b83ebd 100644
|
||||
index 35eb3a5a61145e94d5b0c77c0eb13bfa46fac23b..6861b1a345496a83900b0ef702ba34315a030ef6 100644
|
||||
--- a/src/main/java/net/minecraft/server/BehaviorFindPosition.java
|
||||
+++ b/src/main/java/net/minecraft/server/BehaviorFindPosition.java
|
||||
@@ -29,8 +29,54 @@ public class BehaviorFindPosition extends Behavior<EntityCreature> {
|
||||
@@ -29,8 +29,55 @@ public class BehaviorFindPosition extends Behavior<EntityCreature> {
|
||||
|
||||
protected void a(WorldServer worldserver, EntityCreature entitycreature, long i) {
|
||||
this.f = 0;
|
||||
|
@ -79,14 +79,13 @@ index 35eb3a5a61145e94d5b0c77c0eb13bfa46fac23b..be85c20bdc7dc10e6389d4ad8738fd58
|
|||
+ ++poiAttempts;
|
||||
+ PathEntity pathentity = entitycreature.getNavigation().a(com.google.common.collect.ImmutableSet.of(pos), 8, false, this.a.d());
|
||||
+
|
||||
+ if (poiAttempts <= maxPoiAttempts && pathentity != null && pathentity.h()) {
|
||||
+ if (pathentity != null && pathentity.h()) {
|
||||
+ record.decreaseVacancy();
|
||||
+ GlobalPos globalPos = GlobalPos.create(worldserver.getWorldProvider().getDimensionManager(), pos);
|
||||
+ entitycreature.getBehaviorController().setMemory(this.b, globalPos);
|
||||
+ break OUT;
|
||||
+ }
|
||||
+ if (poiAttempts > maxPoiAttempts) {
|
||||
+ this.e.long2LongEntrySet().removeIf((entry) -> entry.getLongValue() < this.d);
|
||||
+ if (poiAttempts >= maxPoiAttempts) {
|
||||
+ break OUT;
|
||||
+ }
|
||||
+ }
|
||||
|
@ -94,11 +93,13 @@ index 35eb3a5a61145e94d5b0c77c0eb13bfa46fac23b..be85c20bdc7dc10e6389d4ad8738fd58
|
|||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // Clean up - vanilla does this only when it runs out, but that would push it to try farther POI's...
|
||||
+ this.e.long2LongEntrySet().removeIf((entry) -> entry.getLongValue() < this.d);
|
||||
+ /*
|
||||
Predicate<BlockPosition> predicate = (blockposition) -> {
|
||||
long j = blockposition.asLong();
|
||||
|
||||
@@ -61,6 +107,6 @@ public class BehaviorFindPosition extends Behavior<EntityCreature> {
|
||||
@@ -61,6 +108,6 @@ public class BehaviorFindPosition extends Behavior<EntityCreature> {
|
||||
return entry.getLongValue() < this.d;
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue