13
0
geforkt von Mirrors/Paper

Oprimise map impl for tracked players

Reference2BooleanOpenHashMap is going to have
better lookups than HashMap.
Dieser Commit ist enthalten in:
Spottedleaf 2021-02-19 22:51:52 -08:00
Ursprung 12321d761e
Commit 82a8294625

Datei anzeigen

@ -67,19 +67,20 @@
this.mainThreadExecutor = mainThreadExecutor;
ConsecutiveExecutor consecutiveexecutor = new ConsecutiveExecutor(executor, "worldgen");
@@ -198,6 +235,12 @@
this.chunksToEagerlySave.add(pos.toLong());
}
@@ -196,7 +233,13 @@
private void setChunkUnsaved(ChunkPos pos) {
this.chunksToEagerlySave.add(pos.toLong());
+ }
+
+ // Paper start
+ public int getMobCountNear(final ServerPlayer player, final net.minecraft.world.entity.MobCategory mobCategory) {
+ return -1;
+ }
}
+ // Paper end
+
protected ChunkGenerator generator() {
return this.worldGenContext.generator();
}
@@ -325,7 +368,7 @@
throw this.debugFuturesAndCreateReportedException(new IllegalStateException("At least one of the chunk futures were null"), "n/a");
}
@ -357,8 +358,12 @@
protected ChunkDistanceManager(final Executor workerExecutor, final Executor mainThreadExecutor) {
super(workerExecutor, mainThreadExecutor);
@@ -1424,7 +1511,7 @@
public final Set<ServerPlayerConnection> seenBy = Sets.newIdentityHashSet();
@@ -1421,10 +1508,10 @@
final Entity entity;
private final int range;
SectionPos lastSectionPos;
- public final Set<ServerPlayerConnection> seenBy = Sets.newIdentityHashSet();
+ public final Set<ServerPlayerConnection> seenBy = new it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet<>(); // Paper - Perf: optimise map impl
public TrackedEntity(final Entity entity, final int i, final int j, final boolean flag) {
- this.serverEntity = new ServerEntity(ChunkMap.this.level, entity, j, flag, this::broadcast);