mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-19 15:09:25 +00:00
28 lines
1.3 KiB
Diff
28 lines
1.3 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: hayanesuru <hayanesuru@outlook.jp>
|
|
Date: Sat, 17 May 2025 19:03:31 +0900
|
|
Subject: [PATCH] Optimize SynchedEntityData#packDirty
|
|
|
|
|
|
diff --git a/net/minecraft/network/syncher/SynchedEntityData.java b/net/minecraft/network/syncher/SynchedEntityData.java
|
|
index 3d90f9f1ac1bd281edf6bb0f93ea821657d5bd2f..f0b8d44009ebfaf7a45f9cbaea5dc3ff157815fc 100644
|
|
--- a/net/minecraft/network/syncher/SynchedEntityData.java
|
|
+++ b/net/minecraft/network/syncher/SynchedEntityData.java
|
|
@@ -84,7 +84,15 @@ public class SynchedEntityData {
|
|
return null;
|
|
} else {
|
|
this.isDirty = false;
|
|
- List<SynchedEntityData.DataValue<?>> list = new ArrayList<>();
|
|
+ // Leaf start - Optimize SynchedEntityData#packDirty
|
|
+ int cap = 0;
|
|
+ for (SynchedEntityData.DataItem<?> dataItem : this.itemsById) {
|
|
+ if (dataItem.isDirty()) {
|
|
+ cap += 1;
|
|
+ }
|
|
+ }
|
|
+ ArrayList<SynchedEntityData.DataValue<?>> list = new ArrayList<>(cap);
|
|
+ // Leaf end - Optimize SynchedEntityData#packDirty
|
|
|
|
for (SynchedEntityData.DataItem<?> dataItem : this.itemsById) {
|
|
if (dataItem.isDirty()) {
|