mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-07 07:32:03 -07:00
[ci skip] Add more patch identifying comments
This commit is contained in:
@@ -13,11 +13,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
private final Int2ObjectMap<SynchedEntityData.DataItem<?>> itemsById = new Int2ObjectOpenHashMap();
|
||||
// private final ReadWriteLock lock = new ReentrantReadWriteLock(); // Spigot - not required
|
||||
private boolean isDirty;
|
||||
+ // Paper start - array backed synched entity data
|
||||
+ // Paper start - Perf: array backed synched entity data
|
||||
+ private static final int DEFAULT_ENTRY_COUNT = 10;
|
||||
+ private static final int GROW_FACTOR = 8;
|
||||
+ private SynchedEntityData.DataItem<?>[] itemsArray = new SynchedEntityData.DataItem<?>[DEFAULT_ENTRY_COUNT];
|
||||
+ // Paper end - array backed synched entity data
|
||||
+ // Paper end - Perf: array backed synched entity data
|
||||
|
||||
public SynchedEntityData(Entity trackedEntity) {
|
||||
this.entity = trackedEntity;
|
||||
@@ -25,7 +25,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
// this.lock.writeLock().lock(); // Spigot - not required
|
||||
this.itemsById.put(key.getId(), datawatcher_item);
|
||||
// this.lock.writeLock().unlock(); // Spigot - not required
|
||||
+ // Paper start - array backed synched entity data
|
||||
+ // Paper start - Perf: array backed synched entity data
|
||||
+ if (this.itemsArray.length <= key.getId()) {
|
||||
+ final int newSize = Math.min(key.getId() + GROW_FACTOR, MAX_ID_VALUE);
|
||||
+
|
||||
@@ -33,7 +33,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+
|
||||
+ this.itemsArray[key.getId()] = datawatcher_item;
|
||||
+ // Paper end - array backed synched entity data
|
||||
+ // Paper end - Perf: array backed synched entity data
|
||||
}
|
||||
|
||||
public <T> boolean hasItem(EntityDataAccessor<T> key) {
|
||||
@@ -42,7 +42,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
return datawatcher_item;
|
||||
*/
|
||||
- return (SynchedEntityData.DataItem) this.itemsById.get(key.getId());
|
||||
+ // Paper start - array backed synched entity data
|
||||
+ // Paper start - Perf: array backed synched entity data
|
||||
+ final int id = key.getId();
|
||||
+
|
||||
+ if (id < 0 || id >= this.itemsArray.length) {
|
||||
@@ -50,7 +50,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+
|
||||
+ return (DataItem<T>) this.itemsArray[id];
|
||||
+ // Paper end - array backed synched entity data
|
||||
+ // Paper end - Perf: array backed synched entity data
|
||||
// Spigot end
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user