Do not initiate trackedPlayers with ObjectOpenHashSet

Potential fix of #331
Whether or not cursors are present on a map - the game forces the server to track players if the map is rendered.
This change wasn't liked by the maps, so - revert it for now.
I'll probably find a way to optimise this later...
This commit is contained in:
Ivan Pekov 2021-01-06 20:03:47 +02:00
parent 2b156e3c9c
commit 074471c3de
No known key found for this signature in database
GPG Key ID: BC975C392D9CA3A3

View File

@ -25,24 +25,3 @@ index bdcbdc21f986852277dcc41a2b0f385f8caeb9f7..dff2dc82c2a6b26c6e41b3949953abca
return i > random.nextInt(b0) ? false : a(entitytypes, generatoraccess, enummobspawn, blockposition, random); return i > random.nextInt(b0) ? false : a(entitytypes, generatoraccess, enummobspawn, blockposition, random);
} }
} }
diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
index 228236bce14bfdf930570b453862dcfaae9e4823..e278681892d8cc6fe704f32f9d892b3186435ce4 100644
--- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java
+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
@@ -2,6 +2,7 @@ package net.minecraft.server;
import com.google.common.collect.Lists;
import com.mojang.datafixers.util.Pair;
+import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; // Yatopia
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
@@ -56,7 +57,7 @@ public class EntityTrackerEntry {
public EntityTrackerEntry(WorldServer worldserver, Entity entity, int i, boolean flag, Consumer<Packet<?>> consumer, Set<EntityPlayer> trackedPlayers) {
// Paper end
- this.trackedPlayers = trackedPlayers;
+ this.trackedPlayers = new ObjectOpenHashSet<>(trackedPlayers); // Yatopia - uses less memory
// CraftBukkit end
this.m = Vec3D.ORIGIN;
this.p = Collections.emptyList();