2020-12-23 09:01:47 +01:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Ivan Pekov <ivan@mrivanplays.com>
|
|
|
|
Date: Wed, 23 Dec 2020 09:55:43 +0200
|
|
|
|
Subject: [PATCH] Don't unnecessarily copy the passenger list
|
|
|
|
|
|
|
|
It is only copied if it's needed, and that is in EntityTrackerEntry, when we've detected a change.
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
2020-12-24 08:14:21 +01:00
|
|
|
index 51c4ff1bd6948ab46d723c37af39c76cdf662be5..a48b56839a3516baa7d3373295b259a24012109e 100644
|
2020-12-23 09:01:47 +01:00
|
|
|
--- a/src/main/java/net/minecraft/server/Entity.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/Entity.java
|
2020-12-24 08:14:21 +01:00
|
|
|
@@ -3282,7 +3282,12 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
2020-12-23 09:01:47 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public List<Entity> getPassengers() {
|
|
|
|
+ // Yatopia start - don't copy passengers list
|
|
|
|
+ /*
|
|
|
|
return (List) (this.passengers.isEmpty() ? Collections.emptyList() : Lists.newArrayList(this.passengers));
|
|
|
|
+ */
|
|
|
|
+ return this.passengers.isEmpty() ? Collections.emptyList() : this.passengers;
|
|
|
|
+ // Yatopia end
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean w(Entity entity) {
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
|
|
|
|
index 228236bce14bfdf930570b453862dcfaae9e4823..0be11d1263d84b270c25ec8249832164dc75409d 100644
|
|
|
|
--- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
|
|
|
|
@@ -78,7 +78,7 @@ public class EntityTrackerEntry {
|
|
|
|
List<Entity> list = this.tracker.getPassengers();
|
|
|
|
|
|
|
|
if (!list.equals(this.p)) {
|
|
|
|
- this.p = list;
|
|
|
|
+ this.p = com.google.common.collect.ImmutableList.copyOf(list); // Yatopia - only copy list if something has changed
|
|
|
|
this.broadcastIncludingSelf(new PacketPlayOutMount(this.tracker)); // CraftBukkit
|
|
|
|
}
|
|
|
|
|