[ci skip] Add more identifying patch comments, merge related patches

This commit is contained in:
Nassim Jahnke
2024-01-19 17:54:05 +01:00
parent 64e5ff904c
commit 3c246dc632
26 changed files with 99 additions and 119 deletions

View File

@@ -16,11 +16,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
final Spliterator<? extends Tag> spliterator = entityNbtList.spliterator();
return StreamSupport.stream(new Spliterator<Entity>() {
+ final java.util.Map<EntityType<?>, Integer> loadedEntityCounts = new java.util.HashMap<>(); // Paper
+ final java.util.Map<EntityType<?>, Integer> loadedEntityCounts = new java.util.HashMap<>(); // Paper - Entity load/save limit per chunk
public boolean tryAdvance(Consumer<? super Entity> consumer) {
return spliterator.tryAdvance((nbtbase) -> {
EntityType.loadEntityRecursive((CompoundTag) nbtbase, world, (entity) -> {
+ // Paper start
+ // Paper start - Entity load/save limit per chunk
+ final EntityType<?> entityType = entity.getType();
+ final int saveLimit = world.paperConfig().chunks.entityPerChunkSaveLimit.getOrDefault(entityType, -1);
+ if (saveLimit > -1) {
@@ -29,7 +29,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ this.loadedEntityCounts.merge(entityType, 1, Integer::sum);
+ }
+ // Paper end
+ // Paper end - Entity load/save limit per chunk
consumer.accept(entity);
return entity;
});
@@ -41,9 +41,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
ListTag listTag = new ListTag();
+ final java.util.Map<net.minecraft.world.entity.EntityType<?>, Integer> savedEntityCounts = new java.util.HashMap<>(); // Paper
+ final java.util.Map<net.minecraft.world.entity.EntityType<?>, Integer> savedEntityCounts = new java.util.HashMap<>(); // Paper - Entity load/save limit per chunk
entities.forEach((entity) -> { // diff here: use entities parameter
+ // Paper start
+ // Paper start - Entity load/save limit per chunk
+ final EntityType<?> entityType = entity.getType();
+ final int saveLimit = level.paperConfig().chunks.entityPerChunkSaveLimit.getOrDefault(entityType, -1);
+ if (saveLimit > -1) {
@@ -52,7 +52,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ savedEntityCounts.merge(entityType, 1, Integer::sum);
+ }
+ // Paper end
+ // Paper end - Entity load/save limit per chunk
CompoundTag compoundTag = new CompoundTag();
if (entity.save(compoundTag)) {
listTag.add(compoundTag);