Added missing mappings (#6810)

This commit is contained in:
Jake Potrebic
2021-11-04 07:08:53 -07:00
parent 7df969de65
commit 546ba82ea7
5 changed files with 109 additions and 32 deletions

View File

@@ -80,22 +80,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
if (this.channel.eventLoop().inEventLoop()) {
- this.a(packet, callback, enumprotocol, enumprotocol1);
+ this.a(packet, callback, enumprotocol, enumprotocol1, flush); // Paper - add flush parameter
- this.doSendPacket(packet, callback, enumprotocol, enumprotocol1);
+ this.doSendPacket(packet, callback, enumprotocol, enumprotocol1, flush); // Paper - add flush parameter
} else {
this.channel.eventLoop().execute(() -> {
- this.a(packet, callback, enumprotocol, enumprotocol1);
+ this.a(packet, callback, enumprotocol, enumprotocol1, flush); // Paper - add flush parameter
- this.doSendPacket(packet, callback, enumprotocol, enumprotocol1);
+ this.doSendPacket(packet, callback, enumprotocol, enumprotocol1, flush); // Paper - add flush parameter
});
}
}
private void a(Packet<?> packet, @Nullable GenericFutureListener<? extends Future<? super Void>> genericfuturelistener, ConnectionProtocol enumprotocol, ConnectionProtocol enumprotocol1) {
private void doSendPacket(Packet<?> packet, @Nullable GenericFutureListener<? extends Future<? super Void>> genericfuturelistener, ConnectionProtocol enumprotocol, ConnectionProtocol enumprotocol1) {
+ // Paper start - add flush parameter
+ this.a(packet, genericfuturelistener, enumprotocol, enumprotocol1, true);
+ this.doSendPacket(packet, genericfuturelistener, enumprotocol, enumprotocol1, true);
+ }
+ private void a(Packet<?> packet, @Nullable GenericFutureListener<? extends Future<? super Void>> genericfuturelistener, ConnectionProtocol enumprotocol, ConnectionProtocol enumprotocol1, boolean flush) {
+ private void doSendPacket(Packet<?> packet, @Nullable GenericFutureListener<? extends Future<? super Void>> genericfuturelistener, ConnectionProtocol enumprotocol, ConnectionProtocol enumprotocol1, boolean flush) {
+ // Paper end - add flush parameter
if (enumprotocol != enumprotocol1) {
this.setProtocol(enumprotocol);

View File

@@ -60,13 +60,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (trackingStatus == Visibility.HIDDEN) {
@@ -0,0 +0,0 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
private boolean a(long i, Consumer<T> consumer, boolean callEvent) {
private boolean storeChunkSections(long chunkPos, Consumer<T> action, boolean callEvent) {
// CraftBukkit end
PersistentEntitySectionManager.ChunkLoadStatus persistententitysectionmanager_b = (PersistentEntitySectionManager.ChunkLoadStatus) this.chunkLoadStatuses.get(chunkPos);
+ org.spigotmc.AsyncCatcher.catchOp("Entity chunk save"); // Paper
PersistentEntitySectionManager.ChunkLoadStatus persistententitysectionmanager_b = (PersistentEntitySectionManager.ChunkLoadStatus) this.chunkLoadStatuses.get(i);
if (persistententitysectionmanager_b == PersistentEntitySectionManager.ChunkLoadStatus.PENDING) {
return false;
@@ -0,0 +0,0 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
}
@@ -76,13 +76,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
ChunkPos chunkcoordintpair = new ChunkPos(chunkPos);
CompletableFuture completablefuture = this.permanentStorage.loadEntities(chunkcoordintpair);
@@ -0,0 +0,0 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
}
private boolean processChunkUnload(long chunkPos) {
boolean flag = this.storeChunkSections(chunkPos, (entityaccess) -> {
+ org.spigotmc.AsyncCatcher.catchOp("Entity chunk unload process"); // Paper
boolean flag = this.a(chunkPos, (entityaccess) -> {
entityaccess.getPassengersAndSelf().forEach(this::unloadEntity);
}, true); // CraftBukkit - add boolean for event call
@@ -0,0 +0,0 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
}

View File

@@ -34,20 +34,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
private static final float AVERAGE_PACKETS_SMOOTHING = 0.75F;
@@ -0,0 +0,0 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
if (this.channel.eventLoop().inEventLoop()) {
this.a(packet, callback, enumprotocol, enumprotocol1, flush); // Paper - add flush parameter
this.doSendPacket(packet, callback, enumprotocol, enumprotocol1, flush); // Paper - add flush parameter
} else {
+ // Paper start - optimise packets that are not flushed
+ // note: since the type is not dynamic here, we need to actually copy the old executor code
+ // into two branches. On conflict, just re-copy - no changes were made inside the executor code.
+ if (!flush) {
+ AbstractEventExecutor.LazyRunnable run = () -> {
+ this.a(packet, callback, enumprotocol, enumprotocol1, flush); // Paper - add flush parameter
+ this.doSendPacket(packet, callback, enumprotocol, enumprotocol1, flush); // Paper - add flush parameter
+ };
+ this.channel.eventLoop().execute(run);
+ } else { // Paper end - optimise packets that are not flushed
this.channel.eventLoop().execute(() -> {
- this.a(packet, callback, enumprotocol, enumprotocol1, flush); // Paper - add flush parameter
+ this.a(packet, callback, enumprotocol, enumprotocol1, flush); // Paper - add flush parameter // Paper - diff on change
- this.doSendPacket(packet, callback, enumprotocol, enumprotocol1, flush); // Paper - add flush parameter
+ this.doSendPacket(packet, callback, enumprotocol, enumprotocol1, flush); // Paper - add flush parameter // Paper - diff on change
});
+ } // Paper
}

View File

@@ -14,14 +14,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
private void ensureVisibility(Advancement advancement) {
+ // Paper start
+ e(advancement, IterationEntryPoint.ROOT);
+ ensureVisibility(advancement, IterationEntryPoint.ROOT);
+ }
+ private enum IterationEntryPoint {
+ ROOT,
+ ITERATOR,
+ PARENT_OF_ITERATOR
+ }
+ private void e(Advancement advancement, IterationEntryPoint entryPoint) {
+ private void ensureVisibility(Advancement advancement, IterationEntryPoint entryPoint) {
+ // Paper end
boolean flag = this.shouldBeVisible(advancement);
boolean flag1 = this.visible.contains(advancement);
@@ -33,7 +33,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- this.ensureVisibility(advancement.getParent());
+ // Paper start - If we're not coming from an iterator consider this to be a root entry, otherwise
+ // market that we're entering from the parent of an iterator.
+ this.e(advancement.getParent(), entryPoint == IterationEntryPoint.ITERATOR ? IterationEntryPoint.PARENT_OF_ITERATOR : IterationEntryPoint.ROOT);
+ this.ensureVisibility(advancement.getParent(), entryPoint == IterationEntryPoint.ITERATOR ? IterationEntryPoint.PARENT_OF_ITERATOR : IterationEntryPoint.ROOT);
}
+ // If this is true, we've went through a child iteration, entered the parent, processed the parent
@@ -48,7 +48,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
Advancement advancement1 = (Advancement) iterator.next();
- this.ensureVisibility(advancement1);
+ this.e(advancement1, IterationEntryPoint.ITERATOR); // Paper - Mark this call as being from iteration
+ this.ensureVisibility(advancement1, IterationEntryPoint.ITERATOR); // Paper - Mark this call as being from iteration
}
}